Maths WorkshopMaths problems with full solutions
Exercise 790Calculus › Single-variable calculus › Differentiation › Differentiable functionsL1Added 2 Nov 2026

The n-th derivative of x² e^x

#higher derivatives#Leibniz formula#induction

Statement

Compute the nn-th derivative of f(x)=x2exf(x)=x^2e^x.

Hint

Use the Leibniz formula (uv)(n)=∑k=0n(nk)u(k)v(n−k)(uv)^{(n)}=\sum_{k=0}^n\binom nk u^{(k)}v^{(n-k)}. Most of the terms vanish because u=x2u=x^2 is a polynomial of degree 22.

Show solutionHide solution

Solution

Idea. The Leibniz formula is the "binomial theorem for derivatives". With u=x2u=x^2 we have u′=2xu'=2x, u′′=2u''=2 and u(k)=0u^{(k)}=0 for k≥3k\ge3. Also v=exv=e^x satisfies v(j)=exv^{(j)}=e^x for all jj.

Computation. Only k=0,1,2k=0,1,2 survive:
f(n)(x)=(n0)x2ex+(n1) 2x ex+(n2) 2 ex=ex(x2+2nx+n(n−1)).f^{(n)}(x)=\binom n0x^2e^x+\binom n1\,2x\,e^x+\binom n2\,2\,e^x=e^x\left(x^2+2nx+n(n-1)\right).

Check. For n=1n=1: ex(x2+2x)e^x(x^2+2x), which is the product rule. For n=2n=2: ex(x2+4x+2)e^x(x^2+4x+2).

Remark. The same method shows that the nn-th derivative of P(x)exP(x)e^x, with PP a polynomial, is exe^x times a polynomial of the same degree.