AI Math Basics: Logarithms and Exponentials, Part 3: Differentiating Logarithmic Functions (Continued)
Good morning. This is the Research Team at Qualiteg.
Today we present the second half of our discussion on differentiating logarithmic functions.
By the end of this installment, you should have a solid grasp of how to differentiate logarithmic functions.
2. Logarithm Identities
First, let's review the basic logarithm identities. We will use them later when deriving the derivative of the logarithmic function.
Because \(a^{0} = 1\), that is, raising \(a\) to the power \(0\) gives \(1\)
$$
\log_a 1 = 0 \tag{2.1}
$$
Because \(a^{1} = a\), that is, raising \(a\) to the power \(1\) gives \(a\)
$$
\log_a a = 1 \tag{2.2}
$$
Logarithm of a product
$$
\log_a (X \times Y) = \log_a X + \log_a Y \tag{2.3}
$$
Logarithm of a quotient
$$
\log_a ( \frac Y X) = \log_a Y - \log_a X \tag{2.4}
$$
In equation \((2.4)\), when \(Y=1\), we have \(log_a Y = log_a 1 = 0\), so
$$
\log_a ( \frac 1 X) = -\log_a X \tag{2.5}
$$
Logarithm of a power
$$
\log_a (X^{Y}) = Y \log_a X \tag{2.6}
$$
Change-of-base formula
$$
\log_a b = \frac {\log_c b} {\log_c a} \tag{2.7}
$$
Here \(c\) is the new base. The change-of-base formula moves \(a\) and \(b\) as shown below.
We mention this only briefly, but this technique comes in handy in many places beyond today's topic, so be sure to remember the following.

