Integrate $\int e^{-x} \cos x \,\mathrm{d}x$ [duplicate]

I know that integration by parts leads to an infinite loops of sin and cos so what do I do?

I can't do $u$ substitution because I can't get rid of all the variables.

$$\int e^{-x} \cos x \,\mathrm{d}x$$

-

marked as duplicate by amWhy, Maisam Hedyelloo, Andrey Rekalo, Micah, AmzotiJul 12 '13 at 20:58

Some MathJax advice: Named math operators should appear upright, and the common ones have their own code for this purpose (e.g. \sin, \log - see entry 11 in our MathJax guide). – Zev Chonoles Jul 12 '13 at 20:29

That's the entire point - you want to go through a loop once and use the "feedback" to get the answer.

Integrate by parts as follows:

\begin{align}\int dx \, e^{-x} \, \cos{x} &= -e^{-x} \cos{x} - \int dx \, e^{-x} \, \sin{x} \\ &=-e^{-x} \cos{x} + e^{-x} \sin{x} - \int dx \, e^{-x} \, \cos{x} \end{align}

Now do you see that you could go on forever...or you can just combine the like terms in the equation. (That is the feedback aspect.) When you do this, you find that

$$\int dx \, e^{-x} \, \cos{x} = \frac12 \left ( \sin{x} - \cos{x} \right ) + C$$

where $C$ is a constant of integration.

-

hint:$$\large{\int e^{-x} \cos x dx=\int e^{-x}\left(\frac{e^{ix}+e^{-ix}}{2} \right)}dx$$

-
Note, though, that someone taking first-year calculus in a U.S. school is has probably never seen the exponential forms of sine and cosine and may well never have worked with complex numbers. – Brian M. Scott Jul 12 '13 at 20:34
@Brian M. Scott: i don't have enough information about education system of u.s school maybe its better integrate by part – Maisam Hedyelloo Jul 12 '13 at 20:40
@BrianM.Scott What better reason to investigate ... I don't know the US, but when I first engaged with this (penultimate year of high school UK some years ago) it excited me. The approach is worth knowing, if it opens such insight. – Mark Bennet Jul 12 '13 at 20:42
I wasn’t criticizing the answer; I assumed that you probably didn’t know. My comment was to let you know and to reassure a typical U.S. student who might be reading this that it was all right to find this approach unfamiliar. – Brian M. Scott Jul 12 '13 at 20:44
Yeah I definitely have no idea why that equality is true. – Paul the Pirate Jul 12 '13 at 20:49

Integrate by parts twice, splitting the integral the same way both times, and solve for the integral.

Let $u=e^{-x}$ and $dv=\cos xdx$, so that $du=-e^{-x}dx$ and $v=\sin x$. Then

$$\int e^{-x}\cos xdx=e^{-x}\sin x+\int e^{-x}\sin x dx\;.$$

Now let $u=e^{-x}$ again, so that $dv=\sin x dx$; $du=-e^{-x}dx$, $v=-\cos x dx$, and

$$\int e^{-x}\cos xdx=e^{-x}\sin x-e^{-x}\cos x-\int e^{-x}\cos x dx\;.$$

Solve this equation for $\int e^{-x}\cos x dx$; don’t forget the constant of integration.

This is a standard trick that comes up quite often.

-
If you can manage to guess or remember that $e^{-x}\cos x$ has an indefinite integral of the form $e^{-x}(A\cos x+B\sin x)$ where $A$ and $B$ are constants, then by differentiating and solving a system of linear equations you can figure out that $A=-\frac1 2,\;B=\frac1 2$. This is called the Method of Undetermined Coefficients.
Since $\cos x=\mathrm{Re} (e^{ix})$ then $$\int e^{-x}\cos x dx=\mathrm{Re}\int e^{(i-1)x}dx=\mathrm{Re}\frac{e^{(i-1)x}}{i-1}+C$$