This site is a work in progress. New lessons are added regularly. Contact us

Introduction to Logarithms

Learning goals

  • Define the logarithm as the exponential's inverse
  • Switch between y=logbxy = \log_b x and by=xb^y = x
  • Restrict the argument to x>0x > 0, not the variable
  • Read logb1=0\log_b 1 = 0 and logbb=1\log_b b = 1 for free
  • Cancel with logb(bt)=t\log_b(b^t) = t and blogbx=xb^{\log_b x} = x
  • Trap an untidy log between straddling integer powers

Why the exponential can be run backward

Fix a base bb with b>0b > 0 and b1b \ne 1, and consider the exponential function f(x)=bxf(x) = b^x. From the previous lesson you know three things about it. It is defined for every real number xx. Its outputs are always positive. And its graph is an unbroken curve that rises steadily when b>1b > 1 and falls steadily when 0<b<10 < b < 1.

“Rises steadily” is the part that matters, because it is what makes the function one-to-one. It deserves a proof rather than a glance at a picture, since everything in this lesson rests on it.

bxb^x is one-to-one, so it has an inverse#

Take the case b>1b > 1 first, and let u<vu < v be any two real numbers. Write t=vut = v - u, so t>0t > 0. The exponent rule for a sum splits the larger power apart:

bv=bu+t=bubt.b^v = b^{u + t} = b^u \cdot b^t.

Since bub^u is positive, whether bvb^v beats bub^u comes down to a single question: is btb^t bigger than 11? It is, and here is why. When tt is a positive integer, btb^t is a product of tt factors each larger than 11, so the product is larger than 11. When t=pqt = \tfrac{p}{q} is a positive rational number, suppose for contradiction that bp/q1b^{p/q} \le 1. Raising both sides of an inequality between positive numbers to the qqth power preserves it, so bp1b^p \le 1, contradicting the integer case. Hence bp/q>1b^{p/q} > 1. When tt is irrational, lean on the previous lesson, which is where bxb^x at an irrational exponent was constructed in the first place. That power was constructed as the single value the rational exponents squeeze it to. Pick a positive rational rr smaller than tt. Every rational exponent between rr and tt gives a power of at least brb^r, so the value they squeeze btb^t to satisfies btbr>1b^t \ge b^r > 1 as well.

So bt>1b^t > 1 for every t>0t > 0, and therefore

bv=bubt>bu1=bu.b^v = b^u \cdot b^t > b^u \cdot 1 = b^u.

That is exactly the statement that u<vu < v forces bu<bvb^u < b^v: the function is strictly increasing. A strictly increasing function can never take the same value twice, because any two different inputs are ordered, and the smaller one is sent to a strictly smaller output. So bxb^x is one-to-one.

For a base with 0<b<10 < b < 1, write b=1cb = \tfrac{1}{c} with c>1c > 1, so that bx=cxb^x = c^{-x}. If u<vu < v then u>v-u > -v, and the case just proved gives cu>cvc^{-u} > c^{-v}, which says bu>bvb^u > b^v. The function is strictly decreasing, and a strictly decreasing function is one-to-one for the same reason. Either way, bxb^x never repeats a value, so it can be run backward.

Being one-to-one tells you the inverse exists. To know what to feed it, you need the range of bxb^x, because the Inverse Functions lesson pinned the two down together. The inverse’s domain is the original function’s range, and the inverse’s range is the original function’s domain.

Every power of a positive base is positive, so bxb^x never outputs 00 and never outputs a negative number. Those values are simply not available. On the other side, with b>1b > 1 the curve climbs past every bound as xx grows. Still with b>1b > 1, as xx runs off to the left, bx=1bxb^x = \tfrac{1}{b^{-x}} shrinks toward 00 without ever landing on it. An unbroken increasing curve that gets arbitrarily close to 00 at one end and arbitrarily large at the other passes through every height in between. Such a curve reaches each of those heights exactly once, because it never repeats a value.

A base with 0<b<10 < b < 1 needs no fresh argument, just the reduction the proof already used. Write b=1cb = \tfrac{1}{c} with c>1c > 1, so that bx=cxb^x = c^{-x}. As xx runs over every real number, so does x-x, so bxb^x produces exactly the same collection of outputs that cxc^x does, merely in the reverse order. Its range is the positive numbers too. Either way, then:

domain of bx=all real numbers,range of bx=all y>0.\text{domain of } b^x = \text{all real numbers}, \qquad \text{range of } b^x = \text{all } y > 0.

Read that through the inverse rule and the inverse is already fully described before it has a name. Its inputs are the positive numbers, its outputs are all the real numbers, and the number it returns for a given input is an exponent. All that is left is to write it down.

The logarithm is the name of that inverse

Here is the definition, and it is the whole lesson in one sentence.

Fix a base bb with b>0b > 0 and b1b \ne 1. For a positive number xx, the logarithm of xx to the base bb, written logbx\log_b x, is the unique real exponent you must put on bb to get xx.

Unpacked into an equation, the definition is a two-way street between a logarithmic statement and an exponential one:

y=logbx    by=x(b>0,  b1,  x>0).y = \log_b x \iff b^y = x \qquad (b > 0,\; b \ne 1,\; x > 0).

Both directions are true, and both are worth checking. Going left to right, if y=logbxy = \log_b x then yy is by definition the exponent that turns bb into xx, so by=xb^y = x. Going right to left, suppose by=xb^y = x for some real yy. Then xx is automatically positive, so it is a legal input for the logarithm, and yy is an exponent that turns bb into xx. There cannot be a second such exponent, because btb^t is one-to-one in tt, so yy has to be the one the logarithm names, and y=logbxy = \log_b x. The equivalence goes both ways, which is why you may swap either form for the other at any moment without losing information.

Say the definition aloud whenever you use it. "log28\log_2 8" means ”22 to the what gives 88?” The answer is 33, and so log28=3\log_2 8 = 3.

The two restrictions on the base are not decoration. If b=1b = 1, then 1y=11^y = 1 for every exponent yy, so the function is a flat line: it is not one-to-one, and it never produces any output except 11. The equation 1y=51^y = 5 has no solution and 1y=11^y = 1 has infinitely many, so no inverse can exist. If bb were negative, bxb^x would not even be a function on the real numbers, since a power like (4)1/2(-4)^{1/2} is not a real number at all. There is nothing there to invert.

Two values come free from the definition and are worth memorising on the spot:

logb1=0(because b0=1),logbb=1(because b1=b).\log_b 1 = 0 \quad (\text{because } b^0 = 1), \qquad \log_b b = 1 \quad (\text{because } b^1 = b).

Reading a logarithm straight from the definition

Every evaluation is the same question asked with different numbers, so ask it out loud each time.

Worked example 1 Evaluate log381\log_3 81, log5125\log_5 \tfrac{1}{25}, and log101000\log_{10} 1000

For log381\log_3 81, ask: three to the what gives eighty-one? Run up the powers of 33, which are 33, 99, 2727, 8181:

34=81log381=4.3^4 = 81 \quad \Longrightarrow \quad \log_3 81 = 4.

For log5125\log_5 \tfrac{1}{25}, ask: five to the what gives one twenty-fifth? A number smaller than 11 needs a negative exponent, since a negative exponent flips the power over:

52=152=125log5125=2.5^{-2} = \frac{1}{5^2} = \frac{1}{25} \quad \Longrightarrow \quad \log_5 \frac{1}{25} = -2.

For log101000\log_{10} 1000, ask: ten to the what gives a thousand? Counting the zeros answers it:

103=1000log101000=3.10^3 = 1000 \quad \Longrightarrow \quad \log_{10} 1000 = 3.

Notice that the logarithm’s answer is never the number in front of you. It is always the exponent hiding behind that number.

When the base and the number are powers of a common smaller number, write both as powers of that number and the exponent falls out.

Worked example 2 Evaluate log84\log_8 4 and log927\log_9 27

Let y=log84y = \log_8 4. By the definition this says 8y=48^y = 4. Both 88 and 44 are powers of 22, so rewrite them that way and use the rule (23)y=23y(2^3)^y = 2^{3y}:

8y=423y=22.8^y = 4 \quad \Longrightarrow \quad 2^{3y} = 2^2.

