Logarithm (log, lg, ln)

To what power must we raise 2 to get 8? The answer is 3, because ${2^3=8}.$ The number 3 is called the logarithm of 8 to base 2, and we write ${\log_2 8=3}.$ Read it as “log base 2 of 8 equals 3”.

Let ${a\gt 0},$ ${a\ne 1}$ and ${b\gt 0}.$ The logarithm of $b$ to base $a$ is the exponent $c$ to which we must raise $a$ to get $b$:

$$\log_a b=c\iff a^c=b$$

The number $a$ is the base of the logarithm, and $b$ is the number whose logarithm we take (the argument). The logarithm $c$ itself can be any real number: positive, negative, zero or a fraction.

Examples

  • ${\log_3 81=4},$ because ${3^4=81}.$
  • ${\log_{10} 1000=3},$ because ${10^3=1000}.$
  • ${\log_5\frac{1}{25}=-2},$ because ${5^{-2}=\frac{1}{5^2}=\frac{1}{25}}.$
  • ${\log_9 3=\frac12},$ because ${9^{\frac12}=\sqrt9=3}.$
  • ${\log_{1/2} 8=-3},$ because ${\left(\frac12\right)^{-3}=2^3=8}.$
  • ${\log_7 1=0},$ because ${7^0=1}.$

Animated example: what is $\log_2 64?$

When does a logarithm exist?

  • The argument is positive: ${b\gt 0}.$ Every power of a positive number is positive, so the equations ${2^c=0}$ and ${2^c=-4}$ have no solution. There is no logarithm of zero or of a negative number: $\log_2 0$ and $\log_2(-4)$ are undefined.
  • The base is positive: ${a\gt 0}.$ A power of a negative number is not defined for every exponent. For example, ${(-4)^{\frac12}}$ would have to be $\sqrt{-4},$ and there is no such real number.
  • The base is not 1: ${a\ne 1}.$ Every power of 1 equals 1. So ${1^c=5}$ has no solution, and ${1^c=1}$ has infinitely many.

On this page: log and ln · Basic properties · Product, quotient, power · Change of base · Graph · Equations and inequalities · Calculator · Solved problems · Common mistakes · Practice

Common and Natural Logarithms

Two bases are used so often that their logarithms have names and symbols of their own.

Common logarithm (base 10): ${\log b=\log_{10} b}.$ Some books write it $\lg b.$

Natural logarithm (base $e$): ${\ln b=\log_e b},$ where ${e\approx 2.718281828}$ is Euler’s number.

  • ${\log 100=2},$ ${\log 1000=3}$ and ${\log 0.01=-2},$ because ${10^{-2}=0.01}.$
  • ${\ln e=1},$ ${\ln 1=0},$ ${\ln e^5=5}$ and ${\ln\frac1e=-1}.$

On a calculator, the log key gives the common logarithm and the ln key the natural one. For example, ${\log 2\approx 0.30103}$ and ${\ln 2\approx 0.69315}.$ A logarithm to any other base is found with the change of base formula. Be careful: in higher mathematics and in most programming languages, $\log x$ written without a base means the natural logarithm $\ln x.$

The common logarithm tells how big a number is. If ${10^n\le b\lt 10^{n+1}},$ then ${n\le\log b\lt n+1},$ so the number $b$ has ${n+1}$ digits before the decimal point. Logarithmic scales are also used in science: the acidity of a solution is ${\mathrm{pH}=-\log[\mathrm{H}^+]},$ loudness is measured in decibels, and earthquakes on the Richter scale.

Basic Properties

The following equalities come straight from the definition. Everywhere ${a\gt 0},$ ${a\ne 1}$ and ${b\gt 0}.$

PropertyWhy it is true
${\log_a 1=0}$${a^0=1}$
${\log_a a=1}$${a^1=a}$
${\log_a a^c=c}$to get $a^c,$ we raise $a$ to the power $c$
${a^{\log_a b}=b}$$\log_a b$ is exactly the exponent that turns $a$ into $b$

The last equality is called the basic logarithmic identity. For example, ${3^{\log_3 7}=7},$ ${10^{\log 5}=5}$ and ${e^{\ln 2}=2}.$

The last two equalities show that raising $a$ to a power and taking the logarithm to base $a$ are inverse operations: each one undoes the other.

Logarithm of a Product, a Quotient and a Power

Logarithms were invented because of these rules: they turn multiplication into addition and division into subtraction. John Napier published the first tables of logarithms in 1614. With them, astronomers replaced long multiplications of many-digit numbers by additions of their logarithms.

For ${a\gt 0},$ ${a\ne 1},$ ${b\gt 0},$ ${c\gt 0}$ and any real number $n$:

$$\log_a(bc)=\log_a b+\log_a c$$ $$\log_a\frac{b}{c}=\log_a b-\log_a c$$ $$\log_a b^n=n\log_a b$$

Why it is true. Let ${\log_a b=x}$ and ${\log_a c=y},$ that is ${b=a^x}$ and ${c=a^y}.$ Then

${bc=a^x\cdot a^y=a^{x+y}},$   ${\frac{b}{c}=\frac{a^x}{a^y}=a^{x-y}},$   ${b^n=(a^x)^n=a^{nx}}$

By the definition of a logarithm, ${\log_a(bc)=x+y},$ ${\log_a\frac{b}{c}=x-y}$ and ${\log_a b^n=nx}.$ The rules of logarithms are the rules of exponents read backwards.

Examples

  • ${\log_2(5\cdot 4)}={\log_2 5+\log_2 4}={\log_2 5+2}$
  • ${\log_2\frac54}={\log_2 5-\log_2 4}={\log_2 5-2}$
  • ${\log_2 8}={\log_2 2^3}={3\log_2 2}={3}$
  • ${\log 2+\log 5}={\log 10}={1}$
  • ${\log_3 54-\log_3 2}={\log_3 27}={3}$

Two special cases of the power rule come up very often:

$$\log_a\frac1b=-\log_a b$$ $$\log_a\sqrt[n]{b}=\frac1n\log_a b$$

For example, ${\log_2\frac18=-\log_2 8=-3}$ and ${\log_2\sqrt{32}=\frac12\log_2 32=\frac52}.$

Careful with even powers. The equality ${\log_a b^2=2\log_a b}$ holds only for ${b\gt 0}.$ The number $b^2$ is positive even when $b$ is negative, so for every ${b\ne 0}$ we have ${\log_a b^2=2\log_a|b|}.$ For example, ${\log\bigl((-10)^2\bigr)}={\log 100}={2},$ while $\log(-10)$ does not exist.

Logarithm of a sum. There is no formula for ${\log_a(b+c)}$ or ${\log_a(b-c)}.$ In general ${\log_a(b+c)\ne\log_a b+\log_a c}.$ For example, ${\log_2(4+4)=\log_2 8=3},$ but ${\log_2 4+\log_2 4=4}.$

Change of Base

For ${a\gt 0},$ ${a\ne 1},$ ${b\gt 0}$ and any new base ${c\gt 0},$ ${c\ne 1}$:

$$\log_a b=\frac{\log_c b}{\log_c a}$$

Why it is true. Take the logarithm to base $c$ of both sides of the basic identity ${a^{\log_a b}=b}$: ${\log_c a^{\log_a b}=\log_c b},$ that is ${\log_a b\cdot\log_c a=\log_c b}.$ Now divide by ${\log_c a\ne 0}.$

With this formula, a calculator gives any logarithm:

${\log_2 3}={\frac{\log 3}{\log 2}}={\frac{\ln 3}{\ln 2}}\approx{1.585}$

The new base can be any positive number other than 1, for example 7: ${\log_2 3=\frac{\log_7 3}{\log_7 2}}.$

Consequences. The arguments are positive, the bases are positive and not equal to 1, and ${n\ne 0}$:

$$\log_a b=\frac{1}{\log_b a}$$ $$\log_a b\cdot\log_b c=\log_a c$$ $$\log_{a^n} b=\frac1n\log_a b$$

For example, ${\log_8 2=\frac{1}{\log_2 8}=\frac13},$ ${\log_2 3\cdot\log_3 8=\log_2 8=3}$ and ${\log_9 27}={\log_{3^2} 3^3}={\frac32\log_3 3}={\frac32}.$

The Logarithmic Function and Its Graph

The function ${y=\log_a x},$ where ${a\gt 0}$ and ${a\ne 1},$ is called a logarithmic function. It is defined only for ${x\gt 0},$ and its values are all real numbers.

1 2 3 4 5 6 7 8 9 10 −3 −2 −1 1 2 3 x y (1, 0) y = log2 x y = ln x y = log x

The graphs of ${y=\log_2 x},$ ${y=\ln x}$ and ${y=\log x}.$ All of them pass through the point ${(1,\ 0)}$ and reach the value 1 at ${x=a}.$

For every base, the graph passes through the points ${(1,\ 0)}$ and ${(a,\ 1)},$ because ${\log_a 1=0}$ and ${\log_a a=1}.$ The $y$-axis is an asymptote of the graph: as $x$ gets close to 0, the graph moves without bound away from the $x$-axis. Whether the function increases or decreases depends on the base:

${a\gt 1}$${0\lt a\lt 1}$
The functionincreasesdecreases
For ${0\lt x\lt 1}$${\log_a x\lt 0}$${\log_a x\gt 0}$
For ${x\gt 1}$${\log_a x\gt 0}$${\log_a x\lt 0}$
As ${x\to 0}$${\log_a x\to-\infty}$${\log_a x\to+\infty}$
As ${x\to+\infty}$${\log_a x\to+\infty}$${\log_a x\to-\infty}$

The graphs of ${y=\log_2 x}$ and ${y=\log_{1/2} x}$ are mirror images in the $x$-axis, because ${\log_{1/2} x=-\log_2 x}.$

1 2 3 4 5 6 7 8 −3 −2 −1 1 2 3 x y y = log2 x y = log1/2 x

${y=\log_2 x}$ increases and ${y=\log_{1/2} x}$ decreases.

The logarithmic function ${y=\log_a x}$ is the inverse of the exponential function ${y=a^x}$: if ${y=a^x},$ then ${x=\log_a y}.$ That is why their graphs are mirror images in the line ${y=x}.$ For example, the point ${(1,\ 2)}$ lies on the graph of ${y=2^x},$ and the point ${(2,\ 1)}$ lies on the graph of ${y=\log_2 x}.$

−2 −1 1 2 3 4 5 −2 −1 1 2 3 4 5 x y y = 2x y = log2 x y = x

The graphs of ${y=2^x}$ and ${y=\log_2 x}$ are mirror images in the line ${y=x}.$

Logarithmic Equations and Inequalities

A logarithmic function is strictly increasing or strictly decreasing, so different numbers have different logarithms to the same base. Therefore equal logarithms mean equal numbers. This step from the logarithms back to the numbers themselves is called taking the antilogarithm.

Let ${a\gt 0},$ ${a\ne 1},$ ${b\gt 0}$ and ${c\gt 0}.$ Then

$$\log_a b=\log_a c\iff b=c$$

For inequalities, the base matters:

if ${a\gt 1}$:   ${\log_a b\gt\log_a c\iff b\gt c}$ (the sign stays);

if ${0\lt a\lt 1}$:   ${\log_a b\gt\log_a c\iff b\lt c}$ (the sign flips).

How to solve a logarithmic equation

  1. Find the allowed values: every expression under a logarithm must be positive. If the unknown is in the base, the base must be positive and not equal to 1.
  2. Use the rules of logarithms to bring the equation to the form ${\log_a f(x)=\log_a g(x)}$ or ${\log_a f(x)=c}.$
  3. Remove the logarithms: ${f(x)=g(x)},$ or by the definition ${f(x)=a^c}.$ Solve the new equation.
  4. Keep only the roots that are allowed values.

Example 1. ${\log_3(2x-1)=2}.$ The allowed values are ${x\gt\frac12}.$ By the definition, ${2x-1=3^2=9},$ so ${x=5}.$ This value is allowed.

Example 2. ${\log_2(x+1)}={\log_2(3x-5)}.$ The allowed values are the $x$ with ${x+1\gt 0}$ and ${3x-5\gt 0},$ that is ${x\gt\frac53}.$ Removing the logarithms: ${x+1=3x-5},$ so ${x=3}.$ Check: both sides equal $\log_2 4.$

Example 3. Compare $\log_{0.5} 3$ and $\log_{0.5} 7.$ The base is less than 1, so the larger number has the smaller logarithm: ${\log_{0.5} 3\gt\log_{0.5} 7}.$

Logarithm Calculator

Enter the base and the number. For the natural logarithm, type the letter e as the base. You can also enter fractions such as 1/2. When the logarithm is a rational number, the calculator finds it exactly and shows why. Otherwise it computes an approximate value by the change of base formula.

${\log_a b}$:   base ${a}=$ number ${b}=$

Solved Problems

Problem 1. Evaluate: a) $\log_2 32;$ b) $\log_3\frac19;$ c) $\log_{1/2} 16;$ d) $\log 0.01;$ e) $\log_{27} 3.$

Solution: We look for the exponent to which we must raise the base to get the number.

  • a) ${2^5=32},$ so ${\log_2 32=5}.$
  • b) ${3^{-2}=\frac19},$ so ${\log_3\frac19=-2}.$
  • c) ${\left(\frac12\right)^{-4}=2^4=16},$ so ${\log_{1/2} 16=-4}.$
  • d) ${10^{-2}=0.01},$ so ${\log 0.01=-2}.$
  • e) ${27^{\frac13}=\sqrt[3]{27}=3},$ so ${\log_{27} 3=\frac13}.$

