0
$\begingroup$

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)}$$

$\endgroup$
2
$\begingroup$

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)$?

$\endgroup$
  • $\begingroup$ what happened to the $-k^{2}$? Why are you dividing by $1+k^2$ ? $\endgroup$ – Jon Apr 21 '18 at 2:33
  • $\begingroup$ @Jon Notice $L$ appears in both sides of the equation, so I move $k^2L$ from the RHS to the LHS. $\endgroup$ – grand_chat Apr 21 '18 at 2:34
  • 1
    $\begingroup$ @Jon When I move $k^2L$ to the LHS, the LHS becomes $L +k^2L=(1+k^2)L$ $\endgroup$ – grand_chat Apr 21 '18 at 2:38
  • 1
    $\begingroup$ @Jon Just plug $x=\pi$ into the last expression for $L$, and then plug $x=-\pi$. (You will need to evaluate $\cos(k\pi)$ and $\cos(-k\pi)$.) Then take the difference of these two results, and divide everything by $\pi$. $\endgroup$ – grand_chat Apr 21 '18 at 2:53
  • 1
    $\begingroup$ @Jon Convince yourself that $\cos(k\pi)=(-1)^k$ for all integer $k$, while $\sin(k\pi)=0$ for all integer $k$. $\endgroup$ – grand_chat Apr 21 '18 at 4:37
1
$\begingroup$

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)$$

$\endgroup$
  • $\begingroup$ Hi Claude! I hope you're well. It's even easier to use $I=\text{Re} \int e^{ax} e^{ibx}\,dx$. $\endgroup$ – Mark Viola Apr 21 '18 at 14:11
  • $\begingroup$ @MarkViola. For sure it is ! But the problem is that I am very old fashioned .... Cheers. $\endgroup$ – Claude Leibovici Apr 21 '18 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.