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

Exercise 5.5 · Q1: Differentiate cos⁡xcos⁡2xcos⁡3x\cos x\cos 2x\cos 3x

Exercise 5.5Logarithmic differentiation · Section 5.5
The question

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

cos⁡x . cos⁡2x . cos⁡3x\cos x\,.\,\cos 2x\,.\,\cos 3x
Exam answer

Let y=cos⁡xcos⁡2xcos⁡3xy = \cos x\cos 2x\cos 3x⁠. Taking log on both sides (where y≠0y \ne 0⁠),

log⁡∣y∣=log⁡∣cos⁡x∣+log⁡∣cos⁡2x∣+log⁡∣cos⁡3x∣\begin{aligned} \log|y| &= \log|\cos x| + \log|\cos 2x| \\ &\quad + \log|\cos 3x| \end{aligned}

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

1y⋅dydx=−sin⁡xcos⁡x+−2sin⁡2xcos⁡2x+−3sin⁡3xcos⁡3x=−(tan⁡x+2tan⁡2x+3tan⁡3x)\begin{aligned} \frac1y\cdot\frac{dy}{dx} &= \frac{-\sin x}{\cos x} \\ &\quad + \frac{-2\sin 2x}{\cos 2x} + \frac{-3\sin 3x}{\cos 3x} \\ &= -(\tan x + 2\tan 2x \\ &\qquad + 3\tan 3x) \end{aligned}

Multiplying by yy⁠,

∴ dydx=−cos⁡xcos⁡2xcos⁡3x×(tan⁡x+2tan⁡2x+3tan⁡3x)\begin{aligned} \therefore\ \dfrac{dy}{dx} &= -\cos x\cos 2x\cos 3x \\ &\quad\times(\tan x + 2\tan 2x \\ &\qquad + 3\tan 3x) \end{aligned}

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

The one idea this problem is built on

A product of several factors becomes a sum when we take logarithms, and a sum is differentiated term by term. Each factor here is a cosine, which can be negative, so we take the logarithm of the absolute value: log⁡∣y∣\log|y| exists wherever y≠0y \ne 0⁠, and its derivative is still 1ydydx\frac{1}{y}\frac{dy}{dx}⁠. The answer comes out in terms of tan⁡x\tan x⁠, tan⁡2x\tan 2x⁠, tan⁡3x\tan 3x⁠, so that form needs every cosine to be non-zero. The ordinary product rule gives a form valid for every xx⁠.

