Tutorials › Calculus II › Rational Trigonometric Integrals with tan(x/2)

Rationalizing Substitutions · Tutorial 240 of 998

Rational Trigonometric Integrals with tan(x/2)

Learn how the half-angle parameter converts rational trigonometric integrals into rational integrals, and how to choose intervals where the substitution is valid.

Intermediate 9 min read

What You'll Learn

  • Derive the sine, cosine, and differential formulas for \(t=\tan(x/2)\)
  • Recognize which trigonometric integrands become rational functions of \(t\)
  • Identify the intervals on which the substitution is one-to-one
  • Compute antiderivatives and check them by differentiation
  • Split a definite integral when the substitution has a pole inside the interval
  • Avoid losing the factor of two in the transformed differential

Why Use the Half-Angle Parameter?

Some integrals involve sine and cosine in a rational combination: a quotient of polynomials in \(\sin x\) and \(\cos x\), for example. The substitution \(t=\tan(x/2)\) converts both trigonometric functions, as well as the differential \(dx\), into rational expressions in \(t\). The resulting integral is therefore a rational-function integral.

The method is powerful, but it is not valid as one global change of variable across the entire real line. The tangent function has poles, so the substitution must be used on suitable intervals. This matters especially for definite integrals whose interval crosses one of those poles.

Definition: The half-angle substitution, also called the Weierstrass substitution, is \(t=\tan(x/2)\). It gives \( \sin x=\frac{2t}{1+t^2},\quad \cos x=\frac{1-t^2}{1+t^2},\quad dx=\frac{2\,dt}{1+t^2}. \) These formulas apply on intervals where \(t\) is defined.

Deriving the Conversion Formulas

Set \(u=x/2\), so that \(t=\tan u\). The double-angle identities give \(\sin x=2\sin u\cos u\) and \(\cos x=\cos^2u-\sin^2u\). Since \(\tan u=t\), we can write \(\sin u=t\cos u\). Using \(\sin^2u+\cos^2u=1\), we obtain \((1+t^2)\cos^2u=1\). Substitution into the double-angle identities gives the formulas for sine and cosine.

For the differential, differentiate \(t=\tan(x/2)\) with respect to \(x\):

$$ \frac{dt}{dx} =\frac{1}{2}\sec^2(x/2) =\frac{1}{2}\bigl(1+\tan^2(x/2)\bigr) =\frac{1+t^2}{2}. $$

Since this derivative is positive wherever \(t\) is defined, we can solve for \(dx\):

$$ dx=\frac{2\,dt}{1+t^2}. $$

The factor of \(2\) is essential. Omitting it changes the value of the integral.

When the Substitution Produces a Rational Integral

Suppose the integrand is a rational expression in \(\sin x\) and \(\cos x\), and suppose its denominator is nonzero on the interval being considered. Replacing each sine and cosine by its formula in \(t\) gives rational expressions in \(t\). Multiplying by \(dx=2\,dt/(1+t^2)\) leaves a rational function of \(t\), which can be integrated by the standard methods for rational functions.

This applies to expressions such as \(P(\sin x,\cos x)/Q(\sin x,\cos x)\), where \(P\) and \(Q\) are polynomials and \(Q(\sin x,\cos x)\ne 0\) on the interval. It does not assert that every trigonometric integrand becomes rational: expressions involving, for example, \(e^{\sin x}\) do not become rational functions of \(t\) under this substitution.

1
Choose an interval.
Work on an interval where \(t=\tan(x/2)\) is defined and the original integrand has no singularity.
2
Substitute all three formulas.
Replace \(\sin x\), \(\cos x\), and \(dx\), including the factor \(2\) in the differential.
3
Integrate in \(t\).
Use an appropriate method for the resulting rational function.
4
Interpret and check.
Keep the interval restrictions in mind, and differentiate the resulting expression with respect to \(x\) to verify it.

The Intervals of Validity

