# Weierstrass Substitution

The Weierstrass substitution, named after German mathematician Karl Weierstrass (1815−1897), is used for converting rational expressions of trigonometric functions into algebraic rational functions, which may be easier to integrate.

This method of integration is also called the tangent half-angle substitution as it implies the following half-angle identities:

where $$t = \tan \frac{x}{2}$$ or $$x = 2\arctan t.$$

The differential $$dx$$ is determined as follows:

$dx = d\left( {2\arctan t} \right) = \frac{{2dt}}{{1 + {t^2}}}.$

Any rational expression of trigonometric functions can be always reduced to integrating a rational function by making the Weierstrass substitution.

The Weierstrass substitution is very useful for integrals involving a simple rational expression in $$\sin x$$ and/or $$\cos x$$ in the denominator.

To calculate an integral of the form $$\int {R\left( {\sin x} \right)\cos x\,dx} ,$$ where $$R$$ is a rational function, use the substitution $$t = \sin x.$$

Similarly, to calculate an integral of the form $$\int {R\left( {\cos x} \right)\sin x\,dx} ,$$ where $$R$$ is a rational function, use the substitution $$t = \cos x.$$

If an integrand is a function of only $$\tan x,$$ the substitution $$t = \tan x$$ converts this integral into integral of a rational function.

To calculate an integral of the form $$\int {R\left( {\sin x} \right)\cos x\,dx} ,$$ where both functions $$\sin x$$ and $$\cos x$$ have even powers, use the substitution $$t = \tan x$$ and the formulas

${\cos ^2}x = \frac{1}{{1 + {{\tan }^2}x}} = \frac{1}{{1 + {t^2}}},\;\;\;{\sin ^2}x = \frac{{{{\tan }^2}x}}{{1 + {{\tan }^2}x}} = \frac{{{t^2}}}{{1 + {t^2}}}.$

## Solved Problems

### Example 1.

Evaluate the integral $\int {\frac{{dx}}{{1 + \sin x}}}.$

Solution.

We use the universal trigonometric substitution:

$t = \tan \frac{x}{2},\;\; \Rightarrow x = 2\arctan t,\;\;\; dx = \frac{{2dt}}{{1 + {t^2}}}.$

Since $$\sin x = {\frac{{2t}}{{1 + {t^2}}}},$$ we have

$\int {\frac{{dx}}{{1 + \sin x}}} = \int {\frac{{\frac{{2dt}}{{1 + {t^2}}}}}{{1 + \frac{{2t}}{{1 + {t^2}}}}}} = \int {\frac{{2dt}}{{1 + {t^2} + 2t}}} = \int {\frac{{2dt}}{{{{\left( {t + 1} \right)}^2}}}} = - \frac{2}{{t + 1}} + C = - \frac{2}{{\tan \frac{x}{2} + 1}} + C.$

### Example 2.

Evaluate the integral $\int {\frac{{dx}}{{3 - 2\sin x}}}.$

Solution.

Using the Weierstrass substitution

$x = \arctan t,\;\; \sin x = \frac{{2t}}{{1 + {t^2}}},\;\; dx = \frac{{2dt}}{{1 + {t^2}}},$

we can rewrite the integral in the form

$I = \int {\frac{{dx}}{{3 - 2\sin x}}} = \int {\frac{{\frac{{2dt}}{{1 + {t^2}}}}}{{3 - 2 \cdot \frac{{2t}}{{1 + {t^2}}}}}} = \int {\frac{{2dt}}{{3 + 3{t^2} - 4t}}} = \int {\frac{{2dt}}{{3\left( {{t^2} - \frac{4}{3}t + 1} \right)}}} = \frac{2}{3}\int {\frac{{dt}}{{{t^2} - \frac{4}{3}t + 1}}} .$

Complete the square in the denominator:

${t^2} - \frac{4}{3}t + 1 = {t^2} - \frac{4}{3}t + {\left( {\frac{2}{3}} \right)^2} - {\left( {\frac{2}{3}} \right)^2} + 1 = {\left( {t - \frac{2}{3}} \right)^2} - \frac{4}{9} + 1 = {\left( {t - \frac{2}{3}} \right)^2} + \frac{5}{9} = {\left( {t - \frac{2}{3}} \right)^2} + {\left( {\frac{{\sqrt 5 }}{3}} \right)^2}.$

Changing $$u = t - \frac{2}{3},$$ $$du = dt$$ gives the final answer:

