# Question on indefinite integrals

I have to integrate:

$$I_2 = \int \frac{e^{2x} - e^{x} + 1}{(e^x\cos(x) - \sin(x))\cdot \left(e^x\sin(x) + \cos(x)\right)} \text{d}x$$

• Quite unclear.. the integral you want to compute is $$\int \frac{e^{2x} - e^{x} + 1}{e^x\cos(x) - \sin(x)}\cdot \left(e^x\sin(x) + \cos(x)\right) \text{d}x$$ ?? Nov 30, 2015 at 11:39
• @Kim Peek II yes you are right .... Nov 30, 2015 at 11:40
• I don't know the format which you guys are using... Nov 30, 2015 at 11:42
• When you create a question, If you read the information which the website give you, you will get instructions on how you write so that the mathematics looks nice. This lack of formating and the lack of own work (How would you start here? Have you shortened the expressions?) in the question is probably why you have gotten downvotes. Nov 30, 2015 at 11:44
• Seeing your EDIT, it seems it's not the integral I wrote below.. Nov 30, 2015 at 11:49

I consulted Moor and he suggested an approach involving differentiating the denominator. Let $f(x) = (e^x \cos (x) - \sin(x))$ and $g(x) = (e^x \sin x + \cos x)$. Then, note that, by the product rule $(fg)'=f'g +g'f = (e^x\cos(x)-e^x\sin(x) - \cos(x))(e^x \sin (x) + \cos (x)) + (e^x\sin (x) + e^x \cos(x)-\sin(x))(e^x \cos(x) - \sin(x))$

but this doesn't cancel out nicely to get $e^{2x}-e^x+1$. In fact, expanding gives $$(fg)' = (e^{2x} \sin(x) \cos(x) + e^x \cos^2(x) - e^{2x} \sin^2 (x) - \cos^2(x) - 2e^x \sin(x)\cos(x)) \\ +(e^{2x}\sin(x)\cos(x) - e^x \sin^2(x) + e^{2x} \cos^2 (x) + \sin^2(x) - 2e^x \sin (x) \cos (x))$$ Note that $fg'$ will cancel with a lot of $f'g$ terms if $fg'$ is negative. In particular, note that $f'(x)g(x) - f(x)g'(x) = -(e^{2x} - e^x + 1)$.

So, our integral looks like

\begin{align*} \int \frac{e^{2x} - e^{x} + 1}{(e^x\cos(x) - \sin(x))\cdot \left(e^x\sin(x) + \cos(x)\right)} \, dx &= -\int \frac{f'(x)g(x) - f(x)g'(x)}{f(x)g(x)}\,dx \\ &= - \int \left(\frac{f'(x)}{f(x)} - \frac{g'(x)}{g(x)} \right) \,dx \\ &= - \ln(f(x)) + \ln(g(x)) + C \\ &= \ln\left(\frac{g(x)}{f(x)}\right) + C \\ &= \ln\left(\frac{e^x \sin(x) + \cos(x)}{e^x \cos(x) - \sin(x)} \right) +C \end{align*}

HINT:

$$\int\space\frac{e^{2x}-e^x+1}{\left(e^x\cos(x)-\sin(x)\right)\left(e^x\sin(x)+\cos(x)\right)}\space\text{d}x=$$ $$2\int\space\frac{-e^x+e^{2x}+1}{e^{2x}\sin(2x)-\sin(2x)+2e^x\cos(2x)}\space\text{d}x=$$ $$2\int\space\frac{2\cosh(x)-1}{2\left(\cos(2x)+\sin(2x)\sinh(x)\right)}\space\text{d}x=$$ $$\frac{2}{2}\int\space\frac{2\cosh(x)-1}{\cos(2x)+\sin(2x)\sinh(x)}\space\text{d}x=$$ $$\int\space\frac{2\cosh(x)-1}{\cos(2x)+\sin(2x)\sinh(x)}\space\text{d}x=$$ $$2\int\space\frac{2\cosh(x)-\frac{1}{2}}{\cos(2x)+\sin(2x)\sinh(x)}\space\text{d}x=$$ $$2\int\space\left(\frac{\cosh(x)}{\cos(2x)+\sin(2x)\sinh(x)}-\frac{1}{2\left(\cos(2x)+\sin(2x)\sinh(x)\right)}\right)\space\text{d}x=$$ $$2\int\space\frac{\cosh(x)}{\cos(2x)+\sin(2x)\sinh(x)}\space\text{d}x-2\int\frac{1}{2\left(\cos(2x)+\sin(2x)\sinh(x)\right)}\space\text{d}x=$$ $$2\int\space\frac{\cosh(x)}{\cos(2x)+\sin(2x)\sinh(x)}\space\text{d}x-\int\frac{1}{\cos(2x)+\sin(2x)\sinh(x)}\space\text{d}x$$

