Derivatives of Exponential and Log Functions: e^x, a^x and ln x
Learn the derivatives of e^x, a^x, ln x and log base a, why e is special, and how logarithmic differentiation handles x^x and messy products.
By the PracticeCalculus team Published 6 min read
On this page
- The four formulas
- Why e^x is its own derivative
- Why the derivative of ln x is 1/x
- Worked example 1: e with an inside function
- Worked example 2: an exponential with a different base
- Worked example 3: logarithms of products and chains
- What these derivatives mean: growth proportional to size
- Logarithmic differentiation
- Common mistakes
- Quick reference
- Build the habit with practice
The power rule handles x^2, but it is useless for 2^x, where the variable sits in the exponent. Exponentials and logarithms model growth, decay, interest and half-lives, so you need their derivatives constantly. There are only four formulas to learn, and they all come from one remarkable fact about the number e.
The four formulas
An exponential function has the variable in the exponent, like e^x or 3^x. A logarithm is its inverse, like \ln x or \log_2 x. Their derivatives are:
Here a > 0, a \neq 1, and \ln means the natural log (base e). Notice that the two base-e formulas are the special case a = e of the general ones, because \ln e = 1.
Why e^x is its own derivative
Try differentiating any exponential a^x with the limit definition:
The derivative of a^x is a^x times a constant. That constant is just the slope of a^x at x = 0. For a = 2 it is about 0.693. For a = 3 it is about 1.099. Somewhere between 2 and 3 there is a base where the slope at 0 is exactly 1, and that base is e \approx 2.71828.
So e is defined by the property that makes calculus clean: the slope of e^x at every point equals its height. And the mystery constant for other bases turns out to be \ln a, which gives \frac{d}{dx}a^x = a^x \ln a.
Why the derivative of ln x is 1/x
Let y = \ln x. That means e^y = x. Differentiate both sides with respect to x, using the chain rule on the left (this is implicit differentiation):
A neat consequence: \frac{d}{dx}\ln|x| = \frac{1}{x} for all x \neq 0, which is why \int \frac{1}{x}\,dx = \ln|x| + C.
For other bases, rewrite with the change-of-base formula \log_a x = \frac{\ln x}{\ln a}. Since \frac{1}{\ln a} is just a constant, the derivative is \frac{1}{x \ln a}.
Worked example 1: e with an inside function
Differentiate y = e^{x^2}.
Step 1. Outside: e^u, whose derivative is itself, e^{x^2}.
Step 2. Inside: u = x^2, with derivative 2x.
Step 3. Multiply, by the chain rule:
The exponent stays exactly as it was. Only the factor 2x comes out front.
Worked example 2: an exponential with a different base
Differentiate y = 5^{3x}.
Step 1. The derivative of 5^u is 5^u \ln 5, so the outer part is 5^{3x}\ln 5.
Step 2. The inside 3x has derivative 3.
Do not use the power rule here. 3x \cdot 5^{3x-1} is wrong, because the base is constant and the exponent is variable, which is the opposite of the power rule situation.
Worked example 3: logarithms of products and chains
Differentiate y = \ln(3x) and y = \log_2(x^2 + 4).
First function. By the chain rule, y' = \frac{1}{3x}\cdot 3 = \frac{1}{x}. That looks surprising until you use a log law: \ln(3x) = \ln 3 + \ln x, and \ln 3 is a constant. The constant disappears, leaving \frac{1}{x}.
Second function. The outside is \log_2 u, with derivative \frac{1}{u \ln 2}. The inside x^2 + 4 has derivative 2x:
Tip: before differentiating a log, expand it with log laws. \ln\big(x^3\sqrt{x+1}\big) = 3\ln x + \tfrac{1}{2}\ln(x+1), whose derivative \frac{3}{x} + \frac{1}{2(x+1)} needs no product rule at all.
What these derivatives mean: growth proportional to size
The rule \frac{d}{dx}e^{kx} = ke^{kx} says something physical: the rate of change is proportional to the current amount. That is exactly how populations, compound interest and radioactive decay behave.
Suppose a bacteria culture has P(t) = 500e^{0.04t} cells after t hours. Then
At every moment the culture grows at 4% of its current size per hour. At t = 0 that is 20 cells per hour. By the time the culture has doubled to 1000 cells (at t = \frac{\ln 2}{0.04} \approx 17.3 hours), it is growing at 40 cells per hour. Bigger populations grow faster, and e^{kx} is the function that captures that perfectly.
Logarithms work the other way. Since \frac{d}{dx}\ln x = \frac{1}{x} shrinks as x grows, \ln x keeps increasing forever but more and more slowly. That is why log scales (decibels, the Richter scale, pH) compress huge ranges of values into small, readable numbers.
Logarithmic differentiation
Some functions are impossible with the basic rules, like x^x, where the variable is in both the base and the exponent. Others are possible but painful, like a long product of powers. Logarithmic differentiation handles both:
- Write y = f(x) and take \ln of both sides.
- Use log laws to break products, quotients and powers into sums.
- Differentiate both sides. The left side becomes \frac{y'}{y}.
- Multiply both sides by y, then substitute the original f(x) back in.
Worked example 4: the derivative of x^x
Let y = x^x for x > 0.
Step 1. \ln y = \ln(x^x) = x\ln x.
Step 2. Differentiate. The right side needs the product rule:
Step 3. Multiply by y = x^x:
Check at x = 1: y' = 1 \cdot (0 + 1) = 1. The same method gives \frac{d}{dx}x^{\sin x} = x^{\sin x}\left(\cos x \ln x + \frac{\sin x}{x}\right).
Worked example 5: a messy product and quotient
Differentiate y = \dfrac{x^2(x+1)^3}{\sqrt{x-1}} for x > 1.
Step 1. Take logs and expand.
Step 2. Differentiate each term.
Step 3. Multiply by y.
Doing this with the quotient rule plus the product rule plus two chain rules would take a full page. Logs turned it into three easy terms.
Common mistakes
- Using the power rule on a^x. \frac{d}{dx}2^x \neq x\,2^{x-1}. The power rule is only for a variable base and a constant exponent.
- Forgetting \ln a. \frac{d}{dx}3^x = 3^x \ln 3, not 3^x. Only base e skips this factor.
- Changing the exponent. \frac{d}{dx}e^{x^2} = 2x e^{x^2}, not e^{2x} and not x^2 e^{x^2 - 1}.
- Writing \frac{d}{dx}\ln(g(x)) = \frac{1}{g'(x)}. The correct form is \frac{g'(x)}{g(x)}: the inside goes on the bottom, its derivative on top.
- Forgetting to multiply by y at the end of logarithmic differentiation, leaving the answer as \frac{y'}{y}.
Quick reference
| Function | Derivative | With inside g(x) |
|---|---|---|
| e^x | e^x | g'(x)\,e^{g(x)} |
| a^x | a^x \ln a | g'(x)\,a^{g(x)}\ln a |
| \ln x | \frac{1}{x} | \frac{g'(x)}{g(x)} |
| \ln\lvert x\rvert | \frac{1}{x} | \frac{g'(x)}{g(x)} |
| \log_a x | \frac{1}{x\ln a} | \frac{g'(x)}{g(x)\ln a} |
| x^x | x^x(\ln x + 1) | use logarithmic differentiation |
Build the habit with practice
The formulas are short, but the traps (power rule on 2^x, a missing \ln a, a changed exponent) are easy to fall into under exam pressure. The interactive lesson below drills exactly these, with instant feedback on every answer, so the correct pattern becomes automatic before test day.
Practice it now
Exponentials and logarithms
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson