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

Exercise 5.5 · Q4: Differentiate xx−2sin⁡xx^x-2^{\sin x}⁠, x>0x>0

Exercise 5.5Logarithmic differentiation · Section 5.5
The question

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

xx−2sin⁡xx^x - 2^{\sin x}
Exam answer

Let u=xxu = x^x and v=2sin⁡xv = 2^{\sin x}⁠, so y=u−vy = u - v⁠, where x>0x > 0⁠.

Taking log on both sides of u=xxu = x^x⁠, log⁡u=xlog⁡x\log u = x\log x⁠. Differentiating w.r.t. xx⁠,

1u⋅dudx=1⋅log⁡x+x⋅1x=log⁡x+1\begin{aligned} \frac1u\cdot\frac{du}{dx} &= 1\cdot\log x + x\cdot\frac1x \\ &= \log x + 1 \end{aligned} ∴ dudx=xx(1+log⁡x)\therefore\ \frac{du}{dx} = x^x(1 + \log x)

Taking log on both sides of v=2sin⁡xv = 2^{\sin x}⁠, log⁡v=sin⁡xlog⁡2\log v = \sin x\log 2⁠. Differentiating w.r.t. xx⁠,

1v⋅dvdx=cos⁡xlog⁡2\frac1v\cdot\frac{dv}{dx} = \cos x\log 2 ∴ dvdx=2sin⁡xcos⁡xlog⁡2\therefore\ \frac{dv}{dx} = 2^{\sin x}\cos x\log 2

∴ dydx=dudx−dvdx\therefore\ \dfrac{dy}{dx} = \dfrac{du}{dx} - \dfrac{dv}{dx} =xx(1+log⁡x)= x^x(1 + \log x) − 2sin⁡xcos⁡xlog⁡2-\ 2^{\sin x}\cos x\log 2 (x>0)(x > 0)⁠.

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

The one idea this problem is built on

The function is a difference of two terms, and the logarithm of a difference does not split into anything simpler (and the difference can be negative). So we do not take the log of the whole function. Instead we use the difference rule, (u−v)′=u′−v′(u - v)' = u' - v'⁠, and find each derivative separately by logarithmic differentiation: u=xxu = x^x has a variable base and exponent; v=2sin⁡xv = 2^{\sin x} has a constant base and a variable exponent.

Given, to find, and the plan
Given
y=xx−2sin⁡xy = x^x - 2^{\sin x}⁠.
To find
dydx\frac{dy}{dx}⁠, and where it holds.
Plan
(1) Find the domain. (2) Write y=u−vy = u - v⁠. (3) Find u′u' by taking log⁡u\log u⁠. (4) Find v′v' by taking log⁡v\log v⁠. (5) Subtract.

Basics you need

1Variable powers need a positive base

For u>0u > 0⁠, uv=evlog⁡u>0u^v = e^{v\log u} > 0 and log⁡(uv)=vlog⁡u\log(u^v) = v\log u (Example 25, Section 5.4). Basics: exponentials and logarithms

2Sum and difference rule; product rule

(u±v)′=u′±v′(u \pm v)' = u' \pm v' and (uv)′=u′v+uv′(uv)' = u'v + uv' (Section 5.3). Basics: derivative rules

3ddxlog⁡y=1ydydx\frac{d}{dx}\log y = \frac1y\frac{dy}{dx}

The chain rule with outer log⁡\log and inner yy⁠, for y>0y > 0 (Theorems 4 and 5). Basics: composite functions

