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

Example 29: Derivative of xsin⁡xx^{\sin x}⁠, x>0x>0

ExamplesLogarithmic differentiation · Section 5.5
The question

Differentiate xsin⁡xx^{\sin x}⁠, x>0x > 0 w.r.t. xx⁠.

Exam answer

Let y=xsin⁡xy = x^{\sin x}⁠, x>0x > 0⁠. Taking log on both sides,

log⁡y=sin⁡x⋅log⁡x\log y = \sin x\cdot\log x

Differentiating both sides w.r.t. xx⁠,

1y⋅dydx=sin⁡x⋅1x+log⁡x⋅cos⁡x\frac1y\cdot\frac{dy}{dx} = \sin x\cdot\frac1x + \log x\cdot\cos x ⇒ dydx=y[sin⁡xx+cos⁡xlog⁡x]\Rightarrow\ \frac{dy}{dx} = y\left[\frac{\sin x}{x} + \cos x\log x\right]

∴ dydx=xsin⁡x[sin⁡xx\therefore\ \dfrac{dy}{dx} = x^{\sin x}\Big[\dfrac{\sin x}{x} +cos⁡xlog⁡x]+ \cos x\log x\Big] (x>0)(x > 0)⁠.

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

The one idea this problem is built on

Here both the base and the exponent change with xx⁠. The power rule needs a fixed exponent; the rule for axa^x needs a fixed base. Neither fits. Taking logs turns the power into a product, log⁡y=sin⁡x⋅log⁡x\log y = \sin x\cdot\log x⁠, which the product rule handles. Then multiply back by yy⁠.

Given, to find, and the plan
Given
y=xsin⁡xy = x^{\sin x} for x>0x > 0⁠.
To find
dydx\frac{dy}{dx}⁠.
Plan
(1) Check y>0y > 0 and take logs. (2) Differentiate: chain rule on the left, product rule on the right. (3) Multiply by yy⁠. (4) Expand the answer and interpret it.

Basics you need

1Powers with a variable exponent

For x>0x > 0⁠, xsin⁡xx^{\sin x} means esin⁡xlog⁡xe^{\sin x\log x} (as x=elog⁡xx = e^{\log x}⁠, Example 25). It is always positive. Basics: exponentials and logarithms

2Product rule

(uv)′=u′v+uv′(uv)' = u'v + uv' (Leibnitz or product rule, Section 5.3). Basics: derivative rules

3Logarithmic differentiation

For y=[u(x)]v(x)y = [u(x)]^{v(x)} with u>0u > 0⁠: log⁡y=vlog⁡u\log y = v\log u⁠; differentiate both sides; the left side gives 1ydydx\frac1y\frac{dy}{dx} (Section 5.5). Basics: solving for dy/dx

