Graphing Logarithmic Functions

Learn to graph logarithmic functions: key points, domain, range, the vertical asymptote, the mirror image of the exponential function and shifts.

Advanced30 minLesson

Definition

A logarithmic function has the form f(x)=log⁡bxf(x) = \log_b x with base b>0b > 0 and b≠1b \neq 1. It is the inverse function of the exponential function y=bxy = b^x: y=log⁡bxy = \log_b x means by=xb^y = x.
Key points (they come straight from the definition):
  • (1b,−1)\left(\frac{1}{b}, -1\right) because b−1=1bb^{-1} = \frac{1}{b}
  • (1,0)(1, 0) because b0=1b^0 = 1
  • (b,1)(b, 1) because b1=bb^1 = b
**Features of the graph of y=log⁡bxy = \log_b x:**
  • Domain: x>0x > 0 (you can only take the logarithm of a positive number)
  • Range: all real numbers
  • Vertical asymptote: the line x=0x = 0 (the yy-axis); the graph gets closer and closer to it but never touches it
  • xx-intercept**: (1,0)(1, 0); there is no yy-intercept
  • If b>1b > 1, the graph increases; if 0<b<10 < b < 1, it decreases
The graph of y=log⁡bxy = \log_b x is the reflection of the graph of y=bxy = b^x across the line y=xy = x: every point (p,q)(p, q) of y=bxy = b^x becomes the point (q,p)(q, p).
Transformations:
y=log⁡b(x−h)+ky = \log_b(x - h) + k
  • shifts the graph hh units right (left if h<0h < 0) and kk units up (down if k<0k < 0)
  • vertical asymptote x=hx = h, domain x>hx > h, key points (1+h,k)(1 + h, k) and (b+h,1+k)(b + h, 1 + k)
  • y=−log⁡bxy = -\log_b x reflects the graph across the xx-axis; y=log⁡b(−x)y = \log_b(-x) reflects it across the yy-axis (domain x<0x < 0)
In the interactive graph, move the sliders bb, hh and kk and watch the asymptote and the two key points move.

Try it now

What is the domain of y=log⁡3xy = \log_3 x?

Worked Examples

Graph y=log⁡2xy = \log_2 x and state its domain, range and asymptote.

1

Choose x-values that are powers of 2

x=14,12,1,2,4,8x = \frac{1}{4}, \frac{1}{2}, 1, 2, 4, 8, because log⁡2\log_2 of a power of 2 is easy to find → Six easy x-values

2

Find each y-value

log⁡214=−2\log_2 \frac{1}{4} = -2, log⁡212=−1\log_2 \frac{1}{2} = -1, log⁡21=0\log_2 1 = 0, log⁡22=1\log_2 2 = 1, log⁡24=2\log_2 4 = 2, log⁡28=3\log_2 8 = 3 → y=−2,−1,0,1,2,3y = -2, -1, 0, 1, 2, 3

3

Plot the points and draw the asymptote

Plot (14,−2)\left(\frac{1}{4}, -2\right), (12,−1)\left(\frac{1}{2}, -1\right), (1,0)(1, 0), (2,1)(2, 1), (4,2)(4, 2), (8,3)(8, 3) and draw the dashed line x=0x = 0 → Points and asymptote x=0x = 0

4

Connect with a smooth curve

The curve falls steeply near the yy-axis without touching it and rises slowly to the right → Increasing curve through (1,0)(1, 0)

Common Mistakes

Shifting y=log⁡2(x−3)y = \log_2(x - 3) three units to the left

Why it's wrong: The minus sign looks like a move to the left, but the argument x−3x - 3 must be positive, which means x>3x > 3: the whole graph lies to the right of x=3x = 3.

Correct: y=log⁡b(x−h)y = \log_b(x - h) moves the graph hh units to the right. y=log⁡2(x−3)y = \log_2(x - 3) has the asymptote x=3x = 3.

Letting the graph touch or cross the yy-axis

Why it's wrong: log⁡b0\log_b 0 and log⁡b\log_b of a negative number do not exist, because byb^y is always positive.

Correct: The graph of y=log⁡bxy = \log_b x comes closer and closer to x=0x = 0 but never reaches it. The domain is x>0x > 0.

Thinking the graph levels off at some height

