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$$ 
I simply can't understand from where to begin with. Please help me in solving this problem.

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*}
