# Integral of (12sinx-2cosx+3)/(sinx+cosx) ?

Jun 11, 2018

$I = 5 x - 7 \ln \left(\cos \left(x\right) + \sin \left(x\right)\right) + \frac{6}{\sqrt{2}} {\tanh}^{-} 1 \left(\frac{\tan \left(\frac{x}{2}\right) - 1}{\sqrt{2}}\right) + C$

#### Explanation:

We want to solve

$I = \int \frac{12 \sin \left(x\right) - 2 \cos \left(x\right) + 3}{\sin \left(x\right) + \cos \left(x\right)}$

Let's split this into two separate integral

$I = \int \frac{12 \sin \left(x\right) - 2 \cos \left(x\right)}{\sin \left(x\right) + \cos \left(x\right)} \mathrm{dx} + \int \frac{3}{\sin \left(x\right) + \cos \left(x\right)} \mathrm{dx}$

First integral

Let

${I}_{1} = \int \frac{12 \sin \left(x\right) - 2 \cos \left(x\right)}{\sin \left(x\right) + \cos \left(x\right)} \mathrm{dx}$

Consider the much easier integral

${I}_{M} = A \int \frac{\sin \left(x\right) + \cos \left(x\right)}{\sin \left(x\right) + \cos \left(x\right)} \mathrm{dx} + B \int \frac{\cos \left(x\right) - \sin \left(x\right)}{\sin \left(x\right) + \cos \left(x\right)} \mathrm{dx}$

Now determinate the constants color(red)(A and color(red)(B, such that color(blue)(I_1=I_M

$A - B = 12$ and $A + B = - 2$

Thus color(red)(A=5 and color(red)(B=-7, so

${I}_{1} = 5 \int \frac{\sin \left(x\right) + \cos \left(x\right)}{\sin \left(x\right) + \cos \left(x\right)} \mathrm{dx} - 7 \int \frac{\cos \left(x\right) - \sin \left(x\right)}{\sin \left(x\right) + \cos \left(x\right)} \mathrm{dx}$

$\textcolor{w h i t e}{{I}_{1}} = 5 x - 7 \ln \left(\cos \left(x\right) + \sin \left(x\right)\right) + {C}_{1}$

Second integral

Let

${I}_{2} = \int \frac{3}{\sin \left(x\right) + \cos \left(x\right)} \mathrm{dx}$

Substitute color(blue)(u=tan(x/2) larr color(red)("Weierstrass substitution"

${I}_{2} = 6 \int \frac{1}{\frac{2 u}{1 + {u}^{2}} + \frac{1 - {u}^{2}}{1 + {u}^{2}}} \cdot \frac{1}{{u}^{2} + 1} \mathrm{du}$

$\textcolor{w h i t e}{{I}_{2}} = 6 \int \frac{1}{- {u}^{2} + 2 u + 1} \mathrm{du}$

$\textcolor{w h i t e}{{I}_{2}} = 6 \int \frac{1}{2 - {\left(u - 1\right)}^{2}} \mathrm{du}$

Let color(blue)(s=u-1=>ds=du

${I}_{2} = 6 \int \frac{1}{2 - {s}^{2}} \mathrm{ds}$

$\textcolor{w h i t e}{{I}_{2}} = 3 \int \frac{1}{1 - {\left(\frac{s}{\sqrt{2}}\right)}^{2}} \mathrm{ds}$

$\textcolor{w h i t e}{{I}_{2}} = \frac{6}{\sqrt{2}} {\tanh}^{-} 1 \left(\frac{s}{\sqrt{2}}\right) + {C}_{1}$

Substitute back color(blue)(s=u-1 and color(blue)(u=tan(x/2)

${I}_{2} = \frac{6}{\sqrt{2}} {\tanh}^{-} 1 \left(\frac{\tan \left(\frac{x}{2}\right) - 1}{\sqrt{2}}\right) + {C}_{1}$

Combining these

$I = 5 x - 7 \ln \left(\cos \left(x\right) + \sin \left(x\right)\right) + \frac{6}{\sqrt{2}} {\tanh}^{-} 1 \left(\frac{\tan \left(\frac{x}{2}\right) - 1}{\sqrt{2}}\right) + C$

Hopefully not too many typos :-)