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

Exercise 5.4 · Q5: Differentiate log⁡(cos⁡ex)\log(\cos e^x)

Exercise 5.4Chain rule with log and eˣ · Section 5.4
The question

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

log⁡(cos⁡ex)\log\left(\cos e^x\right)
Exam answer

Let y=log⁡(cos⁡ex)y = \log(\cos e^x)⁠. By the chain rule,

dydx=1cos⁡ex⋅ddx(cos⁡ex)=1cos⁡ex⋅(−sin⁡ex)⋅ex\begin{aligned} \frac{dy}{dx} &= \frac{1}{\cos e^x}\cdot\frac{d}{dx}(\cos e^x) \\ &= \frac{1}{\cos e^x}\cdot(-\sin e^x)\cdot e^x \end{aligned}

∴ dydx=−extan⁡ex\therefore\ \dfrac{dy}{dx} = -e^x\tan e^x (where cos⁡ex>0\cos e^x > 0⁠).

The answer key gives the condition ex≠(2n+1)π2e^x \ne (2n + 1)\frac{\pi}{2}⁠, n∈Nn \in \mathbf{N}⁠, which is weaker than the true domain cos⁡ex>0\cos e^x > 0⁠.

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

The one idea this problem is built on

Three functions are applied in turn: exe^x⁠, then cosine, then logarithm. The chain rule for three links gives the derivative as a product of three rates, and it simplifies to −extan⁡ex-e^x\tan e^x⁠. The real care is the domain: a logarithm needs a positive input, so we may only use xx for which cos⁡ex>0\cos e^x > 0⁠, and that rules out whole intervals, not just isolated points.

Given, to find, and the plan
Given
y=log⁡(cos⁡ex)y = \log(\cos e^x)⁠, with log⁡\log the natural logarithm (base ee⁠), as everywhere in this chapter.
To find
dydx\dfrac{dy}{dx}⁠, and the exact set of xx where it is valid.
Plan
(1) Find the domain: solve cos⁡ex>0\cos e^x > 0⁠. (2) Name the links u=exu = e^x⁠, v=cos⁡uv = \cos u⁠, y=log⁡vy = \log v and differentiate each. (3) Multiply and simplify. (4) Compare with the answer key's condition.

Basics you need

1Domain of log⁡\log

log⁡v\log v is defined only for v>0v > 0 (Section 5.4: "we cannot make a meaningful definition of logarithm of non-positive numbers"). Basics: exponentials and logarithms

2Theorem 5

ddxex=ex\dfrac{d}{dx}e^x = e^x for all xx⁠, and ddvlog⁡v=1v\dfrac{d}{dv}\log v = \dfrac1v for v>0v > 0⁠. Lesson: exponential and logarithmic functions

3Where cosine is positive

cos⁡u>0\cos u > 0 exactly when uu lies in one of the intervals (2nπ−π2, 2nπ+π2)\left(2n\pi - \frac{\pi}{2},\ 2n\pi + \frac{\pi}{2}\right)⁠, n∈Zn \in \Z⁠. Its zeros are the odd multiples of π2\frac{\pi}{2}⁠. Basics: trigonometric identities

4Chain rule for three functions

dydx=dydv⋅dvdu⋅dudx\dfrac{dy}{dx} = \dfrac{dy}{dv}\cdot\dfrac{dv}{du}\cdot\dfrac{du}{dx} (Section 5.3.1). Basics: composite functions