Solution

  1. Take logarithms (allowed because y>0y > 0⁠)

    Let y=xsin⁡xy = x^{\sin x}⁠. For x>0x > 0 the base is positive, so y=esin⁡xlog⁡x>0y = e^{\sin x\log x} > 0 and log⁡y\log y exists. By the power law for logs,

    log⁡y=sin⁡x⋅log⁡x.\log y = \sin x\cdot\log x.
    This is why the question says x>0x > 0⁠. For x≤0x \le 0⁠, log⁡x\log x is undefined and a power like (−2)sin⁡(−2)=(−2)−0.909…(-2)^{\sin(-2)} = (-2)^{-0.909\ldots} has no real value. The book's general remark for y=[u(x)]v(x)y = [u(x)]^{v(x)} is that u(x)u(x) and f(x)f(x) must be positive; here u(x)=x>0u(x) = x > 0⁠.
    log⁡pn=nlog⁡p\log p^n = n\log p with p=x>0p = x > 0 and n=sin⁡xn = \sin x (Section 5.4). Basics: exponentials and logarithms
  2. Differentiate both sides with respect to xx

    Left (chain rule, outer log⁡\log⁠, inner yy⁠): 1y⋅dydx\frac1y\cdot\frac{dy}{dx}⁠. Right: a product of u=sin⁡xu = \sin x and v=log⁡xv = \log x⁠, so by the product rule

    1y⋅dydx=sin⁡x⋅ddx(log⁡x)+log⁡x⋅ddx(sin⁡x)=sin⁡x⋅1x+log⁡x⋅cos⁡x.\begin{aligned} \frac1y\cdot\frac{dy}{dx} &= \sin x\cdot\frac{d}{dx}(\log x) \\ &\quad + \log x\cdot\frac{d}{dx}(\sin x) \\ &= \sin x\cdot\frac1x + \log x\cdot\cos x. \end{aligned}
    Both factors sin⁡x\sin x and log⁡x\log x change with xx⁠, so the product rule is needed: differentiate one factor at a time, keeping the other, and add. The derivatives are 1x\frac1x (Theorem 5) and cos⁡x\cos x (Table 5.3).
    Product rule (Section 5.3); ddxlog⁡x=1x\frac{d}{dx}\log x = \frac1x (Theorem 5). Lesson: logarithmic differentiation
  3. Multiply by yy

    dydx=y[sin⁡xx+cos⁡xlog⁡x]=xsin⁡x[sin⁡xx+cos⁡xlog⁡x].\begin{aligned} \frac{dy}{dx} &= y\left[\frac{\sin x}{x} + \cos x\log x\right] \\ &= x^{\sin x}\left[\frac{\sin x}{x} + \cos x\log x\right]. \end{aligned}
    Multiplying both sides by yy isolates dydx\frac{dy}{dx}⁠, and replacing yy by xsin⁡xx^{\sin x} puts the answer in xx alone.
    Rearranging; y≠0y \ne 0⁠. Basics: solving for dy/dx
  4. Expand, and see the two parts

    Multiply out the bracket, using xsin⁡xx=xsin⁡x−1\frac{x^{\sin x}}{x} = x^{\sin x - 1}⁠:

    dydx=xsin⁡x−1⋅sin⁡x+xsin⁡x⋅cos⁡xlog⁡x.\frac{dy}{dx} = x^{\sin x - 1}\cdot\sin x + x^{\sin x}\cdot\cos x\log x.

    The two terms have a clear meaning:

    • sin⁡x⋅xsin⁡x−1\sin x\cdot x^{\sin x - 1} is what the power rule would give if the exponent sin⁡x\sin x were frozen;
    • xsin⁡xlog⁡x⋅cos⁡xx^{\sin x}\log x\cdot\cos x is what the axa^x rule (Example 28) with the chain rule would give if the base xx were frozen.
    When both base and exponent vary, the total rate of change is the sum of the two "one at a time" rates. This is the product rule at work behind the scenes, and it is a quick way to check any answer of this type.
    Index law xmx=xm−1\frac{x^m}{x} = x^{m-1} for x>0x > 0⁠. Basics: exponentials and logarithms
  5. See it on the graph

    x y π/2 π 3π/2 2π 1 2 (π/2, π/2): slope 1 (π, 1): slope −log π ≈ −1.145 y = x^(sin x) open dot: x = 0 not in domain
    y=xsin⁡xy = x^{\sin x} for 0<x≤2π0 < x \le 2\pi⁠, equal scales. At x=π2x = \frac{\pi}{2}⁠: y=π2y = \frac{\pi}{2} and the slope is π2[1π/2+0]=1\frac{\pi}{2}\left[\frac{1}{\pi/2} + 0\right] = 1⁠. At x=πx = \pi⁠: y=π0=1y = \pi^0 = 1 and the slope is 1⋅[0+(−1)log⁡π]1\cdot[0 + (-1)\log\pi] =−log⁡π≈−1.145= -\log\pi \approx -1.145⁠.
    These two points are good tests because one term of the bracket vanishes at each: at π2\frac{\pi}{2}⁠, cos⁡x=0\cos x = 0⁠; at π\pi⁠, sin⁡x=0\sin x = 0⁠. Near 00 the function tends to 11 (open dot), since sin⁡xlog⁡x→0\sin x\log x \to 0⁠, but x=0x = 0 itself is not in the domain.
    The derivative at a point is the slope of the tangent there. Basics: slope at a point