Solution

  1. Domain: x>0x > 0

    Let y=xx−2sin⁡xy = x^x - 2^{\sin x}⁠. The term xxx^x has a variable exponent, so its base must be positive: x>0x > 0⁠. The term 2sin⁡x2^{\sin x} has the positive base 22⁠, so it is defined for every real xx⁠. Together, the function is defined for x>0x > 0⁠.

    yy itself can be negative: at x=1x = 1⁠, y=1−2sin⁡1y = 1 - 2^{\sin 1} =1−1.7918762=−0.7918762= 1 - 1.7918762 = -0.7918762⁠. So we could not take log⁡y\log y here even if it helped, and it would not help, because log⁡(u−v)\log(u - v) has no rule for splitting. This is why each term is handled on its own.
    xx=exlog⁡xx^x = e^{x\log x} needs x>0x > 0 (Basic 1). Basics: exponentials and logarithms
  2. Split with the difference rule

    Put u=xxu = x^x and v=2sin⁡xv = 2^{\sin x}⁠, so y=u−vy = u - v and

    dydx=dudx−dvdx.\frac{dy}{dx} = \frac{du}{dx} - \frac{dv}{dx}.
    The derivative of a difference is the difference of the derivatives (rule (1) of the algebra of derivatives). Now each piece is a single power, and a single positive power is exactly what logarithmic differentiation handles. Both uu and vv are positive for x>0x > 0⁠.
    (u−v)′=u′−v′(u - v)' = u' - v' (Section 5.3). Basics: derivative rules
  3. u=xxu = x^x⁠: take logs and differentiate

    For x>0x > 0⁠, u>0u > 0 and log⁡u=xlog⁡x\log u = x\log x⁠. Differentiate; the right side is a product (xx times log⁡x\log x⁠):

    1u⋅dudx=1⋅log⁡x+x⋅1x=log⁡x+1.\begin{aligned} \frac1u\cdot\frac{du}{dx} &= 1\cdot\log x + x\cdot\frac1x \\ &= \log x + 1. \end{aligned}

    So

    dudx=u(1+log⁡x)=xx(1+log⁡x).\frac{du}{dx} = u(1 + \log x) = x^x(1 + \log x).
    Neither standard rule fits xxx^x⁠: the power rule nxn−1nx^{n-1} needs a fixed exponent and the axa^x rule needs a fixed base. Taking logs turns the power into the product xlog⁡xx\log x⁠, and the product rule finishes it.
    Product rule; ddxlog⁡x=1x\frac{d}{dx}\log x = \frac1x (Theorem 5). Lesson: logarithmic differentiation
  4. v=2sin⁡xv = 2^{\sin x}⁠: take logs and differentiate

    v>0v > 0 and log⁡v=sin⁡x⋅log⁡2\log v = \sin x\cdot\log 2⁠, where log⁡2\log 2 is a constant. Differentiate:

    1v⋅dvdx=cos⁡x⋅log⁡2,\frac1v\cdot\frac{dv}{dx} = \cos x\cdot\log 2,

    so

    dvdx=2sin⁡xcos⁡xlog⁡2.\frac{dv}{dx} = 2^{\sin x}\cos x\log 2.
    The same result comes from Example 28 (ddt2t=2tlog⁡2\frac{d}{dt}2^t = 2^t\log 2⁠) with the chain rule, outer 2t2^t⁠, inner t=sin⁡xt = \sin x whose derivative is cos⁡x\cos x⁠. The factor log⁡2\log 2 is a constant (about 0.6930.693⁠), not something to differentiate.
    ddxsin⁡x=cos⁡x\frac{d}{dx}\sin x = \cos x (Table 5.3); ddxax=axlog⁡a\frac{d}{dx}a^x = a^x\log a (Example 28). Basics: exponentials and logarithms
  5. Subtract

    For x>0x > 0⁠,

    dydx=xx(1+log⁡x)−2sin⁡xcos⁡xlog⁡2.\frac{dy}{dx} = x^x(1 + \log x) - 2^{\sin x}\cos x\log 2.
    Step 2 says the answer is u′−v′u' - v'⁠; Steps 3 and 4 supplied them. This is exactly the textbook's answer.
    Difference rule (Section 5.3). Basics: derivative rules
Result

For x>0x > 0⁠,

dydx=xx(1+log⁡x)−2sin⁡xcos⁡xlog⁡2.\frac{dy}{dx} = x^x(1 + \log x) - 2^{\sin x}\cos x\log 2.

(Textbook answer: xx(1+log⁡x)x^x(1 + \log x) − 2sin⁡xcos⁡xlog⁡2-\ 2^{\sin x}\cos x\log 2⁠; the key does not state x>0x > 0⁠.)

Check it with numbers

At x=1x = 1⁠: 11(1+log⁡1)=11^1(1 + \log 1) = 1⁠, and 2sin⁡1cos⁡1log⁡22^{\sin 1}\cos 1\log 2 =1.7918762×0.5403023×0.6931472= 1.7918762\times 0.5403023\times 0.6931472 =0.6710738= 0.6710738⁠. So dydx=1−0.6710738=0.3289262\frac{dy}{dx} = 1 - 0.6710738 = 0.3289262⁠. The central difference quotient with h=0.0001h = 0.0001 gives 0.32892620.3289262⁠.

At x=2x = 2 the formula gives 7.31433747.3143374 and the difference quotient 7.31433747.3143374⁠.

Common mistakes
  1. Taking log⁡\log of the whole function and writing log⁡(xx−2sin⁡x)\log(x^x - 2^{\sin x}) as xlog⁡x−sin⁡xlog⁡2x\log x - \sin x\log 2⁠. The log of a difference is not the difference of the logs.
  2. ddxxx=x⋅xx−1\frac{d}{dx}x^x = x\cdot x^{x-1} (power rule) or xxlog⁡xx^x\log x (exponential rule). Each misses one part; the correct xx(1+log⁡x)x^x(1 + \log x) is their sum.
  3. Forgetting the chain-rule factor cos⁡x\cos x in ddx2sin⁡x\frac{d}{dx}2^{\sin x}⁠.
What to take away
  1. For sums and differences, split first and log-differentiate each power separately.
  2. ddxxx=xx(1+log⁡x)\frac{d}{dx}x^x = x^x(1 + \log x) for x>0x > 0⁠: worth remembering.
  3. ddxag(x)=ag(x)log⁡a⋅g′(x)\frac{d}{dx}a^{g(x)} = a^{g(x)}\log a\cdot g'(x) for a positive constant aa⁠.

Every fact used, and where it comes from

FactUsed inSource
Positive base for logarithmic differentiationSteps 1, 3, 4Section 5.5 (Lesson: logarithmic differentiation)
x=elog⁡xx = e^{\log x} for x>0x > 0Step 1Example 25
Sum, difference and product rulesSteps 2, 3, 5Algebra of derivatives (1), (2), Section 5.3
log⁡pn=nlog⁡p\log p^n = n\log pSteps 3, 4Section 5.4
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 xStep 4Table 5.3
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 →