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

Exercise 5.5 · Q11: Differentiate (xcos⁡x)x+(xsin⁡x)1/x(x\cos x)^x+(x\sin x)^{1/x}

Exercise 5.5Logarithmic differentiation · Section 5.5
The question

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

(xcos⁡x)x+(xsin⁡x)1x.(x\cos x)^x + (x\sin x)^{\frac1x}.
Exam answer

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

Taking log on both sides of u=(xcos⁡x)xu = (x\cos x)^x⁠,

log⁡u=xlog⁡(xcos⁡x)\log u = x\log(x\cos x)

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

1ududx=log⁡(xcos⁡x)+x⋅cos⁡x−xsin⁡xxcos⁡x=1−xtan⁡x+log⁡(xcos⁡x)∴ dudx=(xcos⁡x)x[1−xtan⁡x+log⁡(xcos⁡x)]\begin{aligned} \frac1u\frac{du}{dx} &= \log(x\cos x) \\ &\qquad + x\cdot\frac{\cos x - x\sin x}{x\cos x} \\ &= 1 - x\tan x + \log(x\cos x) \\ \therefore\ \frac{du}{dx} &= (x\cos x)^x\big[1 - x\tan x \\ &\qquad + \log(x\cos x)\big] \end{aligned}

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

log⁡v=1xlog⁡(xsin⁡x)\log v = \frac1x\log(x\sin x)

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

1vdvdx=−1x2log⁡(xsin⁡x)+1x⋅sin⁡x+xcos⁡xxsin⁡x=1x2[xcot⁡x+1−log⁡(xsin⁡x)]\begin{aligned} &\frac1v\frac{dv}{dx} \\ &= -\frac{1}{x^2}\log(x\sin x) \\ &\quad + \frac1x\cdot\frac{\sin x + x\cos x}{x\sin x} \\ &= \frac{1}{x^2}\big[x\cot x + 1 - \log(x\sin x)\big] \end{aligned} ∴ dvdx=(xsin⁡x)1xx2[xcot⁡x+1−log⁡(xsin⁡x)]\begin{aligned} \therefore\ \frac{dv}{dx} &= \frac{(x\sin x)^{\frac1x}}{x^2}\big[x\cot x + 1 \\ &\qquad - \log(x\sin x)\big] \end{aligned}