Given, to find, and the plan
Given
y=cos⁡xcos⁡2xcos⁡3xy = \cos x\cos 2x\cos 3x⁠, defined for every real xx⁠.
To find
dydx\frac{dy}{dx}⁠, and where each form of the answer holds.
Plan
(1) See where yy is positive, negative or zero. (2) Show that ddxlog⁡∣g∣=g′g\frac{d}{dx}\log|g| = \frac{g'}{g}⁠. (3) Take log⁡∣y∣\log|y|⁠, split it, differentiate, multiply by yy⁠. (4) Get the same answer from the product rule, valid everywhere, and look at a point where a cosine is zero.

Basics you need

1Log laws (positive numbers only)

log⁡(pq)=log⁡p+log⁡q\log(pq) = \log p + \log q for p,q>0p, q > 0 (Section 5.4). Since ∣abc∣=∣a∣ ∣b∣ ∣c∣|abc| = |a|\,|b|\,|c|⁠, this gives log⁡∣abc∣=log⁡∣a∣+log⁡∣b∣+log⁡∣c∣\log|abc| = \log|a| + \log|b| + \log|c| whenever a,b,c≠0a, b, c \ne 0⁠. Basics: exponentials and logarithms

2Chain rule and ddxlog⁡x=1x\frac{d}{dx}\log x = \frac1x

ddxlog⁡g(x)=g′(x)g(x)\frac{d}{dx}\log g(x) = \frac{g'(x)}{g(x)} where g(x)>0g(x) > 0 (Theorem 4 with Theorem 5). Basics: derivative rules

3Derivatives of cos⁡kx\cos kx

ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin x (Table 5.3); with the chain rule, inner kxkx⁠: ddxcos⁡kx=−ksin⁡kx\frac{d}{dx}\cos kx = -k\sin kx⁠. Basics: composite functions

4Product rule

(uv)′=u′v+uv′(uv)' = u'v + uv' (Section 5.3); used twice it gives (uvw)′=u′vw+uv′w+uvw′(uvw)' = u'vw + uv'w + uvw'⁠. Basics: derivative rules

Solution

  1. Where is yy positive, negative or zero?

    Let y=cos⁡xcos⁡2xcos⁡3xy = \cos x\cos 2x\cos 3x⁠. It is defined and differentiable for every real xx⁠, being a product of differentiable functions. But it is not always positive. At x=0x = 0⁠, y=1⋅1⋅1=1>0y = 1\cdot 1\cdot 1 = 1 > 0⁠. At x=0.6x = 0.6 (radians), cos⁡0.6=0.8253…\cos 0.6 = 0.8253\ldots⁠, cos⁡1.2=0.3624…\cos 1.2 = 0.3624\ldots and cos⁡1.8=−0.2272…\cos 1.8 = -0.2272\ldots⁠, so

    y=cos⁡0.6 cos⁡1.2 cos⁡1.8≈−0.0679,y = \cos 0.6\,\cos 1.2\,\cos 1.8 \approx -0.0679,

    which is negative.

    And y=0y = 0 exactly when one of the cosines is zero:

    cos⁡x=0  ⟺  x=(2n+1)π2,cos⁡2x=0  ⟺  x=(2n+1)π4,cos⁡3x=0  ⟺  x=(2n+1)π6,\begin{aligned} \cos x = 0 &\iff x = (2n+1)\tfrac{\pi}{2}, \\ \cos 2x = 0 &\iff x = (2n+1)\tfrac{\pi}{4}, \\ \cos 3x = 0 &\iff x = (2n+1)\tfrac{\pi}{6}, \end{aligned}

    with n∈Zn \in \mathbf{Z}⁠. Call these the excluded points. Away from them, y≠0y \ne 0⁠, but yy may be negative, so log⁡y\log y may not exist.

    The book's method takes log⁡y\log y⁠, which needs y>0y > 0 ("as otherwise their logarithms are not defined", Section 5.5). Here yy changes sign, so we use log⁡∣y∣\log|y| instead: ∣y∣>0|y| > 0 at every point that is not excluded.
    cos⁡θ=0\cos\theta = 0 exactly when θ\theta is an odd multiple of π2\frac{\pi}{2}⁠. Basics: trigonometric identities
  2. The tool: ddxlog⁡∣g(x)∣=g′(x)g(x)\frac{d}{dx}\log|g(x)| = \frac{g'(x)}{g(x)} wherever g(x)≠0g(x) \ne 0

    Let gg be differentiable with g(x)≠0g(x) \ne 0⁠. Near such a point gg keeps one sign (it is continuous, Theorem 3).

    • If g(x)>0g(x) > 0⁠: ∣g∣=g|g| = g⁠, so ddxlog⁡g=1g⋅g′=g′g\frac{d}{dx}\log g = \frac{1}{g}\cdot g' = \frac{g'}{g}⁠.
    • If g(x)<0g(x) < 0⁠: ∣g∣=−g>0|g| = -g > 0⁠, so ddxlog⁡(−g)=1−g⋅(−g′)\frac{d}{dx}\log(-g) = \frac{1}{-g}\cdot(-g') =g′g= \frac{g'}{g}⁠.

    Either way the result is g′g\frac{g'}{g}⁠. In particular, ddxlog⁡∣y∣=1y⋅dydx\frac{d}{dx}\log|y| = \frac{1}{y}\cdot\frac{dy}{dx}⁠.

    This is what lets logarithmic differentiation work for functions that are negative in places: the absolute value makes the logarithm exist, and the derivative formula does not change. Each case is just the chain rule with outer function log⁡\log and inner function gg or −g-g⁠.
    Chain rule (Theorem 4) with ddtlog⁡t=1t\frac{d}{dt}\log t = \frac1t for t>0t > 0 (Theorem 5). Lesson: logarithmic differentiation
  3. Take log⁡∣y∣\log|y| and split it

    At any point that is not excluded, all three cosines are non-zero, so

    log⁡∣y∣=log⁡(∣cos⁡x∣ ∣cos⁡2x∣ ∣cos⁡3x∣)=log⁡∣cos⁡x∣+log⁡∣cos⁡2x∣+log⁡∣cos⁡3x∣.\begin{aligned} \log|y| &= \log\big(|\cos x|\,|\cos 2x|\,|\cos 3x|\big) \\ &= \log|\cos x| + \log|\cos 2x| \\ &\quad + \log|\cos 3x|. \end{aligned}
    The absolute value of a product is the product of the absolute values, and the three numbers ∣cos⁡x∣|\cos x|⁠, ∣cos⁡2x∣|\cos 2x|⁠, ∣cos⁡3x∣|\cos 3x| are positive, so the law log⁡(pq)=log⁡p+log⁡q\log(pq) = \log p + \log q applies (twice). The product has become a sum.
    log⁡bpq=log⁡bp+log⁡bq\log_b pq = \log_b p + \log_b q (Section 5.4). Basics: exponentials and logarithms
  4. Differentiate both sides

    Left side, by Step 2: 1ydydx\frac1y\frac{dy}{dx}⁠. Right side, by Step 2 on each term with g=cos⁡kxg = \cos kx⁠, g′=−ksin⁡kxg' = -k\sin kx⁠:

    ddxlog⁡∣cos⁡x∣=−sin⁡xcos⁡x=−tan⁡x,ddxlog⁡∣cos⁡2x∣=−2sin⁡2xcos⁡2x=−2tan⁡2x,ddxlog⁡∣cos⁡3x∣=−3sin⁡3xcos⁡3x=−3tan⁡3x.\begin{aligned} \frac{d}{dx}\log|\cos x| &= \frac{-\sin x}{\cos x} = -\tan x, \\ \frac{d}{dx}\log|\cos 2x| &= \frac{-2\sin 2x}{\cos 2x} = -2\tan 2x, \\ \frac{d}{dx}\log|\cos 3x| &= \frac{-3\sin 3x}{\cos 3x} = -3\tan 3x. \end{aligned}

    So

    1y⋅dydx=−tan⁡x−2tan⁡2x−3tan⁡3x.\frac1y\cdot\frac{dy}{dx} = -\tan x - 2\tan 2x - 3\tan 3x.
    The factors 22 and 33 are the inner derivatives: cos⁡2x\cos 2x is a composite with outer cos⁡\cos and inner 2x2x⁠, so its derivative is −sin⁡2x⋅2-\sin 2x\cdot 2⁠. Forgetting them is the most common error in this question.
    Chain rule: ddxcos⁡kx=−ksin⁡kx\frac{d}{dx}\cos kx = -k\sin kx⁠; sin⁡θcos⁡θ=tan⁡θ\frac{\sin\theta}{\cos\theta} = \tan\theta⁠. Lesson: the chain rule
  5. Multiply by yy

    dydx=−y (tan⁡x+2tan⁡2x+3tan⁡3x)=−cos⁡xcos⁡2xcos⁡3x×(tan⁡x+2tan⁡2x+3tan⁡3x).\begin{aligned} \frac{dy}{dx} &= -y\,(\tan x + 2\tan 2x + 3\tan 3x) \\ &= -\cos x\cos 2x\cos 3x \\ &\quad\times(\tan x + 2\tan 2x + 3\tan 3x). \end{aligned}

    This holds at every xx where cos⁡x\cos x⁠, cos⁡2x\cos 2x and cos⁡3x\cos 3x are all non-zero, that is, at every xx that is not an odd multiple of π2\frac{\pi}{2}⁠, π4\frac{\pi}{4} or π6\frac{\pi}{6}⁠.

    Multiplying both sides by yy (non-zero here) isolates dydx\frac{dy}{dx}⁠. This is exactly the textbook's answer. The restriction is real: at an excluded point one of the tangents is undefined, so this form cannot even be evaluated there.
    Rearranging: 1yY=R\frac1y Y = R with y≠0y \ne 0 gives Y=yRY = yR⁠. Basics: solving for dy/dx
  6. The product rule gives a form valid for every xx

    With u=cos⁡xu = \cos x⁠, v=cos⁡2xv = \cos 2x⁠, w=cos⁡3xw = \cos 3x and u′=−sin⁡xu' = -\sin x⁠, v′=−2sin⁡2xv' = -2\sin 2x⁠, w′=−3sin⁡3xw' = -3\sin 3x⁠:

    dydx=u′vw+uv′w+uvw′=−sin⁡xcos⁡2xcos⁡3x−2cos⁡xsin⁡2xcos⁡3x−3cos⁡xcos⁡2xsin⁡3x.\begin{aligned} \frac{dy}{dx} &= u'vw + uv'w + uvw' \\ &= -\sin x\cos 2x\cos 3x \\ &\quad - 2\cos x\sin 2x\cos 3x \\ &\quad - 3\cos x\cos 2x\sin 3x. \end{aligned}

    Where no cosine is zero, this equals the answer of Step 5: for instance −cos⁡xcos⁡2xcos⁡3x⋅tan⁡x-\cos x\cos 2x\cos 3x\cdot\tan x =−sin⁡xcos⁡2xcos⁡3x= -\sin x\cos 2x\cos 3x⁠, since cos⁡x⋅sin⁡xcos⁡x=sin⁡x\cos x\cdot\frac{\sin x}{\cos x} = \sin x⁠; the other two terms match in the same way.

    The product rule needs no logarithms and no sign conditions, so this form is valid for every real xx⁠. Expanding the bracket of Step 5 and cancelling one cosine in each term gives exactly these three terms, which confirms the textbook answer wherever it is defined.
    Product rule used twice: (uvw)′=(uv)′w+(uv)w′(uvw)' = (uv)'w + (uv)w' =u′vw+uv′w+uvw′= u'vw + uv'w + uvw'⁠. Basics: derivative rules
  7. At an excluded point the derivative still exists

    Take x=π6x = \frac{\pi}{6}⁠, where cos⁡3x=cos⁡π2=0\cos 3x = \cos\frac{\pi}{2} = 0⁠, so y=0y = 0 and tan⁡3x\tan 3x is undefined. The product-rule form still works: the first two terms contain cos⁡3x=0\cos 3x = 0⁠, so

    dydx∣x=π/6=−3cos⁡π6cos⁡π3sin⁡π2=−3⋅32⋅12⋅1=−334.\begin{aligned} \frac{dy}{dx}\Big|_{x=\pi/6} &= -3\cos\tfrac{\pi}{6}\cos\tfrac{\pi}{3}\sin\tfrac{\pi}{2} \\ &= -3\cdot\tfrac{\sqrt3}{2}\cdot\tfrac12\cdot 1 = -\tfrac{3\sqrt3}{4}. \end{aligned}
    So the restriction in Step 5 belongs to the method (and the tan form of the answer), not to the function: yy is differentiable everywhere. −334=−1.2990381…-\frac{3\sqrt3}{4} = -1.2990381\ldots⁠, and a central difference quotient at π6\frac{\pi}{6} gives the same.
    cos⁡π6=32\cos\frac{\pi}{6} = \frac{\sqrt3}{2}⁠, cos⁡π3=12\cos\frac{\pi}{3} = \frac12⁠, sin⁡π2=1\sin\frac{\pi}{2} = 1⁠. Basics: trigonometric identities
Result

Wherever cos⁡x\cos x⁠, cos⁡2x\cos 2x⁠, cos⁡3x\cos 3x are all non-zero,

dydx=−cos⁡xcos⁡2xcos⁡3x×[tan⁡x+2tan⁡2x+3tan⁡3x].\begin{aligned} \frac{dy}{dx} = &-\cos x\cos 2x\cos 3x \\ &\times\left[\tan x + 2\tan 2x + 3\tan 3x\right]. \end{aligned}

(Textbook answer: −cos⁡xcos⁡2xcos⁡3x [tan⁡x+2tan⁡2x+3tan⁡3x]-\cos x\cos 2x\cos 3x\,[\tan x + 2\tan 2x + 3\tan 3x]⁠; the key does not state the condition.) For every real xx⁠, including the excluded points,

dydx=−sin⁡xcos⁡2xcos⁡3x−2cos⁡xsin⁡2xcos⁡3x−3cos⁡xcos⁡2xsin⁡3x.\begin{aligned} \frac{dy}{dx} = &-\sin x\cos 2x\cos 3x \\ &- 2\cos x\sin 2x\cos 3x \\ &- 3\cos x\cos 2x\sin 3x. \end{aligned}
Check it with numbers

At x=0.3x = 0.3⁠: cos⁡0.3=0.9553365\cos 0.3 = 0.9553365⁠, cos⁡0.6=0.8253356\cos 0.6 = 0.8253356⁠, cos⁡0.9=0.6216100\cos 0.9 = 0.6216100⁠, so y=0.4901228y = 0.4901228⁠. The bracket is 0.3093362+1.3682736+3.78047470.3093362 + 1.3682736 + 3.7804747 =5.4580845= 5.4580845⁠, and

dydx=−0.4901228×5.4580845=−2.6751318.\frac{dy}{dx} = -0.4901228\times 5.4580845 = -2.6751318.

The central difference quotient y(0.3001)−y(0.2999)0.0002\frac{y(0.3001) - y(0.2999)}{0.0002} gives −2.6751317-2.6751317⁠, agreeing to 6 decimal places. A third route: the product-to-sum formulas give y=14(1+cos⁡2x+cos⁡4x+cos⁡6x)y = \frac14(1 + \cos 2x + \cos 4x + \cos 6x)⁠, so dydx=−12(sin⁡2x+2sin⁡4x+3sin⁡6x)\frac{dy}{dx} = -\frac12(\sin 2x + 2\sin 4x + 3\sin 6x)⁠, which at 0.30.3 is also −2.6751318-2.6751318⁠.

Common mistakes
  1. Taking log⁡y\log y without a sign check. yy is negative for some xx (for example x=0.6x = 0.6⁠); use log⁡∣y∣\log|y|⁠, or the product rule.
  2. Dropping the inner derivatives 22 and 33⁠: ddxlog⁡∣cos⁡2x∣=−2tan⁡2x\frac{d}{dx}\log|\cos 2x| = -2\tan 2x⁠, not −tan⁡2x-\tan 2x⁠.
  3. Sign slips: ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin x⁠, so every term carries a minus sign.
  4. Concluding that yy is not differentiable where tan⁡3x\tan 3x is undefined. Only the tan form fails there; Step 7 shows the derivative exists.
What to take away
  1. For a product, log⁡∣y∣\log|y| turns it into a sum, and ddxlog⁡∣g∣=g′g\frac{d}{dx}\log|g| = \frac{g'}{g} wherever g≠0g \ne 0⁠.
  2. The log method needs every factor to be non-zero; state where that is, and note that the answer may still extend to the other points.
  3. Two methods (log differentiation, product rule) agreeing is a strong check.

Every fact used, and where it comes from

FactUsed inSource
Logarithmic differentiation needs a positive functionStep 1Section 5.5 (Lesson: logarithmic differentiation)
Zeros of cosine: odd multiples of π2\frac{\pi}{2}Step 1Trigonometric functions (Class XI)
A differentiable function is continuousStep 2Theorem 3, Section 5.3
ddxlog⁡x=1x\frac{d}{dx}\log x = \frac1x⁠; chain ruleSteps 2, 4Theorem 5, Section 5.4; Theorem 4, Section 5.3.1
ddxlog⁡∣g∣=g′g\frac{d}{dx}\log|g| = \frac{g'}{g}⁠, g≠0g \ne 0Steps 2, 4Derived in Step 2 from Theorems 4 and 5
log⁡pq=log⁡p+log⁡q\log pq = \log p + \log qStep 3Section 5.4
ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin x⁠, ddxsin⁡x=cos⁡x\frac{d}{dx}\sin x = \cos xSteps 4, 6Table 5.3, Section 5.3
Product ruleStep 6Algebra of derivatives (2), 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 →