[Math] Discontinuous Fourier Series

continuityfourier series

I have a discontinuous function:

$F(x) = \begin{cases} 0, & -\pi < x < 0 \\
\pi x, & 0 < x < \pi \end{cases}$

Calculate the Fourier series.

First of all, am i right in thinking this function, because discontinuous, is neither odd or even.

Also, is my answer correct please:

$a_0 = \dfrac{\pi^2}2$

$a_n = \dfrac{(-1)^n}{n^2}$

$b_n = \dfrac{-\pi(-1)^n}n$

$$F(x) = \dfrac{\pi^2}4 + \sum_{n=1}^{+\infty}\left(\frac{(-1)^n}{n^2} \cos(nx) – \frac{\pi(-1)^n}n \sin(nx)\right)$$

Thank you very much

Best Answer

First of all, am i right in thinking this function, because discontinuous, is neither odd or even.

No. Discontinuous functions can still be odd or even (or neither). For example, $f(x) = \begin{cases} 0, & -1 \le x \le 1 \\ 1, & x < -1 \\ -1, & x > 1 \end{cases}$ is odd and discontinuous.

However, the function you gave really is neither odd nor even.

In general, the best way to test a function $f(x)$ for oddness or evenness is to evaluate $f(-x)$. If you find that $f(-x) = -f(x)$, then $f$ is odd. If you find that $f(-x) = f(x)$, then $f$ is even. Or you can just look at the graph of $f$. If the graph of $f$ is symmetric over the $y$-axis, then $f$ is even. If the graph of $f$ is symmetric over the origin, then $f$ is odd.

Also, is my answer correct please:

The formulas for the coefficients of a Fourier series, if we integrate over $-L$ to $L$, are

\begin{align*} a_n &= \frac1L \int_{-L}^L f(x) \cos \frac{n\pi x}L \, dx \quad (n=0,1,2,\dots)\\[0.3cm] b_n &= \frac1L \int_{-L}^L f(x) \sin \frac{n\pi x}L \, dx \quad (n=1,2,3,\dots)\\[0.3cm] \end{align*}

Note that this also requires we write the series as $$\frac{a_0}2 + \sum_{n=1}^{+\infty} \left(a_n \cos\frac{n\pi x}L + b_n\sin\frac{n\pi x}L\right)$$

In your case you have $L = \pi$, and you only need to integrate from $0$ to $L$ (i.e., $0$ to $\pi$) because your $f(x)$ is $0$ for $-\pi < x < 0$. So then:

$$a_0 = \frac1\pi \int_0^\pi \pi x \, dx = \frac{\pi^2}2$$

So that checks out.

$$a_n = \frac1\pi \int_0^\pi x \cos nx \, dx = \dots = \frac{(-1)^n-1}{n^2} $$

Looks like you're missing the $-1$ in the numerator on yours. Did you perhaps leave off a $\cos(nx)$ evaluated at $x=0$ when doing the integration?

$$b_n = \frac1\pi \int_0^\pi x \sin nx ,\ dx = \dots = \frac{\pi(-1)^{n+1}}n$$

Same as what you got in a slightly different form.

Let me know if you need more help fixing $a_n$.

Note: You can verify your answer by graphing on desmos.com. Here's a link for this one. I don't think desmos can handle infinite sums so I made the upper limit 100. High enough to get a clear picture.

Related Question