The function \(t=\tan(x/2)\) is undefined when \(x=(2k+1)\pi\), where \(k\) is an integer. On each interval \(I_k=((2k-1)\pi,(2k+1)\pi)\), it is defined, strictly increasing, and takes every real value exactly once. Its inverse on that interval is \(x=2\arctan t+2k\pi\), where \(\arctan t\) takes values in \((-\pi/2,\pi/2)\).

Consequently, an antiderivative obtained in \(t\) gives an antiderivative in \(x\) on each appropriate connected interval. The constants of integration can differ on distinct intervals. If a definite integral crosses a point where \(t\) is undefined, split the interval there and use limits at the split. The original integrand may still be continuous at that point; the pole may belong to the substitution rather than to the integrand.

Worked Example: Integrating a Reciprocal Linear Expression in Cosine

Find an antiderivative of \(1/(2+\cos x)\) on the interval \((-\pi,\pi)\). This interval avoids the pole of \(t=\tan(x/2)\), and \(2+\cos x\) is positive throughout it.

Substitute the cosine formula into the denominator:

$$ 2+\cos x =2+\frac{1-t^2}{1+t^2} =\frac{2(1+t^2)+1-t^2}{1+t^2} =\frac{3+t^2}{1+t^2}. $$

Now substitute the differential. The factors \(1+t^2\) cancel:

$$ \int\frac{dx}{2+\cos x} =\int \frac{1+t^2}{3+t^2}\,\frac{2\,dt}{1+t^2} =\int\frac{2\,dt}{t^2+3}. $$

Using \(\int du/(u^2+a^2)=(1/a)\arctan(u/a)+C\), with \(a=\sqrt{3}\), gives

$$ \int\frac{2\,dt}{t^2+3} =\frac{2}{\sqrt{3}}\arctan\!\left(\frac{t}{\sqrt{3}}\right)+C =\frac{2}{\sqrt{3}}\arctan\!\left(\frac{\tan(x/2)}{\sqrt{3}}\right)+C. $$

To check, write \(F(x)\) for the final expression. Since \(dt/dx=(1+t^2)/2\), the chain rule gives

$$ F'(x) =\frac{2}{\sqrt{3}}\cdot \frac{1}{1+t^2/3}\cdot\frac{1}{\sqrt{3}}\cdot\frac{1+t^2}{2} =\frac{1+t^2}{3+t^2} =\frac{1}{2+\cos x}. $$

The derivative agrees with the integrand, as required.

Worked Example: A Quotient of Sine and One Plus Cosine

Find an antiderivative of \(\sin x/(1+\cos x)\) on \((-\pi,\pi)\). The denominator is nonzero in this open interval, so the integrand is defined there.

In terms of \(t\), the quotient simplifies:

$$ \frac{\sin x}{1+\cos x} = \frac{2t/(1+t^2)}{1+(1-t^2)/(1+t^2)} = \frac{2t/(1+t^2)}{2/(1+t^2)} =t. $$

Including the differential, the integral becomes

$$ \int\frac{\sin x}{1+\cos x}\,dx =\int t\,\frac{2\,dt}{1+t^2} =\int\frac{2t}{1+t^2}\,dt =\ln(1+t^2)+C. $$

Thus one antiderivative on the stated interval is \(\ln\!\bigl(1+\tan^2(x/2)\bigr)+C\). To check it, differentiate with \(t=\tan(x/2)\):

$$ \frac{d}{dx}\ln(1+t^2) =\frac{2t}{1+t^2}\frac{dt}{dx} =\frac{2t}{1+t^2}\frac{1+t^2}{2} =t =\frac{\sin x}{1+\cos x}. $$

This verifies the result wherever the substitution and integrand are defined.

A Definite Integral That Crosses a Substitution Pole

The interval restriction is particularly visible when a definite integral crosses \(x=\pi\). At that point \(t\) is undefined, even though an integrand such as \(1/(3+2\cos x)\) is finite. Splitting the integral lets us use the substitution on each side separately.

Worked Example: Integrating Across \(x=\pi\)

Evaluate \(\int_0^{2\pi} dx/(3+2\cos x)\). The denominator is positive, since \(3+2\cos x\ge 1\), so the integral is proper in \(x\). Split it at \(x=\pi\), where the substitution has a pole.

