Free preview

106 lessons

Essential Calculus for ML

Free preview

Essential Calculus for ML · 106 lessons

Master the fundamentals

No surprise gaps

Actually remember it

Skip what you know

One subscription. All learning paths included.

Our content is best on a larger screen

Second and higher-order derivatives

Computing the second derivative

Explanation

The derivative ff' is a function in its own right: it takes an input xx and returns the rate of change of ff there. Like any function, it can be differentiated. Doing so gives a new function, one that measures how fast the rate of change is itself changing rather than how fast ff is changing.

The second derivative

Definition

The second derivative of ff is the derivative of ff':

f(x)=ddx[f(x)].f''(x) = \dfrac{d}{dx}\left[f'(x)\right].

In Leibniz notation, where y=f(x)y = f(x), it is written d2ydx2\dfrac{d^2y}{dx^2}.

The symbol d2ydx2\dfrac{d^2y}{dx^2} records that the operator ddx\dfrac{d}{dx} has been applied twice. It is a single piece of notation rather than a power, so it does not mean dydx\dfrac{dy}{dx} squared.

Computing ff'' needs no new rules. The same differentiation rules apply to ff' as applied to ff.

Computing the second derivative

Procedure

  1. Differentiate ff to obtain ff'.
  2. Simplify ff'.
  3. Differentiate ff' to obtain ff'', using whichever rules its structure requires.

Which rules apply when differentiating ff' is decided by the form of ff', not by the form of ff. Differentiating can change that form, so we read the structure of ff' before differentiating it, exactly as we would for any other function.

Example

Compute f(x)f''(x) for f(x)=x2exf(x) = x^2e^x.

Solution

  1. We differentiate ff to obtain ff'. The expression is a product of two factors, so we name them:

    u(x)=x2,v(x)=ex.u(x) = x^2, \qquad v(x) = e^x.

    Each factor differentiates on its own: the power rule gives u(x)=2xu'(x) = 2x, and v(x)=exv'(x) = e^x. Assembling with the product rule,

    f(x)=u(x)v(x)+u(x)v(x)=2xex+x2ex.\begin{align*} f'(x) &= u'(x)\,v(x) + u(x)\,v'(x) \\ &= 2xe^x + x^2e^x. \end{align*}
  2. We simplify ff'. Both terms carry a factor of exe^x, so we factor it out:

    f(x)=(x2+2x)ex.f'(x) = \left(x^2 + 2x\right)e^x.

    Written this way, the structure of ff' is visible. It is again a product, but not the product we began with: its first factor is x2+2xx^2 + 2x, where the first factor of ff was x2x^2.

  3. We differentiate ff' to obtain ff''. Its structure requires the product rule again, now with the factors

    p(x)=x2+2x,q(x)=ex,p(x) = x^2 + 2x, \qquad q(x) = e^x,

    giving p(x)=2x+2p'(x) = 2x + 2 and q(x)=exq'(x) = e^x. Assembling with the product rule again,

    f(x)=p(x)q(x)+p(x)q(x)=(2x+2)ex+(x2+2x)ex=(x2+4x+2)ex.\begin{align*} f''(x) &= p'(x)\,q(x) + p(x)\,q'(x) \\ &= (2x + 2)e^x + \left(x^2 + 2x\right)e^x \\ &= \left(x^2 + 4x + 2\right)e^x. \end{align*}

Practice questions

6 questions

Compute f(x)f''(x) for f(x)=2x45x3+xf(x) = 2x^4 - 5x^3 + x.

Select the correct answer:

+ 5 more questions

Higher-order derivatives of polynomials

Explanation

The second derivative is not the end of the process. Differentiating ff'' gives the third derivative f(x)f'''(x), that function can be differentiated in turn to give a fourth, and so on for as far as we choose to go.

Higher-order derivatives

Definition

The order of a derivative is the number of times ff has been differentiated. Beyond the third, prime marks become impractical to count, so the derivative of order nn is written f(n)(x)f^{(n)}(x).

In Leibniz notation it is written dnydxn\dfrac{d^ny}{dx^n}.

For a polynomial, we can find the order at which the derivatives vanish, and the degree of every derivative below it, without computing them. The power rule lowers each exponent by one, so the highest power falls by one at every differentiation. Once the degree reaches 00 the derivative is a non-zero constant, and differentiating a constant gives 00, so every derivative beyond that order is 00.

Derivatives of a polynomial vanish

Theorem

If ff is a polynomial of degree mm, then f(m)f^{(m)} is a non-zero constant and

f(n)(x)=0for every n>m.f^{(n)}(x) = 0 \quad \text{for every } n > m.

Below that order, f(n)f^{(n)} has degree mnm - n.

Only the leading term of the polynomial matters. Lower-degree terms reach 00 at earlier orders of differentiation, so they are never the last to vanish.

f(3)f^{(3)} and f3f^3 mean different things

Gotcha

The brackets are part of the notation. f(3)f^{(3)} is the third derivative, whereas f3f^3 means ff cubed.

Example

Find f(4)(x)f^{(4)}(x) for f(x)=x52x3+7xf(x) = x^5 - 2x^3 + 7x, and state the smallest order at which the derivatives become 00.

Solution

We differentiate four times, applying the power rule to each term:

DerivativeExpressionDegree
f(x)f(x)x52x3+7xx^5 - 2x^3 + 7x55
f(x)f'(x)5x46x2+75x^4 - 6x^2 + 744
f(x)f''(x)20x312x20x^3 - 12x33
f(x)f'''(x)60x21260x^2 - 1222
f(4)(x)f^{(4)}(x)120x120x11

So f(4)(x)=120xf^{(4)}(x) = 120x, and the degree falls by one at each order, as the power rule requires.

The order at which the derivatives vanish follows from the degree alone. The polynomial has degree 55, so the derivative of order 55 has degree 00:

f(5)(x)=120,f^{(5)}(x) = 120,

a non-zero constant. Differentiating it gives f(6)(x)=0f^{(6)}(x) = 0, and every derivative beyond the sixth is 00 as well. The smallest such order is 66, which the degree tells us directly, without computing the table above.

Practice questions

4 questions

For y=2x4x2+5y = 2x^4 - x^2 + 5, find d3ydx3\dfrac{d^3y}{dx^3}.

Select the correct answer:

+ 3 more questions