# 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.

Source: https://practicecalculus.com/blog/derivatives-of-exponential-and-logarithmic-functions
Updated: 2026-10-18

## Key takeaways

- $e^x$ is its own derivative, and $\frac{d}{dx}\ln x = \frac{1}{x}$.
- For other bases, a natural log appears: $\frac{d}{dx}a^x = a^x \ln a$ and $\frac{d}{dx}\log_a x = \frac{1}{x \ln a}$.
- With an inside function, $\frac{d}{dx}e^{g(x)} = g'(x)e^{g(x)}$ and $\frac{d}{dx}\ln g(x) = \frac{g'(x)}{g(x)}$.
- Logarithmic differentiation (take $\ln$ of both sides, then differentiate) is the tool for $x^x$ and for long products and quotients.

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:

$$\frac{d}{dx}e^x = e^x \qquad \frac{d}{dx}\ln x = \frac{1}{x}$$

$$\frac{d}{dx}a^x = a^x \ln a \qquad \frac{d}{dx}\log_a x = \frac{1}{x\ln a}$$

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](/blog/limit-definition-of-the-derivative):

$$\frac{d}{dx}a^x = \lim_{h\to 0}\frac{a^{x+h} - a^x}{h} = a^x \cdot \lim_{h \to 0}\frac{a^h - 1}{h}$$

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$.

```graph
title: 'Graph of y = eˣ with its tangent line y = x + 1 at x = 0'
caption: 'The slope of $e^x$ at $x = 0$ is exactly 1, and at every point the slope equals the height $e^x$.'
x: [-3, 2.5]
y: [-1, 7]
functions:
  - expr: e^x
    label: y = eˣ
  - expr: x + 1
    label: tangent at x = 0
    dashed: true
points:
  - [0, 1, '(0, 1)']
  - [1, 2.7183, '(1, e)']
```

## 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](/blog/implicit-differentiation)):

$$e^y \cdot \frac{dy}{dx} = 1 \quad\Longrightarrow\quad \frac{dy}{dx} = \frac{1}{e^y} = \frac{1}{x}$$

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}$.

```graph
title: 'Graph of y = ln x with tangent lines at x = 1 and x = 4'
caption: 'The slope of $\ln x$ is $\frac{1}{x}$: it is 1 at $x = 1$ but only $\frac{1}{4}$ at $x = 4$, so the curve keeps rising but flattens out.'
x: [-0.5, 7]
y: [-3, 3]
functions:
  - expr: ln(x)
    label: y = ln x
  - expr: x - 1
    label: tangent at x = 1
    dashed: true
  - expr: x/4 - 1 + ln(4)
    label: tangent at x = 4
    dashed: true
points:
  - [1, 0, '(1, 0)']
  - [4, 1.3863, '(4, ln 4)']
```

## 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](/blog/chain-rule):

$$y' = 2x\,e^{x^2}$$

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.

$$y' = 3\ln 5 \cdot 5^{3x}$$

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$:

$$y' = \frac{2x}{(x^2+4)\ln 2}$$

> **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

$$P'(t) = 500 \cdot 0.04\, e^{0.04t} = 20e^{0.04t} = 0.04\,P(t)$$

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:

1. Write $y = f(x)$ and take $\ln$ of both sides.
2. Use log laws to break products, quotients and powers into sums.
3. Differentiate both sides. The left side becomes $\frac{y'}{y}$.
4. 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:

$$\frac{y'}{y} = 1 \cdot \ln x + x\cdot \frac{1}{x} = \ln x + 1$$

**Step 3.** Multiply by $y = x^x$:

$$y' = x^x(\ln x + 1)$$

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.**

$$\ln y = 2\ln x + 3\ln(x+1) - \tfrac{1}{2}\ln(x-1)$$

**Step 2. Differentiate each term.**

$$\frac{y'}{y} = \frac{2}{x} + \frac{3}{x+1} - \frac{1}{2(x-1)}$$

**Step 3. Multiply by $y$.**

$$y' = \frac{x^2(x+1)^3}{\sqrt{x-1}}\left(\frac{2}{x} + \frac{3}{x+1} - \frac{1}{2(x-1)}\right)$$

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

1. **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.
2. **Forgetting $\ln a$.** $\frac{d}{dx}3^x = 3^x \ln 3$, not $3^x$. Only base $e$ skips this factor.
3. **Changing the exponent.** $\frac{d}{dx}e^{x^2} = 2x e^{x^2}$, not $e^{2x}$ and not $x^2 e^{x^2 - 1}$.
4. **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.
5. **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.

## Frequently asked questions

### What is the derivative of e^x?

The derivative of $e^x$ is $e^x$. It is the only exponential function (apart from constant multiples of it) that equals its own derivative, which is exactly why the number $e \approx 2.718$ is so important in calculus.

### What is the derivative of ln x?

The derivative of $\ln x$ is $\frac{1}{x}$ for $x > 0$. More generally $\frac{d}{dx}\ln|x| = \frac{1}{x}$ for every $x \neq 0$.

### What is the derivative of 2^x?

The derivative of $2^x$ is $2^x \ln 2$. In general $\frac{d}{dx}a^x = a^x \ln a$. A common mistake is to use the power rule and write $x \cdot 2^{x-1}$, which is wrong because the variable is in the exponent.

### What is the derivative of x^x?

Use logarithmic differentiation. Take $\ln$ of both sides to get $\ln y = x\ln x$, differentiate to get $\frac{y'}{y} = \ln x + 1$, and multiply by $y$: the derivative is $x^x(\ln x + 1)$.

### What is the derivative of log base 10 of x?

The derivative of $\log_{10} x$ is $\frac{1}{x \ln 10}$. Every logarithm is a constant multiple of $\ln x$, since $\log_a x = \frac{\ln x}{\ln a}$, so its derivative is $\frac{1}{x}$ times that same constant.