Problem 2. Find $x$: a) ${\log_3 x=-2};$ b) ${\log_x 16=4};$ c) ${\log_{\sqrt3} 9=x}.$

Solution:

  • a) By the definition, ${x=3^{-2}=\frac19}.$
  • b) ${x^4=16},$ and the base must be positive and not equal to 1. So ${x=2}.$ The number $-2$ also solves ${x^4=16},$ but it cannot be a base.
  • c) ${\left(\sqrt3\right)^x=9},$ and ${9=\left(\sqrt3\right)^4}.$ So ${x=4}.$

Problem 3. Evaluate: a) $2^{3+\log_2 5};$ b) $25^{\log_5 3}.$

Solution: We use the basic logarithmic identity.

a) ${2^{3+\log_2 5}}={2^3\cdot 2^{\log_2 5}}={8\cdot 5}={40}$

b) ${25^{\log_5 3}}={\left(5^2\right)^{\log_5 3}}={\left(5^{\log_5 3}\right)^2}={3^2}={9}$

Problem 4. Evaluate: a) ${\log 8+3\log 5};$ b) ${\log_6 4+\log_6 9};$ c) ${\log_3 18}-{\log_3 2+\log_3\frac{1}{27}}.$

Solution:

a) ${\log 8+3\log 5}={\log 8+\log 5^3}={\log(8\cdot 125)}={\log 1000}={3}$

b) ${\log_6 4+\log_6 9}={\log_6(4\cdot 9)}={\log_6 36}={2}$

c) ${\log_3 18}-{\log_3 2+\log_3\frac{1}{27}}={\log_3 9+\log_3 3^{-3}}={2-3}={-1}$

Problem 5. Evaluate ${\log_2 3\cdot\log_3 4\cdot\log_4 8}.$

Solution: We use the formula ${\log_a b\cdot\log_b c=\log_a c}$ twice:

${\log_2 3\cdot\log_3 4\cdot\log_4 8}={\log_2 4\cdot\log_4 8}={\log_2 8}={3}$

We get the same if we write every factor as a quotient of common logarithms: ${\frac{\log 3}{\log 2}\cdot\frac{\log 4}{\log 3}\cdot\frac{\log 8}{\log 4}}={\frac{\log 8}{\log 2}}={3}.$

Problem 6. Given ${\log 2=a}$ and ${\log 3=b},$ express in terms of $a$ and $b$: a) $\log 12;$ b) $\log 5;$ c) $\log_6 24.$

Solution:

a) ${\log 12}={\log\left(2^2\cdot 3\right)}={2\log 2+\log 3}={2a+b}$

b) ${\log 5}={\log\frac{10}{2}}={\log 10-\log 2}={1-a}$

c) ${\log_6 24}={\frac{\log 24}{\log 6}}={\frac{\log\left(2^3\cdot 3\right)}{\log(2\cdot 3)}}={\frac{3a+b}{a+b}}$

Problem 7. How many digits does the number $2^{100}$ have? Use ${\log 2\approx 0.30103}.$

Solution: ${\log 2^{100}}={100\log 2}\approx{30.103}.$ So ${30\lt\log 2^{100}\lt 31},$ that is ${10^{30}\lt 2^{100}\lt 10^{31}}.$ The smallest 31-digit number is $10^{30},$ and $10^{31}$ already has 32 digits. Therefore $2^{100}$ has 31 digits.

Problem 8. Solve the equation ${\log_2(x-1)}+{\log_2(x+1)}={3}.$

Solution: The allowed values are the $x$ with ${x-1\gt 0}$ and ${x+1\gt 0},$ that is ${x\gt 1}.$ A sum of logarithms is the logarithm of the product:

${\log_2\bigl((x-1)(x+1)\bigr)}={3},$   ${x^2-1=2^3},$   ${x^2=9},$   ${x=\pm 3}$

The root ${x=-3}$ is not allowed, because $\log_2(-4)$ does not exist. Answer: ${x=3}.$ Check: ${\log_2 2+\log_2 4}={1+2}={3}.$

Problem 9. Solve the equation ${\log^2 x-3\log x+2=0}.$

Solution: The allowed values are ${x\gt 0}.$ Here $\log^2 x$ means ${(\log x)^2}.$ Let ${\log x=t};$ then ${t^2-3t+2=0}$ with the roots ${t_1=1}$ and ${t_2=2}$:

${\log x=1\Rightarrow x=10},$   ${\log x=2\Rightarrow x=100}$

Answer: ${x_1=10},$ ${x_2=100}.$

Problem 10. Solve the inequality ${\log_{1/3}(2x-1)\ge -1}.$

