# Tangent half-angle substitution

In integral calculus, the tangent half-angle substitution is a substitution used for finding antiderivatives, and hence definite integrals, of rational functions of trigonometric functions. No generality is lost by taking these to be rational functions of the sine and cosine. Michael Spivak wrote that "The world's sneakiest substitution is undoubtedly" this technique.

## Euler and Weierstrass

Various books call this the Weierstrass substitution, after Karl Weierstrass (1815 – 1897), without citing any occurrence of the substitution in Weierstrass' writings, but the technique appears well before Weierstrass was born, in the work of Leonhard Euler (1707 – 1783).

## The substitution

One starts with the problem of finding an antiderivative of a rational function of the sine and cosine; and replaces sin x, cos x, and the differential dx with rational functions of a variable t and the product of a rational function of t with the differential dt, as follows:

{\begin{aligned}\sin x&={\frac {2t}{1+t^{2}}}\\[6pt]\cos x&={\frac {1-t^{2}}{1+t^{2}}}\\[6pt]dx&={\frac {2}{1+t^{2}}}\,dt.\end{aligned}} ### Derivation

Let

$t=\tan {\frac {x}{2}}.$ By the double-angle formula for the sine function,

{\begin{aligned}\sin x&=2\sin {\frac {x}{2}}\cos {\frac {x}{2}}\\[6pt]&=2t\cos ^{2}{\frac {x}{2}}\\[6pt]&={\frac {2t}{\sec ^{2}{\frac {x}{2}}}}\\[6pt]&={\frac {2t}{1+t^{2}}}.\end{aligned}} By the double-angle formula for the cosine function,

{\begin{aligned}\cos x&=1-2\sin ^{2}{\frac {x}{2}}\\[6pt]&=1-2t^{2}\cos ^{2}{\frac {x}{2}}\\[6pt]&=1-{\frac {2t^{2}}{\sec ^{2}{\frac {x}{2}}}}\\[6pt]&=1-{\frac {2t^{2}}{1+t^{2}}}\\[6pt]&={\frac {1-t^{2}}{1+t^{2}}}.\end{aligned}} One has

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

{\begin{aligned}{\frac {dt}{dx}}&={\frac {1}{2}}\sec ^{2}{\frac {x}{2}}\\[6pt]&={\frac {1+t^{2}}{2}}.\end{aligned}} ## Examples

### First example

{\begin{aligned}\int \csc x\,dx&=\int {\frac {dx}{\sin x}}\\&=\int \left({\frac {1+t^{2}}{2t}}\right)\left({\frac {2}{1+t^{2}}}\,dt\right)&t&=\tan {\frac {x}{2}}\\&=\int {\frac {dt}{t}}\\&=\ln t+C\\&=\ln \tan {\frac {x}{2}}+C.\end{aligned}} ### Second example: a definite integral

{\begin{aligned}\int _{0}^{2\pi }{\frac {dx}{2+\cos x}}&=\int _{0}^{\pi }{\frac {dx}{2+\cos x}}+\int _{\pi }^{2\pi }{\frac {dx}{2+\cos x}}\\&=\int _{0}^{\infty }{\frac {2\,dt}{3+t^{2}}}+\int _{-\infty }^{0}{\frac {2\,dt}{3+t^{2}}}&t&=\tan {\frac {x}{2}}\\&=\int _{-\infty }^{\infty }{\frac {2\,dt}{3+t^{2}}}\\&={\frac {2}{\sqrt {3}}}\int _{-\infty }^{\infty }{\frac {du}{1+u^{2}}}&t&=u{\sqrt {3}}\\&={\frac {2\pi }{\sqrt {3}}}.\end{aligned}} In the first line, one does not simply substitute $t=0$ for both limits of integration. The singularity (in this case, a vertical asymptote) of $t=\tan {\frac {x}{2}}$ at $x=\pi$ must be taken into account.

### Third example

{\begin{aligned}\int {\frac {dx}{a\cos x+b\sin x+c}}&=\int {\frac {2dt}{a(1-t^{2})+2bt+c(t^{2}+1)}}\\&=\int {\frac {2dt}{(c-a)t^{2}+2bt+a+c}}\\&={\frac {2}{\sqrt {c^{2}-(a^{2}+b^{2})}}}\arctan {\frac {(c-a)\tan {\frac {x}{2}}+b}{\sqrt {c^{2}-(a^{2}+b^{2})}}}+C\end{aligned}} If $4E=4(c-a)(c+a)-(2b)^{2}=4(c^{2}-(a^{2}+b^{2}))>0$ .

## Geometry The Weierstrass substitution parametrizes the unit circle centered at (0, 0). Instead of +∞ and −∞, we have only one ∞, at both ends of the real line. That is often appropriate when dealing with rational functions and with trigonometric functions. (This is the one-point compactification of the line.)

As x varies, the point (cos x, sin x) winds repeatedly around the unit circle centered at (0, 0). The point

$\left({\frac {1-t^{2}}{1+t^{2}}},{\frac {2t}{1+t^{2}}}\right)$ goes only once around the circle as t goes from −∞ to +∞, and never reaches the point (−1, 0), which is approached as a limit as t approaches ±∞. As t goes from −∞ to −1, the point determined by t goes through the part of the circle in the third quadrant, from (−1, 0) to (0, −1). As t goes from −1 to 0, the point follows the part of the circle in the fourth quadrant from (0, −1) to (1, 0). As t goes from 0 to 1, the point follows the part of the circle in the first quadrant from (1, 0) to (0, 1). Finally, as t goes from 1 to +∞, the point follows the part of the circle in the second quadrant from (0, 1) to (−1, 0).

Here is another geometric point of view. Draw the unit circle, and let P be the point (−1, 0). A line through P (except the vertical line) is determined by its slope. Furthermore, each of the lines (except the vertical line) intersects the unit circle in exactly two points, one of which is P. This determines a function from points on the unit circle to slopes. The trigonometric functions determine a function from angles to points on the unit circle, and by combining these two functions we have a function from angles to slopes.

## Hyperbolic functions

As with other properties shared between the trigonometric functions and the hyperbolic functions, it is possible to use hyperbolic identities to construct a similar form of the substitution:

$\sinh x={\frac {2t}{1-t^{2}}},$ $\cosh x={\frac {1+t^{2}}{1-t^{2}}},$ $\tanh x={\frac {2t}{1+t^{2}}},$ $dx={\frac {2}{1-t^{2}}}\,dt.$ 