# Fourier series for square wave signal

Show that the Fourier series for the square wave function $$f(t)=\begin{cases}-1 & -\frac{T}{2}\leq t \lt 0, \\ +1 & \ \ \ \ 0 \leq t \lt \frac{T}{2}\end{cases}$$ is $$f(t)=\frac{4}{\pi}\left(\sin\left(\frac{2\pi t}{T}\right)+\frac{\sin(\frac{6\pi t}{T})}{3}+\frac{\sin(\frac{10\pi t}{T})}{5}+\cdots\right)$$

I understand that the general Fourier series expansion of the function $$f(t)$$ is given by $$f(t)=\frac{a_0}{2}+ \sum_{r=1}^{r=\infty}\left(a_r\cos\left(\frac{2\pi r t}{T}\right)+b_r\sin\left(\frac{2\pi r t}{T}\right)\right)$$ But what happened to the $$\frac{a_0}{2}$$ term at the beginning of

$$f(t)=\frac{a_0}{2}+ \sum_{r=1}^{r=\infty}\left(a_r\cos\left(\frac{2\pi r t}{T}\right)+b_r\sin\left(\frac{2\pi r t}{T}\right)\right)$$ for the general Fourier series expansion?

From advice, I've been told that the constant term can be found by integrating $$f(t)$$ such that $$\int_{t=-\frac{T}{2}}^{t=\frac{T}{2}}f(t)\mathrm{d}t= \int_{t=-\frac{T}{2}}^{t=\frac{T}{2}} \left(\frac{a_0}{2}+ \sum_{r=1}^{r=\infty} (a_r\cos\frac{2\pi r t}{T}+b_r\sin\frac{2\pi r t}{T})\right)\mathrm{d}t$$ from here could someone please show me the steps involved in showing that $$\frac{a_0}{2}=0$$

Many thanks,

Blaze

First, your function considered on each of the intervals $[0,T/2[$ and $[-T/2,0[$ separately, is just a constant function. It's the whole that is non-constant. So, when you integrate, since you can separate out your integration over the different integration intervals, on them, you are just integrating a constant function.

So, $f$ didn't disappear, $f$ is just equal to $1$ over the interval $[0,T/2[$.

Second, your function is also odd. The constant term is found by simply integrating the function over an interval symmetric around the origin.

$$a_0=\frac{2}{T}\int_{t=-\frac{T}{2}}^{t=\frac{T}{2}}f(t)\,\mathrm{d}t=\frac{2}{T}\int_{t=-\frac{T}{2}}^{t=0}f(t)\,\mathrm{d}t+\frac{2}{T}\int_{t=0}^{t=\frac{T}{2}}f(t)\,\mathrm{d}t \\ =\frac{2}{T}\int_{t=-\frac{T}{2}}^{t=0}-1 \, \,\mathrm{d}t+\frac{2}{T}\int_{t=0}^{t=\frac{T}{2}} 1 \, \,\mathrm{d}t = 0 \; .$$

Therefore the integral is zero.

EDIT: $$\begin{eqnarray}\int_{t=-\frac{T}{2}}^{t=\frac{T}{2}}f(t)\,\mathrm{d}t & = & \int_{t=-\frac{T}{2}}^{t=\frac{T}{2}} \left(\frac{a_0}{2}+ \sum_{r=1}^{r=\infty} a_r\cos\frac{2\pi r t}{T}+b_r\sin\frac{2\pi r t}{T}\right)\,\mathrm{d}t\\ & = & \int_{t=-\frac{T}{2}}^{t=\frac{T}{2}} \frac{a_0}{2}\,\mathrm{d}t+ \sum_{r=1}^{r=\infty} a_r \int_{t=-\frac{T}{2}}^{t=\frac{T}{2}}\cos\frac{2\pi r t}{T}\,\mathrm{d}t+\sum_{r=1}^{r=\infty}b_r\int_{t=-\frac{T}{2}}^{t=\frac{T}{2}} \sin\frac{2\pi r t}{T}\,\mathrm{d}t \\ & = & \int_{t=-\frac{T}{2}}^{t=\frac{T}{2}} \frac{a_0}{2}\,\mathrm{d}t+ \sum_{r=1}^{r=\infty} a_r \cdot 0+\sum_{r=1}^{r=\infty}b_r\cdot 0 \\ & = & \int_{t=-\frac{T}{2}}^{t=\frac{T}{2}} \frac{a_0}{2}\,\mathrm{d}t \\ & = & \frac{a_0}{2}\cdot T \end{eqnarray}$$

• Thanks for your reply, I'm still a bit confused could you explain in a bit more detail? I don't understand why "Therefore the integral is zero." By "constant term" are you referring to $$\frac{a_0}{2}$$ Why is $f(t)$ equal to 1? I know that $f(t)$ is 1 on that interval but $f(t)$ appears in the integrand. Sorry this is really simple to you, it isn't simple to me. Sep 11 '15 at 4:32
• No problem. I'll further elaborate my answer. Sep 11 '15 at 5:44
• Thanks, that makes more sense, only thing I still don't understand is why $\frac{a_0}{2}=\frac{2}{T}\int_{t=-\frac{T}{2}}^{t=\frac{T}{2}}f(t)\mathrm{d}t$ or put in another way; why can the constant term $$\frac{a_0}{2}$$ be found by simply integrating the function over an interval symmetric around the origin? Sep 11 '15 at 19:54
• Look at your Fourier series for $f$. Integrate both sides. Because the $\sin$ and $\cos$ get integrated over a (or several) full period(s), they integrate to zero. But not the constant term. Sep 12 '15 at 16:41