Why This Substitution Works
When an integrand contains a rational expression in \(\tan x\) multiplied by \(\sec^2 x\), the derivative of \(\tan x\) is already present. Setting \(t=\tan x\) then replaces both the trigonometric expression and the differential, leaving an integral of a rational function of \(t\).
The substitution is straightforward on intervals where tangent is continuous and one-to-one. It needs more care on an interval that crosses a pole of tangent: the interval must be split into branches, and a definite integral across the pole must be treated as an improper integral.
The Tangent Branches
Tangent has period \(\pi\) and has poles at \(x=\frac{\pi}{2}+k\pi\), where \(k\) is an integer. Its maximal intervals of continuity are
On each \(I_k\), tangent is strictly increasing and takes every real value exactly once. Indeed, \(\frac{d}{dx}\tan x=\sec^2 x>0\) wherever tangent is defined, and tangent approaches \(-\infty\) and \(+\infty\) at the left and right ends of each such interval. Therefore \(t=\tan x\) is a valid one-to-one change of variable on any subinterval contained in a single \(I_k\).
For an indefinite integral, the resulting antiderivative is initially valid on a pole-free interval. For a definite integral whose limits lie in one branch, the limits transform in the usual way: \(x=a\) becomes \(t=\tan a\), and \(x=b\) becomes \(t=\tan b\). If the interval crosses a pole, tangent is not one-to-one or continuous over the whole interval, so the substitution cannot be applied as one unbroken change of variable.
Deriving the Rational Integral
Suppose \(R\) is a rational function and consider \(\int R(\tan x)\sec^2 x\,dx\) on an interval contained in one tangent branch. Put \(t=\tan x\). Differentiating gives \(dt=\sec^2 x\,dx\), so the factor multiplying \(R(\tan x)\) is exactly the differential needed for the substitution. Also, \(R(\tan x)=R(t)\). These two replacements give \(\int R(t)\,dt\).
The reason this calculation gives an antiderivative can be seen by the chain rule. Let \(F\) be an antiderivative of \(R\), so that \(F'(t)=R(t)\). Then
Thus, wherever the expressions are defined on a branch, \(F(\tan x)\) is an antiderivative of the original integrand. The rational integral may then be evaluated using methods for rational functions; the substitution itself does not guarantee that every resulting rational integral is easy.
Look for a rational expression in \(\tan x\) multiplied by \(\sec^2 x\).
For a single substitution, work on an interval with no tangent pole.
Set \(t=\tan x\) and \(dt=\sec^2 x\,dx\), including transformed limits for a definite integral.
Find an antiderivative of the rational function, then differentiate the result after substituting \(t=\tan x\).
Worked Examples
Worked Example: Integrating a Polynomial in Tangent
Evaluate \(\int (\tan^2 x+2\tan x+3)\sec^2 x\,dx\) on an interval containing no tangent pole.
Set \(t=\tan x\). Then \(dt=\sec^2 x\,dx\), so the integral becomes
Substitute back to obtain
To check, differentiate each term:
The derivative is the original integrand, as required.
Worked Example: A Logarithm from a Rational Function
Evaluate \(\int \frac{2\tan x+1}{\tan^2 x+\tan x+3}\sec^2 x\,dx\) on an interval containing no tangent pole.
With \(t=\tan x\), the integral becomes
The denominator has derivative \(2t+1\), the numerator. Therefore, using \(u=t^2+t+3\) and \(du=(2t+1)\,dt\), we get
In fact, \(t^2+t+3=(t+\frac12)^2+\frac{11}{4}>0\) for every real \(t\), so the absolute-value signs can be removed. Substituting back gives \(\ln(\tan^2 x+\tan x+3)+C\). Check by differentiation:
This matches the integrand.
Worked Example: A Definite Integral on One Branch
Evaluate \(\int_0^{\pi/4}\frac{\tan x\,\sec^2 x}{(1+\tan^2 x)^2}\,dx\). The interval \([0,\pi/4]\) lies inside the branch \((-\pi/2,\pi/2)\).
Set \(t=\tan x\). The limits become \(t=0\) at \(x=0\) and \(t=1\) at \(x=\pi/4\), and \(dt=\sec^2 x\,dx\). Hence
An antiderivative is \(-\frac{1}{2(1+t^2)}\), since
Therefore, evaluating at the limits gives
As a check, the antiderivative in \(x\) is \(-\frac{1}{2(1+\tan^2 x)}\). Differentiating it gives \(\frac{\tan x\sec^2 x}{(1+\tan^2 x)^2}\), and its endpoint values give the same result, \(\frac14\).
When the Interval Crosses a Pole
A definite integral across a tangent pole cannot be transformed using a single pair of finite tangent limits. Instead, split it at the pole and evaluate each side as an improper integral. Each side stays within one tangent branch, but one transformed endpoint may be infinite. The one-sided limits must exist for the improper integral to converge; if both sides converge, their values are added.
Worked Example: Splitting at a Tangent Pole
Consider \(\int_0^\pi \frac{\sec^2 x}{1+\tan^2 x}\,dx\), interpreted as an improper integral at \(x=\pi/2\). On its domain, the integrand simplifies to \(1\), so the improper integral should have value \(\pi\). The substitution also confirms this, provided the interval is split.
On \([0,\pi/2)\), set \(t=\tan x\). The transformed limits are \(0\) and \(+\infty\), giving
On \((\pi/2,\pi]\), tangent increases from \(-\infty\) to \(0\). Thus
Both one-sided integrals converge, and their sum is \(\frac{\pi}{2}+\frac{\pi}{2}=\pi\), agreeing with the simplified integrand. The value at the single pole is not needed to define the improper integral.
A Common Mistake
It is incorrect to substitute \(t=\tan x\) across a pole as though tangent were one-to-one on the whole interval. For the last example, one might incorrectly use \(t=\tan x\) from \(x=0\) to \(x=\pi\), see that both endpoint values are \(0\), and conclude
This calculation is invalid: the \(t\)-integral does not have the same path as a single substitution over \([0,\pi]\). As \(x\) approaches \(\pi/2\) from the left, \(\tan x\) tends to \(+\infty\); just to the right, it starts at \(-\infty\). The correct transformed integrals are the two separate improper integrals, from \(0\) to \(+\infty\) and from \(-\infty\) to \(0\), whose sum is \(\pi\).
Check Your Understanding
Use the branch condition as well as the algebra when deciding whether the substitution is valid.
- Use \(t=\tan x\) to find an antiderivative of \(\tan^4 x\sec^2 x\), and check it by differentiation.
- For which maximal intervals is tangent one-to-one, and where are its poles?
- Transform \(\int_0^{\pi/4}\frac{\sec^2 x}{1+\tan^2 x}\,dx\) into a rational integral and evaluate it.
- Why can’t \(t=\tan x\) be used as one continuous, one-to-one substitution on \([0,\pi]\)?
- What must be checked before adding the two pieces of an improper integral split at a tangent pole?