2

I don't understand how the expression ${e}^x \cdot \cos(x)$ is integrated.

On integral calculator the answer is given as $\frac{{{e}^x\sin{x} - {e}^x\cos{x}}}{2}$ and it is so because by partial integration we get on the right side of the equation: $-\int{(f'\cdot g) \cdot dx}$ a $\int{{e}^x}\cdot \sin(x) \cdot dx$ twice.

Could someone explain as to why if the integral above shows twice on the right side by doing partial integration then the integral of it is $\int\frac{{{e}^x}\sin(x)-{e}^x\cos(x)}{2}$?

Thank you!

Ivo Terek
  • 80,301
user
  • 1,412
  • Note that there's a very easy way to integrate either $\int e^{ax}\cos bx;dx$ or $\int e^{ax}\sin bx;dx$ as an exponential. Just note that $e^{ax}\cos bx = \operatorname{Re}e^{(a+bi)x}$ and $e^{ax}\sin bx = \operatorname{Im}e^{(a+bi)x}$, and observe $\int e^{(a+bi)x};dx = \tfrac{1}{a+bi}e^{(a+bi)x}$ (up to additive constant) and equate real or imaginary parts of each side. – MPW May 07 '19 at 21:27

5 Answers5

2

One lazy way to do it is to guess that $$\int e^x\cos x\,{\rm d}x = Ae^x \cos x + Be^x \sin x$$for some constants $A$ and $B$. Differentiate to get $$e^x\cos x = e^x(A\cos x - A\sin x + B \sin x + B\cos x),$$so that $$A + B = 1 \quad\mbox{and} \quad -A + B = 0.$$Thus $A = B = 1/2$ and so $$\int e^x\cos x\,{\rm d}x = \frac{e^x\cos x + e^x\sin x}{2}.$$

Ivo Terek
  • 80,301
  • This is a really nice method that works nicely, although only works for simple examples like this as you have to know the integral is of that form – Henry Lee May 08 '19 at 12:29
1

It is because if you differentiate $e^x$ twice you get $e^x$, and if you integrate $\cos(x)$ twice you get $-\cos(x)$. You can call the integral $I$ and have

$I = ... - I$ then collect terms and solve for $I$.

fGDu94
  • 4,072
1

Integrating by parts twice, we have\begin{align}\int e^x\cos(x)\,\mathrm dx&=e^x\sin(x)-\int e^x\sin(x)\,\mathrm dx\\&=e^x\sin(x)-\left(-e^x\cos(x)\,\mathrm dx+\int e^x\cos(x)\,\mathrm dx\right)\\&=e^x\sin(x)+e^x\cos(x)-\int e^x\cos(x)\,\mathrm dx\end{align}and therefore$$\int e^x\cos(x)\,\mathrm dx=\frac12e^x\bigl(\sin(x)+\cos(x)\bigr).$$Note that you have a wrong sign.

1

You can consider $\mathrm e^x \cos x$ is the real part of $\mathrm e^x\mathrm e^{ix}=\mathrm e^{(1+i)x}$. So you can integrate the latter and take the real part of the result: $$\int \mathrm e^{(1+i)x}\,\mathrm dx= \frac 1{1+i}\, \mathrm e^{(1+i)x}=\dots$$

Bernard
  • 179,256
0

There are a few ways to approach problems like this. I personally think that using complex numbers are the best way, but if you are not comfortable with this method then there are other ways.

Firstly imagine we are trying to solve two different integrals, defined below: $$I=\int e^x\cos(x)dx$$ $$J=\int e^x\sin(x)dx$$ If we combine these two we can get: $$I+jJ=\int e^x\cos(x)dx+j\int e^x\sin(x)dx=\int e^x\left[\cos(x)+j\sin(x)\right]dx$$ now if we use Euler's formula which states that $e^{jx}=\cos(x)+j\sin(x)$ we get: $$I+jJ=\int e^xe^{jx}dx=\int e^{(j+1)x}dx$$ $$I+jJ=\frac{e^{(j+1)x}}{j+1}=\frac{(j-1)e^{(j+1)x}}{(j+1)(j-1)}=\frac{(1-j)e^{(j+1)x}}{2}=\frac{(1-j)e^x\left[\cos(x)+j\sin(x)\right]}{2}$$ $$I+jJ=e^x\frac{\cos(x)+\sin(x)-j\cos(x)+j\sin(x)}{2}$$ now notice that $\Re(I+jJ)=I$ and $\Im(I+jJ)=J$ so the following is true: $$I=\Re\left[e^x\frac{\cos(x)+\sin(x)-j\cos(x)+j\sin(x)}{2}\right]=e^x\frac{\cos(x)+\sin(x)}{2}$$ $$J=\Im\left[e^x\frac{\cos(x)+\sin(x)-j\cos(x)+j\sin(x)}{2}\right]=e^x\frac{\sin(x)-\cos(x)}{2}$$ And so we can conclude that: $$\int e^x\cos(x)dx=e^x\frac{\cos(x)+\sin(x)}{2}+C$$ $$\int e^x\sin(x)dx=e^x\frac{\sin(x)-\cos(x)}{2}+C$$

However you can also do this by using "Integration By parts": $$W=\int e^x\cos(x)dx$$ first we take $u=e^x$ and $v'=\cos(x)$ and we can say that: $$W=uv-\int u'v=e^x\sin(x)-\int e^x\sin(x)dx$$ This hasn't got us anywhere so we can just repeat the process again. Let $u=e^x$ and $v'=\sin(x)$ and so: $$W=e^x\sin(x)-\left[e^x(-\cos(x))-\int e^x(-\cos(x))dx\right]$$ Which we can rearrange to give: $$W=e^x\sin(x)+e^x\cos(x)-\int e^x\cos(x)dx$$ Now notice that the integral that we are left with is in fact equal to W, so we can say: $$W=e^x\sin(x)+e^x\cos(x)-W$$ $$2W=e^x\sin(x)+e^x\cos(x)$$ $$W=\frac{e^x\sin(x)+e^x\cos(x)}{2}$$

Henry Lee
  • 12,554