Hence, for xcos⁡x>0x\cos x > 0⁠, xsin⁡x>0x\sin x > 0⁠, dydx=(xcos⁡x)x[1−xtan⁡x+log⁡(xcos⁡x)]+(xsin⁡x)1xx2[xcot⁡x+1−log⁡(xsin⁡x)]\begin{aligned} \dfrac{dy}{dx} &= (x\cos x)^x\big[1 - x\tan x \\ &\qquad + \log(x\cos x)\big] \\ &\quad + \dfrac{(x\sin x)^{\dfrac1x}}{x^2}\big[x\cot x + 1 \\ &\qquad - \log(x\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 whose base and exponent both vary, so each needs logarithmic differentiation. They are added, and logs do not split sums, so we treat the two terms separately and add the results. The logs need positive bases, so we first find exactly where xcos⁡x>0x\cos x > 0 and xsin⁡x>0x\sin x > 0⁠.

Given, to find, and the plan
Given
y=(xcos⁡x)x+(xsin⁡x)1/xy = (x\cos x)^x + (x\sin x)^{1/x}⁠.
To find
dydx\frac{dy}{dx}⁠, and where the formula holds.
Plan
(1) Find where both bases are positive; split y=u+vy = u + v⁠. (2) Differentiate u=(xcos⁡x)xu = (x\cos x)^x by logs. (3) Differentiate v=(xsin⁡x)1/xv = (x\sin x)^{1/x} by logs. (4) Add.

Basics you need

1Logarithmic differentiation

For u>0u > 0⁠: dudx=u⋅ddx(log⁡u)\frac{du}{dx} = u\cdot\frac{d}{dx}(\log u)⁠. Bases of powers with variable exponents must be positive (Section 5.5). Basics: exponentials and logarithms

2Derivative of the log of a function

For g(x)>0g(x) > 0⁠: ddxlog⁡g(x)=g′(x)g(x)\frac{d}{dx}\log g(x) = \frac{g'(x)}{g(x)} (Theorem 5 with the chain rule). This needs only g>0g > 0⁠, even if gg is a product of two negative factors. Basics: derivative rules

3Signs of sine and cosine

sin⁡x\sin x and cos⁡x\cos x are both positive in the first quadrant and both negative in the third quadrant (and the same after adding any multiple of 2π2\pi⁠). Basics: trigonometric identities

Solution

  1. Where are both bases positive?

    We need xcos⁡x>0x\cos x > 0 and xsin⁡x>0x\sin x > 0 (and x≠0x \ne 0 for the exponent 1x\frac1x⁠).

    • If x>0x > 0⁠: we need cos⁡x>0\cos x > 0 and sin⁡x>0\sin x > 0⁠, so xx is in a first-quadrant interval (2kπ, 2kπ+π2)(2k\pi,\ 2k\pi + \frac{\pi}{2})⁠, k=0,1,2,…k = 0, 1, 2, \ldots
    • If x<0x < 0⁠: we need cos⁡x<0\cos x < 0 and sin⁡x<0\sin x < 0⁠, so xx is in a third-quadrant interval. The negative ones are
    (−(2k+1)π, −(2k+1)π+π2),\left(-(2k+1)\pi,\ -(2k+1)\pi + \tfrac{\pi}{2}\right),

    k=0,1,2,…k = 0, 1, 2, \ldots⁠; for k=0k = 0 this is (−π,−π2)(-\pi, -\frac{\pi}{2})⁠.

    On these intervals both terms are defined and positive. Put

    u=(xcos⁡x)x,v=(xsin⁡x)1/x,u = (x\cos x)^x, \qquad v = (x\sin x)^{1/x},

    so y=u+vy = u + v and dydx=dudx+dvdx\frac{dy}{dx} = \frac{du}{dx} + \frac{dv}{dx}⁠.

    A product of two numbers is positive exactly when they have the same sign. For x>0x > 0 both cos⁡x\cos x and sin⁡x\sin x must be positive; for x<0x < 0 both must be negative. For example x=−2.5x = -2.5 lies in (−π,−π2)(-\pi, -\frac{\pi}{2})⁠, where cos⁡x\cos x and sin⁡x\sin x are both negative, so xcos⁡x=2.0028590>0x\cos x = 2.0028590 > 0 and xsin⁡x=1.4961804>0x\sin x = 1.4961804 > 0⁠. The book does not state the domain; the formula below holds on all of these intervals.
    Signs of sin⁡\sin and cos⁡\cos by quadrant; positivity requirement (Section 5.5). Basics: trigonometric identities
  2. dudx\frac{du}{dx} for u=(xcos⁡x)xu = (x\cos x)^x

    Take logs: log⁡u=xlog⁡(xcos⁡x)\log u = x\log(x\cos x)⁠. We need the derivative of log⁡(xcos⁡x)\log(x\cos x)⁠. With g=xcos⁡xg = x\cos x and g′=cos⁡x−xsin⁡xg' = \cos x - x\sin x (product rule):

    ddxlog⁡(xcos⁡x)=cos⁡x−xsin⁡xxcos⁡x=1x−tan⁡x.\begin{aligned} \frac{d}{dx}\log(x\cos x) &= \frac{\cos x - x\sin x}{x\cos x} \\ &= \frac1x - \tan x. \end{aligned}

    Now the product rule on x⋅log⁡(xcos⁡x)x\cdot\log(x\cos x)⁠:

    1ududx=1⋅log⁡(xcos⁡x)+x(1x−tan⁡x)=1−xtan⁡x+log⁡(xcos⁡x).\begin{aligned} \frac1u\frac{du}{dx} &= 1\cdot\log(x\cos x) + x\left(\frac1x - \tan x\right) \\ &= 1 - x\tan x + \log(x\cos x). \end{aligned}

    Multiply by uu⁠:

    dudx= (xcos⁡x)x×[1−xtan⁡x+log⁡(xcos⁡x)].\begin{aligned} \frac{du}{dx} = \ &(x\cos x)^x \\ &\times\big[1 - x\tan x + \log(x\cos x)\big]. \end{aligned}
    We keep log⁡(xcos⁡x)\log(x\cos x) as the log of one positive quantity. Writing it as log⁡x+log⁡cos⁡x\log x + \log\cos x would be wrong on the negative intervals, where xx and cos⁡x\cos x are both negative and neither has a logarithm. Dividing term by term, cos⁡xxcos⁡x=1x\frac{\cos x}{x\cos x} = \frac1x and xsin⁡xxcos⁡x=tan⁡x\frac{x\sin x}{x\cos x} = \tan x (both allowed, since x≠0x \ne 0 and cos⁡x≠0\cos x \ne 0 here).
    ddxlog⁡g=g′g\frac{d}{dx}\log g = \frac{g'}{g} for g>0g > 0 (Theorem 5 and chain rule); product rule (Section 5.3). Lesson: logarithmic differentiation
  3. dvdx\frac{dv}{dx} for v=(xsin⁡x)1/xv = (x\sin x)^{1/x}

    Take logs: log⁡v=1xlog⁡(xsin⁡x)\log v = \frac1x\log(x\sin x)⁠. With g=xsin⁡xg = x\sin x⁠, g′=sin⁡x+xcos⁡xg' = \sin x + x\cos x⁠:

    ddxlog⁡(xsin⁡x)=sin⁡x+xcos⁡xxsin⁡x=1x+cot⁡x.\begin{aligned} \frac{d}{dx}\log(x\sin x) &= \frac{\sin x + x\cos x}{x\sin x} \\ &= \frac1x + \cot x. \end{aligned}

    Product rule on 1x⋅log⁡(xsin⁡x)\frac1x\cdot\log(x\sin x)⁠, using ddx1x=−1x2\frac{d}{dx}\frac1x = -\frac1{x^2}⁠:

    1vdvdx=−1x2log⁡(xsin⁡x)+1x(1x+cot⁡x)=xcot⁡x+1−log⁡(xsin⁡x)x2.\begin{aligned} \frac1v\frac{dv}{dx} &= -\frac{1}{x^2}\log(x\sin x) + \frac1x\left(\frac1x + \cot x\right) \\ &= \frac{x\cot x + 1 - \log(x\sin x)}{x^2}. \end{aligned}

    Multiply by vv⁠:

    dvdx= (xsin⁡x)1x×[xcot⁡x+1−log⁡(xsin⁡x)x2].\begin{aligned} \frac{dv}{dx} = \ &(x\sin x)^{\frac1x} \\ &\times\left[\frac{x\cot x + 1 - \log(x\sin x)}{x^2}\right]. \end{aligned}
    The exponent 1x\frac1x comes down as a factor. To combine the three terms over the common denominator x2x^2⁠: 1x⋅1x=1x2\frac1x\cdot\frac1x = \frac{1}{x^2} and 1xcot⁡x=xcot⁡xx2\frac1x\cot x = \frac{x\cot x}{x^2}⁠. Here sin⁡x≠0\sin x \ne 0⁠, so cot⁡x\cot x is defined.
    (x−1)′=−x−2(x^{-1})' = -x^{-2} (Table 5.3); product rule; ddxlog⁡g=g′g\frac{d}{dx}\log g = \frac{g'}{g}⁠. Basics: derivative rules
  4. Add the two derivatives

    dydx= (xcos⁡x)x[1−xtan⁡x+log⁡(xcos⁡x)]+(xsin⁡x)1x[xcot⁡x+1−log⁡(xsin⁡x)x2],\begin{aligned} \frac{dy}{dx} = \ &(x\cos x)^x\big[1 - x\tan x + \log(x\cos x)\big] \\ &+ (x\sin x)^{\frac1x}\left[\frac{x\cot x + 1 - \log(x\sin x)}{x^2}\right], \end{aligned}

    valid on every interval of Step 1.

    Sum rule. Each part was derived using only xcos⁡x>0x\cos x > 0 and xsin⁡x>0x\sin x > 0⁠, so the result holds wherever the function itself is defined.
    Sum rule (Section 5.3). Basics: derivative rules
Result

Wherever xcos⁡x>0x\cos x > 0 and xsin⁡x>0x\sin x > 0 (for example on (0,π2)(0, \frac{\pi}{2}) and on (−π,−π2)(-\pi, -\frac{\pi}{2})⁠):

dydx= (xcos⁡x)x[1−xtan⁡x+log⁡(xcos⁡x)]+(xsin⁡x)1x[xcot⁡x+1−log⁡(xsin⁡x)x2].\begin{aligned} \frac{dy}{dx} = \ &(x\cos x)^x\big[1 - x\tan x + \log(x\cos x)\big] \\ &+ (x\sin x)^{\frac1x}\left[\frac{x\cot x + 1 - \log(x\sin x)}{x^2}\right]. \end{aligned}

(Textbook answer: the same expression, without the domain.)

Check it with numbers

At x=1x = 1⁠: cos⁡1=0.5403023\cos 1 = 0.5403023⁠, sin⁡1=0.8414710\sin 1 = 0.8414710⁠, tan⁡1=1.5574077\tan 1 = 1.5574077⁠, cot⁡1=0.6420926\cot 1 = 0.6420926⁠.

  • u=0.5403023u = 0.5403023⁠, bracket 1−1.5574077+log⁡0.54030231 - 1.5574077 + \log 0.5403023 =−1.1730342= -1.1730342⁠, so dudx=−0.6337931\frac{du}{dx} = -0.6337931⁠.
  • v=0.8414710v = 0.8414710⁠, bracket 0.6420926+1−log⁡0.84147100.6420926 + 1 - \log 0.8414710 =1.8146964= 1.8146964⁠, so dvdx=1.5270143\frac{dv}{dx} = 1.5270143⁠.

Total 0.89322130.8932213⁠; the central difference with step 0.000010.00001 gives 0.89322130.8932213⁠.

At x=−2.5x = -2.5 (in (−π,−π2)(-\pi, -\frac{\pi}{2})⁠): the formula gives 0.6274570−0.3744431=0.25301400.6274570 - 0.3744431 = 0.2530140⁠, and the central difference also gives 0.25301400.2530140⁠. So the formula is right on the negative intervals too.

Common mistakes
  1. Logging the whole sum. log⁡(u+v)\log(u + v) does not split; differentiate the terms separately.
  2. Splitting log⁡(xcos⁡x)\log(x\cos x) into log⁡x+log⁡cos⁡x\log x + \log\cos x when x<0x < 0⁠: neither log exists there. Differentiate log⁡(xcos⁡x)\log(x\cos x) directly as g′g\frac{g'}{g}⁠.
  3. Forgetting the derivative of the exponent 1x\frac1x, which is −1x2-\frac1{x^2}⁠, not 00⁠.
  4. Sign slip in (xcos⁡x)′=cos⁡x−xsin⁡x(x\cos x)' = \cos x - x\sin x⁠.
  5. Assuming the domain is all x>0x > 0⁠. Both bases must be positive, which fails for most xx⁠.
What to take away
  1. Sum of powers: one logarithmic differentiation per term.
  2. ddxlog⁡g=g′g\frac{d}{dx}\log g = \frac{g'}{g} needs only g>0g > 0⁠; do not split a product of negatives.
  3. Always find where the bases are positive; the answer holds there.

Every fact used, and where it comes from

FactUsed inSource
Bases must be positive for logarithmic differentiationStep 1Section 5.5 (Lesson: logarithmic differentiation)
Signs of sin⁡x\sin x⁠, cos⁡x\cos x by quadrantStep 1Trigonometric functions (Class XI)
log⁡pn=nlog⁡p\log p^n = n\log pSteps 2, 3Section 5.4
ddxlog⁡x=1x\frac{d}{dx}\log x = \frac1x⁠; chain ruleSteps 2, 3Theorem 5, Section 5.4; Theorem 4, Section 5.3.1
Sum and product rulesSteps 1–4Algebra of derivatives, Section 5.3
(sin⁡x)′(\sin x)'⁠, (cos⁡x)′(\cos x)'⁠, (xn)′(x^n)'Steps 2, 3Table 5.3, Section 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 →