Another useful change of variables is the Weierstrass substitution, named after Karl Weierstrass:
t
=
tan
(
x
2
)
{\displaystyle t=\tan \left({\tfrac {x}{2}}\right)}
With this transformation, using the double-angle trigonometric identities,
sin
(
x
)
=
2
t
1
+
t
2
cos
(
x
)
=
1
−
t
2
1
+
t
2
tan
(
x
)
=
2
t
1
−
t
2
d
x
=
2
d
t
1
+
t
2
{\displaystyle \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
1
1
+
sin
(
x
)
{\displaystyle {\frac {1}{1+\sin(x)}}}
then
∫
0
π
2
d
x
1
+
sin
(
x
)
=
∫
0
1
(
2
d
t
1
+
t
2
)
1
+
(
2
t
1
+
t
2
)
=
∫
0
1
2
d
t
(
t
+
1
)
2
{\displaystyle \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
=
∫
−
1
1
1
−
x
2
1
+
x
2
d
x
{\displaystyle I=\int \limits _{-1}^{1}{\frac {\sqrt {1-x^{2}}}{1+x^{2}}}dx}
we can first use the substitution
x
=
sin
(
θ
)
{\displaystyle x=\sin(\theta )}
, which gives
I
=
∫
−
π
2
π
2
cos
2
(
θ
)
1
+
sin
2
(
θ
)
d
θ
{\displaystyle 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
=
∫
−
1
1
(
1
−
t
2
)
2
1
+
6
t
2
+
t
4
⋅
2
d
t
1
+
t
2
{\displaystyle 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.
I
=
∫
−
1
1
2
−
2
t
2
+
3
−
2
2
d
t
+
∫
−
1
1
2
+
2
t
2
+
3
+
2
2
d
t
−
∫
−
1
1
2
1
+
t
2
d
t
=
4
−
2
2
3
−
2
2
⋅
arctan
(
3
+
2
2
)
+
4
+
2
2
3
+
2
2
⋅
arctan
(
3
−
2
2
)
−
π
{\displaystyle {\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
±
2
2
=
(
2
±
1
)
2
arctan
(
2
±
1
)
=
(
1
4
±
1
8
)
π
{\displaystyle 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 }
ultimately leading to
I
=
(
2
−
1
)
π
{\displaystyle 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
=
∫
−
π
2
π
2
cos
2
(
θ
)
1
+
sin
2
(
θ
)
d
θ
{\displaystyle 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
=
∫
−
π
2
π
2
1
+
cos
(
2
θ
)
3
−
cos
(
2
θ
)
d
θ
=
1
2
∫
−
π
π
1
+
cos
(
ϕ
)
3
−
cos
(
ϕ
)
d
ϕ
{\displaystyle 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
I
=
∫
−
∞
∞
1
1
+
2
t
2
⋅
d
t
1
+
t
2
=
∫
−
∞
∞
2
d
t
1
+
2
t
2
−
∫
−
∞
∞
d
t
1
+
t
2
{\displaystyle {\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
=
4
2
⋅
π
2
−
2
π
2
=
(
2
−
1
)
π
{\displaystyle 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
(
θ
)
{\displaystyle t=\tan(\theta )}
right from the start, which will directly bring us to the line
I
=
∫
−
∞
∞
1
1
+
2
t
2
⋅
d
t
1
+
t
2
{\displaystyle I=\int \limits _{-\infty }^{\infty }{\frac {1}{1+2t^{2}}}\cdot {\frac {dt}{1+t^{2}}}}
above. More generally, the substitution
t
=
tan
(
x
)
{\displaystyle t=\tan(x)}
gives us
sin
(
x
)
=
t
1
+
t
2
cos
(
x
)
=
1
1
+
t
2
d
x
=
d
t
1
+
t
2
{\displaystyle \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
)
{\displaystyle t=a\tan(x)}
, then
d
t
=
a
sec
2
(
x
)
d
x
{\displaystyle dt=a\sec ^{2}(x)dx}
and
t
2
+
a
2
=
a
sec
(
x
)
{\displaystyle {\sqrt {t^{2}+a^{2}}}=a\sec(x)}
when
−
π
2
<
x
<
π
2
{\displaystyle -{\frac {\pi }{2}}<x<{\frac {\pi }{2}}}
. So,
∫
d
t
(
t
2
+
a
2
)
t
2
+
a
2
{\displaystyle \int {\frac {dt}{(t^{2}+a^{2}){\sqrt {t^{2}+a^{2}}}}}}
=
∫
a
sec
2
(
x
)
a
3
sec
3
(
x
)
d
x
{\displaystyle =\int {\frac {a\sec ^{2}(x)}{a^{3}\sec ^{3}(x)}}dx}
=
1
a
2
∫
cos
(
x
)
d
x
{\displaystyle ={\frac {1}{a^{2}}}\int \cos(x)dx}
=
sin
(
x
)
a
2
+
C
{\displaystyle ={\frac {\sin(x)}{a^{2}}}+C}
=
1
a
2
⋅
a
tan
(
x
)
a
sec
(
x
)
+
C
{\displaystyle ={\frac {1}{a^{2}}}\cdot {\frac {a\tan(x)}{a\sec(x)}}+C}
=
t
a
2
t
2
+
a
2
+
C
{\displaystyle ={\frac {t}{a^{2}{\sqrt {t^{2}+a^{2}}}}}+C}
In general, to evaluate integrals of the form
∫
A
+
B
cos
(
x
)
+
C
sin
(
x
)
a
+
b
cos
(
x
)
+
c
sin
(
x
)
d
x
{\displaystyle \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
)
≡
p
(
a
+
b
cos
(
x
)
+
c
sin
(
x
)
)
+
q
d
d
x
(
a
+
b
cos
(
x
)
+
c
sin
(
x
)
)
+
r
{\displaystyle {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
∫
(
p
+
q
⋅
d
d
x
(
a
+
b
cos
(
x
)
+
c
sin
(
x
)
)
a
+
b
cos
(
x
)
+
c
sin
(
x
)
+
r
a
+
b
cos
(
x
)
+
c
sin
(
x
)
)
d
x
{\displaystyle {\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.
Evaluate
∫
cos
(
x
)
+
2
cos
(
x
)
+
sin
(
x
)
d
x
{\displaystyle \int {\frac {\cos(x)+2}{\cos(x)+\sin(x)}}dx}
,
Let
cos
(
x
)
+
2
≡
p
(
cos
(
x
)
+
sin
(
x
)
)
+
q
d
d
x
(
cos
(
x
)
+
sin
(
x
)
)
+
r
{\displaystyle \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
≡
p
(
cos
(
x
)
+
sin
(
x
)
)
+
q
(
cos
(
x
)
−
sin
(
x
)
)
+
r
{\displaystyle \cos(x)+2\equiv p{\Big (}\cos(x)+\sin(x){\Big )}+q{\Big (}\cos(x)-\sin(x){\Big )}+r}
cos
(
x
)
+
2
≡
(
p
+
q
)
cos
(
x
)
+
(
p
−
q
)
sin
(
x
)
+
r
{\displaystyle \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
{
p
+
q
=
1
p
−
q
=
0
r
=
2
{\displaystyle {\begin{cases}p+q&=1\\p-q&=0\\r&=2\end{cases}}}
yielding p = q = 1/2, r = 2. Substituting back into the integrand,
∫
cos
(
x
)
+
2
cos
(
x
)
+
sin
(
x
)
d
x
=
∫
d
x
2
+
1
2
∫
d
(
cos
(
x
)
+
sin
(
x
)
)
cos
(
x
)
+
sin
(
x
)
+
∫
2
cos
(
x
)
+
sin
(
x
)
d
x
{\displaystyle {\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
∫
2
cos
(
x
)
+
sin
(
x
)
d
x
=
2
ln
|
tan
(
x
2
)
−
1
+
2
tan
(
x
2
)
−
1
−
2
|
+
C
{\displaystyle \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
∫
cos
(
x
)
+
2
cos
(
x
)
+
sin
(
x
)
d
x
=
x
+
ln
|
cos
(
x
)
+
sin
(
x
)
|
2
+
2
ln
|
tan
(
x
2
)
−
1
+
2
tan
(
x
2
)
−
1
−
2
|
+
C
{\displaystyle {\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}}
.