Weierstrass Substitution
Solved Problems
Example 9.
Evaluate the integral \[\int {\frac{{dx}}{{1 + \csc x}}}.\]
Solution.
We will use the Weierstrass substitution. Hence
\[t = \tan \frac{x}{2},\;\; \Rightarrow x = 2\arctan t,\;\; \Rightarrow dx = \frac{{2dt}}{{1 + {t^2}}},\;\; \Rightarrow \csc x = \frac{{1 + {t^2}}}{{2t}}.\]
The integral becomes
\[I = \int {\frac{{dx}}{{1 + \csc x}}} = \int {\frac{{\frac{{2dt}}{{1 + {t^2}}}}}{{1 + \frac{{1 + {t^2}}}{{2t}}}}} = \int {\frac{{\frac{{2dt}}{{1 + {t^2}}}}}{{\frac{{2t + 1 + {t^2}}}{{2t}}}}} = \int {\frac{{2dt}}{{1 + {t^2}}} \cdot \frac{{2t}}{{{{\left( {t + 1} \right)}^2}}}} = \int {\frac{{4t}}{{\left( {1 + {t^2}} \right){{\left( {t + 1} \right)}^2}}}dt} .\]
Now we decompose the rational function in the integrand using the method of partial fractions. Since
\[\frac{{4t}}{{\left( {1 + {t^2}} \right){{\left( {t + 1} \right)}^2}}} = \frac{{At + B}}{{1 + {t^2}}} + \frac{C}{{t + 1}} + \frac{D}{{{{\left( {t + 1} \right)}^2}}},\]
we can write
\[4t = \left( {At + B} \right){\left( {t + 1} \right)^2} + C\left( {t + 1} \right)\left( {1 + {t^2}} \right) + D\left( {1 + {t^2}} \right),\]
\[4t = \left( {At + B} \right)\left( {{t^2} + 2t + 1} \right) + C\left( {t + 1 + {t^3} + {t^2}} \right) + D\left( {1 + {t^2}} \right),\]
\[\color{red}{4t} = \color{magenta}{A{t^3}} + \color{darkgreen}{B{t^2}} + \color{darkgreen}{2A{t^2}} + \color{red}{2Bt} + \color{red}{At} + \color{blue}{B} + \color{red}{Ct} + \color{blue}C + \color{magenta}{C{t^3}} + \color{darkgreen}{C{t^2}} + \color{blue}D + \color{darkgreen}{D{t^2}},\]
\[\color{red}{4t} = \left( \color{magenta}{A + C} \right)\color{magenta}{t^3} + \left( \color{darkgreen}{2A + B + C + D} \right)\color{darkgreen}{t^2} + \left( \color{red}{A + 2B + C} \right)\color{red}t + \left( \color{blue}{B + C + D} \right).\]
So we can determine the unknown coefficients from the following system of equations:
\[\left\{ \begin{array}{l}
A + C = 0\\
2A + B + C + D = 0\\
A + 2B + C = 4\\
B + C + D = 0
\end{array} \right.,\;\; \Rightarrow \left\{ \begin{array}{l}
A = 0\\
B = 2\\
C = 0\\
D = - 2
\end{array} \right..\]
Then
\[\frac{{4t}}{{\left( {1 + {t^2}} \right){{\left( {t + 1} \right)}^2}}} = \frac{2}{{1 + {t^2}}} - \frac{2}{{{{\left( {t + 1} \right)}^2}}},\]
and the integral takes the form
\[I = \int {\frac{{4t}}{{\left( {1 + {t^2}} \right){{\left( {t + 1} \right)}^2}}}dt} = \int {\left( {\frac{2}{{1 + {t^2}}} - \frac{2}{{{{\left( {t + 1} \right)}^2}}}} \right)dt} = 2\int {\frac{{dt}}{{1 + {t^2}}}} - 2\int {\frac{{dt}}{{{{\left( {t + 1} \right)}^2}}}} = 2\arctan t + \frac{2}{{t + 1}} + C = 2\arctan \left( {\tan \frac{x}{2}} \right) + \frac{2}{{\tan \frac{x}{2} + 1}} + C = 2 \cdot \frac{x}{2} + \frac{2}{{\tan \frac{x}{2} + 1}} + C = x + \frac{2}{{\tan \frac{x}{2} + 1}} + C.\]
Example 10.
Calculate the integral \[\int {\frac{{dx}}{{{{\sin }^4}x + {{\cos }^4}x}}}.\]
Solution.
Since \({\sin ^2}x + {\cos ^2}x = 1,\) we can write
\[\left( {{{\sin }^2}x + {{\cos }^2}x} \right)^2 = {\sin ^4}x + 2\,{\sin ^2}x\,{\cos ^2}x + {\cos ^4}x = 1.\]
Hence,
\[{\sin ^4}x + {\cos ^4}x = 1 - 2\,{\sin ^2}x\,{\cos ^2}x = 1 - \frac{{{{\left( {2\sin x\cos x} \right)}^2}}}{2} = 1 - \frac{{{{\sin }^2}2x}}{2},\]
so the integral can be transformed in the following way:
\[I = \int {\frac{{dx}}{{{{\sin }^4}x + {{\cos }^4}x}}} = \int {\frac{{dx}}{{1 - \frac{{{{\sin }^2}2x}}{2}}}} = \int {\frac{{d\left( {2x} \right)}}{{2 - {{\sin }^2}2x}}} .\]
We make the substitution
\[t = \tan 2x,\;\;\Rightarrow d\left( {2x} \right) = \frac{{dt}}{{1 + {t^2}}}.\]
Then use the identity
\[{\sin ^2}2x = \frac{{{{\tan }^2}2x}}{{1 + {{\tan }^2}2x}} = \frac{{{t^2}}}{{1 + {t^2}}}.\]
The final answer is given by
\[I = \int {\frac{{\frac{{dt}}{{1 + {t^2}}}}}{{2 - \frac{{{t^2}}}{{1 + {t^2}}}}}} = \int {\frac{{dt}}{{2 + 2{t^2} - {t^2}}}} = \int {\frac{{dt}}{{{{\left( {\sqrt 2 } \right)}^2} + {t^2}}}} = \frac{1}{{\sqrt 2 }}\arctan \frac{t}{{\sqrt 2 }} + C = \frac{1}{{\sqrt 2 }}\arctan \left( {\frac{{\tan 2x}}{{\sqrt 2 }}} \right) + C.\]
Example 11.
Calculate the integral \[\int {\frac{{dx}}{{a\sin x + b\cos x}}}.\]
Solution.
We solve this integral by making the trigonometric substitution
\[t = \tan \frac{x}{2},\;\; \Rightarrow x = 2\arctan t,\;\;\; dx = \frac{{2dt}}{{1 + {t^2}}}.\]
Taking into account that
\[\sin x = {\frac{{2t}}{{1 + {t^2}}}},\;\cos x = {\frac{{1 - {t^2}}}{{1 + {t^2}}}},\]
we find the integral:
\[\int {\frac{{dx}}{{a\sin x + b\cos x}}} = \int {\frac{{\frac{{2dt}}{{1 + {t^2}}}}}{{\frac{{2at}}{{1 + {t^2}}} + \frac{{b - b{t^2}}}{{1 + {t^2}}}}}} = \int {\frac{{2dt}}{{2at + b - b{t^2}}}} = \frac{2}{b}\int {\frac{{dt}}{{1 - \left( {{t^2} - \frac{{2a}}{b}t} \right)}}} = \frac{2}{b}\int {\frac{{dt}}{{1 - \left( {{t^2} - \frac{{2a}}{b}t + \frac{{4{a^2}}}{{{b^2}}} - \frac{{4{a^2}}}{{{b^2}}}} \right)}}} = \frac{2}{b}\int {\frac{{dt}}{{1 + \frac{{4{a^2}}}{{{b^2}}} - {{\left( {t - \frac{a}{b}} \right)}^2}}}} = \frac{2}{b}\int {\frac{{d\left( {t - \frac{a}{b}} \right)}}{{{{\left( {\sqrt {\frac{{{b^2} + 4{a^2}}}{b}} } \right)}^2} - {{\left( {t - \frac{a}{b}} \right)}^2}}}} = \frac{2}{b} \cdot \frac{1}{{\frac{{2\sqrt {{b^2} + 4{a^2}} }}{b}}} \cdot \ln \left| {\frac{{\frac{{\sqrt {{b^2} + 4{a^2}} }}{b} + \left( {t - \frac{a}{b}} \right)}}{{\frac{{\sqrt {{b^2} + 4{a^2}} }}{b} - \left( {t - \frac{a}{b}} \right)}}} \right| + C = \frac{1}{{\sqrt {{b^2} + 4{a^2}} }} \ln \left| {\frac{{\sqrt {{b^2} + 4{a^2}} + b\tan \frac{x}{2} - a}}{{\sqrt {{b^2} + 4{a^2}} - b\tan \frac{x}{2} + a}}} \right| + C.\]
Example 12.
Find the integral \[\int {\frac{{dx}}{{3\sin x + 4\cos x}}}.\]
Solution.
We use the Weierstrass substitution:
\[t = \tan \frac{x}{2},\;\; \Rightarrow x = 2\arctan t,\;\; dx = \frac{{2dt}}{{1 + {t^2}}},\;\; \sin x = \frac{{2t}}{{1 + {t^2}}},\;\; \cos x = \frac{{1 - {t^2}}}{{1 + {t^2}}}.\]
So the integral becomes
\[\int {\frac{{dx}}{{3\sin x + 4\cos x}}} = \int {\frac{{\frac{{2dt}}{{1 + {t^2}}}}}{{3 \cdot \frac{{2t}}{{1 + {t^2}}} + 4 \cdot \frac{{1 - {t^2}}}{{1 + {t^2}}}}}} = \int {\frac{{2dt}}{{6t + 4 - 4{t^2}}}} = \frac{2}{4}\int {\frac{{dt}}{{1 - \left( {{t^2} - \frac{6}{4}t} \right)}}} = \frac{1}{2}\int {\frac{{dt}}{{1 - \left( {{t^2} - \frac{6}{4}t + \frac{9}{{16}} - \frac{9}{{16}}} \right)}}} = \frac{1}{2}\int {\frac{{dt}}{{1 + \frac{9}{{16}} - {{\left( {t - \frac{3}{4}} \right)}^2}}}} = \frac{1}{2}\int {\frac{{dt}}{{{{\left( {\frac{5}{4}} \right)}^2} - {{\left( {t - \frac{3}{4}} \right)}^2}}}} = \frac{1}{2} \cdot \frac{1}{{2 \cdot \frac{5}{4}}}\ln \left| {\frac{{\frac{5}{4} + t - \frac{3}{4}}}{{\frac{5}{4} - t + \frac{3}{4}}}} \right| + C = \frac{1}{5}\ln \left| {\frac{{\frac{1}{2} + t}}{{2 - t}}} \right| + C = \frac{1}{5}\ln \left| {\frac{{1 + 2t}}{{4 - 2t}}} \right| + C = \frac{1}{5}\ln \left| {\frac{{1 + 2\tan \frac{x}{2}}}{{4 - 2\tan \frac{x}{2}}}} \right| + C.\]
Example 13.
Find the integral \[\int {\frac{{dx}}{{5\sin x + 12\cos x}}}.\]
Solution.
Using the Weierstrass substitution:
\[t = \tan \frac{x}{2},\;\; \Rightarrow x = 2\arctan t,\;\; dx = \frac{{2dt}}{{1 + {t^2}}},\;\; \sin x = \frac{{2t}}{{1 + {t^2}}},\;\; \cos x = \frac{{1 - {t^2}}}{{1 + {t^2}}},\]
we obtain
\[\int {\frac{{dx}}{{12\sin x + 13\cos x}}} = \int {\frac{{\frac{{2dt}}{{1 + {t^2}}}}}{{12 \cdot \frac{{2t}}{{1 + {t^2}}} + 13 \cdot \frac{{1 - {t^2}}}{{1 + {t^2}}}}}} = \int {\frac{{2dt}}{{10t + 12 - 12{t^2}}}} = \frac{2}{{12}}\int {\frac{{dt}}{{1 - \left( {{t^2} - \frac{{10}}{{12}}t} \right)}}} = \frac{1}{6}\int {\frac{{dt}}{{1 + \frac{{25}}{{144}} - {{\left( {t - \frac{5}{{12}}} \right)}^2}}}} = \frac{1}{6}\int {\frac{{dt}}{{{{\left( {\frac{{13}}{{12}}} \right)}^2} - {{\left( {t - \frac{5}{{12}}} \right)}^2}}}} = \frac{1}{6} \cdot \frac{1}{{2 \cdot \frac{{13}}{{12}}}}\ln \left| {\frac{{\frac{{13}}{{12}} + t - \frac{5}{{12}}}}{{\frac{{13}}{{12}} - t + \frac{5}{{12}}}}} \right| + C = \frac{1}{{13}}\ln \left| {\frac{{\frac{4}{6} + t}}{{\frac{9}{6} - t}}} \right| + C = \frac{1}{{13}}\ln \left| {\frac{{4 + 6t}}{{9 - 6t}}} \right| + C = \frac{1}{{13}}\ln \left| {\frac{{4 + 6\tan \frac{x}{2}}}{{9 - 6\tan \frac{x}{2}}}} \right| + C.\]
Example 14.
Compute the integral \[\int {\frac{{dx}}{{5\sin x + 2\cos x + 2}}}.\]
Solution.
We reduce the integral to rational form using the Weierstrass substitution:
\[t = \tan \frac{x}{2},\;\; \Rightarrow x = 2\arctan t,\;\; dx = \frac{{2dt}}{{1 + {t^2}}},\;\; \sin x = \frac{{2t}}{{1 + {t^2}}},\;\; \cos x = \frac{{1 - {t^2}}}{{1 + {t^2}}}.\]
This yields:
\[\int {\frac{{dx}}{{5\sin x + 2\cos x + 2}}} = \int {\frac{{\frac{{2dt}}{{1 + {t^2}}}}}{{5 \cdot \frac{{2t}}{{1 + {t^2}}} + 2 \cdot \frac{{1 - {t^2}}}{{1 + {t^2}}} + 2}}} = \int {\frac{{2dt}}{{10t + 2 - 2{t^2} + 2 + 2{t^2}}}} = \int {\frac{{dt}}{{5t + 2}}} = \frac{1}{5}\ln \left| {5t + 2} \right| + C = \frac{1}{5}\ln \left| {5\tan \frac{x}{2} + 2} \right| + C.\]
Example 15.
Find the integral \[\int {\frac{{dx}}{{2\sin x - \cos x + 5}}}.\]
Solution.
We have a rational expression in \(\sin x\) and \(\cos x\) in the denominator, so we use the Weierstrass substitution to simplify the integral:
\[t = \tan \frac{x}{2},\;\; \Rightarrow x = 2\arctan t,\;\; \Rightarrow dx = \frac{{2dt}}{{1 + {t^2}}},\]
and
\[\sin x = \frac{{2t}}{{1 + {t^2}}},\;\; \cos x = \frac{{1 - {t^2}}}{{1 + {t^2}}}.\]
Then the integral is written as
\[I = \int {\frac{{dx}}{{2\sin x - \cos x + 5}}} = \int {\frac{{\frac{{2dt}}{{1 + {t^2}}}}}{{2 \cdot \frac{{2t}}{{1 + {t^2}}} - \frac{{1 - {t^2}}}{{1 + {t^2}}} + 5}}} = \int {\frac{{\frac{{2dt}}{{1 + {t^2}}}}}{{\frac{{4t - 1 + {t^2} + 5 + 5{t^2}}}{{1 + {t^2}}}}}} = \int {\frac{{2dt}}{{6{t^2} + 4t + 4}}} = \int {\frac{{dt}}{{3{t^2} + 2t + 2}}} .\]
To compute the integral, we complete the square in the denominator:
\[I = \int {\frac{{dt}}{{3{t^2} + 2t + 2}}} = \frac{1}{3}\int {\frac{{dt}}{{{t^2} + \frac{2}{3}t + \frac{2}{3}}}} = \frac{1}{3}\int {\frac{{dt}}{{\left( {{t^2} + \frac{2}{3}t + \frac{1}{9}} \right) - \frac{1}{9} + \frac{2}{3}}}} = \frac{1}{3}\int {\frac{{dt}}{{{{\left( {t + \frac{1}{3}} \right)}^2} + \frac{5}{9}}}} = \frac{1}{3}\int {\frac{{dt}}{{{{\left( {t + \frac{1}{3}} \right)}^2} + {{\left( {\frac{{\sqrt 5 }}{3}} \right)}^2}}}} = \frac{1}{3} \cdot \frac{1}{{\frac{{\sqrt 5 }}{3}}}\arctan \frac{{t + \frac{1}{3}}}{{\frac{{\sqrt 5 }}{3}}} + C = \frac{1}{{\sqrt 5 }}\arctan \frac{{3t + 1}}{{\sqrt 5 }} + C = \frac{1}{{\sqrt 5 }}\arctan \left( {\frac{{3\tan \frac{x}{2} + 1}}{{\sqrt 5 }}} \right) + C.\]
Example 16.
Find the integral \[\int {\frac{{2dx}}{{4\sin x - 3\cos x + 5}}}.\]
Solution.
We make the tangent half-angle substitution:
\[t = \tan \frac{x}{2},\;\; \Rightarrow x = 2\arctan t,\;\; dx = \frac{{2dt}}{{1 + {t^2}}},\;\; \sin x = \frac{{2t}}{{1 + {t^2}}},\;\; \cos x = \frac{{1 - {t^2}}}{{1 + {t^2}}}.\]
This yields:
\[\int {\frac{{2dx}}{{4\sin x - 3\cos x + 5}}} = \int {\frac{{2 \cdot \frac{{2dt}}{{1 + {t^2}}}}}{{4 \cdot \frac{{2t}}{{1 + {t^2}}} - 3 \cdot \frac{{1 - {t^2}}}{{1 + {t^2}}} + 5}}} = \int {\frac{{4dt}}{{8t - 3\left( {1 - {t^2}} \right) + 5\left( {1 + {t^2}} \right)}}} = \int {\frac{{4dt}}{{8t - 3 + 3{t^2} + 5 + 5{t^2}}}} = \int {\frac{{4dt}}{{8{t^2} + 8t + 2}}} = 2\int {\frac{{dt}}{{4{t^2} + 4t + 1}}} = 2\int {\frac{{dt}}{{{{\left( {2t + 1} \right)}^2}}}} = 2 \cdot \left( { - \frac{1}{2}} \right) \cdot \frac{1}{{2t + 1}} + C = - \frac{1}{{2t + 1}} + C = - \frac{1}{{2\tan \frac{x}{2} + 1}} + C.\]
Example 17.
Find the integral \[\int {\frac{{dx}}{{\sin x + \cos x - 1}}}.\]
Solution.
Using the Weierstrass substitution
\[t = \tan \frac{x}{2},\;\; \Rightarrow x = 2\arctan t,\;\; dx = \frac{{2dt}}{{1 + {t^2}}},\;\; \sin x = \frac{{2t}}{{1 + {t^2}}},\;\; \cos x = \frac{{1 - {t^2}}}{{1 + {t^2}}},\]
we rewrite the integral in \(t-\)terms:
\[I = \int {\frac{{dx}}{{\sin x + \cos x - 1}}} = \int {\frac{{\frac{{2dt}}{{1 + {t^2}}}}}{{\frac{{2t}}{{1 + {t^2}}} + \frac{{1 - {t^2}}}{{1 + {t^2}}} - 1}}} = \int {\frac{{2dt}}{{2t + 1 - {t^2} - 1 - {t^2}}}} = \int {\frac{{2dt}}{{2t - 2{t^2}}}} = \int {\frac{{dt}}{{t - {t^2}}}} .\]
Decompose the integrand into partial fractions:
\[\frac{1}{{t\left( {1 - t} \right)}} = \frac{A}{t} + \frac{B}{{1 - t}},\]
\[1 = A\left( {1 - t} \right) + Bt,\]
\[1 = A - At + Bt,\]
\[1 = \left( {B - A} \right)t + A.\]
Hence
\[\left\{ \begin{array}{l}
B - A = 0\\
A = 1
\end{array} \right.,\;\; \Rightarrow \left\{ \begin{array}{l}
A = 1\\
B = 1
\end{array} \right..\]
The initial integral is written as the difference of two simple integrals:
\[I = \int {\frac{{dt}}{{t - {t^2}}}} = \int {\left( {\frac{1}{t} + \frac{1}{{1 - t}}} \right)dt} = \int {\frac{{dt}}{t}} - \int {\frac{{dt}}{{t - 1}}} = \ln \left| t \right| - \ln \left| {t - 1} \right| + C = \ln \left| {\frac{t}{{t - 1}}} \right| + C = \ln \left| {\frac{{\tan \frac{x}{2}}}{{\tan \frac{x}{2} - 1}}} \right| + C.\]
Example 18.
Find the integral \[\int {\frac{{dx}}{{1 + \tan x}}}.\]
Solution.
We make the substitution:
\[t = \tan x,\;\; \Rightarrow x = \arctan t,\;\;\; dx = \frac{{dt}}{{1 + {t^2}}}.\]
As a result, the integral becomes
\[I = \int {\frac{{dx}}{{1 + \tan x}}} = \int {\frac{{\frac{{dt}}{{1 + {t^2}}}}}{{1 + t}}} = \int {\frac{{dt}}{{\left( {1 + t} \right)\left( {1 + {t^2}} \right)}}} .\]
Using the method of partial fractions, we can write the integrand as
\[\frac{1}{{\left( {1 + t} \right)\left( {1 + {t^2}} \right)}} = \frac{A}{{1 + t}} + \frac{{Bt + C}}{{1 + {t^2}}}.\]
Calculate the coefficients \(A, B, C:\)
\[1 = A\left( {1 + {t^2}} \right) + \left( {Bt + C} \right)\left( {1 + t} \right),\;\; \Rightarrow 1 = A + A{t^2} + Bt + C + B{t^2} + Ct.\]
Hence,
\[
\left\{ \begin{array}{l}
A + C = 1\\
A + B = 0\\
B + C = 0
\end{array} \right.,\;\; \Rightarrow
\left\{ \begin{array}{l}
A = \frac{1}{2}\\
B = - \frac{1}{2}\\
C = \frac{1}{2}
\end{array} \right..\]
So the integral is
\[I = \frac{1}{2}\int {\left( {\frac{1}{{1 + t}} + \frac{{1 - t}}{{1 + {t^2}}}} \right)dt} = \frac{1}{2}\ln \left| {t + 1} \right| - \frac{1}{2}\int {\frac{{t - 1}}{{1 + {t^2}}}dt} = \frac{1}{2}\ln \left| {t + 1} \right| - \frac{1}{4}\int {\frac{{2tdt}}{{1 + {t^2}}}} + \frac{1}{2}\int {\frac{{dt}}{{1 + {t^2}}}} = \frac{1}{2}\ln \left| {t + 1} \right| - \frac{1}{4}\int {\frac{{d\left( {1 + {t^2}} \right)}}{{1 + {t^2}}}} + \frac{1}{2}\arctan t = \frac{1}{2}\ln \left| {t + 1} \right| - \frac{1}{4}\ln \left( {{t^2} + 1} \right) + \frac{1}{2}\arctan t + C = \frac{1}{2}\ln \left| {\tan x + 1} \right| - \frac{1}{4}\ln \left( {{{\tan }^2}x + 1} \right) + \frac{x}{2} + C.\]