# Find the Fourier coefficients and Fourier series of the following function

Find the Fourier coefficients and Fourier series of the following function $$f(x)=\frac{\pi e^{-x}}{e^{\pi}-e^{-\pi}};\quad -\pi\le x\le\pi$$

Here is my work:

Since $L=\pi$ we obtain \begin{align*}a_0&=\frac{1}{2\pi}\int\limits_{-\pi}^{\pi}f(x)\text{d}x=\frac{1}{2\left(e^{\pi}-e^{-\pi}\right)}\int\limits_{-\pi}^{\pi}e^{-x}\text{d}x=\frac{1}{2\left(e^{\pi}-e^{-\pi}\right)}\Big[-e^{-x}\Big]_{-\pi}^{\pi}=\frac{1}{2} \\ a_n&=\frac{1}{\pi}\int\limits_{-\pi}^{\pi}f(x)\cos\left(nx\right)\text{d}x=\frac{1}{e^{\pi}-e^{-\pi}}\int\limits_{-\pi}^{\pi}e^{-x}\cos(nx)\text{d}x \\ b_n&=\frac{1}{\pi}\int\limits_{-\pi}^{\pi}f(x)\sin(nx)\text{d}x=\frac{1}{e^{\pi}-e^{-\pi}}\int\limits_{-\pi}^{\pi}e^{-x}\sin(nx)\text{d}x\end{align*}

I'm stuck in $a_{n}$ and $b_{n}$, need help finding an easy way to solve this integration.

• What's the problem? You're just integrating sines and cosines, as $e^{-\pi}$ is a constant. Commented Aug 22, 2017 at 17:15
• sorry it's e^(-x) Commented Aug 22, 2017 at 17:16
• Okay - then it's just integration by parts. Also, as a user with 500+ rep, you should know how to use MathJax and not just paste things in an image. Commented Aug 22, 2017 at 17:17
• Like I said, you need to use a special trick once you arrive at the same integral from integrating by parts twice...the trick is in adding the original integrals together and dividing by 2... Commented Aug 22, 2017 at 17:21
• @user155971, I've edited your post. Please notice that you had a mistake in computation of $a_0$. Also, I find that Math Lover's hint is a bit easier than IBP. Up to you choosing what you prefer. Commented Aug 22, 2017 at 17:30

IBP does the trick. Here's a start:

$$\frac{1}{n}\int_{-\pi} ^\pi e^{-x} \cos{nx} \ dx = \frac{1}{n} \left(-e^{-x} \cos {nx}\Big|_{-\pi}^\pi - n\int_{-\pi} ^\pi e^{-x} \sin{nx} \ dx \right)$$

The first term is easy. Do another IBP on the second term and you'll get the original integrand, so do what you would do in calculus II and solve for the unknown integral afterwards.

• I think you need to divide the integration, from -pi to 0 and from 0 to pi Commented Aug 22, 2017 at 17:30
• There's no need to - you'll get the same answer. Commented Aug 22, 2017 at 17:31
• also there is mistake , it should be 1/n not in just n , in integration Commented Aug 22, 2017 at 17:35
• Fixed - but of course, you can just add that in later as it's a constant multiplier. Commented Aug 22, 2017 at 17:36
• @SeanRoberson, $$\left.-e^{-x}\cos(nx)\right\vert_{-\pi}^{\pi}=\cos(n\pi)\left(e^{\pi}-e^{-\pi}\right)=(-1)^n\left(e^{\pi}-e^{-\pi}\right)$$ i.e, the first term is not $0$. Commented Aug 22, 2017 at 17:37

Hint: $$\int e^{-x + i a x} dx = \int{e^{-x} \cos(ax)dx + i \int e^{-x} \sin(ax) dx}.$$

• Nice one ! (+1) Commented Aug 22, 2017 at 17:40
• Thanks @Galc127. Using this method, we can get both integrals at the same time by computing the integral of an exponential. Commented Aug 22, 2017 at 17:44