3. The Derivative of the Logarithmic Function
Now, here is the formula for the derivative of the logarithmic function.
Formula for the derivative of the logarithmic function
$$
f(x) = \log_a x
$$
Differentiating with respect to \(x\), the derivative \(f'(x)\) is
$$
f'(x) = \frac{1}{x \log_e a} \tag{3.1}
$$
as shown above.
For the logarithmic function with base \(e\)
$$
g(x) = \log_e x
$$
differentiating with respect to \(x\), the derivative \(g'(x)\) is
$$
g'(x) = \frac{1}{x} \tag{3.2}
$$
as shown above.
This is because substituting Napier's constant \(e\) for \(a\) in equation \((3.1)\) gives \(g'(x) = \frac{1}{x \log_e e}\), and since \(\log_e e = 1\), we can derive \(g'(x) = \frac{1}{x}\).
4. Deriving the Derivative of the Logarithmic Function
We showed the derivative formula up front, but that was merely the appetizer.
This is the main course.
Let's derive the formula for the derivative of the logarithmic function, equation \((3.1)\) above, using the tools we have seen so far.
$$
f(x) = \log_a x
$$
Applying the definition of the derivative to this, we get
$$
\begin{aligned}
f'(x) = &\lim_{h \to 0} \frac {f(x+h)-f(x)} {h}& \
=& \lim_{h \to 0} \frac {\log_a (x+h) - \log_a x} {h} &\
\end{aligned}
$$
and rewriting this using \(\frac {1}{h}\), we get
$$
f'(x) = \lim_{h \to 0} \frac {1} {h} (\log_a (x+h) - \log_a x) \tag{4.1}
$$
as shown above.
Here,
if we let \((x+h) = Y\) and \(x = X\), we get
$$
\log_a (x+h) - \log_a x = \log_a Y - \log_a X
$$
as shown above.
Logarithm of a quotient — using identity \((2.4)\),
$$
\log_a ( \frac Y X) = \log_a Y - \log_a X \tag{2.4}
$$
we find that \(\log_a Y - \log_a X\) becomes \(\log_a ( \frac Y X)\), so
listing the steps so far, we have
$$
\begin{aligned}
&\log_a (x+h) - \log_a x&\
= &\log_a Y - \log_a X& \
= &\log_a ( \frac Y X)&
\end{aligned}
$$
as shown above.
Now, since \(X = x\) and \(Y= (x+h)\),
$$
\begin{aligned}
\log_a ( \frac Y X)= \log_a ( \frac {x+h}{x})\
\end{aligned}
$$
and so, listing the steps so far once again, we have
$$
\begin{aligned}
&\log_a (x+h) - \log_a x&\
= &\log_a Y - \log_a X& \
= &\log_a ( \frac Y X)&\
= &\log_a ( \frac {x+h}{x})&
\end{aligned}
$$
as shown above.
Substituting this into equation \((4.1)\), we get
$$
f'(x) = \lim_{h \to 0} \frac {1} {h} (\log_a (x+h) - \log_a x) = \lim_{h \to 0} \frac {1} {h} (\log_a ( \frac {x+h}{x})) \tag{4.2}
$$
as shown above.
Logarithm of a power — from identity \((2.6)\), \(Y \log_a X = \log_a (X^{Y})\), so if we let \(Y = \frac {1}{h}\) and \(X=\frac {x+h}{x}\), we get
$$
\begin{aligned}
f'(x) = &\lim_{h \to 0} \frac {1} {h} (\log_a ( \frac {x+h}{x}))
= \lim_{h \to 0} Y (\log_a X)
= \lim_{h \to 0} (\log_a(X^{Y}))&\
\
&\text{Substituting } X \text{ and } Y \text{ back, we get}&\
\
& \lim_{h \to 0} Y (\log_a X) = \lim_{h \to 0} (\log_a(\frac {x+h}{x})^\frac {1} {h})\ .& \
\
\text{Furthermore, since } &\frac {x+h}{x} = 1 + \frac {h}{x}\text{,}&\
\
&\lim_{h \to 0} (\log_a(\frac {x+h}{x})^\frac {1} {h}) = \lim_{h \to 0} (\log_a(1 + \frac {h}{x})^\frac {1} {h})&\
\
&\text{Moreover, if we substitute } \frac{h}{x} = t\text{,}&\
&\lim_{h \to 0} →\lim_{t \to 0} \text{ and } \frac {1} {h} → \frac {1} {tx}\text{, so}&\
\
&\lim_{h \to 0} (\log_a(1 + \frac {h}{x})^\frac {1} {h}) = \lim_{t \to 0} (\log_a(1 + t)^{\frac {1} {tx}}) = \lim_{t \to 0} (\log_a(1 + t)^{\frac {1} {t} \cdot \frac {1} {x}})&\
\end{aligned}
$$
From exponent identity 1.4, \((a^{x})^{y} = a^{xy}\), so
$$
\begin{aligned}
f'(x) = &\lim_{t \to 0} (\log_a(1 + t)^{\frac {1} {t} \cdot \frac {1} {x}}) = \lim_{t \to 0} (\log_a ((1 + t)^{\frac {1} {t}})^{\frac {1} {x}})\&
\
\end{aligned}
$$
$$
\begin{aligned}
\text{In the expression above, letting } & \lim_{t \to 0} (1 + t)^{\frac {1}{t}} \text{ be } e\text{,} &\
f'(x)=&\lim_{t \to 0} (\log_a ((1 + t)^{\frac {1} {t}})^{\frac {1} {x}})=
\log_a e^{\frac {1}{x}}&
\end{aligned}
$$
Furthermore, logarithm of a power — from identity \((2.6)\),
\(\log_a (X^{Y}) = Y \log_a X\), so if we let \(Y = \frac {1}{x}\) and \(X = e\), we get
$$
f'(x) = \log_a e^{\frac {1}{x}} = \frac{1}{x} \log_a {e} \tag{4.3}
$$
Now let's focus on the \(\log_a {e}\) in equation \((4.3)\).
Change-of-base formula — from equation \((2.7)\), \(\log_a b = \frac {\log_c b} {\log_c a}\), so if we let \(b = e\) and \(c=e\), we get
$$
\begin{aligned}
\log_a e = \frac {\log_e e}{\log_e a}
\end{aligned}
$$
as shown above.
$$
\begin{aligned}
\text{Since } \log_e e = 1\text{,}&\
&\frac {\log_e e}{\log_e a} = \frac {1}{log_e a}&
\end{aligned}
$$
and with this we find that
$$
\log_a e = \frac {1}{log_e a}
$$
holds. Rewriting equation \((4.3)\) with \(\log_a e → \frac {1}{log_e a}\), we get
$$
\begin{aligned}
f'(x) = &\frac{1}{x} \log_a {e}&\
=&\frac{1}{x} \cdot \frac {1}{log_e a}&
\end{aligned}
$$
and we have thereby derived equation \((3.1)\).
$$
f'(x) = \frac{1}{x \log_e a} \tag{3.1, restated}
$$
We recommend actually working through this derivation on paper.
Similar derivations will appear later in the LLM-related techniques we cover.
Papers and explanatory articles often skip five or six of these derivation steps without comment, so to avoid getting stuck at such points, it is a good idea to build the habit of working through derivations one step at a time at this foundational stage.
See you next time.
navigation