$I = \frac{2}{3}\int {\frac{{dt}}{{{{\left( {t - \frac{2}{3}} \right)}^2} + {{\left( {\frac{{\sqrt 5 }}{3}} \right)}^2}}}} = \frac{2}{3}\int {\frac{{du}}{{{u^2} + {{\left( {\frac{{\sqrt 5 }}{3}} \right)}^2}}}} = \frac{2}{3} \cdot \frac{1}{{\frac{{\sqrt 5 }}{3}}}\arctan \frac{u}{{\frac{{\sqrt 5 }}{3}}} + C = \frac{2}{{\sqrt 5 }}\arctan \frac{{3\left( {t - \frac{2}{3}} \right)}}{{\sqrt 5 }} + C = \frac{2}{{\sqrt 5 }}\arctan \frac{{3t - 2}}{{\sqrt 5 }} + C = \frac{2}{{\sqrt 5 }}\arctan \left( {\frac{{3\tan \frac{x}{2} - 2}}{{\sqrt 5 }}} \right) + C.$

### Example 3.

Calculate the integral $\int {\frac{{dx}}{{1 + \cos \frac{x}{2}}}}.$

Solution.

Make the universal trigonometric substitution:

$t = \tan \frac{x}{4},\;\; \Rightarrow d\left( {\frac{x}{2}} \right) = \frac{{2dt}}{{1 + {t^2}}},\;\; \Rightarrow \cos \frac{x}{2} = \frac{{1 - {t^2}}}{{1 + {t^2}}}.$

Then the integral becomes

$\int {\frac{{dx}}{{1 + \cos \frac{x}{2}}}} = \int {\frac{{d\left( {\frac{x}{2}} \right)}}{{1 + \cos \frac{x}{2}}}} = 2\int {\frac{{\frac{{2dt}}{{1 + {t^2}}}}}{{1 + \frac{{1 - {t^2}}}{{1 + {t^2}}}}}} = 4\int {\frac{{dt}}{{1 + \cancel{t^2} + 1 - \cancel{t^2}}}} = 2\int {dt} = 2t + C = 2\tan \frac{x}{4} + C.$

### Example 4.

Evaluate the integral $\int {\frac{{dx}}{{1 + \cos 2x}}}.$

Solution.

Using the substitution

$t = \tan x,\;\; \Rightarrow x = \arctan t,\;\; \Rightarrow dx = \frac{{dt}}{{1 + {t^2}}},\;\; \Rightarrow \cos 2x = \frac{{1 - {t^2}}}{{1 + {t^2}}},$

we can easily find the integral:we can easily find the integral:

$\int {\frac{{dx}}{{1 + \cos 2x}}} = \int {\frac{{\frac{{dt}}{{1 + {t^2}}}}}{{1 + \frac{{1 - {t^2}}}{{1 + {t^2}}}}}} = \int {\frac{{dt}}{{1 + \cancel{t^2} + 1 - \cancel{t^2}}}} = \int {\frac{{dt}}{2}} = \frac{t}{2} + C = \frac{1}{2}\tan x + C.$

### Example 5.

Compute the integral $\int {\frac{{dx}}{{4 + 5\cos \frac{x}{2}}}}.$

Solution.

To simplify the integral, we use the Weierstrass substitution:

$t = \tan \frac{x}{4},\;\; \Rightarrow x = 4\arctan t,\;\; dx = \frac{{4dt}}{{1 + {t^2}}},\;\; \cos \frac{x}{2} = \frac{{1 - {t^2}}}{{1 + {t^2}}}.$

The integral becomes

$\int {\frac{{dx}}{{4 + 5\cos \frac{x}{2}}}} = \int {\frac{{\frac{{4dt}}{{1 + {t^2}}}}}{{4 + 5 \cdot \frac{{1 - {t^2}}}{{1 + {t^2}}}}}} = \int {\frac{{4dt}}{{4\left( {1 + {t^2}} \right) + 5\left( {1 - {t^2}} \right)}}} = 4\int {\frac{{dt}}{{4 + 4{t^2} + 5 - 5{t^2}}}} = 4\int {\frac{{dt}}{{{3^2} - {t^2}}}} = 4 \cdot \frac{1}{{2 \cdot 3}}\ln \left| {\frac{{3 + t}}{{3 - t}}} \right| + C = \frac{2}{3}\ln \left| {\frac{{3 + \tan \frac{x}{4}}}{{3 - \tan \frac{x}{4}}}} \right| + C.$

