# `int 5cosx/(sin^2x+3sinx-4)dx` Use substitution and partial fractions to find the indefinite integral

*print*Print*list*Cite

`int5cos(x)/(sin^2(x)+3sin(x)-4)dx`

Take the constant out,

`=5intcos(x)/(sin^2(x)+3sin(x)-4)dx`

Now let's apply integral substitution:`u=sin(x)`

`=>du=cos(x)dx`

`=5int1/(u^2+3u-4)du`

Now to use partial fractions, denominator of the integrand needs to be factored,

Let's split the middle term,

`1/(u^2+3u-4)=1/(u^2-u+4u-4)`

`=1/(u(u-1)+4(u-1))`

`=1/((u-1)(u+4))`

Now let's write it as sum of partial fractions:

`1/((u-1)(u+4))=A/(u-1)+B/(u+4)`

Multiply the above by the LCD,

`=>1=A(u+4)+B(u-1)`

`1=Au+4A+Bu-B`

`1=(A+B)u+4A-B`

Equating the coefficients of the like terms,

`A+B=0` -----------------------------(1)

`4A-B=1` ----------------------------(2)

Solve the above linear equations to get the values of A and B,

Add equation 1 and 2,

`5A=1`

`A=1/5`

Plug the value of A in equation 1,

`1/5+B=0`

`B=-1/5`

Plug in the values of A and B in the partial fraction template,

`1/((u-1)(u+4))=(1/5)/(u-1)+(-1/5)/(u+4)`

`=1/(5(u-1))-1/(5(u+4))`

`int1/(u^2+3u-4)du=int(1/(5(u-1))-1/(5(u+4)))du`

`=int1/5(1/(u-1)-1/(u+4))du`

Take the constant out,

`=1/5int(1/(u-1)-1/(u+4))du`

Apply the sum rule,

`=1/5(int1/(u-1)du-int1/(u+4)du)`

Now use the common integral:`int1/xdx=ln|x|`

`=1/5(ln|u-1|-ln|u+4|)`

Substitute back `u=sin(x)`

`=1/5(ln|sin(x)-1|-ln|sin(x)+4|)`

`int5cos(x)/(sin^2(x)+3sin(x)-4)dx=5(1/5(ln|sin(x)-1|-ln|sin(x)+4|)`

Simplify and add a constant C to the solution,

`=ln|sin(x)-1|-ln|sin(x)+4|+C`