Higher-Order Derivatives

A higher-order derivative is what you get by differentiating again: f'' is the derivative of f', f''' is the derivative of f'', and f^{(n)} is the result of differentiating n times. Each step uses the same rules as the first derivative, applied to the previous result, so the work is repeated differentiation plus careful bookkeeping of signs and constants.

Notation

Primes work well up to the third derivative. After that, a number in parentheses is easier to read than a row of primes.

Order Prime / index notation Leibniz notation
1 f'(x) \dfrac{dy}{dx}
2 f''(x) \dfrac{d^2y}{dx^2}
3 f'''(x) \dfrac{d^3y}{dx^3}
4 f^{(4)}(x) \dfrac{d^4y}{dx^4}
n f^{(n)}(x) \dfrac{d^ny}{dx^n}

The operator form \dfrac{d^n}{dx^n}f(x) means the same thing. With time as the variable, write \dfrac{d^2s}{dt^2}.

Two notations are easy to misread:

What the second derivative means

The second derivative is the rate of change of the rate of change. If f' tells you how fast f is changing, f'' tells you how fast that speed itself is changing.

The clearest case is motion. When s(t) is position, v(t)=s'(t) is velocity and a(t)=s''(t) is acceleration, measured in metres per second squared. In the article on derivative as velocity, the position s(t)=5t^2 had velocity v(t)=10t. One more derivative gives the acceleration, the constant a(t)=10 m/s².

The second derivative also controls the shape of the graph: its sign says whether the slope is increasing or decreasing, and so whether the curve bends upward or downward.

Example: a polynomial

Differentiate f(x)=x^5 repeatedly with the power rule. Each step multiplies by the current exponent and lowers it by one:

\begin{aligned} f'(x)&=5x^4,\\ f''(x)&=5\cdot 4x^3=20x^3,\\ f'''(x)&=20\cdot 3x^2=60x^2,\\ f^{(4)}(x)&=60\cdot 2x=120x,\\ f^{(5)}(x)&=120,\\ f^{(6)}(x)&=0. \end{aligned}

The fifth derivative is the constant 120=5!. After a constant appears, the next derivative is 0, and every later one is 0 as well.

This is general. A polynomial of degree n loses one degree per derivative, so f^{(n)} is a constant and f^{(n+1)} is 0.

Repeating patterns

Some functions return to themselves after a few derivatives.

Sine and cosine. Differentiating \sin x gives a cycle of period 4:

Order 0 1 2 3 4
f^{(n)}(x) \sin x \cos x -\sin x -\cos x \sin x

To find any derivative of \sin x, divide n by 4 and look at the remainder: 0 gives \sin x, 1 gives \cos x, 2 gives -\sin x, and 3 gives -\cos x. Each derivative shifts the argument by a quarter turn, which gives a single formula:

\frac{d^n}{dx^n}\sin x=\sin\!\left(x+\frac{n\pi}{2}\right).

The cosine follows the same cycle shifted by one step.

The exponential e^{2x}. Each derivative multiplies by 2, the derivative of the inner function 2x (see the chain rule):

f'(x)=2e^{2x},\qquad f''(x)=4e^{2x},\qquad f'''(x)=8e^{2x},

and in general

f^{(n)}(x)=2^n e^{2x}.

A pattern with factorials

Take f(x)=\ln x for x>0 and differentiate four times:

f'(x)=\frac1x,\qquad f''(x)=-\frac1{x^2},\qquad f'''(x)=\frac{2}{x^3},\qquad f^{(4)}(x)=-\frac{6}{x^4}.

The signs alternate, and the numerators 1, 1, 2, 6 are the factorials 0!, 1!, 2!, 3!. That suggests

f^{(n)}(x)=\frac{(-1)^{n-1}(n-1)!}{x^n}.

Check it for n=1,2,3,4: the formula gives \dfrac{1}{x}, -\dfrac{1}{x^2}, \dfrac{2}{x^3} and -\dfrac{6}{x^4}, as above.

A guess from four cases is not yet a proof. To confirm it, differentiate the formula for n and see whether you get the formula for n+1:

\frac{d}{dx}\left[(-1)^{n-1}(n-1)!\,x^{-n}\right]=(-1)^{n-1}(n-1)!\cdot(-n)\,x^{-n-1}=\frac{(-1)^{n}\,n!}{x^{n+1}}.

That is the formula with n replaced by n+1, so the pattern continues forever.

Products: differentiate twice

Let f(x)=x^2e^x. Apply the product rule once:

f'(x)=2xe^x+x^2e^x=(x^2+2x)e^x.

Apply it again to f', with u=x^2+2x and v=e^x:

f''(x)=(2x+2)e^x+(x^2+2x)e^x=(x^2+4x+2)e^x.

There is a direct formula for the second derivative of a product. Differentiating (uv)'=u'v+uv' once more gives

(uv)''=u''v+2u'v'+uv''.

With u=x^2 and v=e^x we have u'=2x, u''=2 and v'=v''=e^x. Substituting:

f''(x)=2e^x+2\cdot 2x\cdot e^x+x^2e^x=(x^2+4x+2)e^x.

Both routes give the same answer.

Mistakes to avoid

Try it: Open x^2*exp(x) at order 2; the link sets the “order” menu to 2nd. The calculator shows two cards, “1st derivative” and “2nd derivative”. The second is printed unsimplified, as x(x+2)e^x+xe^x+(x+2)e^x; its Simplify button gives (x^2+4x+2)e^x. The “order” menu offers 1st to 5th, so you can also open x^5 at order 5 and read 120 on the last card. To go beyond the fifth derivative, use the “Calculate next higher derivative” button under the cards.

Frequently asked questions

What is the 0th derivative?

It is the function itself: f^{(0)}=f, by convention, meaning zero differentiations. The convention keeps formulas consistent. For example, \sin\!\left(x+\frac{0\cdot\pi}{2}\right)=\sin x and 2^0e^{2x}=e^{2x} both match the patterns above at n=0.

When is the n-th derivative zero?

For a polynomial of degree m, every derivative of order above m is zero. On an interval, f^{(n)} is zero everywhere exactly when f is a polynomial of degree at most n-1. Functions such as \sin x, e^{2x} and \ln x never reach a derivative that is zero everywhere, although a particular derivative may be zero at some points.

Do I always have to differentiate step by step to get f^{(n)}?

No, but you need a pattern to skip steps. Compute the first few derivatives, guess the general form, and then confirm it by showing that differentiating the formula for n gives the formula for n+1, as was done for \ln x. For a product there is also the Leibniz formula, (uv)^{(n)}=\sum_{k=0}^{n}\binom nk u^{(k)}v^{(n-k)}, whose coefficients 1,2,1 at second order become the binomial coefficients. For functions with no pattern, you differentiate one step at a time.

Where to go next

To test your own results, try the higher-order derivative calculator: every card has its own “Check your answer” box that accepts any equivalent form.