Why Nested Trigonometric Functions Need Care
A trigonometric function can take another function as its input. For example, in \(\sin(\cos x)\), the input to sine is \(\cos x\), not simply \(x\). If that cosine itself takes a polynomial as its input, as in \(\sin(\cos(2x^2-3x))\), there are several layers to differentiate.
The key is to keep track of those layers. Starting with the outermost function, differentiate it with respect to its input, then multiply by the derivative of that input. Continue inward until reaching the original variable. This is the Chain Rule applied repeatedly.
The Basic Trigonometric Chain Rules
For a differentiable function \(u=u(x)\), the Chain Rule gives the composite sine and cosine rules:
For tangent, where \(\cos(u(x))\ne 0\), the corresponding rule is:
These rules combine the derivative of the outer trigonometric function with the derivative of its input. In a nested expression, that input may itself be a trigonometric function, so its derivative must be found using another chain-rule step.
For example, when differentiating \(\sin(\cos x)\), the outer sine contributes \(\cos(\cos x)\). The inner cosine contributes \(-\sin x\). Their product is the derivative. Stopping after finding the outer contribution would leave out the change in the input.
Why the Derivative Factors Multiply
The multiplication in the Chain Rule reflects how changes pass through successive functions. Suppose \(y=F(u)\) and \(u=G(x)\), with \(F\) and \(G\) differentiable. For a small change \(h\) in \(x\), differentiability gives
Here \(o(h)\) denotes a quantity whose ratio to \(h\) tends to zero as \(h\) tends to zero. Applying differentiability of \(F\) to the resulting change in its input gives
Substituting the first change into the second expression and dividing by \(h\), the terms that tend to zero vanish in the limit. The remaining factor is \(F'(G(x))G'(x)\). Thus
For three layers, apply this result twice. If \(y=F(G(H(x)))\), then
Each factor accounts for the rate of change at one layer. This is why a nested derivative must include every layer's derivative, not just the derivative of the outermost function.
A Reliable Layer-by-Layer Method
Before differentiating, name the intermediate expressions. This makes it easier to see which input belongs to which function and helps prevent missing a factor.
Ask which operation is applied last. Differentiate that function while leaving its input intact.
Multiply by the derivative of the input to the outer function.
If an input is itself a composition, differentiate its outer layer and keep multiplying.
Write the result in terms of the original variable, then confirm that every layer's derivative appears once.
Worked Examples
Worked Example: Sine of Cosine of a Polynomial
Differentiate \(y=\sin(\cos(2x^2-3x))\).
There are three layers. Let \(u=2x^2-3x\), \(v=\cos u\), and \(y=\sin v\). Differentiate each layer:
Substitute \(v=\cos(2x^2-3x)\) and the expression for \(v'\):
Check: The outer sine contributes \(\cos(\cos(2x^2-3x))\). The middle cosine contributes \(-\sin(2x^2-3x)\), and the polynomial contributes \(4x-3\). Their product is exactly the derivative above.
Worked Example: Cosine of Sine of an Affine Input
Differentiate \(y=\cos(\sin(3x+\pi/6))\).
Name the layers \(u=3x+\pi/6\), \(v=\sin u\), and \(y=\cos v\). Their derivatives are
Putting the layers together gives
For an additional check at \(x=0\), the inner input is \(3(0)+\pi/6=\pi/6\). Thus \(\cos(\pi/6)=\sqrt{3}/2\), and the derivative formula gives
This agrees with the layer derivatives at \(x=0\): the affine layer contributes \(3\), the sine layer contributes \(\cos(\pi/6)=\sqrt{3}/2\), and the outer cosine contributes \(-\sin(1/2)\). Multiplying them gives the same value.
Worked Example: Tangent of Cosine of Sine
Differentiate \(y=\tan(\cos(\sin x))\).
Set \(u=\sin x\), \(v=\cos u\), and \(y=\tan v\). Start with the outer tangent. Its derivative is \(\sec^2(v)v'\), provided \(\cos v\ne 0\). Then differentiate the inner cosine and sine:
Therefore,
The expression is defined for every real \(x\). Indeed, \(\sin x\) lies between \(-1\) and \(1\), so \(\cos(\sin x)\) lies between \(\cos(1)\) and \(1\), both positive. In particular, \(\cos(\cos(\sin x))\ne 0\), which is the condition needed for the outer tangent rule.
Check: The outer tangent contributes \(\sec^2(\cos(\sin x))\); the middle cosine contributes \(-\sin(\sin x)\); and the inner sine contributes \(\cos x\). Multiplying these three factors reproduces the result.
Conditions and Common Pitfalls
The Chain Rule applies when the functions in the composition are differentiable at the relevant inputs. Sine and cosine are differentiable for every real input. Tangent is differentiable only where its input is not an odd multiple of \(\pi/2\), equivalently where the cosine of that input is nonzero. When a tangent occurs inside a longer composition, check that its input stays in its domain before using the tangent derivative rule.
Trigonometric derivatives here use angles measured in radians. This is the convention under which the basic derivatives of sine and cosine have the forms used above.
A frequent mistake is to differentiate the outer function but forget to multiply by the derivative of its input. For instance, the following calculation is incorrect:
This includes only the derivative of the outer sine. Its input, \(\cos x\), also changes with \(x\), and its derivative is \(-\sin x\). The corrected calculation is
Another useful check is to count the layers in the original expression. For \(\sin(\cos(2x^2-3x))\), there are three: outer sine, middle cosine, and inner polynomial. The derivative must therefore show the derivative contribution from each of those layers.
Why This Skill Matters
Nested trigonometric expressions occur whenever a changing quantity is passed through more than one transformation. The Chain Rule tracks how a change in the original variable affects each successive input. Naming the layers is not just a bookkeeping device: it makes the mathematical structure visible and turns a complicated-looking expression into a sequence of familiar derivative rules.
When the composition becomes longer, resist the temptation to differentiate the whole expression in one leap. Write the intermediate functions, differentiate each layer, and multiply the factors. Then check that the arguments in the resulting sine, cosine, or tangent expressions match the original layers.
Check Your Understanding
For each question, identify the layers before differentiating.
- Differentiate \(y=\sin(\cos(3x))\).
- Differentiate \(y=\cos(\sin(x^2))\).
- For \(y=\tan(\sin(2x))\), state the condition needed to apply the outer tangent derivative rule.
- In differentiating \(\sin(\cos x)\), which factor is missing from the incorrect answer \(\cos(\cos x)\)?
- Explain why differentiating a three-layer composition requires three derivative factors.