LIATE / ILATE rule In another question of mine users proposed the LIATE or ILATE rule for partial integration. However, I have encountered a problem:
$$ e^{-x}\cos(x)$$
If I use the rule, I eventually get:
$$ d(\cos(x) \cdot - e^{-x}) + e^{-x} \cdot \cos(x) \cdot d$$
It seems to me as if I use the rule in this situation I will get an infinite loop. Is this true?
My solution to this problem would be to just do it the other way around the second time. If I do this, I won't have wasted time on the problem but I (probably) avoid  the infinite loop. Is this correct?
 A: You'll get an infinite loop if you don't see the pattern...
For further reference; Wikipedia isn't always so bad. In fact, it has this exact problem yet with $e^{x}$ instead of $e^{-x}$:
"Recursive" Integration By Parts
A: Do not do it the other way round the second time: that just undoes the first integration by parts and leaves you with nothing useful. Do it the same way round, and solve for the integral. Here’s how it works out with your example.
If you begin with the substitutions $u=\cos x$, $dv=e^{-x}dx$, you get $du=-\sin x dx$, $v=-e^{-x}$, and
$$\int e^{-x}\cos x dx=-e^{-x}\cos x-\int e^{-x}\sin xdx\;.$$
If you repeat the procedure using the same rule, i.e., with the substitutions $u=\sin x$, $dv=e^{-x}dx$, you get $du=\cos x dx$, $v=-e^{-x}$, and
$$\int e^{-x}\cos x dx=-e^{-x}\cos x+e^{-x}\sin x-\int e^{-x}\cos x dx\;.$$
Now just solve for the integral:
$$2\int e^{-x}\cos x dx=-e^{-x}\cos x+e^{-x}\sin x\;,$$
and
$$\int e^{-x}\cos x dx=\frac12e^{-x}(\sin x-\cos x)+C\;.$$
If you do it the other way round the second time, with $u=e^{-x}$ and $dv=\sin x dx$, you get $du=-e^{-x}dx$, $v=-\cos x$, and
$$\int e^{-x}\cos x dx=-e^{-x}\cos x-\left(-e^{-x}\cos x-\int e^{-x}\cos x\right)=\int e^{-x}\cos x dx\;,$$
which is true, but completely useless.
A: At this stage you should do some algebraic rearrangement to combine terms and then solve.
A: $$I= e^{-x}\cos(x)$$
$$I= e^{-x}\int\cos x \;dx-\int\dfrac{d}{dx}e^{-x}\int\cos x\;dx\;dx$$
$$I= e^{-x}\sin x \;dx+\int e^{-x}\sin x\;dx$$
Here we again use integration by parts
$$I= e^{-x}\sin x \;dx+e^{-x}\int\sin x\;dx-\int\dfrac{d}{dx}e^{-x}\int\sin x\;dx\;dx$$
$$I= e^{-x}\sin x \;dx-e^{-x}\cos x\;+\int e^{-x}(-\cos x)\;dx$$
$$I= e^{-x}\sin x \;dx-e^{-x}\cos x\;-\int e^{-x} \cos x\;dx$$
$$I= e^{-x}\sin x \;dx-e^{-x}\cos x\;-I$$
$$I= \dfrac {e^{-x}\sin x \;dx-e^{-x}\cos x}{2}+C$$
A: Using ILATE ( I - inverse trigo function, L - logarithmic function, A - algebric function, T - trigono. function, E - exponential function) for choosing first and second function therefore : 
Let first function is f(x) and second be g(x) therefore using formula of integration by parts which is $ f(x) . \int g(x) -\int d(f(x)).\int g(x)dx$
Here using ILATE : we can take cosx as f(x) and $e^{-x} = g(x)$
$Let I = \int cosx.e^{-x}dx = cosx.\int e^{-x} -\{\int d(cosx)\int e^{-x}d\}x$+C
$\Rightarrow I = e^{-x}sinx +\int e^{-x}.sinx dx = e^{-x}sinx -e^{-x}cosx -\int e^{-x}cosx dx$ +C
$\Rightarrow I = e^{-x}sinx +\int e^{-x}.sinx dx = e^{-x}sinx -e^{-x}cosx -I $+C
$\Rightarrow 2I = e^{-x}sinx +\int e^{-x}.sinx dx = e^{-x}sinx -e^{-x}cosx $  +C
$\Rightarrow I = \frac{1}{2} \{ e^{-x}sinx -e^{-x}cosx \}$  +C
A: Let $I=\int e^{-x}\cos x\,dx$ and let $J=\int e^{-x}\sin x\,dx$. 
We find an expression for $I$. Let $u=e^{-x}$ and $dv=\cos x\,dx$. (The other way around will also work, but we only chase down this one.) Then $du=-e^{-x}\,dx$ and we can take $v=\sin x$. We get
$$I=e^{-x}\sin x +\int e^{-x}\sin x\,dx=e^{-x}\sin x+J.\tag{1}$$
Now in a similar way, we calculate $J$. Let $u=e^{-x}$ and $dv=\sin x\,dx$. (So we are making the same "kind" of choice for $u$ and $v$ as we did for the first integral. Choosing to do it "the other way," by letting $u=\sin x$ and $dv=e^{-x}\,dx$ will not work.) 
Then $du=-e^{-x}\,dx$ and we can take $v=-\cos x$. We obtain
$$J=-e^{-x}\cos x-\int e^{-x}\cos x\,dx=-e^{-x}\cos x -I.\tag{2}$$
It looks as if we are going in circles.  Equation (1) says I will tell you what $I$ is if you will tell me what $J$ is. And Equation (2) says I will tell you what $J$ is if you will tell me what $I$ is. Often, when it looks as if we are going in circles, we are going in circles. But not this time. Combining (1) and (2), we get
$$I=e^{-x}\cos x-e^{-x}\sin x-I,$$
and therefore 
$$I=\frac{e^{-x}\sin x-e^{-x}\cos x}{2}.$$
To finish, we remember about the $+C$ business. We had found one antiderivative of $e^{-x}\cos x$, and we were asked for them all. 
Remark: The following does not answer your question, but is how I would actually do the calculation. "Guess" that the answer will have shape $Ae^{-x}\sin x +Be^{-x}\cos x$. Now differentiate our guess. Quickly we can find what $A$ and $B$ must be for the derivative to be $e^{-x}\cos x$. 
A: Complex functions of a real variable can be formally integrated using the rules for real functions. So, remember that
$$
\cos x=\frac{e^{ix}+e^{-ix}}{2}.
$$
Therefore
$$
e^{-x}\cos x=\frac{1}{2}(e^{x(-1+i)}+e^{x(-1-i)}).
$$
Hence a primitive is
$$
\frac{1}{2}\left(
\frac{1}{-1+i}e^{-x+ix}+\frac{1}{-1-i}e^{-x-ix}
\right)
$$
that we can rewrite as
\begin{align}
&\frac{e^{-x}}{4}\bigl(
(-1-i)(\cos x+i\sin x)+(-1+i)(\cos x-i\sin x)
\bigr)\\[1ex]
={}&\frac{e^{-x}}{4}\bigl(
(-1-i-1+i)\cos x+i(-1-i+1-i)\sin x\bigr)\\[1ex]
={}&\frac{e^{-x}}{2}(-\cos x+\sin x)
\end{align}
A:                         Integration by Parts