Why it's wrong: The curve rises slowly, so it looks flat, but it never stops rising: log⁡21024=10\log_2 1024 = 10 and log⁡21048576=20\log_2 1048576 = 20.

Correct: A logarithmic graph has no horizontal asymptote. The range is all real numbers.

Keeping the domain x>0x > 0 after a horizontal shift

Why it's wrong: The domain comes from the argument, not from xx itself.

Correct: For y=log⁡3(x+5)y = \log_3(x + 5) the argument x+5x + 5 must be positive, so the domain is x>−5x > -5.

Interactive Visual

Function graph

-6-4-20246810-6-4-20246xy(1, 0)(2, 1)x = 0

Tap or hover over the graph to read off values.

y = log_b(x - h) + kAsymptote

Table of values

x0.51248
y-10123

Function graph

-4-202468-505xy(0, 1)(1, 0)(2, 4)(4, 2)y = xy = 0x = 0

Tap or hover over the graph to read off values.

Tap a name to show or hide its graph.

y = xAsymptote

Function graph

-202468-4-2024xy(1, 0)(2, 1)(2, -1)x = 0

Tap or hover over the graph to read off values.

Tap a name to show or hide its graph.

Asymptote

Table of values

x0.250.51248
log_2(x)-2-10123
log_0.5(x)210-1-2-3

Interactive Sandbox

Interactive Grapher

-10-50510-10-50510xy

Tap or hover over the graph to read off values.

Try these examples:

y = log_2(x)

Expression Calculator

Try these:

History

No calculations yet

Practice Problems

18 problems
Problem 1 of 18
Easy

What is the domain of y=log⁡3xy = \log_3 x?

Why It Matters

Graphs of logarithmic functions show how a quantity grows when every new step needs many times more input:
  • Sound: a sound level meter shows L=10log⁡(II0)L = 10 \log\left(\frac{I}{I_0}\right) decibels; multiplying the intensity by 1010 adds only 1010 dB, which is why the curve is so flat.
  • Chemistry: pH=−log⁡[H+]\text{pH} = -\log[H^+] is a reflected log graph: more hydrogen ions give a smaller pH.
  • Computer science: binary search needs about log⁡2n\log_2 n steps for nn items; doubling the list adds only one step.
  • Earthquakes: the Richter scale grows by 11 every time the amplitude is multiplied by 1010.
Reading these graphs means knowing three things at a glance: where the asymptote is, which values are allowed (domain), and how fast the curve rises. This lesson builds on Definition of a Logarithm and prepares you for Solving Logarithmic Equations.

Real World Applications

Sound Level in Decibels

A sound level meter shows $L = 10 \log\left(\frac{I}{I_0}\right)$ decibels, where $\frac{I}{I_0}$ tells how many times stronger the sound is than the quietest sound we can hear. The graph is a stretched log curve: very flat for large intensities.

Example:

A sound 100100 times stronger than I0I_0 gives L=10log⁡100=20L = 10 \log 100 = 20 dB. A sound 1010 times stronger again gives only 3030 dB.

1Try It Yourself

A quiet library is 10001000 times stronger than the quietest audible sound, so II0=1000\frac{I}{I_0} = 1000.

What is the sound level LL in decibels?

Step 1: Write the mathematical expression

Calculate L=10log⁡(1000)L = 10 \log(1000):

Binary Search in Computer Science

Binary search finds a name in a sorted list by halving the list again and again. For $n$ names it needs about $\log_2 n$ halvings, so the graph of the number of steps is the graph of $y = \log_2 x$.

Example:

A list of 88 names needs log⁡28=3\log_2 8 = 3 halvings: 8→4→2→18 \to 4 \to 2 \to 1.

2Try It Yourself

A sorted contact list has 10241024 names. Each step of binary search halves the list.

How many halvings are needed to get down to one name?

Step 1: Write the mathematical expression

Calculate log⁡2(1024)\log_2(1024):

The pH Scale in Chemistry

Acidity is measured with $\text{pH} = -\log[H^+]$, where $[H^+]$ is the hydrogen ion concentration. The minus sign reflects the log graph across the $x$-axis, so the pH goes down when the concentration goes up.

Example:

Lemon juice has [H+]=0.01=10−2[H^+] = 0.01 = 10^{-2}, so pH=−log⁡(10−2)=2\text{pH} = -\log(10^{-2}) = 2.

3Try It Yourself

