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

Exercise 5.5 · Q9: Differentiate xsin⁡x+(sin⁡x)cos⁡xx^{\sin x}+(\sin x)^{\cos x}

Exercise 5.5Logarithmic differentiation · Section 5.5
The question

Differentiate the function w.r.t. xx⁠:

xsin⁡x+(sin⁡x)cos⁡xx^{\sin x} + (\sin x)^{\cos x}
Exam answer

Let y=u+vy = u + v⁠, where u=xsin⁡xu = x^{\sin x} and v=(sin⁡x)cos⁡xv = (\sin x)^{\cos x}⁠. Then dydx=dudx+dvdx\frac{dy}{dx} = \frac{du}{dx} + \frac{dv}{dx}⁠.

Taking log on both sides of u=xsin⁡xu = x^{\sin x}⁠,

log⁡u=sin⁡xlog⁡x\log u = \sin x\log x

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

1ududx=cos⁡xlog⁡x+sin⁡xx∴ dudx=xsin⁡x[sin⁡xx+cos⁡xlog⁡x]\begin{aligned} \frac1u\frac{du}{dx} &= \cos x\log x + \frac{\sin x}{x} \\ \therefore\ \frac{du}{dx} &= x^{\sin x}\bigg[\frac{\sin x}{x} \\ &\qquad + \cos x\log x\bigg] \end{aligned}

Taking log on both sides of v=(sin⁡x)cos⁡xv = (\sin x)^{\cos x}⁠,

log⁡v=cos⁡xlog⁡sin⁡x\log v = \cos x\log\sin x

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

1vdvdx=−sin⁡xlog⁡sin⁡x+cos⁡x⋅cos⁡xsin⁡x=cos⁡xcot⁡x−sin⁡xlog⁡sin⁡x∴ dvdx=(sin⁡x)cos⁡x×[cos⁡xcot⁡x−sin⁡xlog⁡sin⁡x]\begin{aligned} \frac1v\frac{dv}{dx} &= -\sin x\log\sin x \\ &\qquad + \cos x\cdot\frac{\cos x}{\sin x} \\ &= \cos x\cot x \\ &\qquad - \sin x\log\sin x \\ \therefore\ \frac{dv}{dx} &= (\sin x)^{\cos x} \\ &\quad\times\big[\cos x\cot x \\ &\qquad - \sin x\log\sin x\big] \end{aligned}

Hence, for x>0x > 0⁠, sin⁡x>0\sin x > 0⁠, dydx=xsin⁡x[sin⁡xx+cos⁡xlog⁡x]+(sin⁡x)cos⁡x[cos⁡xcot⁡x−sin⁡xlog⁡sin⁡x]\begin{aligned} \dfrac{dy}{dx} &= x^{\sin x}\bigg[\dfrac{\sin x}{x} + \cos x\log x\bigg] \\ &\quad + (\sin x)^{\cos x}\big[\cos x\cot x \\ &\qquad - \sin x\log\sin x\big] \end{aligned}

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

The one idea this problem is built on

Both terms are powers with a variable base and a variable exponent, added together. The log of a sum does not split, so we use the sum rule and log-differentiate each term on its own. The first term is Example 29. Each base must be positive: x>0x > 0 for the first and sin⁡x>0\sin x > 0 for the second, so the function lives on the intervals (2nπ,(2n+1)π)(2n\pi, (2n+1)\pi)⁠, n=0,1,2,…n = 0, 1, 2, \ldots

Given, to find, and the plan
Given
y=u+vy = u + v⁠, with u=xsin⁡xu = x^{\sin x} and v=(sin⁡x)cos⁡xv = (\sin x)^{\cos x}⁠.
To find
dydx\frac{dy}{dx}⁠, and where it holds.
Plan
(1) Domain: both bases positive. (2) u′u' via log⁡u=sin⁡xlog⁡x\log u = \sin x\log x⁠. (3) v′v' via log⁡v=cos⁡xlog⁡sin⁡x\log v = \cos x\log\sin x⁠. (4) Add.

Basics you need

1Variable powers need a positive base

For p>0p > 0⁠: pq=eqlog⁡p>0p^q = e^{q\log p} > 0 and log⁡pq=qlog⁡p\log p^q = q\log p (Example 25, Section 5.4). Basics: exponentials and logarithms

2Where sin⁡x>0\sin x > 0

sin⁡x>0\sin x > 0 exactly when 2nπ<x<(2n+1)π2n\pi < x < (2n+1)\pi for an integer nn (the upper half of the unit circle, repeated every 2π2\pi⁠). Basics: trigonometric identities

3Sum rule, product rule, chain rule

(u+v)′=u′+v′(u + v)' = u' + v'⁠, (fg)′=f′g+fg′(fg)' = f'g + fg' (Section 5.3); ddxlog⁡sin⁡x=cos⁡xsin⁡x=cot⁡x\frac{d}{dx}\log\sin x = \frac{\cos x}{\sin x} = \cot x for sin⁡x>0\sin x > 0 (Theorems 4 and 5). Basics: derivative rules

