
# 4.5: Graphs of Logarithmic Functions

$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$

Recall that the exponential function $$f(x)=2^{x}$$ produces this table of values

 $$x$$ -3 -2 -1 0 1 2 3 $$f(x)$$ $$\frac{1}{8}$$ $$\frac{1}{4}$$ $$\frac{1}{2}$$ 1 2 4 8

Since the logarithmic function is an inverse of the exponential, $$g(x)=\log _{2} (x)$$ produces the table of values

 $$x$$ $$\frac{1}{8}$$ $$\frac{1}{4}$$ $$\frac{1}{2}$$ 1 2 4 8 $$g(x)$$ -3 -2 -1 0 1 2 3

In this second table, notice that

1. As the input increases, the output increases.
2. As input increases, the output increases more slowly.
3. Since the exponential function only outputs positive values, the logarithm can only accept positive values as inputs, so the domain of the log function is $$(0,\infty )$$.
4. Since the exponential function can accept all real numbers as inputs, the logarithm can output any real number, so the range is all real numbers or $$(-\infty ,\infty )$$.

Sketching the graph, notice that as the input approaches zero from the right, the output of the function grows very large in the negative direction, indicating a vertical asymptote at

$$x = 0$$.

In symbolic notation we write

as $$x \to 0^{+} ,f(x) \to -\infty$$, and as$$x \to \infty ,f(x) \to \infty$$

Graphical Features of the Logarithm

Graphically, in the function $$g(x)=\log _{b} (x)$$

The graph has a horizontal intercept at (1, 0)

The graph has a vertical asymptote at $$x = 0$$

The graph is increasing and concave down

The domain of the function is $$x > 0$$, or $$(0,\infty )$$

The range of the function is all real numbers, or $$(-\infty ,\infty )$$

When sketching a general logarithm with base $$b$$, it can be helpful to remember that the graph will pass through the points (1, 0) and ($$b$$, 1).

To get a feeling for how the base affects the shape of the graph, examine the graphs below.

Notice that the larger the base, the slower the graph grows. For example, the common log graph, while it grows without bound, it does so very slowly. For example, to reach an output of 8, the input must be 100,000,000.

Another important observation made was the domain of the logarithm. Like the reciprocal and square root functions, the logarithm has a restricted domain which must be considered when finding the domain of a composition involving a log.

Example 1

Find the domain of the function $$f(x)=\log (5-2x)$$.

Solution

The logarithm is only defined with the input is positive, so this function will only be defined when $$5 - 2x > 0$$. Solving this inequality,

$$\begin{array}{l} {-2x>-5} \\ {x<\frac{5}{2} } \end{array}$$

The domain of this function is $$x < \frac{5}{2}$$, or in interval notation, $$\left(-\infty ,\frac{5}{2} \right)$$

Exercise

Find the domain of the function $$f(x)=\log (x-5)+2$$; before solving this as an inequality, consider how the function has been transformed.

Domain: {$$x$$ | $$x > 5$$}

Transformations of the Logarithmic Function

Transformations can be applied to a logarithmic function using the basic transformation techniques, but as with exponential functions, several transformations result in interesting relationships.

First recall the change of base property tells us that $$\log _{b} x=\frac{\log _{c} x}{\log _{c} b} =\frac{1}{\log _{c} b} \log _{c} x$$

From this, we can see that $$\log _{b} x$$ is a vertical stretch or compression of the graph of the $$\log _{c} x$$ graph. This tells us that a vertical stretch or compression is equivalent to a change of base. For this reason, we typically represent all graphs of logarithmic functions in terms of the common or natural log functions.

Next, consider the effect of a horizontal compression on the graph of a logarithmic function. Considering $$f(x)=\log (cx)$$, we can use the sum property to see

$$f(x)=\log (cx)=\log (c)+\log (x)$$

Since log($$c$$) is a constant, the effect of a horizontal compression is the same as the effect of a vertical shift.

Example 2

