Implicit differentiation, which we explored in the last section, can also be employed to find the derivatives of logarithmic functions, which are of the form $y = \log_a{x}$. This also includes the natural logarithmic function $y = \ln{x}$.
Proving $\frac{d}{dx} (\log_a{x}) = \frac{1}{x \ln{a}}$¶
Taking advantage of the fact that $y = \log_a{x}$ can be rewritten as an exponential equation, $a^y = x$, we can state the derivative of $\log_a{x}$ as:
$$ \frac{d}{dx} (\log_a{x}) = \frac{1}{x \ln{a}} $$This can be proved by applying implicit differentiation. First we find the deriative of $y = a^x$. Start by taking the $\ln{}$ of both sides of the equation:
$$ \ln{y} = \ln{a^x} $$Then exponentiate both sides:
$$ e^{\ln{y}} = e^{\ln{a^x}} $$As $a^{\ln{x}}$ = $x \ln{e}$, and $\ln{e} = 1$, we can simplify the left side of the equation to remove the exponent and natural log.
$$ y = e^{\ln{a^x}} $$Proceed to find the derivative by using the chain rule:
$$ \frac{dx}{dy} = e^{\ln{a^x}}, \qquad y = e^u, \qquad u = \ln{a^x} $$$$ \frac{dy}{du} = e^u, \qquad \frac{du}{dx} = \ln{a} $$$$ \ln{a} e^u = \ln{a} e^{\ln{a}} $$Just as $\ln{e} = 1$, $e^{\ln{x}} = x$, thus:
$$ \frac{dy}{dx} \ln{a} \space a^x $$Returning to the derivative of $y = \log_a{x}$, rewrite the equation:
$$ a^y = x $$Now that we know $\frac{dy}{dx} \ln{a} \space a^x$, we can derive the equation implicitly with respect to $x$:
$$ \frac{d}{dx} a^y = \frac{d}{dx} x $$$$ a^y \ln{a} \frac{dy}{dx} = 1 $$Then, dividing by $a^y \ln{a}$:
$$ \frac{d}{dx} \log_a{x} = \frac{1}{x \ln{a}} $$Proving $\frac{d}{dx} (\ln{x}) = \frac{1}{x}$¶
Start with $y = \ln{x}$. Exponentate both sides of the equation:
$$ e^y = e^{\ln{x}} $$Recalling that $e^{\ln{x}} = x$:
$$ e^y = x $$Applying implicit differentiation:
$$ \frac{dy}{dx} e^y = \frac{d}{dx} x $$$$ e^y \frac{dy}{dx} = 1 $$Using the fact that $e^y = x$, we can substitute $x$ for $e^y$:
$$ x \frac{dy}{dx} = 1 $$Divide by $x$:
$$ \frac{dy}{dx} = \frac{1}{x} $$Examples¶
from sympy import symbols, diff, simplify, sin, cos, log, tan, sqrt, init_printing
from mpmath import ln, e
init_printing()
x = symbols('x')
y = symbols('y')
Example 1: Calculate the derivative of $f(x) = \sin{\ln{x}}$¶
Apply the Chain Rule:
$$ y = \sin{u}, \qquad u = \ln{x} $$As we proved above, $\frac{du}{dx} = \frac{1}{x}$, therefore:
$$ \frac{dy}{dx} = \frac{1}{x} \cos{\ln{x}} $$diff(sin(ln(x)))
Example 2: Find the derivative of the function $f(x) = \log_2{(1 - 3x)}$¶
Using the fact that $\frac{d}{dx} (\log_a{x}) = \frac{1}{x \ln{a}}$, apply the Chain Rule:
$$ y = \log_2{u}, \qquad u = 1 - 3x $$$$ \frac{dy}{du} = \frac{1}{u \ln{2}}, \qquad \frac{du}{dx} = 3 $$$$ \frac{dy}{dx} = \frac{3}{(1 - 3x) \ln{2}} $$diff(log((1 - 3 * x), 2))
Example 3: Find the derivative to the function $\sqrt[5]{\ln{x}}$¶
First, rewrite the equation as $\sqrt[5]{\ln{x}} = (\ln{x})^{\frac{1}{5}}$. Then, apply the Chain Rule:
$$ y = u^\frac{1}{5}, \qquad u = \ln{x} $$$$ \frac{dy}{du} = \frac{1}{5} (\ln{x})^{-\frac{4}{5}}, \qquad \frac{du}{dx} = \frac{1}{x} $$$$ \frac{dy}{dx} = \frac{1}{x} \space \frac{1}{5} (\ln{x})^{-\frac{4}{5}} = \frac{(\ln{x})^{-\frac{4}{5}}}{5x} = \frac{1}{5x \ln^\frac{4}{5}{x}} $$diff((log(x)) ** (1/5))
Example 4: Find the derivative of $f(x) = \sin{x} \ln{5x}$¶
Start by using the Product rule, $u \frac{dv}{dx} + v \frac{du}{dx}$:
$$ u = \sin{x}, \qquad v = \ln{5x} $$$$ \frac{dy}{dx} = (\sin{x}) \frac{dv}{dx} \ln{5x} + (\ln{5x}) \frac{du}{dx} \sin{x} $$$$ \frac{dy}{dx} = \frac{\sin{x}}{x} + \ln{5x} \cos{x} $$diff(sin(x) * log(5 * x))
Example 5: Find the derivative of the function $F(x) = \ln{\frac{(2x + 1)^3}{(3x - 1)^4}}$¶
Here, rather than applying the Chain Rule and then the Quotient Rule to the inner equation, which would result in a very lengthy and tedious derivation, we can take advantage of one of the logarithmic identities, $\ln{ab} = \ln{a} + \ln{b}$. Thus, we can rewrite the function as:
$$ F(x) = \ln{(2x + 1)^3} + \ln{\frac{1}{(3x - 1)^4}} $$With the rewritten function, we can leverage another logarithmic identity, $\ln{a^b} = b \ln{a}$ to simplify the derivation. We can therefore rewrite the function again as:
$$ F(x) = 3 \ln{(2x + 1)} - 4 \ln{(3x - 1)} $$Then, proceed to differentiate the function:
$$ \frac{dy}{dx} = 3 \frac{d}{dx} \ln{(2x + 1)} - 4 \frac{d}{dx} \ln{(3x - 1)} $$$$ \frac{dy}{dx} = 3 \frac{2}{2x + 1} - 4 \frac{3}{3x - 1} = \frac{6}{2x + 1} - \frac{12}{3x - 1} $$simplify(diff(log((2 * x + 1) ** 3 / (3 * x - 1) ** 4)))