Solution

  1. Domain: x>0x > 0 and sin⁡x>0\sin x > 0

    u=xsin⁡xu = x^{\sin x} needs its base positive: x>0x > 0⁠. v=(sin⁡x)cos⁡xv = (\sin x)^{\cos x} needs sin⁡x>0\sin x > 0⁠. Both together:

    x∈(2nπ, (2n+1)π),n=0,1,2,…x \in (2n\pi,\ (2n+1)\pi), \quad n = 0, 1, 2, \ldots
    sin x > 0 sin x > 0 sin x > 0 sin x ≤ 0 sin x ≤ 0 0 π 2π 3π 4π 5π …
    The domain (green) for 0<x<5π0 < x < 5\pi⁠: the intervals (0,π)(0, \pi)⁠, (2π,3π)(2\pi, 3\pi)⁠, (4π,5π)(4\pi, 5\pi)⁠, and so on to the right (34 px per unit). The endpoints are excluded: 00 because the base xx must be positive, the multiples of π\pi because sin⁡x=0\sin x = 0 there.
    The book requires the base of each power to be positive for logarithmic differentiation (Section 5.5). Negative xx are excluded by the first term even where sin⁡x>0\sin x > 0⁠; the gaps [(2n−1)π,2nπ][(2n-1)\pi, 2n\pi] are excluded by the second. For example, at x=3π2x = \frac{3\pi}{2}⁠, v=(−1)0=1v = (-1)^0 = 1 happens to be defined, but at x=5π3x = \frac{5\pi}{3}⁠, where sin⁡x=−32\sin x = -\frac{\sqrt3}{2} and cos⁡x=12\cos x = \frac12⁠, vv would be the square root of a negative number, which is not real. The answer key does not state the domain.
    Sign of sin⁡x\sin x on each quarter-turn. Basics: trigonometric identities
  2. Split with the sum rule

    dydx=dudx+dvdx\frac{dy}{dx} = \frac{du}{dx} + \frac{dv}{dx}⁠.

    We cannot take log⁡(u+v)\log(u + v) apart, so each term is handled separately; each is a positive power on the domain.
    (u+v)′=u′+v′(u + v)' = u' + v' (Section 5.3). Basics: derivative rules
  3. u=xsin⁡xu = x^{\sin x}

    log⁡u=sin⁡x⋅log⁡x\log u = \sin x\cdot\log x⁠. Product rule:

    1u⋅dudx=cos⁡x⋅log⁡x+sin⁡x⋅1x,\frac1u\cdot\frac{du}{dx} = \cos x\cdot\log x + \sin x\cdot\frac1x,

    so

    dudx=xsin⁡x[sin⁡xx+cos⁡xlog⁡x].\frac{du}{dx} = x^{\sin x}\left[\frac{\sin x}{x} + \cos x\log x\right].
    This is exactly Example 29 (valid for all x>0x > 0⁠). The two terms in the bracket come from differentiating log⁡x\log x (giving 1x\frac1x⁠) and sin⁡x\sin x (giving cos⁡x\cos x⁠) in turn.
    Product rule; ddxlog⁡x=1x\frac{d}{dx}\log x = \frac1x (Theorem 5). Lesson: logarithmic differentiation
  4. v=(sin⁡x)cos⁡xv = (\sin x)^{\cos x}

    log⁡v=cos⁡x⋅log⁡sin⁡x\log v = \cos x\cdot\log\sin x⁠. Product rule, with ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin x and ddxlog⁡sin⁡x=cos⁡xsin⁡x\frac{d}{dx}\log\sin x = \frac{\cos x}{\sin x} (chain rule, inner sin⁡x>0\sin x > 0⁠):

    1v⋅dvdx=−sin⁡x⋅log⁡sin⁡x+cos⁡x⋅cos⁡xsin⁡x=cos⁡xcot⁡x−sin⁡xlog⁡sin⁡x.\begin{aligned} \frac1v\cdot\frac{dv}{dx} &= -\sin x\cdot\log\sin x + \cos x\cdot\frac{\cos x}{\sin x} \\ &= \cos x\cot x - \sin x\log\sin x. \end{aligned}

    So

    dvdx= (sin⁡x)cos⁡x×[cos⁡xcot⁡x−sin⁡xlog⁡sin⁡x].\begin{aligned} \frac{dv}{dx} = \ &(\sin x)^{\cos x} \\ &\times\left[\cos x\cot x - \sin x\log\sin x\right]. \end{aligned}
    cos⁡x⋅cos⁡xsin⁡x=cos⁡xcot⁡x\cos x\cdot\frac{\cos x}{\sin x} = \cos x\cot x (it could also be written cos⁡2xsin⁡x\frac{\cos^2 x}{\sin x}⁠). The terms are ordered as in the textbook's answer. Multiplying by vv (positive) isolates dvdx\frac{dv}{dx}⁠.
    Chain rule (Theorem 4); ddxsin⁡x=cos⁡x\frac{d}{dx}\sin x = \cos x⁠, ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin x (Table 5.3). Lesson: the chain rule
  5. Add

    For x>0x > 0 with sin⁡x>0\sin x > 0⁠:

    dydx= xsin⁡x[sin⁡xx+cos⁡xlog⁡x]+(sin⁡x)cos⁡x×[cos⁡xcot⁡x−sin⁡xlog⁡sin⁡x].\begin{aligned} \frac{dy}{dx} = \ &x^{\sin x}\left[\frac{\sin x}{x} + \cos x\log x\right] \\ &+ (\sin x)^{\cos x} \\ &\quad\times\left[\cos x\cot x - \sin x\log\sin x\right]. \end{aligned}
    This is u′+v′u' + v'⁠, and it is exactly the textbook's answer.
    Sum rule (Section 5.3). Basics: derivative rules
