Calculus/Integration techniques/Tangent Half Angle

 ← Integration techniques/Partial Fraction Decomposition Calculus Integration techniques/Reduction Formula → Integration techniques/Tangent Half Angle

Another useful change of variables is the Weierstrass substitution, named after Karl Weierstrass:

$t=\tan \left({\tfrac {x}{2}}\right)$ With this transformation, using the double-angle trigonometric identities,

$\sin(x)={\frac {2t}{1+t^{2}}}\quad \cos(x)={\frac {1-t^{2}}{1+t^{2}}}\quad \tan(x)={\frac {2t}{1-t^{2}}}\quad dx={\frac {2\ dt}{1+t^{2}}}$ This transforms a trigonometric integral into an algebraic integral, which may be easier to integrate.

For example, if the integrand is ${\frac {1}{1+\sin(x)}}$ then

$\int \limits _{0}^{\frac {\pi }{2}}{\frac {dx}{1+\sin(x)}}=\int \limits _{0}^{1}{\frac {\left({\frac {2\ dt}{1+t^{2}}}\right)}{1+\left({\frac {2t}{1+t^{2}}}\right)}}=\int \limits _{0}^{1}{\frac {2\ dt}{(t+1)^{2}}}$ This method can be used to further simplify trigonometric integrals produced by the changes of variables described earlier.

For example, if we are considering the integral

$I=\int \limits _{-1}^{1}{\frac {\sqrt {1-x^{2}}}{1+x^{2}}}dx$ we can first use the substitution $x=\sin(\theta )$ , which gives

$I=\int \limits _{-{\frac {\pi }{2}}}^{\frac {\pi }{2}}{\frac {\cos ^{2}(\theta )}{1+\sin ^{2}(\theta )}}d\theta$ then use the tan-half-angle substition to obtain

$I=\int \limits _{-1}^{1}{\frac {(1-t^{2})^{2}}{1+6t^{2}+t^{4}}}\cdot {\frac {2\ dt}{1+t^{2}}}$ In effect, we've removed the square root from the original integrand. We could do this with a single change of variables, but doing it in two steps gives us the opportunity of doing the trigonometric integral another way.

Having done this, we can split the new integrand into partial fractions, and integrate.

{\begin{aligned}I&=\int \limits _{-1}^{1}{\frac {2-{\sqrt {2}}}{t^{2}+3-2{\sqrt {2}}}}dt+\int \limits _{-1}^{1}{\frac {2+{\sqrt {2}}}{t^{2}+3+2{\sqrt {2}}}}dt-\int \limits _{-1}^{1}{\frac {2}{1+t^{2}}}dt\\[8pt]&={\frac {4-2{\sqrt {2}}}{\sqrt {3-2{\sqrt {2}}}}}\cdot \arctan \left({\sqrt {3+2{\sqrt {2}}}}\right)+{\frac {4+2{\sqrt {2}}}{\sqrt {3+2{\sqrt {2}}}}}\cdot \arctan \left({\sqrt {3-2{\sqrt {2}}}}\right)-\pi \end{aligned}} This result can be further simplified by use of the identities

$3\pm 2{\sqrt {2}}=\left({\sqrt {2}}\pm 1\right)^{2}\quad \arctan \left({\sqrt {2}}\pm 1\right)=\left({\frac {1}{4}}\pm {\frac {1}{8}}\right)\pi$ $I=\left({\sqrt {2}}-1\right)\pi$ In principle, this approach will work with any integrand which is the square root of a quadratic multiplied by the ratio of two polynomials. However, it should not be applied automatically.

E.g., in this last example, once we deduced

$I=\int \limits _{-{\frac {\pi }{2}}}^{\frac {\pi }{2}}{\frac {\cos ^{2}(\theta )}{1+\sin ^{2}(\theta )}}d\theta$ we could have used the double angle formula, since this contains only even powers of cos and sin. Doing that gives

$I=\int \limits _{-{\frac {\pi }{2}}}^{\frac {\pi }{2}}{\frac {1+\cos(2\theta )}{3-\cos(2\theta )}}d\theta ={\frac {1}{2}}\int \limits _{-\pi }^{\pi }{\frac {1+\cos(\phi )}{3-\cos(\phi )}}d\phi$ Using tan-half-angle on this new, simpler, integrand gives

{\begin{aligned}I&=\int \limits _{-\infty }^{\infty }{\frac {1}{1+2t^{2}}}\cdot {\frac {dt}{1+t^{2}}}\\&=\int \limits _{-\infty }^{\infty }{\frac {2\ dt}{1+2t^{2}}}-\int \limits _{-\infty }^{\infty }{\frac {dt}{1+t^{2}}}\end{aligned}} This can be integrated on sight to give

$I={\frac {4}{\sqrt {2}}}\cdot {\frac {\pi }{2}}-2{\frac {\pi }{2}}=\left({\sqrt {2}}-1\right)\pi$ This is the same result as before, but obtained with less algebra, which shows why it is best to look for the most straightforward methods at every stage.

