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

Example 21: Derivative of sin⁡(x2)\sin(x^2) by the chain rule

ExamplesChain rule · Section 5.3.1
The question

Find the derivative of the function given by f(x)=sin⁡(x2)f(x) = \sin(x^2)⁠.

Exam answer

Let y=sin⁡(x2)y = \sin(x^2)⁠. By the chain rule,

dydx=cos⁡(x2)⋅ddx(x2)=cos⁡(x2)⋅2x\begin{aligned} \frac{dy}{dx} &= \cos(x^2)\cdot\frac{d}{dx}(x^2) \\ &= \cos(x^2)\cdot 2x \end{aligned}

∴ dydx=2xcos⁡(x2)\therefore\ \dfrac{dy}{dx} = 2x\cos(x^2)⁠.

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

The one idea this problem is built on

sin⁡(x2)\sin(x^2) is a function inside another function: first square xx⁠, then take the sine of the result. The chain rule says the rate of change of such a composite is the product of the two separate rates: the rate of the outer function (sine) at the inner value, times the rate of the inner function (squaring). So the answer is cos⁡(x2)\cos(x^2) times 2x2x⁠.

Given, to find, and the plan
Given
f(x)=sin⁡(x2)f(x) = \sin(x^2) for every real xx⁠.
To find
f′(x)=dfdxf'(x) = \dfrac{df}{dx}⁠.
Plan
(1) Split ff into an inner function t=u(x)=x2t = u(x) = x^2 and an outer function v(t)=sin⁡tv(t) = \sin t⁠. (2) Differentiate each one separately. (3) Multiply the two derivatives (chain rule). (4) Write the answer in terms of xx only.

Basics you need

1Composite functions

v∘uv \circ u means "do uu first, then vv": (v∘u)(x)=v(u(x))(v\circ u)(x) = v(u(x))⁠. The order matters: squaring then taking sine is not the same as taking sine then squaring. Basics: composite functions

2Two standard derivatives

From Table 5.3: ddx(xn)=nxn−1\dfrac{d}{dx}(x^n) = nx^{n-1}⁠, so ddx(x2)=2x\dfrac{d}{dx}(x^2) = 2x⁠; and ddt(sin⁡t)=cos⁡t\dfrac{d}{dt}(\sin t) = \cos t⁠. Basics: derivative rules

3The chain rule (Theorem 4)

If f=v∘uf = v\circ u⁠, t=u(x)t = u(x)⁠, and both dtdx\dfrac{dt}{dx} and dvdt\dfrac{dv}{dt} exist, then dfdx=dvdt⋅dtdx\dfrac{df}{dx} = \dfrac{dv}{dt}\cdot\dfrac{dt}{dx}⁠. Basics: slope at a point

Solution

  1. Recognise the composite: name the inner and outer functions

    To compute sin⁡(x2)\sin(x^2) for a given xx⁠, we do two jobs in order: first square xx⁠, then take the sine. Give each job a name:

    t=u(x)=x2  (inner),v(t)=sin⁡t  (outer).\begin{gathered} t = u(x) = x^2 \ \ (\text{inner}), \\ v(t) = \sin t \ \ (\text{outer}). \end{gathered}

    Then v(u(x))=v(x2)=sin⁡(x2)=f(x)v(u(x)) = v(x^2) = \sin(x^2) = f(x)⁠, so f=v∘uf = v \circ u⁠.

    The chain rule only applies once we can see a function as "outer applied to inner". The test for which is inner: it is the job done first when you evaluate. With x=3x = 3⁠: first 32=93^2 = 9⁠, then sin⁡9\sin 9⁠. So squaring is inner and sine is outer.
    sin⁡(x2)\sin(x^2) (often printed sin⁡x2\sin x^2⁠) is different from sin⁡2x=(sin⁡x)2\sin^2 x = (\sin x)^2⁠. The second one is u∘vu\circ v⁠: sine first, then square. Example: at x=πx = \pi⁠, sin⁡(π2)≈−0.4303\sin(\pi^2) \approx -0.4303 but (sin⁡π)2=0(\sin\pi)^2 = 0⁠. Basics: composite functions
  2. Differentiate each piece separately

    Inner: by the power rule with n=2n = 2⁠,

    dtdx=ddx(x2)=2x2−1=2x.\frac{dt}{dx} = \frac{d}{dx}(x^2) = 2x^{2-1} = 2x.

    Outer, as a function of its own variable tt⁠:

    dvdt=ddt(sin⁡t)=cos⁡t.\frac{dv}{dt} = \frac{d}{dt}(\sin t) = \cos t.

    Both derivatives exist for every real xx and every real tt⁠, so the conditions of the chain rule hold everywhere.

    Theorem 4 asks for two things before it may be used: dtdx\frac{dt}{dx} and dvdt\frac{dv}{dt} must exist. Checking them is part of the solution, not a formality. Here both functions are differentiable on all of R\R⁠, so there are no exceptional points.
    Power rule ddxxn=nxn−1\frac{d}{dx}x^n = nx^{n-1} and ddtsin⁡t=cos⁡t\frac{d}{dt}\sin t = \cos t⁠, both from Table 5.3 (Section 5.3). Basics: derivative rules
  3. Multiply the two rates (chain rule)

    dfdx=dvdt⋅dtdx=cos⁡t⋅2x.\frac{df}{dx} = \frac{dv}{dt}\cdot\frac{dt}{dx} = \cos t \cdot 2x.

    The diagram shows why the rates multiply.

    x t = x² f = sin t inner: square outer: sin rate dt/dx = 2x rate df/dt = cos t overall rate df/dx = (cos t)(2x) = 2x cos(x²) at x = 1: t moves 2 times as fast as x, f moves cos 1 ≈ 0.540 times as fast as t so f moves 2 × 0.540 ≈ 1.081 times as fast as x
    The input passes through two machines. Near x=1x = 1⁠, tt changes about 2 times as fast as xx⁠, and ff changes about cos⁡1≈0.540\cos 1 \approx 0.540 times as fast as tt⁠. So ff changes about 2×0.5402 \times 0.540 times as fast as xx⁠.
    If a small change Δx\Delta x in xx makes tt change by about 2x Δx2x\,\Delta x⁠, and a small change Δt\Delta t makes sin⁡t\sin t change by about cos⁡t Δt\cos t\,\Delta t⁠, then the change in ff is about cos⁡t⋅2x Δx\cos t \cdot 2x\,\Delta x⁠. The two "magnification factors" multiply. That is the content of the chain rule.
    Chain rule: dfdx=dvdt⋅dtdx\frac{df}{dx} = \frac{dv}{dt}\cdot\frac{dt}{dx} (Theorem 4, Section 5.3.1). Lesson: chain rule
  4. Write the answer in terms of xx

    The question is about xx⁠, and tt was only a helper. Put t=x2t = x^2 back:

    dfdx=cos⁡(x2)⋅2x=2xcos⁡(x2),x∈R.\begin{aligned} \frac{df}{dx} &= \cos(x^2)\cdot 2x \\ &= 2x\cos(x^2), \qquad x \in \R. \end{aligned}
    An answer that still contains tt mixes two variables and cannot be evaluated from xx alone. The book calls expressing the final result in xx "normal practice". Writing the factor 2x2x in front avoids the ambiguity of cos⁡(x2) 2x\cos(x^2)\,2x being misread as cos⁡(2x3)\cos(2x^3)⁠.
    Substitution: wherever tt appears, write x2x^2⁠. Keep the brackets: cos⁡(x2)\cos(x^2)⁠, not cos⁡2x\cos^2 x⁠.