A sample of rainwater has [H+]=0.0001[H^+] = 0.0001.

What is its pH?

Step 1: Write the mathematical expression

Calculate pH=−log⁡(0.0001)\text{pH} = -\log(0.0001):

Key Takeaways

  • 1y=log⁡bxy = \log_b x is the inverse of y=bxy = b^x: its graph is the reflection of y=bxy = b^x across the line y=xy = x
  • 2Key points of y=log⁡bxy = \log_b x: (1b,−1)\left(\frac{1}{b}, -1\right), (1,0)(1, 0) and (b,1)(b, 1)
  • 3Domain x>0x > 0, range all real numbers, vertical asymptote x=0x = 0, no yy-intercept
  • 4For b>1b > 1 the graph increases; for 0<b<10 < b < 1 it decreases
  • 5y=log⁡b(x−h)+ky = \log_b(x - h) + k moves the graph hh right and kk up: asymptote x=hx = h, domain x>hx > h
  • 6A minus sign in front of the log reflects the graph across the xx-axis; log⁡b(−x)\log_b(-x) reflects it across the yy-axis

Frequently Asked Questions

On the yy-axis x=0x = 0, and log⁡b0\log_b 0 would need by=0b^y = 0. A positive base raised to any power is positive, so no yy works. Near x=0x = 0 the values get very large negative numbers (for b>1b > 1), which is why the curve dives along the asymptote.
On the yy-axis x=0x = 0, and log⁡b0\log_b 0 would need by=0b^y = 0. A positive base raised to any power is positive, so no yy works. Near x=0x = 0 the values get very large negative numbers (for b>1b > 1), which is why the curve dives along the asymptote.
No. The exponential graph has the horizontal asymptote y=0y = 0; after the reflection across y=xy = x it becomes the vertical asymptote x=0x = 0. The log graph keeps rising (for b>1b > 1), only very slowly.
Both have a base greater than 1 (1010 and e≈2.718e \approx 2.718), so both increase, pass through (1,0)(1, 0) and have the asymptote x=0x = 0. ln⁡x\ln x passes through (e,1)(e, 1) and log⁡x\log x through (10,1)(10, 1), so ln⁡x\ln x rises faster.
Look at the base. If b>1b > 1, the graph increases; if 0<b<10 < b < 1, it decreases. A minus sign in front, as in y=−log⁡2xy = -\log_2 x, also turns an increasing graph into a decreasing one.

Glossary

Logarithmic function
A function f(x)=log⁡bxf(x) = \log_b x with b>0b > 0, b≠1b \neq 1; it gives the exponent to which bb must be raised to get xx
Vertical asymptote
A vertical line x=hx = h that the graph gets closer and closer to without touching it; for y=log⁡bxy = \log_b x it is x=0x = 0
Domain
All x-values for which the function is defined; for y=log⁡b(x−h)y = \log_b(x - h) it is x>hx > h
Range
All y-values the function takes; for every logarithmic function it is all real numbers
Inverse function
A function that undoes another one; its graph is the reflection across y=xy = x, as y=log⁡bxy = \log_b x is for y=bxy = b^x
Key points
Easy points to plot: (1b,−1)\left(\frac{1}{b}, -1\right), (1,0)(1, 0) and (b,1)(b, 1) for y=log⁡bxy = \log_b x

Formula Card

Parent function

y=log⁡bx  ⟺  by=xy = \log_b x \iff b^y = x

Base $b > 0$, $b \neq 1$; domain $x > 0$, range all real numbers

Key points

(1b,−1), (1,0), (b,1)\left(\tfrac{1}{b}, -1\right),\ (1, 0),\ (b, 1)

Plot these three points first

Transformed function

y=log⁡b(x−h)+ky = \log_b(x - h) + k

Asymptote $x = h$, domain $x > h$, key points $(1 + h, k)$ and $(b + h, 1 + k)$

Reflections

y=−log⁡bx,y=log⁡b(−x)y = -\log_b x,\quad y = \log_b(-x)

Across the $x$-axis and across the $y$-axis (domain $x < 0$)

Inverse of the exponential

(p,q) on y=bx  ⟺  (q,p) on y=log⁡bx(p, q) \text{ on } y = b^x \iff (q, p) \text{ on } y = \log_b x

Reflection across the line $y = x$

More in This Topic