Result

For x∈(2nπ,(2n+1)π)x \in (2n\pi, (2n+1)\pi)⁠, n=0,1,2,…n = 0, 1, 2, \ldots⁠,

dydx= xsin⁡x[sin⁡xx+cos⁡xlog⁡x]+(sin⁡x)cos⁡x×[cos⁡xcot⁡x−sin⁡xlog⁡sin⁡x].\begin{aligned} \frac{dy}{dx} = \ &x^{\sin x}\left[\frac{\sin x}{x} + \cos x\log x\right] \\ &+ (\sin x)^{\cos x} \\ &\quad\times\left[\cos x\cot x - \sin x\log\sin x\right]. \end{aligned}

(Textbook answer: the same expression; the key does not state the domain.)

Check it with numbers

At x=π2x = \frac{\pi}{2}⁠: sin⁡x=1\sin x = 1⁠, cos⁡x=0\cos x = 0⁠. Then u′=π2[1π/2+0]=1u' = \frac{\pi}{2}\left[\frac{1}{\pi/2} + 0\right] = 1 and v′=10 [0−1⋅log⁡1]=0v' = 1^0\,[0 - 1\cdot\log 1] = 0⁠. Total 11⁠; the central difference quotient with h=0.0001h = 0.0001 gives 1.00000001.0000000⁠.

At x=1x = 1⁠: sin⁡1=0.8414710\sin 1 = 0.8414710⁠, cos⁡1=0.5403023\cos 1 = 0.5403023⁠. u′=1⋅[0.8414710+0]=0.8414710u' = 1\cdot[0.8414710 + 0] = 0.8414710⁠; v=0.9109583v = 0.9109583 and its bracket is 0.49216520.4921652⁠, so v′=0.4483419v' = 0.4483419⁠. Total 1.28981291.2898129⁠; the difference quotient gives 1.28981291.2898129⁠. In the second piece of the domain, at x=7x = 7 (between 2π≈6.2832\pi \approx 6.283 and 3π≈9.4253\pi \approx 9.425⁠), the formula gives 6.43650686.4365068 and the difference quotient 6.43650686.4365068⁠.

Common mistakes
  1. Taking log⁡\log of the sum instead of splitting.
  2. ddxlog⁡sin⁡x=1sin⁡x\frac{d}{dx}\log\sin x = \frac{1}{\sin x}: the inner derivative cos⁡x\cos x is missing; it is cot⁡x\cot x⁠.
  3. Sign of sin⁡xlog⁡sin⁡x\sin x\log\sin x: it comes from ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin x⁠.
  4. Domain "x>0x > 0" only: the second base also needs sin⁡x>0\sin x > 0⁠.
What to take away
  1. For uvu^v with u>0u > 0⁠: ddxuv=uv[v′log⁡u+vuu′]\frac{d}{dx}u^v = u^v\left[v'\log u + \frac{v}{u}u'\right]⁠.
  2. Second term: u=sin⁡xu = \sin x⁠, v=cos⁡xv = \cos x⁠: v′log⁡u=−sin⁡xlog⁡sin⁡xv'\log u = -\sin x\log\sin x and vuu′=cos⁡xsin⁡xcos⁡x\frac{v}{u}u' = \frac{\cos x}{\sin x}\cos x⁠.
  3. The domain of a sum is the intersection of the terms' domains.

Every fact used, and where it comes from

FactUsed inSource
Positive bases for logarithmic differentiationStep 1Section 5.5 (Lesson: logarithmic differentiation)
sin⁡x>0\sin x > 0 on (2nπ,(2n+1)π)(2n\pi, (2n+1)\pi)Step 1Trigonometric functions (Class XI)
Sum rule, product ruleSteps 2, 3, 4, 5Algebra of derivatives (1), (2), Section 5.3
log⁡pn=nlog⁡p\log p^n = n\log pSteps 3, 4Section 5.4
ddxxsin⁡x\frac{d}{dx}x^{\sin x}Step 3Example 29
ddxlog⁡x=1x\frac{d}{dx}\log x = \frac1x⁠; chain ruleSteps 3, 4Theorem 5, Section 5.4; Theorem 4, Section 5.3.1
ddxsin⁡x=cos⁡x\frac{d}{dx}\sin x = \cos x⁠, ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin xStep 4Table 5.3
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 →