Two powers of 22 are equal only when their exponents are equal, because 2x2^x is one-to-one. So 3y=23y = 2 and y=23y = \tfrac{2}{3}. Check it against the definition: 82/3=(81/3)2=22=48^{2/3} = \left(8^{1/3}\right)^2 = 2^2 = 4, as required.

The same move handles log927\log_9 27. Setting y=log927y = \log_9 27 gives 9y=279^y = 27, and both sides are powers of 33:

32y=332y=3y=32.3^{2y} = 3^3 \quad \Longrightarrow \quad 2y = 3 \quad \Longrightarrow \quad y = \frac{3}{2}.

A logarithm is under no obligation to be a whole number. Here it is a fraction, and that is perfectly ordinary.

Check your understanding

Evaluate log4164\log_4 \tfrac{1}{64}.

Answer choices

The two cancellation laws

The Inverse Functions lesson ended with a pair of identities: composing a function with its inverse, in either order, gives back what you started with. Written for f(x)=bxf(x) = b^x and f1(x)=logbxf^{-1}(x) = \log_b x, they read

logb ⁣(bt)=tfor every real t,blogbx=xfor every x>0.\log_b\!\left(b^t\right) = t \quad \text{for every real } t, \qquad b^{\log_b x} = x \quad \text{for every } x > 0.

Neither needs the general theory to justify it; each is one line from the definition. For the first, ask what logb(bt)\log_b(b^t) means: it is the exponent you put on bb to get btb^t. The exponent tt does that job, and one-to-one-ness says no other exponent does, so the answer is tt. For the second, logbx\log_b x is by construction the exponent that turns bb into xx; put it on bb, and you get xx.

Watch the two domains, because they are not the same. You may write logb(bt)=t\log_b(b^t) = t for every real tt, positive or negative, since btb^t is a legal input for the logarithm no matter what tt is. But blogbx=xb^{\log_b x} = x requires x>0x > 0, because otherwise logbx\log_b x does not exist and the left side is meaningless. Written as log7 ⁣(75)=5\log_7\!\left(7^{-5}\right) = -5 and 7log712=127^{\log_7 12} = 12, the two laws are easy to use and easy to confuse, so keep asking which one you are applying.

The cancellation laws combine with the exponent rules to settle expressions that look far worse than they are. Take 9log359^{\log_3 5}. The base 99 is 323^2, so

9log35=(32)log35=(3log35)2=52=25.9^{\log_3 5} = \left(3^2\right)^{\log_3 5} = \left(3^{\log_3 5}\right)^2 = 5^2 = 25.

Nothing there is a new rule. It is (bm)n=(bn)m\left(b^m\right)^n = \left(b^n\right)^m followed by the cancellation law, and the tangle collapses to 2525.

What you are allowed to take the logarithm of

The domain question was answered before the logarithm even had a name. Its domain is the range of bxb^x, and its range is the domain of bxb^x:

domain of logbx=all x>0,range of logbx=all real numbers.\text{domain of } \log_b x = \text{all } x > 0, \qquad \text{range of } \log_b x = \text{all real numbers}.

So log20\log_2 0 and log2(8)\log_2(-8) are not small, or negative, or infinite. They do not exist. There is no real exponent yy with 2y=02^y = 0, because powers of 22 stay strictly positive however far left you go, and there is certainly no exponent with 2y=82^y = -8. For a fixed legal base, logbx\log_b x is defined exactly when x>0x > 0: positive inputs always work, since every positive number is bb to some power, and nothing else ever works.

In practice this restriction bites on the argument, the quantity sitting inside the logarithm, not on the variable. The function y=log5(x2)y = \log_5(x - 2) is defined precisely when x2>0x - 2 > 0, which is to say x>2x > 2. The function y=log2(x2+1)y = \log_2(x^2 + 1) is defined for every real xx, negative xx included, because x2+1x^2 + 1 is positive no matter what. Always ask what the logarithm is being handed, and then demand that that be positive.

The graph is the exponential reflected across the line y=xy = x