Solution: The allowed values are ${x\gt\frac12}.$ We write the right side as a logarithm to the same base: ${-1=\log_{1/3} 3},$ because ${\left(\frac13\right)^{-1}=3}.$

${\log_{1/3}(2x-1)\ge\log_{1/3} 3}$

The base is between 0 and 1, so the inequality sign flips: ${2x-1\le 3},$ that is ${x\le 2}.$ Together with the allowed values: ${\frac12\lt x\le 2},$ that is ${x\in\left(\frac12,\ 2\right]}.$

Common Mistakes

MistakeWrongRight
The logarithm of a sum taken as the sum of the logarithms${\log_2(4+4)}={\log_2 4+\log_2 4}={4}$${\log_2(4+4)=\log_2 8=3}$
A quotient of logarithms taken as a difference${\frac{\log_2 8}{\log_2 4}}={\log_2 8-\log_2 4}={1}$${\frac{\log_2 8}{\log_2 4}=\frac32}$
A power of a logarithm mixed up with the logarithm of a power${(\log_2 8)^2=2\log_2 8=6}$${(\log_2 8)^2=3^2=9},$ while ${\log_2 8^2=2\log_2 8=6}$
Negative $x$ lost with an even power${\log x^2=2\log x}$ for every ${x\ne 0}$${\log x^2=2\log|x|}$
The base and the number swapped${\log_8 2=3}$${\log_8 2=\frac13},$ because ${8^{\frac13}=2}$
The logarithm of a negative number${\log(-100)=-2}$$\log(-100)$ does not exist, while ${\log 0.01=-2}$
The allowed values not checkedThe equation ${\log_2(x-1)}+{\log_2(x+1)}={3}$ has the roots $\pm 3$Only ${x=3};$ for ${x=-3}$ the logarithms do not exist
With a base between 0 and 1, the inequality sign not flipped${\log_{0.5} x\gt\log_{0.5} 2\Rightarrow x\gt 2}$${\log_{0.5} x\gt\log_{0.5} 2\Rightarrow 0\lt x\lt 2}$

Practice Problems

Try them yourself, then open the answer.

1. Evaluate $\log_5 125.$

${5^3=125},$ so ${\log_5 125=3}.$

2. Evaluate $\log_8 2.$

${8^{\frac13}=\sqrt[3]8=2},$ so ${\log_8 2=\frac13}.$

3. Evaluate $\log_{1/3} 27.$

${\left(\frac13\right)^{-3}=3^3=27},$ so ${\log_{1/3} 27=-3}.$

4. Evaluate $3^{2\log_3 4}.$

${3^{2\log_3 4}}={\left(3^{\log_3 4}\right)^2}={4^2}={16}$

5. Evaluate ${\log_{12} 3+\log_{12} 48}.$

${\log_{12} 3+\log_{12} 48}={\log_{12}(3\cdot 48)}={\log_{12} 144}={2}$

6. Evaluate $\frac{\log 8+\log 18}{2\log 2+\log 3}.$

The numerator is ${\log(8\cdot 18)=\log 144}$ and the denominator is ${\log\left(2^2\cdot 3\right)=\log 12}.$ Since ${144=12^2},$ we get ${\frac{\log 144}{\log 12}=\frac{2\log 12}{\log 12}=2}.$

7. Between which two consecutive integers does $\log_2 10$ lie?

${2^3=8\lt 10\lt 16=2^4},$ so ${3\lt\log_2 10\lt 4}.$ More precisely, ${\log_2 10\approx 3.32}.$

8. Solve the equation ${\log_5(3x+1)=2}.$

The allowed values are ${x\gt-\frac13}.$ ${3x+1=5^2=25},$ so ${x=8}.$

9. Solve the equation ${\log_3 x+\log_3(x-8)=2}.$

The allowed values are ${x\gt 8}.$ ${\log_3\bigl(x(x-8)\bigr)=2},$ so ${x^2-8x=9}$ and ${x^2-8x-9=0}.$ The roots are $9$ and $-1,$ but only ${x=9}$ is allowed.

10. A bank deposit grows by 5% every year. After how many years will the money double?

After $n$ years the money is ${1.05^n}$ times larger. We need the smallest $n$ with ${1.05^n\ge 2}.$ Taking logarithms: ${n\log 1.05\ge\log 2},$ so ${n\ge\frac{\log 2}{\log 1.05}\approx 14.2}.$ The money doubles after 15 years.

Have a question? Ask it in our forum about logarithms.

See also: Exponents

Feedback   Contact email:
Follow us on   Twitter   Facebook
  Math10 Banners   Math History  
Copyright © 2005 - 2026