Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

It seems to be a pretty simple integral but I am blanking out on how to find this integral:

$$\int_0^1 e^{-x}\cos(n\pi x) \;dx$$

I tried Mathematica, but it seems to use some formula instead of integrating by parts.

Thanks for your help!

share|improve this question

3 Answers 3

up vote 2 down vote accepted

I don't believe it matters which part you integrate and which part you take the derivative of. If you took the derivative of $e^{-x}$ the first time, do it for the second integration by parts as well.

If you have done it correctly, you should have an equation with the same integral on each side, yet they won't cancel out. Simply combine like terms and you should have your answer.

share|improve this answer
    
Oh, I got it. You need to switch the parts for the second integration. Thank you! –  dana May 27 '12 at 7:00
1  
@dana Switch the parts? Sounds like the opposite of what I was saying. What did your equation look like after the second integration by parts? –  Mike May 27 '12 at 7:07
    
ooops, this is not what I actually meant to say. My problem was not seing that after the second integration I had two identical (almost) integrals on the both sides of the equation. I guess it's a good time for me to go to bed. Thanks again! –  dana May 27 '12 at 7:19

When you’ve a product of an exponential and a sine or cosine, you can split it either way. I’ll set $u=e^{-x}$ and $dv=\cos n\pi x\,dx$, so that $du=-e^{-x}dx$ and $v=\frac1{n\pi}\sin n\pi x$. Then

$$\begin{align*} \int_0^1 e^{-x}\cos n\pi x\,dx&=\left[\frac1{n\pi}e^{-x}\sin n\pi x\right]_0^1-\int_0^1\frac1{n\pi}\sin n\pi x(-e^{-x})dx\\ &=\frac1{n\pi}\int_0^1 e^{-x}\sin n\pi x\,dx\;. \end{align*}$$

Now repeat, making sure to split the new integral the same way: $u=e^{-x}$ and $dv=\sin n\pi x\,dx$, so $du=-e^{-x}dx$, $v=-\frac1{n\pi}\cos n\pi x$, and the integral is

$$\begin{align*} \frac1{n\pi}\int_0^1 e^{-x}\sin n\pi x\,dx&=\frac1{n\pi}\left(\left[-\frac1{n\pi}e^{-x}\cos n\pi x\right]_0^1-\frac1{n\pi}\int_0^1e^{-x}\cos n\pi x\,dx\right)\\ &=\frac1{n^2\pi^2}\left(\left[e^{-x}\cos n\pi x\right]_0^1-\int_0^1e^{-x}\cos n\pi x\,dx\right)\;. \end{align*}$$

Call the original integral $I$; then

$$I=\frac1{n^2\pi^2}\left(\left[e^{-x}\cos n\pi x\right]_1^0-I\right)\;,$$

so $$\left(1+\frac1{n^2\pi^2}\right)I=\frac1{n^2\pi^2}\left[e^{-x}\cos n\pi x\right]_1^0=\frac1{n^2\pi^2}\left(1-\frac1e\cos n\pi\right)=\frac1{n^2\pi^2}\left(1-\frac{(-1)^n}e\right)\;,$$ since $\cos n\pi=(-1)^n$. Finally,

$$I=\frac{\dfrac1{n^2\pi^2}\left(1-\dfrac{(-1)^n}e\right)}{1+\dfrac1{n^2\pi^2}}=\frac{e-(-1)^n}{e(n^2\pi^2+1)}\;,$$

barring possible careless errors.

share|improve this answer
    
Thank you! I think there is a small typo in the final equation: numerator should have $n \pi$ not $n^2\pi^2$. Otherwise I was almost there in my initial solution, I just didn't recognize that the integrals on the both sides were almost identical. Too much studying for today. –  dana May 27 '12 at 7:22
    
@dana: Unless I’m asleep (which is possible), the $n^2\pi^2$ is right: I multiplied the four-story fraction by $\frac{en^2\pi^2}{en^2\pi^2}$. –  Brian M. Scott May 27 '12 at 7:28
    
Actually, in the line where you have combined the $I$'s, the $\frac{1}{\pi^2n^2}$ is missing before $[e^{-x}\cos(n\pi x)]^1_0$. So, both of us were a bit off :) –  dana May 27 '12 at 7:37
    
@dana: You are so right; thanks. –  Brian M. Scott May 27 '12 at 7:44

Here is another method that applies if you know some complex numbers.

Recall

$$e^{i \theta} = \cos \theta + i \sin \theta$$

In this case we have a $\cos (n \pi x)$, which is the real part of $e^{i n \pi x}$ $$\mathscr{R}(e^{in \pi x}) = \cos(n \pi x)$$

Then we have $$\int_{0}^1 e^{-x} \cos (n \pi x)dx = \mathscr{R} \int_{0}^1 e^{-x}\cdot e^{i n \pi x}$$

share|improve this answer
    
Interesting. Thanks for the tip. –  dana May 27 '12 at 7:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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