A more direct way of evaluating the integral I is to substitute $t=\tan(\theta )$ right from the start, which will directly bring us to the line

$I=\int \limits _{-\infty }^{\infty }{\frac {1}{1+2t^{2}}}\cdot {\frac {dt}{1+t^{2}}}$ above. More generally, the substitution $t=\tan(x)$ gives us

$\sin(x)={\frac {t}{\sqrt {1+t^{2}}}}\quad \cos(x)={\frac {1}{\sqrt {1+t^{2}}}}\quad dx={\frac {dt}{1+t^{2}}}$ so this substitution is the preferable one to use if the integrand is such that all the square roots would disappear after substitution, as is the case in the above integral.

Example

Using the trigonometric substitution $t=a\tan(x)$ , then $dt=a\sec ^{2}(x)dx$ and ${\sqrt {t^{2}+a^{2}}}=a\sec(x)$ when $-{\frac {\pi }{2}} . So,

 $\int {\frac {dt}{(t^{2}+a^{2}){\sqrt {t^{2}+a^{2}}}}}$ $=\int {\frac {a\sec ^{2}(x)}{a^{3}\sec ^{3}(x)}}dx$ $={\frac {1}{a^{2}}}\int \cos(x)dx$ $={\frac {\sin(x)}{a^{2}}}+C$ $={\frac {1}{a^{2}}}\cdot {\frac {a\tan(x)}{a\sec(x)}}+C$ $={\frac {t}{a^{2}{\sqrt {t^{2}+a^{2}}}}}+C$ Alternate Method

In general, to evaluate integrals of the form

$\int {\frac {A+B\cos(x)+C\sin(x)}{a+b\cos(x)+c\sin(x)}}\ dx$ ,

it is extremely tedious to use the aforementioned "tan half angle" substitution directly, as one easily ends up with a rational function with a 4th degree denominator. Instead, we may first write the numerator as

${A+B\cos(x)+C\sin(x)\equiv p{\Big (}a+b\cos(x)+c\sin(x){\Big )}+q{\frac {d}{dx}}{\Big (}a+b\cos(x)+c\sin(x){\Big )}+r}$ .

Then the integral can be written as

{\begin{aligned}\int \left(p+q\cdot {\frac {{\frac {d}{dx}}{\bigl (}a+b\cos(x)+c\sin(x){\bigr )}}{a+b\cos(x)+c\sin(x)}}+{\frac {r}{a+b\cos(x)+c\sin(x)}}\right)dx\end{aligned}} which can be evaluated much more easily.

Example

Evaluate $\int {\frac {\cos(x)+2}{\cos(x)+\sin(x)}}dx$ ,

Let

$\cos(x)+2\equiv p{\Big (}\cos(x)+\sin(x){\Big )}+q{\frac {d}{dx}}{\Big (}\cos(x)+\sin(x){\Big )}+r$ .

Then

$\cos(x)+2\equiv p{\Big (}\cos(x)+\sin(x){\Big )}+q{\Big (}\cos(x)-\sin(x){\Big )}+r$ $\cos(x)+2\equiv (p+q)\cos(x)+(p-q)\sin(x)+r$ Comparing coefficients of cos(x), sin(x) and the constants on both sides, we obtain

${\begin{cases}p+q&=1\\p-q&=0\\r&=2\end{cases}}$ yielding p = q = 1/2, r = 2. Substituting back into the integrand,

{\begin{aligned}\int {\frac {\cos(x)+2}{\cos(x)+\sin(x)}}dx=\int {\frac {dx}{2}}+{\frac {1}{2}}\int {\frac {d{\bigl (}\cos(x)+\sin(x){\bigr )}}{\cos(x)+\sin(x)}}+\int {\frac {2}{\cos(x)+\sin(x)}}dx\end{aligned}} The last integral can now be evaluated using the "tan half angle" substitution described above, and we obtain

$\int {\frac {2}{\cos(x)+\sin(x)}}dx={\sqrt {2}}\ln \left|{\frac {\tan {\bigl (}{\frac {x}{2}}{\bigr )}-1+{\sqrt {2}}}{\tan {\bigl (}{\frac {x}{2}}{\bigr )}-1-{\sqrt {2}}}}\right|+C$ .

The original integral is thus

${\int {\frac {\cos(x)+2}{\cos(x)+\sin(x)}}dx={\frac {x+\ln {\Big |}\cos(x)+\sin(x){\Big |}}{2}}+{\sqrt {2}}\ln \left|{\frac {\tan {\bigl (}{\frac {x}{2}}{\bigr )}-1+{\sqrt {2}}}{\tan {\bigl (}{\frac {x}{2}}{\bigr )}-1-{\sqrt {2}}}}\right|+C}$ .
 ← Integration techniques/Partial Fraction Decomposition Calculus Integration techniques/Reduction Formula → Integration techniques/Tangent Half Angle