Under the substitution, the denominator becomes

$$ 3+2\cos x =3+2\frac{1-t^2}{1+t^2} =\frac{3(1+t^2)+2(1-t^2)}{1+t^2} =\frac{5+t^2}{1+t^2}. $$

Hence the transformed integrand on each interval is \(2\,dt/(t^2+5)\). On \(0\le x<\pi\), \(t\) runs from \(0\) to \(+\infty\). Therefore

$$ \int_0^\pi\frac{dx}{3+2\cos x} =\lim_{b\to+\infty}\int_0^b\frac{2\,dt}{t^2+5} =\lim_{b\to+\infty} \frac{2}{\sqrt{5}}\arctan\!\left(\frac{b}{\sqrt{5}}\right) =\frac{\pi}{\sqrt{5}}. $$

On \(\pi<x\le 2\pi\), \(t\) runs from \(-\infty\) to \(0\). Thus

$$ \int_\pi^{2\pi}\frac{dx}{3+2\cos x} =\lim_{a\to-\infty}\int_a^0\frac{2\,dt}{t^2+5} =\lim_{a\to-\infty} \frac{2}{\sqrt{5}}\left[ \arctan\!\left(\frac{t}{\sqrt{5}}\right) \right]_a^0 =\frac{\pi}{\sqrt{5}}. $$

Adding the two parts gives \(\int_0^{2\pi} dx/(3+2\cos x)=2\pi/\sqrt{5}\). The limits at infinity are necessary because \(t\) is unbounded as \(x\) approaches \(\pi\) from either side. The two transformed intervals are kept separate rather than treating \(t\) as a single coordinate through its pole.

A Common Mistake: Losing the Factor of Two

A frequent error is to use \(dx=dt/(1+t^2)\). But differentiating \(t=\tan(x/2)\) gives \(dt/dx=(1+t^2)/2\), so the correct formula is \(dx=2\,dt/(1+t^2)\).

For instance, in the first worked example, omitting the factor of \(2\) would give the incorrect result \(\frac{1}{\sqrt{3}}\arctan(t/\sqrt{3})\). Differentiating this with respect to \(x\) yields

$$ \frac{1}{\sqrt{3}}\cdot \frac{1}{1+t^2/3}\cdot\frac{1}{\sqrt{3}}\cdot\frac{1+t^2}{2} =\frac{1+t^2}{2(3+t^2)} =\frac{1}{2(2+\cos x)}. $$

This is half the required integrand. The corrected coefficient \(2/\sqrt{3}\) makes the derivative \(1/(2+\cos x)\), as the direct check showed.

When the Method Is Useful

The half-angle substitution is a general route from rational trigonometric expressions to rational functions. It is especially useful when sine and cosine occur together and neither has a simple odd-power factor that makes a direct substitution natural. Once the integral is rational in \(t\), familiar algebraic techniques can be applied.

The method also demands care about domains. Before substituting, identify where the original integrand is defined and where \(t\) is defined. For an antiderivative, work on a connected interval satisfying both conditions. For a definite integral crossing a pole of \(t\), split the interval and take the appropriate one-sided limits. Finally, check the answer by differentiating with \(dt/dx=(1+t^2)/2\); this check often catches a missing factor or an interval error.

Check Your Understanding

Try these questions using the conversion formulas and interval conditions from the tutorial.

  1. Derive \(dx=2\,dt/(1+t^2)\) by differentiating \(t=\tan(x/2)\).
  2. What rational function of \(t\) results from substituting into \(\int dx/(1-\cos x)\), and on what points is the original integrand undefined?
  3. Why does an antiderivative obtained from \(t=\tan(x/2)\) need an interval of validity?
  4. When evaluating a definite integral from \(0\) to \(2\pi\), why might it be necessary to split at \(x=\pi\)?
  5. What incorrect derivative results if the factor of \(2\) is omitted from the transformed differential?

Test yourself: Calculus II 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