Inverse functions swap coordinates. The point (a,c)(a, c) lies on the graph of ff exactly when (c,a)(c, a) lies on the graph of f1f^{-1}. That coordinate swap is the same thing as reflecting the plane across the line y=xy = x. So you do not need a new table of values to graph a logarithm. You need the exponential’s table, read backward.

Point on y=2xy = 2^xPoint on y=log2xy = \log_2 x
(2, 14)\left(-2,\ \tfrac{1}{4}\right)(14, 2)\left(\tfrac{1}{4},\ -2\right)
(1, 12)\left(-1,\ \tfrac{1}{2}\right)(12, 1)\left(\tfrac{1}{2},\ -1\right)
(0, 1)(0,\ 1)(1, 0)(1,\ 0)
(1, 2)(1,\ 2)(2, 1)(2,\ 1)
(2, 4)(2,\ 4)(4, 2)(4,\ 2)
(3, 8)(3,\ 8)(8, 3)(8,\ 3)

What the base bb does to both curves at once

y = 2ˣ. y = log₂ x. Base 2 is greater than 1, so both curves rise. Reflecting across y = x sends (1, 2) on the exponential to (2, 1) on the logarithm. The exponential never reaches y = 0 and the logarithm never reaches x = 0, which is that same asymptote reflected. A coordinate plane carrying an exponential curve, its logarithm, and the dashed diagonal line y = x that reflects each onto the other. Use the control below the figure to change the base. y = 2ˣ y = log₂ x -4 -2 2 4 6 8 10 12 -4 -2 2 4 6 8 10 12
Base

y = 2ˣ. y = log₂ x. Base 2 is greater than 1, so both curves rise. Reflecting across y = x sends (1, 2) on the exponential to (2, 1) on the logarithm. The exponential never reaches y = 0 and the logarithm never reaches x = 0, which is that same asymptote reflected.

An exponential and its logarithm on one plane, with the dashed diagonal y = x that reflects each onto the other. The marked pair is (1, b) on the exponential and (b, 1) on the logarithm, joined by a chord that meets the diagonal at a right angle and is cut in half by it. The base is the only thing you can change, and it moves both curves while the diagonal holds still.

Every feature of the logarithm’s graph is now something you can read off the reflection rather than memorise.

The exponential’s yy-intercept (0,1)(0, 1) becomes the logarithm’s xx-intercept (1,0)(1, 0). So the graph of y=logbxy = \log_b x crosses the xx-axis at x=1x = 1 for every base, which is just logb1=0\log_b 1 = 0 drawn as a picture. The point (1,b)(1, b) on the exponential becomes (b,1)(b, 1) on the logarithm, which is logbb=1\log_b b = 1.

That last pair is the one marked in the figure above, and it is worth stepping the base through every setting to watch it travel. The two marks slide in opposite directions along their curves, always the same distance from the diagonal on opposite sides. Set the base to 11 and the logarithm disappears altogether. That is not a gap in the drawing. Every power of 11 is 11, so y=1xy = 1^x is the flat line y=1y = 1, one height reached by every input. A rule that sends everything to one place has nothing to undo it. The condition b1b \ne 1 in the definition is exactly this state being excluded.

The exponential’s horizontal asymptote y=0y = 0 reflects into a vertical asymptote x=0x = 0 for the logarithm. The curve dives down the side of the yy-axis, getting arbitrarily low without ever touching the axis. That is the picture of “you cannot take the logarithm of 00”: there is no height at all above x=0x = 0.

Reflecting an increasing curve gives an increasing curve, so logbx\log_b x is increasing when b>1b > 1 and decreasing when 0<b<10 < b < 1, matching its exponential exactly. And the growth is slow. If log2x=t\log_2 x = t then x=2tx = 2^t, so doubling the input gives 2x=2t+12x = 2^{t+1}, an input whose logarithm is only t+1t + 1. Each doubling of xx buys a single unit of height. That is why log21000\log_2 1000 is under 1010, and why the right-hand end of the curve looks almost flat.

y = log base 2 of x and y = log base one-half of xTwo logarithm curves crossing the x-axis at (1, 0), one increasing and one decreasing, mirror images of each other across the x-axis, both with the y-axis as a vertical asymptote.xy(1, 0)y = log2 xy = log1/2 x
Both graphs cross the x-axis at (1, 0) and hug the y-axis, which is the vertical asymptote. Base 2 rises because 2 is greater than 1; base one-half falls because one-half is less than 1. The two curves are mirror images across the x-axis.

