Tutorials › Calculus I › Chain Rule for Tangent and Cotangent

Trigonometric Derivatives · Tutorial 497 of 1495

Chain Rule for Tangent and Cotangent

Use the chain rule to differentiate tangent and cotangent of an inner function, while keeping track of the inner derivative and the points where each expression is defined.

Intermediate 9 min read

What You'll Learn

  • State the chain-rule formulas for tangent and cotangent compositions.
  • Check where each trigonometric composition and its derivative are defined.
  • Find the derivative of an inner function before applying the outer derivative.
  • Verify a composite derivative using the quotient rule.
  • Recognize and correct missing factors and sign errors.
  • Simplify derivative expressions without losing domain restrictions.

Why the Inner Derivative Matters

A tangent or cotangent expression may have an input more complicated than \(x\). For example, the angle might be \(3x^2-1\) or \(\sqrt{x+3}\). Differentiating such an expression requires two pieces of information: how the trigonometric function changes with its angle, and how quickly that angle changes with \(x\).

The chain rule combines these two rates. The derivative of the outer function supplies one factor, evaluated at the inner function, and the derivative of the inner function supplies another. Keeping both factors is essential: the derivative of \(\tan(u(x))\) is not just \(\sec^2(u(x))\), and the derivative of \(\cot(u(x))\) is not just \(-\csc^2(u(x))\).

Key idea: Differentiate the outer tangent or cotangent function while leaving its input in place, then multiply by the derivative of that input.

Definitions and Domain Conditions

Let \(u\) be differentiable at \(x\). The expression \(\tan(u(x))\) is defined when \(\cos(u(x))\ne 0\), because \(\tan t=\sin t/\cos t\). The expression \(\cot(u(x))\) is defined when \(\sin(u(x))\ne 0\), because \(\cot t=\cos t/\sin t\). These restrictions matter: a derivative formula can only be applied at a point where the original composite function is defined.

Since sine and cosine are continuous, if the relevant denominator is nonzero at a point, it remains nonzero in some interval around that point. Thus the composition is defined locally there, as needed for its derivative.

Theorem: If \(u\) is differentiable at \(x\) and \(\cos(u(x))\ne 0\), then \(\frac{d}{dx}\tan(u(x))=\sec^2(u(x))u'(x)\). If \(u\) is differentiable at \(x\) and \(\sin(u(x))\ne 0\), then \(\frac{d}{dx}\cot(u(x))=-\csc^2(u(x))u'(x)\).

Here \(\sec t=1/\cos t\) and \(\csc t=1/\sin t\). The formulas may also be written using reciprocals of cosine and sine squared:

$$ \frac{d}{dx}\tan(u(x)) =\frac{u'(x)}{\cos^2(u(x))}, \qquad \frac{d}{dx}\cot(u(x)) =-\frac{u'(x)}{\sin^2(u(x))}. $$

The two forms are equivalent wherever the corresponding function is defined. The minus sign in the cotangent formula belongs to the outer derivative; it does not replace or cancel the inner derivative.

Why These Formulas Follow from the Chain Rule

