Class 12 Maths, Worked in Full Past papersGet updates
Chapter 5 · Continuity and Differentiability

Exercise 5.7 · Q3: Second derivative of xcos⁡xx\cos x

Exercise 5.7Second order derivative · Section 5.7
The question

Find the second order derivatives of the functions given in Exercises 1 to 10.

3. x⋅cos⁡xx \cdot \cos x

Exam answer

Let y=xcos⁡xy = x\cos x⁠. By the product rule,

dydx=cos⁡x−xsin⁡x,d2ydx2=−sin⁡x−(sin⁡x+xcos⁡x)\begin{aligned} \frac{dy}{dx} &= \cos x - x\sin x, \\ \frac{d^2y}{dx^2} &= -\sin x - (\sin x + x\cos x) \end{aligned}

∴ d2ydx2=−xcos⁡x−2sin⁡x\therefore\ \dfrac{d^2y}{dx^2} = -x\cos x - 2\sin x

Want the reason behind every step, the basics and the checks?

The one idea this problem is built on

xcos⁡xx\cos x is a product of two functions, so its derivative needs the product rule (uv)′=u′v+uv′(uv)' = u'v + uv'⁠. The first derivative contains another product, xsin⁡xx\sin x⁠, so the product rule is needed a second time. Done carefully, two sin⁡x\sin x terms appear and combine.

Given, to find, and the plan
Given
y=xcos⁡xy = x\cos x⁠, defined and differentiable for every real xx (xx in radians).
To find
d2ydx2\dfrac{d^2y}{dx^2}⁠.
Plan
(1) State the domain. (2) Product rule for dydx\frac{dy}{dx}⁠. (3) Differentiate dydx\frac{dy}{dx}⁠: difference rule, then the product rule on xsin⁡xx\sin x⁠. (4) Collect like terms.

Basics you need

1Product rule (Leibnitz rule)

(uv)′=u′v+uv′(uv)' = u'v + uv' (Section 5.3, rule (2)): derivative of the first times the second, plus the first times the derivative of the second. Basics: derivative rules

2Derivatives of sin⁡x\sin x and cos⁡x\cos x

ddxsin⁡x=cos⁡x\frac{d}{dx}\sin x = \cos x and ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin x (Table 5.3; xx measured in radians). Watch the minus sign on the second one. Basics: trigonometric identities

3Sum and difference rule

(u±v)′=u′±v′(u \pm v)' = u' \pm v' (Section 5.3, rule (1)).

4Second order derivative (Section 5.7)

d2ydx2=ddx(dydx)\frac{d^2y}{dx^2} = \frac{d}{dx}\left(\frac{dy}{dx}\right)⁠. Lesson: second order derivative

Solution

  1. Name the function and its domain

    Let y=xcos⁡xy = x\cos x⁠. Both xx and cos⁡x\cos x are defined and differentiable for every real xx⁠, so their product is too, and so are all the derivatives below. The answer holds for every x∈Rx \in \mathbf{R}⁠.

    The product of two differentiable functions is differentiable (that is what the product rule says), so nothing needs to be excluded.
  2. First derivative: product rule

    Take u=xu = x and v=cos⁡xv = \cos x⁠, so u′=1u' = 1 and v′=−sin⁡xv' = -\sin x⁠. Then

    dydx=u′v+uv′=1⋅cos⁡x+x⋅(−sin⁡x)=cos⁡x−xsin⁡x.\begin{aligned} \frac{dy}{dx} &= u'v + uv' \\ &= 1\cdot\cos x + x\cdot(-\sin x) \\ &= \cos x - x\sin x. \end{aligned}
    yy is a product, and the derivative of a product is not the product of the derivatives. The product rule differentiates one factor at a time while the other is held as it is.
    Product rule (Section 5.3, rule (2)); ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin x (Table 5.3).
  3. Second derivative: difference rule first

    Differentiate dydx=cos⁡x−xsin⁡x\frac{dy}{dx} = \cos x - x\sin x term by term:

    d2ydx2=ddx(cos⁡x)−ddx(xsin⁡x).\frac{d^2y}{dx^2} = \frac{d}{dx}(\cos x) - \frac{d}{dx}(x\sin x).

    The first piece is ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin x⁠. The second piece is again a product, handled in Step 4.

    The second derivative is the derivative of the expression found in Step 2. It is a difference of two terms, so the difference rule splits the work into two smaller derivatives.
    Difference rule (Section 5.3, rule (1)).
  4. Product rule on xsin⁡xx\sin x

    Take u=xu = x⁠, v=sin⁡xv = \sin x⁠, so u′=1u' = 1 and v′=cos⁡xv' = \cos x⁠:

    ddx(xsin⁡x)=1⋅sin⁡x+xcos⁡x=sin⁡x+xcos⁡x.\begin{aligned} \frac{d}{dx}(x\sin x) &= 1\cdot\sin x + x\cos x \\ &= \sin x + x\cos x. \end{aligned}
    xsin⁡xx\sin x is a product of two functions of xx⁠, so the product rule applies exactly as in Step 2.
    ddxsin⁡x=cos⁡x\frac{d}{dx}\sin x = \cos x (Table 5.3).
  5. Put the pieces together and simplify

    d2ydx2=−sin⁡x−(sin⁡x+xcos⁡x)=−sin⁡x−sin⁡x−xcos⁡x=−xcos⁡x−2sin⁡x.\begin{aligned} \frac{d^2y}{dx^2} &= -\sin x - (\sin x + x\cos x) \\ &= -\sin x - \sin x - x\cos x \\ &= -x\cos x - 2\sin x. \end{aligned}

    So d2ydx2=−xcos⁡x−2sin⁡x\dfrac{d^2y}{dx^2} = -x\cos x - 2\sin x for every real xx⁠.

    The minus sign in front of the bracket applies to both terms inside it; that is where most errors happen. The two −sin⁡x-\sin x terms are like terms and add to −2sin⁡x-2\sin x⁠.
    −(p+q)=−p−q-(p + q) = -p - q⁠.
