Differentiate logarithmic functions
The slope of ln x from a mirror image
The natural logarithm \(\ln x\) is the power to which \(e\) must be raised to give \(x\). Its curve is the mirror image of \(y = e^x\) in the dashed line \(y = x\).
The orange point on \(y = e^x\) has an orange tangent, and its mirror point on \(y = \ln x\) has the mirror image of that tangent. Drag the point up and down to move both.
Go to \(x = 2\). The mirror point on \(e^x\) is at height 2, and the slope of \(e^x\) equals its height, so that tangent has slope 2. A mirror turns each rise into a run and each run into a rise, so the tangent to \(\ln x\) has slope \(\frac12\).
Go to \(x = 0.5\). The tangent to \(e^x\) has slope 0.5, so the slope of \(\ln x\) is 2. At each position, the slope of \(\ln x\) is 1 divided by \(x\).
Slopes that are reciprocals
Without the numbers, the tangents at the two matching points are still mirror images of each other.
If one tangent rises \(m\) units for each 1 unit across, the mirror tangent rises 1 unit for each \(m\) units across. So the two slopes are reciprocals.
On \(y = e^x\), the slope equals the height. The matching point on \(y = \ln x\) has its \(x\) equal to that height, so the slope of \(\ln x\) at \(x\) is \(\frac1x\).
Notation
The derivative of \(\ln x\) is 1 divided by \(x\). The curve \(y = \ln x\) exists only for \(x > 0\), so the formula applies only there.
\[\frac{d}{dx}\ln x = \cy{\frac1x}, \qquad x > 0\]For another base \(b\), the change-of-base formula writes \(\log_b x\) as \(\ln x\) divided by the constant \(\ln b\). The constant stays as a factor, so the slope is divided by \(\ln b\).
\[\frac{d}{dx}\log_b x = \cy{\frac{1}{x\ln b}}\]The number \(\log_b x\) is the power to which \(b\) must be raised to give \(x\). The base \(b\) must be positive and not 1.
When it fails
As \(x\) approaches 0 from the right, the slope \(\frac1x\) becomes very large, and the curve is almost vertical.
At \(x = 0\) and to the left of it, \(\ln x\) does not exist, so the figure shows no curve and there is no slope.
Example 1: a multiple of ln x
Find the slope of \(y = 3\ln x\) at \(x = 6\).
The constant 3 stays as a factor, and the derivative of \(\ln x\) is \(\frac1x\).
\[y' = 3\cdot\frac1x\]The value \(x = 6\) is in the domain \(x > 0\). Substitute it.
\[y'(6) = \frac36 = \cy{\frac12}\]The curve is green because it rises. At \(x = 6\) it rises slowly, and the orange bar on the lower graph reaches one half.
Example 2: a base other than e
Find the slope of \(y = \log_2 x\) at \(x = 4\).
At \(x = 4\), the height of the curve is \(\log_2 4 = 2\). The height of \(\ln x\) there is only about 1.39, because \(\log_2 x\) is \(\ln x\) divided by \(\ln 2\), which is less than 1.
A tempting wrong move: Use \(\frac1x\), as for \(\ln x\).
\[\cr{y'(4) = \frac14}\]The formula \(\frac1x\) has no base in it, so it gives one slope for every base. But \(\log_2 x\) rises faster than \(\ln x\), and the red dashed line with slope \(\frac14\) is less steep than the tangent.
For the base 2, divide \(\frac1x\) by \(\ln 2\).
\[y' = \frac{1}{x\ln 2}\]Substitute \(x = 4\).
\[y'(4) = \cy{\frac{1}{4\ln 2}}\]As a check, this is about 0.36. It is larger than \(\frac14\), as the picture shows.
Practice
Find the slope of \(y = 5\log_{10} x\) at \(x = 20\).
The 5 and the base 10 each give a constant factor. At \(x = 20\), the orange bar shows a small positive slope.
Solution
The constant 5 stays. Divide \(\frac1x\) by \(\ln 10\) for the base 10.
\[y' = \frac{5}{x\ln 10}\]Substitute \(x = 20\).
\[y'(20) = \frac{5}{20\ln 10} = \cy{\frac{1}{4\ln 10}}\]As a check, the slope is about 0.11, which is small and positive, as the orange bar shows.
Questions
Questions 1 and 2 use the curve \(y = \ln x\) with its slope graph below. Question 3 needs a calculation.
The marked point is at \(x = 2\). What is the slope of the tangent?
- \(\ln 2\)
- \(\frac12\)
- 2
Answer
\(\frac12\)
The marked point is at \(x = 0.25\). What is the slope of the tangent?
- \(\frac14\)
- −1.39
- 4
Answer
4
What is the derivative of \(\log_5 x\)?
- \(\dfrac1x\)
- \(\dfrac{\ln 5}{x}\)
- \(\dfrac{1}{x\ln 5}\)
Answer
\(\dfrac{1}{x\ln 5}\)
Summary
You differentiate \(\ln x\) to \(\frac1x\), and \(\log_b x\) to \(\frac{1}{x\ln b}\), for \(x > 0\).
The rule works because \(\ln x\) is the mirror image of \(e^x\), and a mirror swaps rise and run, so the slopes are reciprocals.
You use it for each term with a logarithm, after you check that x is in the domain.
This is one of four skills in topic 2.7 of Which & Why: AP Calculus.