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

Exercise 5.4 · Q10: Differentiate cos⁡(log⁡x+ex)\cos(\log x+e^x)⁠, x>0x>0

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

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

cos⁡(log⁡x+ex),x>0\cos\left(\log x + e^x\right), \qquad x > 0
Exam answer

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

dydx=−sin⁡(log⁡x+ex)×ddx(log⁡x+ex)\begin{aligned} \frac{dy}{dx} &= -\sin(\log x + e^x) \\ &\quad\times\frac{d}{dx}(\log x + e^x) \end{aligned}

∴ dydx\therefore\ \dfrac{dy}{dx} =−(1x+ex)sin⁡(log⁡x+ex)= -\left(\dfrac1x + e^x\right)\sin(\log x + e^x) (x>0)(x > 0)⁠.

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

The one idea this problem is built on

A cosine of a sum. The chain rule handles the cosine (outer function) and the sum inside (inner function); the inner function is differentiated with the sum rule and both parts of Theorem 5. The condition x>0x > 0 is there because log⁡x\log x needs it.

Given, to find, and the plan
Given
y=cos⁡(log⁡x+ex)y = \cos(\log x + e^x)⁠, x>0x > 0 (natural logarithm).
To find
dydx\dfrac{dy}{dx}⁠.
Plan
(1) Domain. (2) Name inner t=log⁡x+ext = \log x + e^x and outer y=cos⁡ty = \cos t⁠; differentiate each. (3) Multiply and substitute back.

Basics you need

1Theorem 5

ddxex=ex\dfrac{d}{dx}e^x = e^x for all xx⁠, and ddxlog⁡x=1x\dfrac{d}{dx}\log x = \dfrac{1}{x} for x>0x > 0⁠. Basics: exponentials and logarithms

2Sum rule

(u+v)′=u′+v′(u + v)' = u' + v' (rule (1), Section 5.3). Basics: derivative rules

3Chain rule

If y=f(t)y = f(t) and t=g(x)t = g(x)⁠, then dydx=dydt⋅dtdx\dfrac{dy}{dx} = \dfrac{dy}{dt}\cdot\dfrac{dt}{dx} (Theorem 4), with ddtcos⁡t=−sin⁡t\frac{d}{dt}\cos t = -\sin t (Table 5.3). Basics: composite functions

Solution

  1. Where is the function defined?

    log⁡x\log x needs x>0x > 0⁠; exe^x and cos⁡\cos accept every real number. So the domain is exactly x>0x > 0⁠, as in the question.

    The only restriction comes from the logarithm. On x>0x > 0 both log⁡x\log x and exe^x are differentiable, and so is cos⁡\cos⁠, so a derivative will exist at every point of the domain.
    Domain of log⁡\log is R+\R^+ (Section 5.4). Basics: exponentials and logarithms
  2. Name the inner and outer functions, and differentiate each

    Inner: t=log⁡x+ext = \log x + e^x⁠. Outer: y=cos⁡ty = \cos t⁠.

    dtdx=1x+ex(x>0),dydt=−sin⁡t.\begin{aligned} \frac{dt}{dx} &= \frac{1}{x} + e^x \quad (x > 0), \\ \frac{dy}{dt} &= -\sin t. \end{aligned}
    To compute yy you first work out the sum log⁡x+ex\log x + e^x⁠, then take its cosine: the sum is the inner function. Its derivative uses the sum rule (differentiate the two terms separately) and both parts of Theorem 5.
    Sum rule, Section 5.3; Theorem 5, Section 5.4; Table 5.3. Lesson: exponential and logarithmic functions
  3. Multiply (chain rule) and substitute back

    dydx=−sin⁡t⋅(1x+ex)=−(1x+ex)sin⁡(log⁡x+ex).\begin{aligned} \frac{dy}{dx} &= -\sin t\cdot\left(\frac{1}{x} + e^x\right) \\ &= -\left(\frac{1}{x} + e^x\right)\sin\left(\log x + e^x\right). \end{aligned}

    This holds for every x>0x > 0⁠.

    The outer rate −sin⁡t-\sin t is evaluated at the inner value t=log⁡x+ext = \log x + e^x⁠. The bracket 1x+ex\frac1x + e^x must be kept whole: both of its terms multiply the sine. If you prefer one fraction, 1x+ex=1+xexx\frac1x + e^x = \frac{1 + xe^x}{x}⁠.
    Chain rule, Theorem 4, Section 5.3.1. Lesson: the chain rule
Result dydx=−(1x+ex)sin⁡(log⁡x+ex),\frac{dy}{dx} = -\left(\frac{1}{x} + e^x\right)\sin\left(\log x + e^x\right),

valid for every x>0x > 0⁠. (Textbook answer: −(1x+ex)sin⁡(log⁡x+ex)-\left(\dfrac1x + e^x\right)\sin(\log x + e^x)⁠, x>0x > 0⁠. The same.)

Check it with numbers

Take x=1x = 1⁠: log⁡1+e1=e≈2.7182818\log 1 + e^1 = e \approx 2.7182818⁠, sin⁡e≈0.4107813\sin e \approx 0.4107813⁠, and 11+e≈3.7182818\frac11 + e \approx 3.7182818⁠. The formula gives −3.7182818×0.4107813-3.7182818\times 0.4107813⁠, which is about −1.5274006-1.5274006⁠. A difference quotient of cos⁡(log⁡x+ex)\cos(\log x + e^x) with h=0.0001h = 0.0001 on each side of 11 gives −1.52740-1.52740⁠. They agree.

Common mistakes
  1. Losing the minus sign. ddtcos⁡t=−sin⁡t\frac{d}{dt}\cos t = -\sin t⁠.
  2. Multiplying the sine by only one term. −1xsin⁡(log⁡x+ex)+ex-\frac1x\sin(\log x + e^x) + e^x is wrong; the whole bracket 1x+ex\frac1x + e^x multiplies the sine.
  3. Changing the inside of the sine. The sine is evaluated at the original inner value log⁡x+ex\log x + e^x⁠, not at its derivative.
What to take away
  1. When the inner function is itself a sum, differentiate it with the sum rule and keep the result in brackets.
  2. ddxcos⁡g(x)=−g′(x)sin⁡g(x)\dfrac{d}{dx}\cos g(x) = -g'(x)\sin g(x)⁠.

Every fact used, and where it comes from

FactUsed inSource
log⁡\log is defined on R+\R^+Step 1Observation (1) on the log function, Section 5.4
ddxex=ex\frac{d}{dx}e^x = e^x⁠, ddxlog⁡x=1x\frac{d}{dx}\log x = \frac1xStep 2Theorem 5, Section 5.4 (Lesson: exponential and logarithmic functions)
Sum ruleStep 2Rule (1), Section 5.3
ddtcos⁡t=−sin⁡t\frac{d}{dt}\cos t = -\sin tStep 2Table 5.3, Section 5.3
Chain ruleStep 3Theorem 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 →