Check your understanding

The graph of y=4xy = 4^x passes through the point (2, 16)(2,\ 16). Which point must lie on the graph of y=log4xy = \log_4 x?

Answer choices

Switching forms to solve equations

The equivalence y=logbx    by=xy = \log_b x \iff b^y = x is a tool, not just a slogan. Whenever an unknown is trapped in an awkward position, translate the statement into the other form and the unknown steps into the open. There are only three places it can hide.

If the unknown is inside the logarithm, as in log2x=5\log_2 x = 5, go to exponential form: x=25=32x = 2^5 = 32.

If the unknown is the base, as in logx81=4\log_x 81 = 4, go to exponential form again: x4=81x^4 = 81. Now x=3x = 3 and x=3x = -3 both satisfy that equation, but a logarithm base must be positive and cannot be 11, so x=3x = 3 is the only answer. The rejected root is not a mistake in the algebra; it is a value the definition forbids.

If the unknown is the exponent, as in 3x=1813^x = \tfrac{1}{81}, go to logarithmic form: x=log3181=4x = \log_3 \tfrac{1}{81} = -4. This is the case the logarithm was built for, and it is why the whole lesson matters.

Worked example 3 Solve logx8=32\log_x 8 = \tfrac{3}{2}

Read the equation with the definition. It says: xx raised to the power 32\tfrac{3}{2} gives 88. Write that down:

x3/2=8.x^{3/2} = 8.

To free xx, raise both sides to the reciprocal power 23\tfrac{2}{3}, since (x3/2)2/3=x1\left(x^{3/2}\right)^{2/3} = x^{1}:

x=82/3=(81/3)2=22=4.x = 8^{2/3} = \left(8^{1/3}\right)^2 = 2^2 = 4.

Check the answer in the original statement rather than in your own algebra. Is log48=32\log_4 8 = \tfrac{3}{2}? That asks whether 43/2=84^{3/2} = 8, and indeed 43/2=(41/2)3=23=84^{3/2} = \left(4^{1/2}\right)^3 = 2^3 = 8. It is, and x=4x = 4 is a legal base, being positive and not 11.

Worked example 4 Solve log2 ⁣(x23x)=2\log_2\!\left(x^2 - 3x\right) = 2

Switch to exponential form. The equation says that the exponent turning 22 into x23xx^2 - 3x is 22, so the argument itself must equal 222^2:

x23x=22=4.x^2 - 3x = 2^2 = 4.

That is a quadratic. Move everything to one side and factor:

x23x4=0(x4)(x+1)=0,x^2 - 3x - 4 = 0 \quad \Longrightarrow \quad (x - 4)(x + 1) = 0,

which gives x=4x = 4 or x=1x = -1.

Now check both against the domain rule, and check it carefully, because the rule applies to the argument of the logarithm, not to xx. For x=4x = 4 the argument is 1612=416 - 12 = 4, which is positive. For x=1x = -1 the argument is 1+3=41 + 3 = 4, which is also positive. Both values are legal, and both are solutions: log24=2\log_2 4 = 2 in each case.

The temptation is to throw out x=1x = -1 on sight because logarithms “cannot take negatives”. That instinct is misplaced. Nothing forbids a negative solution; what is forbidden is a negative argument, and here the argument comes out to 44 either way.

Check your understanding

Solve logx81=4\log_x 81 = 4.

Answer choices

Trapping a logarithm between two integers

Most logarithms are not tidy. No whole number answers ”22 to the what gives 1010?”, and no fraction does either. Suppose one did, say log210=pq\log_2 10 = \tfrac{p}{q} for positive integers pp and qq. Then 2p/q=102^{p/q} = 10, and raising both sides to the qqth power gives 2p=10q=2q5q2^p = 10^q = 2^q \cdot 5^q. Dividing through by 2q2^q leaves 5q=2pq5^q = 2^{p-q}. The left side is an odd integer bigger than 11. The right side is 22 to an integer power, so it is a fraction below 11 when p<qp < q, exactly 11 when p=qp = q, and an even integer when p>qp > q. It is never an odd integer bigger than 11, so no such pp and qq exist, and log210\log_2 10 is irrational.

