Tutorials › AP Calculus › Mixed Trigonometric, Exponential, and Logarithmic Compositions

Chain Rule and Nested Functions · Tutorial 173 of 999

Mixed Trigonometric, Exponential, and Logarithmic Compositions

Use the chain rule systematically to differentiate compositions involving trigonometric, exponential, and logarithmic functions.

Intermediate 9 min read

What You'll Learn

  • Identify the layers in a mixed trigonometric, exponential, or logarithmic composition.
  • Apply the derivative rule for each layer in the correct order.
  • Differentiate exponential functions whose exponents contain trigonometric expressions.
  • Differentiate logarithms whose arguments contain exponential expressions.
  • Check domain conditions for logarithmic compositions.
  • Verify a result by matching each derivative factor to its layer.

Following Every Layer

A composite function can place one familiar function inside another. When several types of functions are nested, the derivative is built from several factors: one for each layer. The challenge is to identify those layers and keep their factors together.

For example, \(e^{\sin x}\) has a sine layer inside an exponential layer. The derivative of the outer exponential is not the whole answer: the derivative of the inner sine must also appear. Likewise, \(\sin(\ln x)\) has a logarithm inside a sine, so both derivative rules contribute.

Key idea: For a composition, differentiate from the outside inward, multiplying by the derivative of each successive inner layer. Do not stop until the input \(x\) has been reached.

The Derivative Rules Used Here

For a differentiable inner function \(u=u(x)\), the relevant chain-rule forms are:

$$ \frac{d}{dx}e^{u}=e^{u}u', \qquad \frac{d}{dx}\sin u=\cos u\,u', \qquad \frac{d}{dx}\ln u=\frac{u'}{u}\quad\text{when }u>0. $$

Here \(u'\) means the derivative of the inner function with respect to \(x\). The exponential rule applies for every real-valued \(u\). The logarithm rule requires a positive argument at the point in question; a composition involving \(\ln u\) is defined only where \(u>0\).

These rules are useful to read as a sequence of layers. Differentiate the outer function while keeping its input in place, then multiply by the derivative of that input. If the input is itself a composition, repeat the process for its layers.

Why the Factors Multiply

Suppose an expression has three layers, \(y=f(g(h(x)))\), and each function is differentiable at the relevant input. A small change in \(x\) first changes \(h(x)\) at rate \(h'(x)\). That change affects \(g\) at rate \(g'(h(x))\), and the resulting change affects \(f\) at rate \(f'(g(h(x)))\). The chain rule expresses these successive local rates as a product:

$$ \frac{dy}{dx} = f'(g(h(x)))\,g'(h(x))\,h'(x). $$

Each factor records one layer's contribution. The order of the factors in a product can be rearranged, but their inputs cannot be changed: the derivative of \(g\) must be evaluated at \(h(x)\), and the derivative of \(f\) at \(g(h(x))\). The examples below make those inputs explicit.

1
Name the outer function.
Keep its input intact while differentiating that outer function.
2
Multiply by the next layer's derivative.
Evaluate that derivative at the input it actually receives.
3
Continue inward.
Repeat until every nested input has been differentiated down to \(x\).
4
Check the domain.
In particular, every logarithm must have a positive argument.

Worked Examples

Worked Example: Exponential of a Sine

Differentiate \(y=e^{\sin x}\).

The outer function is the exponential, and its input is \(\sin x\). Differentiating the outer layer gives \(e^{\sin x}\). The inner sine has derivative \(\cos x\), so multiply by that factor:

$$ \begin{aligned} y'&=e^{\sin x}\cdot\frac{d}{dx}(\sin x)\\ &=e^{\sin x}\cos x. \end{aligned} $$

Check: The exponential layer contributes \(e^{\sin x}\), and the sine layer contributes \(\cos x\); both required factors appear. At \(x=0\), the original inner value is \(\sin 0=0\), so the derivative formula gives \(e^0\cos 0=1\cdot1=1\). The expression is defined for every real \(x\).

Worked Example: Logarithm of One Plus an Exponential

Differentiate \(y=\ln(1+e^x)\).

The outer function is the natural logarithm, with inner argument \(1+e^x\). The derivative of \(\ln u\) is \(u'/u\), provided \(u>0\). Here \(1+e^x>0\) for every real \(x\), and the derivative of the argument is \(e^x\):

$$ \begin{aligned} y' &=\frac{\frac{d}{dx}(1+e^x)}{1+e^x}\\ &=\frac{0+e^x}{1+e^x}\\ &=\frac{e^x}{1+e^x}. \end{aligned} $$

Check: The logarithm rule supplies the denominator \(1+e^x\), while differentiating its argument supplies the numerator \(e^x\). At \(x=0\), the derivative is \(e^0/(1+e^0)=1/2\). The argument \(1+e^x\) is positive, so the logarithm and derivative are defined for all real \(x\).

Worked Example: Sine of a Logarithm

Differentiate \(y=\sin(\ln x)\), and state where the function is defined.

The outer layer is sine, whose derivative contributes \(\cos(\ln x)\). Its input is \(\ln x\), whose derivative is \(1/x\). The logarithm requires \(x>0\):

$$ \begin{aligned} y' &=\cos(\ln x)\cdot\frac{d}{dx}(\ln x)\\ &=\cos(\ln x)\cdot\frac{1}{x}\\ &=\frac{\cos(\ln x)}{x},\qquad x>0. \end{aligned} $$

Check: The sine layer contributes \(\cos(\ln x)\), and the logarithm layer contributes \(1/x\). At \(x=1\), the derivative is \(\cos(\ln 1)/1=\cos 0=1\). The restriction \(x>0\) is necessary because \(\ln x\) is defined only for positive \(x\).

Worked Example: An Exponential with a Doubled Trigonometric Input

Differentiate \(y=e^{\sin(2x)}\).

This expression has three layers: the outer exponential, then sine, then the inner expression \(2x\). Differentiating each layer in turn gives:

$$ \begin{aligned} y' &=e^{\sin(2x)}\cdot\cos(2x)\cdot\frac{d}{dx}(2x)\\ &=e^{\sin(2x)}\cos(2x)\cdot 2\\ &=2e^{\sin(2x)}\cos(2x). \end{aligned} $$

Check: The three factors correspond to the exponential layer, the sine layer, and the \(2x\) layer. At \(x=0\), the result is \(2e^0\cos 0=2\). Omitting the final factor \(2\) would fail to account for the derivative of the innermost expression.

Reading the Structure Before Calculating

Before differentiating a mixed composition, it can help to write its layers in words. For \(e^{\sin x}\), read “exponential of sine of \(x\).” For \(\sin(\ln x)\), read “sine of logarithm of \(x\).” The order of the words identifies which function is outermost. This prevents applying the right derivative rule to the wrong layer.

For a longer expression such as \(e^{\sin(2x)}\), a useful written structure is:

$$ x\longmapsto 2x \longmapsto \sin(2x) \longmapsto e^{\sin(2x)}. $$

Taking the derivative follows the same structure from right to left: the derivative of the last function, evaluated at its input, times the derivative of the preceding layer, and so on. This is why the derivative contains \(e^{\sin(2x)}\), \(\cos(2x)\), and \(2\), rather than just one of those factors.

ExpressionLayer outsideInner factor(s)
\(e^{\sin x}\)Exponential\(\cos x\)
\(\ln(1+e^x)\)Natural logarithm\(e^x\), divided by \(1+e^x\)
\(\sin(\ln x)\)Sine\(1/x\)
\(e^{\sin(2x)}\)Exponential\(\cos(2x)\) and \(2\)

Common Mistake: Stopping at the Outer Derivative

A frequent error is to differentiate the outside function but forget that its input depends on \(x\). For instance, the incorrect calculation

$$ \frac{d}{dx}\left(e^{\sin x}\right)=e^{\sin x} $$

accounts for differentiating the exponential layer, but not for differentiating \(\sin x\). The corrected calculation is

$$ \frac{d}{dx}\left(e^{\sin x}\right) =e^{\sin x}\cdot\frac{d}{dx}(\sin x) =e^{\sin x}\cos x. $$

A related error with \(e^{\sin(2x)}\) is to include \(\cos(2x)\) but omit the factor \(2\). The innermost expression is \(2x\), and its derivative is \(2\), so the full derivative must include that factor too.

Domain and Meaning

Exponential expressions such as \(e^{\sin x}\) are defined for all real \(x\), because the exponential accepts every real input. A logarithmic composition has an additional condition: its argument must be positive. For \(\ln(1+e^x)\), positivity holds for every real \(x\), since \(e^x>0\) and therefore \(1+e^x>0\). For \(\sin(\ln x)\), the condition is \(x>0\), because the logarithm's argument is \(x\).

These domain checks are part of determining where a derivative formula applies, not an optional final detail. A formula involving \(1/x\) does not make sense at \(x=0\), and the original expression \(\sin(\ln x)\) is not defined there either.

Takeaway: Identify every nested function, apply its derivative rule at the correct input, and multiply all inner derivative factors. For logarithms, also verify that the argument is positive.

Check Your Understanding

For each expression, identify its layers and differentiate. Include any necessary domain restriction.

  1. Differentiate \(e^{\cos x}\).
  2. Differentiate \(\ln(2+e^{3x})\).
  3. Differentiate \(\cos(\ln x)\), and state its domain.
  4. Differentiate \(e^{\sin(4x)}\).
  5. In the derivative of \(e^{\sin(2x)}\), what does each of the three factors represent?

Test yourself: AP Calculus practice exams

Ready to check what you know? Work an AP-style practice exam, then open the full solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers all of AP Calculus AB & BC: full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon
Clinical Biostats