Result

For x>0x > 0⁠,

ddx(xsin⁡x)=xsin⁡x[sin⁡xx+cos⁡xlog⁡x]=xsin⁡x−1sin⁡x+xsin⁡xcos⁡xlog⁡x.\begin{aligned} &\frac{d}{dx}\left(x^{\sin x}\right) \\ &= x^{\sin x}\left[\frac{\sin x}{x} + \cos x\log x\right] \\ &= x^{\sin x - 1}\sin x \\ &\quad + x^{\sin x}\cos x\log x. \end{aligned}

(Both forms are the book's.)

Check it with numbers

At x=2x = 2⁠: sin⁡2=0.9092974\sin 2 = 0.9092974⁠, cos⁡2=−0.4161468\cos 2 = -0.4161468⁠, log⁡2=0.6931472\log 2 = 0.6931472⁠, 2sin⁡2=1.87813072^{\sin 2} = 1.8781307⁠. The formula gives

1.8781307[0.4546487−0.2884510]=0.3121410…\begin{aligned} &1.8781307\left[0.4546487 - 0.2884510\right] \\ &= 0.3121410\ldots \end{aligned}

The central difference quotient with h=0.0001h = 0.0001 gives 0.31214100.3121410⁠. At x=π2x = \frac{\pi}{2} the formula gives exactly 11⁠, and the difference quotient 1.00000001.0000000⁠.

Common mistakes
  1. Power rule: sin⁡x⋅xsin⁡x−1\sin x\cdot x^{\sin x - 1} alone. That treats the exponent as constant and misses the second term.
  2. Exponential rule: xsin⁡xlog⁡x⋅cos⁡xx^{\sin x}\log x\cdot\cos x alone. That treats the base as constant and misses the first term.
  3. Product rule slips on sin⁡xlog⁡x\sin x\log x⁠: both terms are needed.
  4. Forgetting to multiply by yy at the end, giving only the bracket.
What to take away
  1. For y=uvy = u^v with u>0u > 0⁠: log⁡y=vlog⁡u\log y = v\log u⁠, so dydx=uv[vuu′+v′log⁡u]\frac{dy}{dx} = u^v\left[\frac{v}{u}u' + v'\log u\right] (the book's formula at the start of Section 5.5).
  2. Here u=xu = x⁠, v=sin⁡xv = \sin x⁠: vuu′=sin⁡xx\frac{v}{u}u' = \frac{\sin x}{x} and v′log⁡u=cos⁡xlog⁡xv'\log u = \cos x\log x⁠.
  3. Answer = (power-rule part) + (exponential part).

Every fact used, and where it comes from

FactUsed inSource
Logarithmic differentiation of [u(x)]v(x)[u(x)]^{v(x)}⁠, u>0u > 0Steps 1–3Section 5.5 (Lesson: logarithmic differentiation)
log⁡pn=nlog⁡p\log p^n = n\log pStep 1Section 5.4
Product ruleStep 2Algebra of derivatives (2), Section 5.3
ddxlog⁡x=1x\frac{d}{dx}\log x = \frac1x⁠; ddxsin⁡x=cos⁡x\frac{d}{dx}\sin x = \cos xStep 2Theorem 5, Section 5.4; Table 5.3
Chain rule for log⁡y\log yStep 2Theorem 4, Section 5.3.1
ddxax=axlog⁡a\frac{d}{dx}a^x = a^x\log aStep 4Example 28
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 →