# Derivative of ln(x²) vs (ln x)²: Formulas and Examples

> The derivative of ln(x²) is 2/x, while the derivative of (ln x)² is 2 ln x / x. See both proofs, a graph and how to tell them apart.

Source: https://practicecalculus.com/derivatives/ln-x-squared
Updated: 2026-11-06

$$ \frac{d}{dx}\,\ln(x^2) = \frac{2}{x} $$

## At a glance

- **Derivative of ln(x²):** $\dfrac{2}{x}$ for $x \ne 0$
- **Derivative of (ln x)²:** $\dfrac{2\ln x}{x}$ for $x > 0$
- **Key log rule:** $\ln(x^2) = 2\ln\lvert x\rvert$
- **Domain of ln(x²):** $x \ne 0$
- **Domain of (ln x)²:** $x > 0$

## Key takeaways

- The derivative of $\ln(x^2)$ is $\frac{2}{x}$: by the chain rule, $\frac{2x}{x^2}$, or by the log rule $\ln(x^2) = 2\ln\lvert x\rvert$.
- The derivative of $(\ln x)^2$ is $\frac{2\ln x}{x}$: the square is on the outside, so use the power rule then the chain rule.
- $\ln(x^2)$ squares the input; $(\ln x)^2$ squares the output. They are different functions.
- $\ln(x^2)$ is defined for all $x \ne 0$, but $(\ln x)^2$ only for $x > 0$.

The **derivative of $\ln(x^2)$ is $\dfrac{2}{x}$**. Do not confuse it with $(\ln x)^2$, whose derivative is $\dfrac{2\ln x}{x}$.

$$\frac{d}{dx}\,\ln(x^2) = \frac{2}{x} \qquad\qquad \frac{d}{dx}\,(\ln x)^2 = \frac{2\ln x}{x}$$

## Derivative of ln(x²): two ways

**With the chain rule.** The inside is $u = x^2$, so $u' = 2x$. Using "derivative of the inside over the inside" from the [derivative of ln x](/derivatives/ln-x):

$$\frac{d}{dx}\ln(x^2) = \frac{2x}{x^2} = \frac{2}{x}$$

**With a log rule first.** The power rule for logs brings the exponent down: $\ln(x^2) = 2\ln\lvert x\rvert$. Since $\frac{d}{dx}\ln\lvert x\rvert = \frac{1}{x}$,

$$\frac{d}{dx}\,2\ln\lvert x\rvert = \frac{2}{x}$$

The absolute value matters because $x^2 > 0$ even when $x < 0$. So $\ln(x^2)$ exists for negative $x$ too, and the formula $\frac{2}{x}$ is valid on both sides of $0$.

## Derivative of (ln x)²

Here the log is computed first and *then* squared. The outer function is a square, so use the [chain rule](/rules/chain-rule) with the power rule outside:

$$\frac{d}{dx}(\ln x)^2 = 2(\ln x)^1\cdot\frac{d}{dx}\ln x = \frac{2\ln x}{x}$$

You will also see $(\ln x)^2$ written as $\ln^2 x$. It never equals $\ln(x^2)$ in general. At $x = e$: $\ln(e^2) = 2$, but $(\ln e)^2 = 1$.

## Graph of both functions

```graph
title: 'Graph of y = ln(x²) and y = (ln x)²'
caption: '$\ln(x^2)$ has two branches, one on each side of the y-axis. $(\ln x)^2$ lives only on $x > 0$, touches zero at $x = 1$ and is never negative.'
x: [-5, 5]
y: [-4, 4]
functions:
  - expr: ln(x^2)
    label: y = ln(x²)
    domain: [0.15, 5]
  - expr: ln(x^2)
    label: y = ln(x²)
    domain: [-5, -0.15]
  - expr: (ln(x))^2
    label: y = (ln x)²
    dashed: true
    domain: [0.14, 5]
points:
  - [1, 0, '(1, 0)']
  - [-1, 0, '(−1, 0)']
```

The graph shows the difference in sign. $\ln(x^2)$ rises for $x > 0$ (its slope $\frac{2}{x}$ is positive) and falls for $x < 0$. $(\ln x)^2$ has a minimum at $x = 1$, where its derivative $\frac{2\ln x}{x}$ equals $0$.

## Side by side

| | $\ln(x^2)$ | $(\ln x)^2$ |
| --- | --- | --- |
| What is squared | the input $x$ | the output $\ln x$ |
| Domain | $x \ne 0$ | $x > 0$ |
| Simplifies to | $2\ln\lvert x\rvert$ | no simpler form |
| Derivative | $\frac{2}{x}$ | $\frac{2\ln x}{x}$ |
| Value at $x = e$ | $2$ | $1$ |

## More examples

**Example 1.** $\frac{d}{dx}\ln(x^3) = \frac{3x^2}{x^3} = \frac{3}{x}$. In general $\frac{d}{dx}\ln(x^n) = \frac{n}{x}$.

**Example 2.** $\frac{d}{dx}\ln(x^2 + 1) = \frac{2x}{x^2 + 1}$. Here nothing cancels, because the inside is not a pure power.

**Example 3.** $\frac{d}{dx}(\ln x)^3 = \frac{3(\ln x)^2}{x}$.

**Example 4.** $\frac{d}{dx}\ln\!\left((x^2 + 1)^2\right) = 2\cdot\frac{2x}{x^2 + 1} = \frac{4x}{x^2 + 1}$, using the log power rule first.

## Common mistakes

1. **Writing $\frac{1}{x^2}$.** You must multiply by the inside derivative $2x$.
2. **Treating $\ln^2 x$ as $\ln(x^2)$.** One squares the output, the other the input.
3. **Writing $\frac{2}{x}$ for $(\ln x)^2$.** You dropped the $\ln x$ that the power rule leaves behind.

For more chain rule practice with logs, see the [derivative of ln(2x)](/derivatives/ln-2x), [logarithmic differentiation](/rules/logarithmic-differentiation) and [derivatives of exponential and logarithmic functions](/practice-problems/derivatives-of-exponential-and-logarithmic-functions).

## Frequently asked questions

### What is the derivative of ln(x²)?

The derivative of $\ln(x^2)$ is $\frac{2x}{x^2} = \frac{2}{x}$, for every $x \ne 0$.

### What is the derivative of (ln x)²?

By the chain rule, $2\ln x\cdot\frac{1}{x} = \frac{2\ln x}{x}$.

### Is ln(x²) the same as 2 ln x?

Only for $x > 0$. In general $\ln(x^2) = 2\ln\lvert x\rvert$, because $\ln(x^2)$ is also defined for negative $x$ while $\ln x$ is not.

### What is the derivative of ln(x² + 1)?

It is $\frac{2x}{x^2 + 1}$. Unlike $\ln(x^2)$, this does not simplify further.
