How to calculate the Fourier coefficients for the function $f(x) = x^2 - \pi^2/3$

263 Views Asked by At

Consider the function $f \in C_{st}$ given by $$ f(x) = x^2- \frac{\pi^2}{3} $$ for $x \in ]-\pi,\pi[$ Then I have to calculate the Fourier coefficient $c_n$ which I am struggling a little bit with.

I know that $$ 2\pi c_n = \int_{-\pi}^\pi x^2e^{-inx} - \frac{\pi^2}{3} \int_{-\pi}^\pi e^{-inx} dx $$ For the case where $n \neq 0$ we have $$ \frac{\pi^2}{3} \int_{-\pi}^\pi e^{-inx} dx = 0 $$ Thus \begin{align*} 2 \pi c_n & = \int_{-\pi}^\pi x^2e^{-inx} dx = \frac{1}{-in} \left[x^2e^{-inx} \right]_{-\pi}^\pi - \frac{1}{-in} \int_{-\pi}^\pi 2xe^{-inx} dx \\ & = \frac{2}{in} \int_{-\pi}^\pi xe^{-inx} dx \\ & = \frac{2}{in} \left( \frac{1}{-in} \left[xe^{-inx} \right]_{-\pi}^\pi - \frac{1}{-in} \int_{-\pi}^\pi e^{-inx} dx \right) \\ & = \frac{2}{in} \left(-2\pi + \frac{1}{n^2} (e^{-in\pi} - e^{in\pi}) \right) \\ & = - \frac{4\pi}{in} \end{align*} which does not give the right answer. I can't see where I am doing a mistake. Do you mind helping me? Thanks

2

There are 2 best solutions below

2
On BEST ANSWER

In the third line from the last,

$$\frac{2}{in}\left[\frac{1}{-i n}(xe^{-inx})\right]^\pi_{-\pi} = \frac{2}{+n^2}(\pi e^{-i\pi n} + \pi e^{i\pi n}) = \color{blue}{\frac{4\pi}{n^2}\cos(n\pi)} $$ and the next one $\left[\int_{-\pi}^\pi e^{-i n x}dx\right]$obviously becomes zero.

2
On

The part with the constant is not hard. For the part with $x^2 e^{-inx}$, do some integration by parts :

\begin{align} \int x^2 e^{-inx}\mathrm{d}x &= [x^2 \frac{e^{-inx}}{-in}] - \int 2x \frac{e^{-inx}}{-in}\mathrm{d}x \\ \end{align}

Do it again : \begin{align} \int xe^{-inx}\mathrm{d}x &= [x \frac{e^{-inx}}{-in}] - \int \frac{e^{-inx}}{-in} \mathrm{d}x \end{align}

I let you fill the holes with suitable values