# Trigonometric Substitutions In Integrals

## Related Calculator: Integral (Antiderivative) Calculator with Steps

Trigonometric Substitutions are especially useful when we want to get rid of `sqrt(x^2-a^2)`, `sqrt(x^2+a^2)` and `sqrt(a^2-x^2)` under integral sign.

Recall that trignomeric identity states `cos^2(x)+sin^2(x)=1`.

Multiplying both sides by `a^2` gives `a^2cos^2(x)+a^2sin^2(x)=a^2`.

Dividing both sides of equation by `cos^2(x)` yields: `a^2+a^2tan^2(x)=a^2sec^2(x)`.

From these equations we have that `cos(x)=1/a sqrt(a^2-(asin(x))^2)` and `tan(x)=1/a sqrt((a sec(x))-a^2)` (since integral is indefinite, we can drop absolute value bars, but this can't be done in definite integral). Notice similarity with above roots.

In general:

- If you have `sqrt(a^2-x^2)`, make substitution `x=asin(u)`.
- If you have `sqrt(x^2-a^2)`, make substitution `x=a sec(u)`.
- If you have `sqrt(x^2+a^2)`, make substitution `x=a tan(u)`.

We already made first substitution when discussed Substitution Rule.

However, carefully examine integral: maybe you don't need none of the above substitutions: for example, for integral `int xsqrt(x^2+a^2)dx` there is a simpler substitution `u=x^2+a^2`.

**Example 1**. Find `int sqrt(4x^2-16)/x dx`

We see similar to above root in numerator, just need to rewrite it a bit: `sqrt(4x^2-16)=2sqrt(x^2-4)`.

Now, we are ready to make substitution `x=2sec(u)` , then `dx=2sec(u)tan(u)du`.

So, `2 int sqrt(x^2-4)/xdx=2 int sqrt(4 sec^2(u)-4)/(2sec(u)) 2sec(u)tan(u)du=`

`=4 int |tan(u)|tan(u)du`

Since integral is indefinite we will drop absolute value bars: `4 int tan^2(u)du`. We know how to do such integrals (see Trigonometric Integrals note). So, `4 int tan^2(u)du=4 int(sec^2(u)-1)du=4(tan(u)-u)+C`.

To return to old variable we will need to find `tan(u)` in terms of `x`. From our substitution we see that `sec(u)=x/2`.

Since `tan(u)=sqrt(sec^2(u)-1)` then `tan(u)=sqrt((x^2)/4-1)=1/2 sqrt(x^2-4)`.

Since `sec(u)=x/2` then `cos(u)=2/x` and `u=arccos(2/x)` (note that we could express `u` in terms of `x` through inverse secant: `u=text(arcsec)(x/2)`, people just more familiar with cosines therefore we use inverse cosine).

Finally, `int (sqrt(4x^2-16))/xdx=4(1/2 sqrt(x^2-4)-arccos(2/x))+C=`

`=2(sqrt(x^2-4)-2arccos(2/x))+C`.

Now, let's see how to handle absolute value bars in the definite integral.

**Example 2**. Calculate `int_2^4 sqrt(4x^2-16)/xdx` .

It is same integral as in example 1. First, simplify expression under square root: `2 int_2^4 sqrt(x^2-4)/x dx`.

Let `x=2sec(u)` then `dx=2sec(u)tan(u)du`.

`x` is changing from 2 to 4, so `sec(u)` is changing from `2/2=1` to `4/2=2` , that's why `cos(u)` is changing from `1/2` to `1` and u is changing from 0 to `pi/3`. Tangent on this interval is positive, so `sqrt(x^2-4)=sqrt(4sec^2(u)-4)=2|tan(u)|=2tan(u)`.

Note that in determining value of `u` we took the smallest positive value.

Now, integral becomes `4 int_0^(pi/3)tan^2(u)du=4 int_0^(pi/3)(sec^2(u)-1)du=4(tan(u)-u)|_0^(pi/2)=`

`=4((tan(0)-0)-(tan(pi/3)-(pi)/3))=-4(0-0-sqrt(3)+(pi)/3)=`

`=4sqrt(3)-(4pi)/3`.

**Example 3**. Calculate `int_(-4)^(-2) sqrt(4x^2-16)/xdx` .

It is same integral as in example 1. First, simplify expression under square root: `2 int_(-4)^(-2) sqrt(x^2-4)/x dx` .

Let `x=2sec(u)` then `dx=2sec(u)tan(u)du`.

`x` is changing from -4 to -2, so `sec(u)` is changing from `(-4)/2=-2` to `(-2)/2=-1`, that's why `cos(u)` is changing from `-1/2` to `-1` and `u` is changing from `(2pi)/3` to `pi`.

This means that tangent on this interval is negative, so `sqrt(x^2-4)=sqrt(4sec^2(u)-4)=2|tan(u)|=-2tan(u)`.

Note that in determining value of `u` we took the smallest positive value.

Now, integral becomes `-4 int_((2pi)/3)^(pi)tan^2(u)du=-4 int_((2pi)/3)^(pi)(sec^2(u)-1)du=4(tan(u)-u)|_((2pi)/3)^(pi)=`

`=-4((tan(pi)-pi)-(tan((2pi)/3)-(2pi)/3))=-4(0-pi+sqrt(3)+(2pi)/3)=`

`=(4pi)/3-4sqrt(3)`.

**Example 4**. Calculate `int 1/(x^2sqrt(4-x^2))dx` .

We will need substitution 2 here: `x=2sin(u)` then `dx=2cos(u)du` and integral can be rewritten as:

`int 1/(4sin^2(u)sqrt(4-4sin^2(u)))2cos(u)du=1/4 int 1/(sin^2(u)|cos(u)|) cos(u)du `.

Since integral is indefinite, we can drop absolute value bars (we assume that cosine is positive):

`1/4 int 1/(sin^2(u))du=1/4 int csc^2(u)du=-1/4 cot(u)+C`.

Now, we will need to return to old variables.

Since `x=2sin(u)` then `sin(u)=x/2` and `cos(u)=sqrt(1-(x^2)/4)=1/2 sqrt(4-x^2)` , so `cot(u)=cos(u)/sin(u)=(1/2 sqrt(4-x^2))/(1/2 x)=(sqrt(4-x^2))/x`.

Finally, `int 1/(x^2sqrt(4-x^2))dx=-(sqrt(4-x^2))/(4x)+C`.

**Example 5**. Calculate `int_0^2 (x^2)/(x^2+4)^(5/2)dx`

Since `(x^2+4)^(5/2)=(sqrt(x^2+4))^5` then make substitution number 3: `x=2tan(u)`. In this case `dx=2sec^2(u)du`.

So, integral can be rewritten as `int_0^2 (4tan^2(u))/(sqrt(4tan^2(u)+4))^5 2sec^2(u)du=int_0^2 (4tan^2(u))/(2|sec(u)|)^5 2sec^2(u)du`.

Since `x` is changing from 0 to 2 then `tan(u)` is changing from `0/2=0` to `2/2=1`. This means that `u` is changing from `0` to `pi/4`. This means that `sec(u)` is positive on this interval, so `|sec(u)|=sec(u)`.

So, integral becomes `1/4 int_0^(pi/4)(tan^2(u))/(sec^3(u))du`.

To calculate this integral it is better to convert it to sines and cosines: `1/4 int_0^(pi/4) (tan^2(u))/(sec^3(u))du=1/4 int_0^(pi/4) sin^2(u)cos(u)du` .

Let `t=sin(u)` then `dt=cos(u)du`. Since u is changing from 0 to `(pi)/4` then `t` is changing from sin(0)=0 to `sin(pi/4)=1/sqrt(2)`.

And integral becomes `1/4int_0^(1/sqrt(2))t^2dt=1/12 t^3|_0^(1/sqrt(2))=1/12 (1/(sqrt(2))^3-0^3)=1/(24sqrt(2))`.

**Example 6**. Evaluate `int sqrt(x^2+4x+13)dx`.

It seems that this integral can't be evaluated using above substitution. However, recall that any quadratic function `ax^2+bx+c` can be transformed into `a(x+d)^2+e` by completing a square.

So, `x^2+4x+13=x^2+4x+4+9=(x+2)^2+9`.

This is similar to `sqrt(x^2+a^2)` except `x+2` term. But this doesn't matter. Let `x+2=3tan(u)`. Then `dx=3sec^2(u)du`.

Integral, thus, becomes `int sqrt(9tan^2(u)+9)*3sec^2(u)du=int 3|sec(u)|*3sec^2(u)du=9 int sec^3(u)du`.

This integral was found in Trigonometric Integrals note: `9 int sec^3(u)du=9/2(sec(u)tan(u)+ln|sec(u)+tan(u)|)+C` .

Since `tan(u)=(x+2)/3` then `sec(u)=sqrt(((x+2)^2)/9+1)=1/3sqrt(x^2+4x+13)`.

Finally, `int sqrt(x^2+4x+13)dx=`

` `

`=9/2(1/3sqrt(x^2+4x+13)*(x+2)/3+ln|(x+2)/3+sqrt(((x+2)/3)^2+1)|)+C=`

`=1/2(sqrt(x^2+4x+13)(x+2)+9text(arcsinh)((x+2)/3))+C`.

**Example 7**. Evaluate `int sqrt(e^x-1)dx` .

Again expression under the square root is not like the above 3 expressions. However, note that `sqrt(e^x-1)=sqrt((e^(x/2))^2-1)` . And it is similar to substitution 2. So, let `e^(x/2)=sec(u)` then `1/2 e^(x/2)dx=sec(u)tan(u)du` . We need to express `dx` in terms of `u` only.

Since `e^(x/2)=sec(u)` then `1/2sec(u)dx=sec(u)tan(u)du` or `dx=2tan(u)du`.

Integral now becomes `int sqrt(sec^2(u)-1)*2tan(u)du=2 int |tan(u)|tan(u)du`.

Since integral is indefinite, we drop absolute value bars: `2 int tan^2(u)du=2 int (sec^2(u)-1)du=2(tan(u)-u)+C`.

Since `sec(u)=e^(x/2)` then `tan(u)=sqrt((e^(x/2))^2-1)=sqrt(e^x-1)`.

And `u` is either `text(arcsec)(e^(x/2))` or `arctan(sqrt(e^x-1))` (we choose second option).

So, `int sqrt(e^x-1)dx=2(sqrt(e^x-1)-arctan(sqrt(e^x-1)))+C` .

Note, that this integral can be solved another way: with double substitution; first substitution is `u=e^x` and second is `t=sqrt(u-1)`.

We have seen (last two examples) that some integrals can be converted into integrals that can be solved using trigonometric substitution described above.