Integrating the product of an exponential function and a trigonometric function
For the product of an exponential function and a trigonometric function, it does 
not matter which function is the u-function. 
Therefore, you can let u = $e^{-x}$ or
$u = cos(x)$, and you will get the same result.  Proceeding, let u = $e^{-x}$;  and let $v = cos(x)$
Then, applying the straightforward integration-by-parts formula (British version):
See also, Calculus 1 & 2 by A. A. Frempong. page 244.
$$\int (uv) dx=u\int vdx -\int [(du/dx)\int vdx]dx$$
$$\int (e^{-x}\cos x) dx=e^{-x}\int cos(x)dx -\int [(d(e^{-x})/dx)\int cos(x)dx]dx$$
$$\int e^{-x}\cos x dx=e^{-x}\sin x +\int e^{-x}\sin xdx$$(two minus signs here for second term on the right)  
Integrating again,
$$\int e^{-x}\cos x dx=e^{-x}\sin x -e^{-x}\cos x-\int e^{-x}\cos xdx$$(three minus signs here for third term on the right)
$$\int e^{-x}\cos x dx + \int e^{-x}\cos xdx=e^{-x}\sin x -e^{-x}\cos x$$ (transposing)
$$2\int e^{-x}\cos x dx =e^{-x}\sin x -e^{-x}\cos x$$ 
$$\int e^{-x}\cos x dx = (1/2)(e^{-x}\sin x -e^{-x}\cos x)+  C$$ (Solving for $ \int e^{-x}\cos x dx )$ 
$$\int e^{-x}\cos x dx = (1/2)[(e^{-x}(\sin x -\cos x)] + C$$
(The above process is Type 3 process of integration-by-parts. See also, Calculus 1 & 2 by A. A. Frempong. page 245.
