Evaluating $\frac{1}{\pi}\int^{\pi}_{-\pi} e^{x}\cos (kx) \text{dx}$

223 Views Asked by At

I am trying to solve this definite integral. I have tried applying this method,but unfortunately I have encountered a problem when trying to approximate the answer. Using integration by parts.

$$\frac{1}{\pi}\int^{\pi}_{-\pi} e^{x}\cos (kx) \text{dx} \\ \frac{1}{\pi}\int u\; dv = [u\;v]^\pi_{-\pi}-\int_{-\pi}^{\pi} v\;du \\dv=e^x \quad u= \cos(kx) \\ v = e^x \quad du = -k\sin(kx) \\ =\cos(kx)e^x-\left[\int e^x\cdot-k \sin(kx) dx \right] \\ dv = e^x \quad u = -k\sin(kx)) dx \\v = e^x \quad du = -k^2\cos(kx)\\ \cos(kx)e^x-[-k\sin(kx)e^x] - \left[\int e^x\cdot-k^2\cdot \cos(kx)dx\right] \\ \text{Apply Linearity} \\ \int^{\pi}_{-\pi} e^{x}\cos (kx) \text{dx}=e^x\cos(kx)-(-ke^x\sin(kx))+k^2\int e^x\cos(kx) dx \\ L = \int^{\pi}_{-\pi} e^{x}\cos (kx) \text{dx} \\ L=e^x\cos(kx)-(-ke^x\sin(kx))+k^2 \cdot L \\ 1=e^x\cos(kx)-(-ke^x\sin(kx))+k^2 \\ \text{However the answer is supposed to be} \\ a_k = \frac{(-1)^k \cdot (e^\pi-e^{-\pi})}{\pi(1+k^2)}$$

2

There are 2 best solutions below

9
On BEST ANSWER

You are almost there. First do the indefinite integral, without the limits of integration, and for now don't think about dividing the whole thing by $\pi$. So you wish to evaluate $$L:=\int e^x\cos kx\,dx.$$ Your strategy of using integration by parts twice goes through, until the incorrect line: $$ \cos(kx)e^x-[-k\sin(kx)e^x] - \left[\int e^x\cdot-k^2\cdot \cos(kx)dx\right] $$ It's incorrect because you've lost a minus sign, since there are big parentheses around the last two terms: $$ \cos(kx)e^x-\left([-k\sin(kx)e^x] - \left[\int e^x\cdot-k^2\cdot \cos(kx)dx\right] \right) $$ With this correction you obtain the result: $$ L=\cos(kx)e^x + k\sin(kx)e^x-k^2L, $$ and then you solve for $L$: $$ L=\frac{[\cos(kx)+k\sin(kx)]e^x }{1+k^2}\quad{\text{(plus constant of integration)}} $$ Now do the definite integral: plug in the limits of integration and divide the whole thing by $\pi$. Notice that $\sin(k\pi)=\sin(-k\pi)=0$ for all integer $k$. What about $\cos(k\pi)$ and $\cos(-k\pi)$?

2
On

Just as a comment.

When you face integrals such as $$I=\int \,e^{ax}\cos(bx)\,dx$$ you can make life simpler avoiding integration by parts rewriting $$I=\frac 12 \int e^{a x}\left(e^{i bx}+e^{-i bx} \right)\,dx=\frac 12 \int \left(e^{(a +i b)x}+e^{(a -i b)x}\right)\,dx$$that is to say $$I=\frac 12\left(\frac{e^{(a +i b)x} } {a+i b }+\frac{e^{(a -i b)x} } {a-i b }\right)=\frac 1{2(a^2+b^2)}\left((a-ib)e^{(a +i b)x}+(a+ib) e^{(a -i b)x} \right)$$ $$(a-ib)e^{(a +i b)x}+(a+ib) e^{(a -i b)x}=$$ $$e^{ax}\left((a-ib)(\cos(bx)+i\sin(bx) +(a+ib)(cos(bx)-i\sin(bx)\right)=$$ $$2( a \cos (b x)+ b \sin (b x))$$ making by the end $$I=\frac {e^{ax}}{(a^2+b^2)}\left( a \cos (b x)+ b \sin (b x)\right)$$