• And now what??? Nov 30, 2015 at 12:08
• Can you please it without using the hyperbolic functions... Nov 30, 2015 at 12:09
• This is not the integral written above! Nov 30, 2015 at 12:15
• Kim PeekII I guess you have changed the integral Nov 30, 2015 at 12:16
• @Kim PeekII I guess you have changed the question Nov 30, 2015 at 12:17

I don't know a general method for this types of integrals, but if they will give a simple result, it must more or less be done in the following way:

We note that $$D(e^x\cos x-\sin x)=e^x(\cos x-\sin x)-\cos x$$ and $$D(e^x\sin x+\cos x)=e^x(\cos x+\sin x)-\sin x.$$ Next, our aim will be to do a kind of partial fraction decomposition (it is not a rational function, so it should perhaps be called something different), $$\frac{e^{2x}-e^x+1}{(e^x\cos x-\sin x)(e^x\sin x+\cos x)}=\frac{f(x)}{e^x\cos x-\sin x}+\frac{g(x)}{e^x\sin x+\cos x}.$$ If we are really lucky $f(x)$ will be the derivative of $e^x\cos x-\sin x$ and $g(x)$ will be the derivative of $e^x\sin x+\cos x$. Now, as it happens, this is not exactly true. But almost! I encourage you to write $$a\frac{e^x(\cos x-\sin x)-\cos x}{e^x\cos x-\sin x}+b\frac{e^x(\cos x+\sin x)-\sin x}{e^x\sin x+\cos x}$$ on common denominator, and try to find constants $a$ and $b$ so that it equals the original integrand. With that done, the integration will be simple, since it is of the form $a\phi'(x)/\phi(x)+b\psi'(x)/\psi(x)$ and thus giving logarithms. I leave those details to you. Scroll over below to see the final result.

One gets $a=-1$ and $b=1$, and thus the final result is $$-\ln|e^x\cos x-\sin x|+\ln|e^x\sin x+\cos x|+C$$

• Thanks bro but it seemed that you already knew the answer............ Nov 30, 2015 at 13:29
• As i said in the beginning, I don't know a general method, but that if it gonna be something "simple", it must go like this. I gave here the steps as I did them myself... Nov 30, 2015 at 13:57
• Nice one thanks for help... Nov 30, 2015 at 14:04

I have a better solution to your problem Here it goes: \begin{aligned} & \int \frac{e^{2 x}-e^{x}+1}{\left(e^{x} \sin x+\cos x\right)\left(e^{x} \cos x-\sin x\right)} dx \\ =& \int \frac{e^{2 x}-e^{x}+1}{\left(e^{2 x}+1\right) \sin \left(x+\tan ^{-1} \frac{1}{e^{x}}\right) \cdot \cos \left(x+\tan ^{-1} \frac{1}{e^{x}}\right)} d x \\ =&2 \int \frac{e^{2 x}-e^{x}+1}{\left(e^{2 x}+1\right) \sin \left(2 x+2 \operatorname{ta}^{-1}\left(\frac{1}{e^{x}}\right)\right)} d x \\ =&2 \int \frac{e^{2 x}-e^{x}+1}{\left(e^{2 x}+1\right) \sin \left(2 x+2 \cot ^{-1}\left(e^{x}\right)\right)} dx \\=&\int \operatorname{cosec}t~ dt=\ln \left|\tan \frac{t}{2}\right|+c \end{aligned}

where $$t=2 x+2 \cot ^{-1}\left(e^{x}\right)$$. Note that

$$\frac{d t}{d x}=2-\frac{2}{1+e^{2 x}} \cdot e^{x}=\frac{2\left(e^{2 x}-e^{x}+1\right)}{e^{2 x}+1}$$

Also, $$\frac{t}{2}=x+\tan ^{-1}\left(\frac{1}{e^{x}}\right)$$ so we have $$\tan \frac{t}{2}=\frac{\tan x+\frac{1}{e^{x}}}{1-\frac{t x}{e^{x}}} =\frac{e^{x} \sin x+\cos x}{e^{x} \cos x-\sin x}$$

Thus the integral is $$\boxed{\ln \left|\frac{e^{x} \sin x+\cos x}{e^{x} \cos x-\sin x}\right|+c}$$