# Discontinuous Fourier 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.

$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

• Could you use MathJax for formatting? – Yujie Zha Apr 18 '17 at 15:00

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.

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.

• thank you so much, that was really helpful and really well explained. I've found my error in An thank you. One question though, why does sigma start at n=1 ad not n=0, is this the general case for all Fourier series? thank you again! – Kate Apr 19 '17 at 8:44
• @Kate, no problem, glad to help. The series starts at $n=1$ because when $n=0$, we have $\sin\dfrac{n\pi x}L = \sin 0 = 0$, so $\displaystyle b_0 = \dfrac1L \int_{-L}^L f(x) \cdot 0 \, dx = 0$ anyway. And $\cos\dfrac{n\pi x}L = \cos 0 = 1$, so $a_0$ is not necessarily zero, but it's "cleaner" to have $a_0$ outside of the series (in that $\dfrac{a_0}2$ term) since otherwise you'd need a separate slightly different formula for $a_0$. – tilper Apr 19 '17 at 12:52
• And yes, it's the general case for all Fourier series in terms of sine and cosine. (It's possible to describe Fourier series in terms of the complex exponential $e^{inx}$, but then the sum is $\displaystyle \sum_{n=-\infty}^{+\infty}$.) – tilper Apr 19 '17 at 12:55