The chain rule says that if an outer function \(F\) is differentiable at \(u(x)\) and \(u\) is differentiable at \(x\), then \((F\circ u)'(x)=F'(u(x))u'(x)\). Apply it first with \(F(t)=\tan t\), whose derivative is \(\sec^2 t\), and then with \(F(t)=\cot t\), whose derivative is \(-\csc^2 t\). Substitution gives the stated formulas.

The multiplication by \(u'(x)\) has a rate-of-change interpretation. A small change in \(x\) produces, to first order, a change of about \(u'(x)\) times as much in the angle \(u(x)\). The tangent or cotangent responds to that angle change at its own rate. Multiplying the two rates gives the rate of change with respect to \(x\).

This can also be seen directly from local linearization. Write \(h\) for a small change in \(x\). Differentiability of \(u\) gives \(u(x+h)=u(x)+u'(x)h+o(h)\), where \(o(h)/h\) tends to zero as \(h\) tends to zero. Set \(k=u(x+h)-u(x)\), so \(k=u'(x)h+o(h)\). If \(F\) is differentiable at \(u(x)\), then \(F(u(x)+k)=F(u(x))+F'(u(x))k+o(k)\). Since \(k=O(h)\), the remainder \(o(k)\) is also \(o(h)\) (and when \(k=0\), the corresponding change in \(F\) is zero). Substituting the expression for \(k\) yields \(F(u(x+h))-F(u(x))=F'(u(x))u'(x)h+o(h)\). Dividing by \(h\) and taking the limit gives the chain rule. For tangent and cotangent, this argument applies at inputs where their denominators are nonzero.

A Reliable Differentiation Process

For a composite tangent or cotangent expression, identify the inner function before doing any differentiation. Then differentiate that inner function and use the appropriate outer derivative. This order helps prevent a missing factor or a sign error.

1
Name the inner function.
Rewrite the expression mentally as \(\tan(u(x))\) or \(\cot(u(x))\), and record \(u(x)\).
2
Differentiate the inner function.
Find \(u'(x)\) separately before combining the factors.
3
Use the appropriate outer derivative.
For tangent use \(\sec^2(u(x))\); for cotangent use \(-\csc^2(u(x))\).
4
Multiply and check the domain.
Include \(u'(x)\) as a factor, and exclude points where the original tangent or cotangent is undefined.

Worked Examples

Worked Example: Tangent of a Quadratic Input

Differentiate \(y=\tan(3x^2-1)\).

The inner function is \(u(x)=3x^2-1\), so \(u'(x)=3(2x)-0=6x\). The outer tangent derivative is \(\sec^2(u(x))\). Therefore, by the chain rule,

$$ \begin{aligned} \frac{dy}{dx} &=\sec^2(3x^2-1)\cdot 6x\\ &=6x\sec^2(3x^2-1). \end{aligned} $$

The original expression is defined when \(\cos(3x^2-1)\ne0\); the derivative formula applies at those points. To verify the result, write \(y=\sin(u)/\cos(u)\). Using the quotient rule and the composite sine and cosine derivatives gives

$$ \begin{aligned} y' &=\frac{\cos(u)\bigl(\cos(u)u'\bigr)-\sin(u)\bigl(-\sin(u)u'\bigr)}{\cos^2(u)}\\ &=\frac{u'\bigl(\cos^2(u)+\sin^2(u)\bigr)}{\cos^2(u)}\\ &=\frac{u'}{\cos^2(u)} =6x\sec^2(3x^2-1). \end{aligned} $$

This agrees with the chain-rule answer.

Worked Example: Cotangent with a Decreasing Input

Differentiate \(y=\cot(1-2x)\).

Set \(u(x)=1-2x\). Its derivative is \(u'(x)=0-2=-2\). Cotangent contributes a negative sign, so both the outer derivative and the inner derivative must be included:

$$ \begin{aligned} \frac{dy}{dx} &=-\csc^2(1-2x)\cdot(-2)\\ &=2\csc^2(1-2x). \end{aligned} $$

The two negative factors produce a positive result. The expression is defined when \(\sin(1-2x)\ne0\). To check the calculation directly, put \(u=1-2x\) and write \(y=\cos(u)/\sin(u)\). Then

$$ \begin{aligned} y' &=\frac{(-\sin(u)u')\sin(u)-\cos(u)(\cos(u)u')}{\sin^2(u)}\\ &=\frac{-u'\bigl(\sin^2(u)+\cos^2(u)\bigr)}{\sin^2(u)}\\ &=-\frac{u'}{\sin^2(u)} =\frac{2}{\sin^2(1-2x)} =2\csc^2(1-2x). \end{aligned} $$

The quotient-rule check confirms both the positive sign and the factor \(2\).

Worked Example: Tangent of a Square-Root Input

Differentiate \(y=\tan(\sqrt{x+3})\), and state where the derivative formula applies.

The inner function is \(u(x)=\sqrt{x+3}=(x+3)^{1/2}\). It is differentiable when \(x>-3\), and

$$ u'(x)=\frac{1}{2}(x+3)^{-1/2} =\frac{1}{2\sqrt{x+3}}. $$

Applying the tangent chain rule gives

$$ \begin{aligned} \frac{dy}{dx} &=\sec^2(\sqrt{x+3})\cdot\frac{1}{2\sqrt{x+3}}\\ &=\frac{\sec^2(\sqrt{x+3})}{2\sqrt{x+3}}. \end{aligned} $$

Thus the formula applies for \(x>-3\) and \(\cos(\sqrt{x+3})\ne0\). The first restriction ensures that the inner function has a finite derivative; the second ensures the tangent is defined. For a direct check, let \(u=\sqrt{x+3}\). The quotient-rule calculation for \(\sin(u)/\cos(u)\) reduces to \(u'/\cos^2(u)\), which is \(\frac{1}{2\sqrt{x+3}}\sec^2(\sqrt{x+3})\), exactly the result above.

Keeping Simplification Under Control

The chain-rule formula is often clearest before any algebraic simplification. For instance, \(u'(x)\sec^2(u(x))\) makes the two sources of the derivative visible. Reordering the factors or writing \(\sec^2(u)=1/\cos^2(u)\) can be useful, but neither operation removes the domain restriction \(\cos(u)\ne0\). Likewise, writing the cotangent derivative with \(\csc^2(u)\) does not make it defined where \(\sin(u)=0\).

Some inner derivatives simplify together with the outer factor. That simplification is valid only after both factors have been found. In particular, do not cancel a factor across a sum, and do not use cancellation to claim that the original composition is defined at a point where its tangent or cotangent denominator is zero.

Common Mistake: Leaving Out the Inner Derivative

A frequent error is to differentiate only the outer tangent or cotangent. For example, the incorrect calculation \(\frac{d}{dx}\tan(3x^2-1)=\sec^2(3x^2-1)\) treats the angle as if it changed at rate \(1\). But the angle \(3x^2-1\) changes at rate \(6x\), so the correct result is

$$ \frac{d}{dx}\tan(3x^2-1) =6x\sec^2(3x^2-1). $$

Another common error is to lose a negative sign for cotangent or to confuse it with the sign of the inner derivative. The cotangent rule always begins with \(-\csc^2(u)u'\). If \(u'\) is negative, the product may be positive, as in \(\frac{d}{dx}\cot(1-2x)=2\csc^2(1-2x)\). A useful check is to write both factors explicitly before multiplying.

Why This Rule Is Useful

Tangent and cotangent often describe slopes, ratios, or angular relationships whose angle itself depends on a changing quantity. The chain rule lets us compute the rate of change with respect to that quantity without pretending that the angle is simply \(x\). Its practical value is also structural: once the inner function is identified, the same procedure works whether that input is a polynomial, a root, or another differentiable expression.

For every application, keep three questions in view: What is the inner function? What is its derivative? At which points is the original tangent or cotangent defined? Answering all three produces a derivative that is not only algebraically correct but also valid on the appropriate domain.

Check Your Understanding

For each question, identify the inner function and keep the domain conditions in mind.

  1. Differentiate \(y=\tan(5x-2)\). What factor comes from differentiating the inner function?
  2. Differentiate \(y=\cot(x^2+4)\). Where is the original expression defined?
  3. A student writes \(\frac{d}{dx}\cot(1-3x)=-\csc^2(1-3x)\). What factor is missing, and what is the correct derivative?
  4. State the condition on \(u(x)\) needed to differentiate \(\tan(u(x))\) at \(x\).
  5. Explain why the derivative of \(\tan(u(x))\) contains both \(\sec^2(u(x))\) and \(u'(x)\).

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): 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