Sketch $$f(x)=\ln (x)$$ and $$g(x)=\ln (x)+2$$.

Solution

Graphing these,

Note that this vertical shift could also be written as a horizontal compression, since $$g(x)=\ln (x)+2=\ln (x)+\ln (e^{2} )=\ln (e^{2} x).$$

While a horizontal stretch or compression can be written as a vertical shift, a horizontal reflection is unique and separate from vertical shifting.

Finally, we will consider the effect of a horizontal shift on the graph of a logarithm.

Example 3

Sketch a graph of $$f(x)=\ln (x+2)$$.

Solution

This is a horizontal shift to the left by 2 units. Notice that none of our logarithm rules allow us rewrite this in another form, so the effect of this transformation is unique. Shifting the graph,

Notice that due to the horizontal shift, the vertical asymptote shifted to $$x = -2$$, and the domain shifted to $$(-2,\infty )$$.

Combining these transformations,

Example 4

Sketch a graph of $$f(x) = 5log(-x + 2)$$.

Solution

Factoring the inside as $$f (x) = 5log(−(x − 2))$$ reveals that this graph is that of the

common logarithm, horizontally reflected, vertically stretched by a factor of 5, and shifted to the right by 2 units.

The vertical asymptote will be shifted to $$x$$ = 2,

and the graph will have domain $$(\infty, 2)$$ . A rough

sketch can be created by using the vertical asymptote along with a couple points on the graph, such as

$$f (1) = 5log(−1+ 2) = 5log(1) = 0$$
$$f (−8) = 5log(−(−8) + 2) = 5log(10) = 5$$

Exercise

Sketch a graph of the function $$f(x)=-3\log (x-2)+1$$.

transormations of logs

Any transformed logarithmic function can be written in the form

$$f(x)=a\log (x-b)+k$$, or $$f(x)=a\log \left(-\left(x-b\right)\right)+k$$ if horizontally reflected,

where $$x = b$$ is the vertical asymptote.

Example 5

Find an equation for the logarithmic function graphed.

Solution

This graph has a vertical asymptote at $$x = –2$$ and has been vertically reflected. We do not know yet the vertical shift (equivalent to horizontal stretch) or the vertical stretch (equivalent to a change of base). We know so far that the equation will have form

$$f(x)=-a\log (x+2)+k$$

It appears the graph passes through the points (–1, 1) and (2, –1). Substituting in (–1, 1),

$$\begin{array}{l} {1=-a\log (-1+2)+k} \\ {1=-a\log (1)+k} \\ {1=k} \end{array}$$

Next, substituting in (2, –1),

$$\begin{array}{l} {-1=-a\log (2+2)+1} \\ {-2=-a\log (4)} \\ {a=\frac{2}{\log (4)} } \end{array}$$

This gives us the equation $$f(x)=-\frac{2}{\log \eqref(4)} \log (x+2)+1$$.

This could also be written as $$f(x)=-2\log _{4} (x+2)+1$$.

Exercise

Write an equation for the function graphed here.

The graph is horizontally reflected and has a vertical asymptote at $$x = 3$$, giving form $$f(x)=a\log \left(-\left(x-3\right)\right)+k$$. Substituting in the point (2,0) gives $$0=a\log \left(-\left(2-3\right)\right)+k$$, simplifying to $$k = 0$$. Substituting in (-2,-2), $$-2=a\log \left(-\left(-2-3\right)\right)$$, so $$\frac{-2}{\log (5)} =a$$.The equation is $$f(x)=\frac{-2}{\log (5)} \log \left(-\left(x-3\right)\right)$$ or $$f(x)=-2\log _{5} \left(-\left(x-3\right)\right)$$.

flashback

Write the domain and range of the function graphed in Example 5, and describe its long run behavior.

Domain: {$$x$$ | $$x$$ > -2}, Range: all real numbers; As $$x\to -2^{+} ,f(x)\to \infty$$and as $$x\to \infty ,f(x)\to -\infty$$.