Result

For y=xcos⁡xy = x\cos x (all real xx⁠):

dydx=cos⁡x−xsin⁡x,d2ydx2=−xcos⁡x−2sin⁡x.\begin{aligned} \frac{dy}{dx} &= \cos x - x\sin x, \\ \frac{d^2y}{dx^2} &= -x\cos x - 2\sin x. \end{aligned}

(Textbook answer: −xcos⁡x−2sin⁡x-x\cos x - 2\sin x⁠.)

Check it with numbers

At x=1x = 1 (radian): cos⁡1≈0.5403023\cos 1 \approx 0.5403023⁠, sin⁡1≈0.8414710\sin 1 \approx 0.8414710⁠.

  • Formula: y′′=−0.5403023−2(0.8414710)y'' = -0.5403023 - 2(0.8414710)⁠, which is about −2.2232443-2.2232443⁠.
  • Second difference with h=0.001h = 0.001⁠: y(1.001)−2y(1)+y(0.999)0.000001\frac{y(1.001) - 2y(1) + y(0.999)}{0.000001} is about −2.2232439-2.2232439⁠.
  • First derivative: cos⁡1−sin⁡1≈−0.3011687\cos 1 - \sin 1 \approx -0.3011687⁠; the central difference y(1.001)−y(0.999)0.002\frac{y(1.001) - y(0.999)}{0.002} is about −0.3011688-0.3011688⁠.

Both agree to six decimal places. ✓

Common mistakes
  1. "Derivative of a product = product of derivatives": 1⋅(−sin⁡x)=−sin⁡x1 \cdot (-\sin x) = -\sin x is not dydx\frac{dy}{dx}⁠.
  2. Sign of ddxcos⁡x\frac{d}{dx}\cos x⁠: it is −sin⁡x-\sin x⁠, not sin⁡x\sin x⁠.
  3. Dropping the bracket in Step 5: writing −sin⁡x−sin⁡x+xcos⁡x-\sin x - \sin x + x\cos x changes the sign of the last term.
What to take away
  1. When the first derivative still contains a product, the product rule is needed again for the second derivative.
  2. Keep the subtracted part in brackets until the end, then expand and collect like terms.

Every fact used, and where it comes from

FactUsed inSource
(uv)′=u′v+uv′(uv)' = u'v + uv'Steps 2, 4Section 5.3, rule (2) (Leibnitz or product rule)
(u±v)′=u′±v′(u \pm v)' = u' \pm v'Step 3Section 5.3, rule (1)
ddxsin⁡x=cos⁡x\frac{d}{dx}\sin x = \cos x⁠, ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin x⁠, ddxx=1\frac{d}{dx}x = 1Steps 2–4Table 5.3, Section 5.3 (Basics: derivative rules)
d2ydx2=ddx(dydx)\frac{d^2y}{dx^2} = \frac{d}{dx}\left(\frac{dy}{dx}\right)Step 3Section 5.7 (Lesson: second order derivative)
Found an error, or want more?

Tell us if something on this page is wrong or unclear, or if you would like a fuller explanation, another method or a new feature. Send feedback on this problem →