Result

ddxsin⁡(x2)=2xcos⁡(x2)\dfrac{d}{dx}\sin(x^2) = 2x\cos(x^2) for every real xx⁠. (The book's solution gets the same: dfdx=cos⁡t⋅2x=2xcos⁡x2\frac{df}{dx} = \cos t\cdot 2x = 2x\cos x^2⁠.)

Check it with numbers

At x=1x = 1 the formula gives 2cos⁡1=1.0806046…2\cos 1 = 1.0806046\ldots⁠. A difference quotient straddling x=1x = 1⁠:

sin⁡(1.0012)−sin⁡(0.9992)0.002≈1.0806022,\begin{aligned} &\frac{\sin(1.001^2) - \sin(0.999^2)}{0.002} \\ &\approx 1.0806022, \end{aligned}

which agrees to five significant figures (the small gap shrinks as the step shrinks). At x=0.5x = 0.5⁠: 2(0.5)cos⁡(0.25)2(0.5)\cos(0.25) =cos⁡0.25=0.9689124…= \cos 0.25 = 0.9689124\ldots⁠. At x=0x = 0 the slope is 00⁠: the graph of sin⁡(x2)\sin(x^2) is flat at the origin, as 2x2x is zero there.

Common mistakes
  1. Forgetting the inner derivative: writing cos⁡(x2)\cos(x^2) alone. The factor 2x2x is the inner rate and must be multiplied in.
  2. Differentiating the inside of the cosine: writing cos⁡(2x)\cos(2x)⁠. The outer derivative is evaluated at the inner value x2x^2⁠; the inner derivative 2x2x multiplies from outside.
  3. Confusing sin⁡(x2)\sin(x^2) with sin⁡2x\sin^2 x⁠. The derivative of sin⁡2x\sin^2 x is 2sin⁡xcos⁡x2\sin x\cos x⁠, a different function.
  4. Leaving tt in the final answer. Always substitute back.
What to take away
  1. For a composite, ask "what is done first?" That is the inner function tt⁠.
  2. Derivative = (derivative of outer, evaluated at tt⁠) ×\times (derivative of inner).
  3. The same pattern gives ddxsin⁡(g(x))=cos⁡(g(x)) g′(x)\frac{d}{dx}\sin(g(x)) = \cos(g(x))\,g'(x) for any differentiable gg⁠, for example Exercise 5.2 Q1.

Every fact used, and where it comes from

FactUsed inSource
Composite (v∘u)(x)=v(u(x))(v\circ u)(x) = v(u(x))Step 1Chapter 1 (composition of functions); Theorem 4, Section 5.3.1
ddxxn=nxn−1\frac{d}{dx}x^n = nx^{n-1}⁠; ddxsin⁡x=cos⁡x\frac{d}{dx}\sin x = \cos xStep 2Table 5.3, Section 5.3 (Lesson: chain rule)
Chain rule dfdx=dvdt⋅dtdx\frac{df}{dx} = \frac{dv}{dt}\cdot\frac{dt}{dx}Step 3Theorem 4 (Chain Rule), Section 5.3.1
All numerical valuesCheckRecomputed in the site's verification script (exact derivative and difference quotients)
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 →