Solution

  1. Where is the function defined?

    exe^x and cos⁡\cos accept every real number, so the only condition comes from the logarithm:

    cos⁡(ex)>0.\cos\left(e^x\right) > 0.

    Put u=exu = e^x⁠. As xx runs over R\R⁠, uu runs over all positive numbers. The positive uu with cos⁡u>0\cos u > 0 are

    0<u<π2,3π2<u<5π2,7π2<u<9π2, …\begin{gathered} 0 < u < \tfrac{\pi}{2}, \quad \tfrac{3\pi}{2} < u < \tfrac{5\pi}{2}, \\ \tfrac{7\pi}{2} < u < \tfrac{9\pi}{2}, \ \dots \end{gathered}

    Taking logarithms (which keeps inequalities, because log⁡\log is increasing), the domain of yy is

    x<log⁡π2, orlog⁡(4n−1)π2<x<log⁡(4n+1)π2, n∈N.\begin{aligned} &x < \log\tfrac{\pi}{2}, \ \text{or} \\ &\log\tfrac{(4n-1)\pi}{2} < x < \log\tfrac{(4n+1)\pi}{2},\ n \in \N. \end{aligned}

    Numerically: x<0.4516x < 0.4516⁠, or 1.5502<x<2.06101.5502 < x < 2.0610⁠, or 2.3975<x<2.64882.3975 < x < 2.6488⁠, and so on. For example x=0x = 0 is in the domain (cos⁡1>0\cos 1 > 0⁠), but x=1x = 1 is not: cos⁡e≈−0.9117\cos e \approx -0.9117⁠, and log⁡\log of a negative number is not defined.

    Solving for u=exu = e^x first is easier than solving for xx directly. The first interval for uu is (0,π2)\left(0, \frac{\pi}{2}\right)⁠, not (−π2,π2)\left(-\frac{\pi}{2}, \frac{\pi}{2}\right)⁠, because exe^x is never 00 or negative. Then x=log⁡ux = \log u converts each uu-interval into an xx-interval; u→0+u \to 0^+ corresponds to x→−∞x \to -\infty⁠.
    Domain of log⁡\log is R+\R^+⁠; log⁡\log is increasing (Section 5.4, observations (1) and (4)). Basics: exponentials and logarithms
    x cos(eˣ) −2 −1 1 2 1 −1 green: where cos(eˣ) > 0, the domain of y positive negative: no log
    The graph of cos⁡(ex)\cos(e^x)⁠. Where it is positive (solid blue) log⁡(cos⁡ex)\log(\cos e^x) exists; where it is negative (dashed) it does not. The green bars mark the domain of yy⁠; the open dots are at x=log⁡π2x = \log\frac{\pi}{2}⁠, log⁡3π2\log\frac{3\pi}{2}⁠, log⁡5π2\log\frac{5\pi}{2} and log⁡7π2\log\frac{7\pi}{2}⁠, where cos⁡ex=0\cos e^x = 0⁠.
  2. Name the three links and differentiate each

    u=exu = e^x⁠,  v=cos⁡u\ v = \cos u⁠,  y=log⁡v\ y = \log v⁠.

    dudx=ex,dvdu=−sin⁡u,dydv=1v(v>0).\begin{aligned} \frac{du}{dx} &= e^x, \\ \frac{dv}{du} &= -\sin u, \\ \frac{dy}{dv} &= \frac{1}{v} \quad (v > 0). \end{aligned}
    The links are in calculation order: exponentiate, take the cosine, take the log. The first and last derivatives are Theorem 5; the middle one is in Table 5.3. On the domain found in Step 1, v=cos⁡ex>0v = \cos e^x > 0⁠, so the logarithm link is differentiable there.
    Theorem 5, Section 5.4; Table 5.3. Basics: derivative rules
  3. Multiply and simplify

    dydx=1v⋅(−sin⁡u)⋅ex=−sin⁡(ex)cos⁡(ex)⋅ex=−extan⁡ex.\begin{aligned} \frac{dy}{dx} &= \frac{1}{v}\cdot(-\sin u)\cdot e^x \\ &= \frac{-\sin(e^x)}{\cos(e^x)}\cdot e^x \\ &= -e^x\tan e^x. \end{aligned}

    This holds at every xx in the domain of Step 1: there cos⁡ex>0\cos e^x > 0⁠, so tan⁡ex\tan e^x is defined.

    Each rate is evaluated at the value entering its link: the log link sees v=cos⁡exv = \cos e^x⁠, the cosine link sees u=exu = e^x⁠. Then sin⁡cos⁡=tan⁡\frac{\sin}{\cos} = \tan tidies the answer.
    Chain rule for three functions, Section 5.3.1; tan⁡=sin⁡cos⁡\tan = \frac{\sin}{\cos}⁠. Lesson: the chain rule
  4. Compare with the condition in the answer key

    The answer key prints −extan⁡ex-e^x\tan e^x with the condition ex≠(2n+1)π2e^x \ne (2n+1)\frac{\pi}{2}⁠, n∈Nn \in \N⁠. That condition only removes the points where cos⁡ex=0\cos e^x = 0 (where tan⁡ex\tan e^x is undefined). It does not ensure cos⁡ex>0\cos e^x > 0⁠: at x=1x = 1⁠, e1≈2.718e^1 \approx 2.718 is not an odd multiple of π2\frac{\pi}{2}⁠, yet cos⁡e<0\cos e < 0 and yy is not defined. Also, n∈Nn \in \N leaves out n=0n = 0⁠, the point ex=π2e^x = \frac{\pi}{2}⁠. The correct set is the domain of Step 1.

    Going deeper: with n=0n = 0 included, the key's condition describes exactly where log⁡∣cos⁡ex∣\log\left|\cos e^x\right| is defined, and the derivative of log⁡∣v∣\log|v| is also v′v\frac{v'}{v} (where v<0v < 0⁠, log⁡∣v∣=log⁡(−v)\log|v| = \log(-v)⁠, and the chain rule gives −v′−v\frac{-v'}{-v}⁠). So the formula −extan⁡ex-e^x\tan e^x is the derivative of log⁡∣cos⁡ex∣\log|\cos e^x| at every such point; for log⁡(cos⁡ex)\log(\cos e^x) itself, only the points with cos⁡ex>0\cos e^x > 0 count.
    A derivative exists only where the function does. Lesson: exponential and logarithmic functions
Result ddxlog⁡(cos⁡ex)=−extan⁡ex,\frac{d}{dx}\log\left(\cos e^x\right) = -e^x\tan e^x,

valid exactly where cos⁡ex>0\cos e^x > 0⁠: x<log⁡π2x < \log\frac{\pi}{2}⁠, or log⁡(4n−1)π2<x<log⁡(4n+1)π2\log\frac{(4n-1)\pi}{2} < x < \log\frac{(4n+1)\pi}{2} with n∈Nn \in \N⁠. (Textbook answer: −extan⁡ex-e^x\tan e^x⁠, with ex≠(2n+1)π2e^x \ne (2n+1)\frac{\pi}{2}⁠, n∈Nn \in \N⁠. The formula is the same; the key's condition is weaker than the true domain, as Step 4 explains.)

Check it with numbers

Take x=0x = 0⁠, which is in the domain: e0=1e^0 = 1 and cos⁡1≈0.5403023>0\cos 1 \approx 0.5403023 > 0⁠. The formula gives −e0tan⁡1=−tan⁡1≈−1.5574077-e^0\tan 1 = -\tan 1 \approx -1.5574077⁠. A difference quotient of log⁡(cos⁡ex)\log(\cos e^x) with h=0.0001h = 0.0001 on each side of 00 gives −1.55741-1.55741⁠. They agree.

Common mistakes
  1. Stopping at 1cos⁡ex\frac{1}{\cos e^x}⁠. The derivative of log⁡\log of something is 1something\frac{1}{\text{something}} times the derivative of the something.
  2. Dropping the last link. −tan⁡ex-\tan e^x forgets the factor exe^x from differentiating exe^x⁠.
  3. Only excluding the zeros of cos⁡ex\cos e^x⁠. The logarithm also needs cos⁡ex\cos e^x to be positive, which removes whole intervals of xx⁠.
What to take away
  1. ddxlog⁡g(x)=g′(x)g(x)\dfrac{d}{dx}\log g(x) = \dfrac{g'(x)}{g(x)} wherever g(x)>0g(x) > 0⁠.
  2. For a logarithm of a function, find where that function is positive, not merely non-zero.

Every fact used, and where it comes from

FactUsed inSource
log⁡\log is defined on R+\R^+ and is increasingStep 1Observations (1) and (4) on the log function, Section 5.4
exe^x takes every positive valueStep 1Feature (2) of exponential functions, Section 5.4
cos⁡u>0\cos u > 0 on (2nπ−π2,2nπ+π2)\left(2n\pi - \frac{\pi}{2}, 2n\pi + \frac{\pi}{2}\right)Step 1Signs of cosine (Class XI trigonometry)
ddxex=ex\frac{d}{dx}e^x = e^x⁠, ddvlog⁡v=1v\frac{d}{dv}\log v = \frac1vStep 2Theorem 5, Section 5.4 (Lesson: exponential and logarithmic functions)
dducos⁡u=−sin⁡u\frac{d}{du}\cos u = -\sin uStep 2Table 5.3, Section 5.3
Chain rule for three functionsStep 3Extension after Theorem 4, Section 5.3.1
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 →