### Example 6.

Find the integral $\int {\frac{{dx}}{{\sin x + \cos x}}}.$

Solution.

As in the previous examples, we will use the universal trigonometric substitution:

$t = \tan \frac{x}{2},\;\; \Rightarrow x = 2\arctan t,\;\;\; dx = \frac{{2dt}}{{1 + {t^2}}}.$

Since $$\sin x = {\frac{{2t}}{{1 + {t^2}}}},$$ $$\cos x = {\frac{{1 - {t^2}}}{{1 + {t^2}}}},$$ we can write:

$\int {\frac{{dx}}{{\sin x + \cos x}}} = \int {\frac{{\frac{{2dt}}{{1 + {t^2}}}}}{{\frac{{2t}}{{1 + {t^2}}} + \frac{{1 - {t^2}}}{{1 + {t^2}}}}}} = \int {\frac{{2dt}}{{2t + 1 - {t^2}}}} = 2\int {\frac{{dt}}{{1 - \left( {{t^2} - 2t} \right)}}} = 2\int {\frac{{dt}}{{1 - \left( {{t^2} - 2t + 1 - 1} \right)}}} = 2\int {\frac{{dt}}{{2 - {{\left( {t - 1} \right)}^2}}}} = 2\int {\frac{{d\left( {t - 1} \right)}}{{{{\left( {\sqrt 2 } \right)}^2} - {{\left( {t - 1} \right)}^2}}}} = 2 \cdot \frac{1}{{2\sqrt 2 }}\ln \left| {\frac{{\sqrt 2 + \left( {t - 1} \right)}}{{\sqrt 2 - \left( {t - 1} \right)}}} \right| + C = \frac{1}{{\sqrt 2 }}\ln \left| {\frac{{\sqrt 2 - 1 + \tan \frac{x}{2}}}{{\sqrt 2 + 1 - \tan \frac{x}{2}}}} \right| + C.$

### Example 7.

Find the integral $\int {\frac{{dx}}{{\sin x + \cos x + 1}}}.$

Solution.

Making the $${\tan \frac{x}{2}}$$ substitution, we have

$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}}}.$

Then the integral in $$t-$$terms is written as

$\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{{\frac{{2dt}}{{1 + {t^2}}}}}{{\frac{{2t + 1 - {t^2} + 1 + {t^2}}}{{1 + {t^2}}}}}} = \int {\frac{{2dt}}{{2t + 2}}} = \int {\frac{{dt}}{{t + 1}}} = \ln \left| {t + 1} \right| + C = \ln \left| {\tan \frac{x}{2} + 1} \right| + C.$

### Example 8.

Evaluate $\int {\frac{{dx}}{{\sec x + 1}}}.$

Solution.

We can write the integral in form:

$I = \int {\frac{{dx}}{{\sec x + 1}}} = \int {\frac{{dx}}{{\frac{1}{{\cos x}} + 1}}} = \int {\frac{{\cos xdx}}{{1 + \cos x}}} .$

Use the universal trigonometric substitution:

$t = \tan \frac{x}{2},\;\; \Rightarrow x = 2\arctan t,\;\;\; dx = \frac{{2dt}}{{1 + {t^2}}}.$

This leads to the following result:

$I = \int {\frac{{\cos xdx}}{{1 + \cos x}}} = \int {\frac{{\frac{{1 - {t^2}}}{{1 + {t^2}}} \cdot \frac{{2dt}}{{1 + {t^2}}}}}{{1 + \frac{{1 - {t^2}}}{{1 + {t^2}}}}}} = 2\int {\frac{{\frac{{1 - {t^2}}}{{{{\left( {1 + {t^2}} \right)}^2}}}dt}}{{\frac{{1 + {t^2} + 1 - {t^2}}}{{1 + {t^2}}}}}} = \int {\frac{{1 - {t^2}}}{{1 + {t^2}}}dt} = - \int {\frac{{1 + {t^2} - 2}}{{1 + {t^2}}}dt} = - \int {1dt} + 2\int {\frac{{dt}}{{1 + {t^2}}}} = - t + 2\arctan t + C = - \tan \frac{x}{2} + 2\arctan \left( {\tan \frac{x}{2}} \right) + C = x - \tan \frac{x}{2} + C.$

See more problems on Page 2.