That does not make it mysterious. You can pin it between two integers using nothing but powers of 22 and the fact that the logarithm is increasing.

First, why is log2\log_2 increasing? Suppose 0<u<v0 < u < v but log2ulog2v\log_2 u \ge \log_2 v. Raising 22 to both sides of that inequality preserves it, since 2x2^x is increasing, and the cancellation law turns each side back into the original number, giving uvu \ge v. That contradicts u<vu < v. So u<vu < v forces log2u<log2v\log_2 u < \log_2 v, and applying a base-22 logarithm to an inequality keeps it pointing the same way.

Now trap the number. Since 23=82^3 = 8 and 24=162^4 = 16,

8<10<16log28<log210<log2163<log210<4.8 < 10 < 16 \quad \Longrightarrow \quad \log_2 8 < \log_2 10 < \log_2 16 \quad \Longrightarrow \quad 3 < \log_2 10 < 4.

So log210\log_2 10 sits between 33 and 44, and its true value is about 3.323.32. Do not try to guess where in that interval it lands by asking whether 1010 is nearer to 88 or to 1616. Arithmetic nearness is the wrong measure, because the height climbs by one unit every time the argument doubles, not every time it grows by 88. The exponent reaches the halfway height 3.53.5 at

23.5=2321/2=8211.3,2^{3.5} = 2^3 \cdot 2^{1/2} = 8\sqrt{2} \approx 11.3,

so the midpoint of the interval sits above 1010, not at the arithmetic middle 1212. Since 10<11.310 < 11.3 and the logarithm is increasing, log210\log_2 10 lies in the lower half of the interval. Even without that refinement, knowing which two integers a logarithm lives between is enough to sanity-check almost any answer.

Base 1010 deserves a note of its own. It is used so often that it is written with no base at all, and logx\log x with a bare “log” means log10x\log_{10} x from here on. The trapping argument is especially sharp there. A whole number nn with dd digits satisfies 10d1n<10d10^{d-1} \le n < 10^{d}, so applying log\log gives

d1logn<d.d - 1 \le \log n < d.

In other words, the whole-number part of a common logarithm is one less than the digit count. Since 10004500<100001000 \le 4500 < 10000, you know without any calculation that log4500\log 4500 is three point something, and sure enough 45004500 has four digits.

What you cannot do yet is compute log210\log_2 10 or log4500\log 4500 to a decimal, or break a complicated logarithm into simpler ones. That takes rules for combining logarithms, which is the business of the next lesson. Everything in this one came from a single idea: the logarithm is the exponential run backward.

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Free Response Questions (FRQ)

Longer questions in parts, to be worked out on paper. Progressive hints, the answer on its own so you can check yourself and try again, then the full worked solution, plus a rubric to mark your own work against.

Free response Work it out on paper 5 questions Start →
More practice (optional)

Extra sets, as hard as the Challenge set. Each one opens on its own page.

More resources (optional)

Other explanations of this lesson, if you want a second take.

A bit of history (Optional)

The logarithm reached the world backwards from the way you have just met it. Its inventor was not inverting anything, because the function bxb^x did not yet exist for him to invert.

John Napier was a Scottish landowner who did mathematics in the hours his estate left him, and he gave about twenty years to one problem. Astronomers were losing whole days to the multiplication of seven-digit numbers, and a slip anywhere spoiled the page. His answer, printed in 1614, was a table of paired numbers.

He built it out of a race. Picture two points, each travelling along a line of its own. The first moves at a steady speed and never varies. The second sets off beside it, but it keeps slowing in proportion to the distance it still has to run. So it closes on its target forever without arriving. Read off the two positions at the same instant, and the pair of numbers you write down is one row of his table.

The definition you met today is the logarithm as the exponential read the other way round, and it is more than a century younger than that table. It needs bxb^x at every real xx, and nobody had built that yet. Once you do have it, the moving points can be dismissed and the tables thrown away. The inverse is the entire definition, and every fact in this lesson fell out of it.