# Fourier series coefficient justification

My textbook gives the following justification when introducing Fourier series: (NOTE: I have excluded the intermediate calculations that are irrelevant to this specific question).

(1) $f(x) = \dfrac{a_0}{2} + \sum_{n = 1}^{\infty} \left( a_n\cos(nx) + b_n\sin(nx) \right) \forall x \in [-\pi,\pi]$

(3) $a_0 = \dfrac{1}{\pi} \int^\pi_{-\pi} f(x) dx$

(7) $a_n = \dfrac{1}{\pi} \int^\pi_{-\pi} f(x) \cos(nx) dx$

By (3), formula (7) is also valid for $n = 0$; this is the reason for writing the constant term in (1) as $\dfrac{a_0}{2}$ rather than $a_0$.

The justification for writing the constant term in (1) as $\dfrac{a_0}{2}$ rather than $a_0$ does not provide enough information to make sense (to an introductory reader). I would greatly appreciate it if people could please take the time to elaborate on this justification and clarify it for an introductory reader such as myself.

• @Amin How does this answer my question? It's only tangentially related. – The Pointer Apr 15 '17 at 7:21
• Please check this one: lpsa.swarthmore.edu/Fourier/Series/DerFS.html math.stackexchange.com/questions/584113/… – Amin Apr 15 '17 at 7:22
• @Amin In addition to that, can you please explain specifically why my textbook gave the above explanation? My goal with this question is to understand the reasoning given by the textbook. – The Pointer Apr 15 '17 at 7:32
• check again the answer. – Amin Apr 15 '17 at 8:10

We have:

$$f(x) = \frac{a_0}{2}+\sum_{n=1}^{\infty} a_n\cos(nx) + b_n\sin(nx),$$

then we can write:

$$\int_{-\pi}^{\pi}f(x) = \int_{-\pi}^{\pi}\frac{a_0}{2} dx + \sum_{n=1}^{\infty}a_n \int_{-\pi}^{\pi}\cos(nx) dx +\sum_{n=1}^{\infty}b_n \int_{-\pi}^{\pi}\sin(nx) dx$$

where $\int_{-\pi}^{\pi}\cos(nx) = 0$ and $\int_{-\pi}^{\pi}\sin(nx) = 0$. Then, $$\implies a_0 = \frac{1}{\pi} \int_{-\pi}^{\pi}f(x)dx.$$

Here, we also can find the formula for

$$\int_{-\pi}^{\pi}f(x)\cos(mx) = \frac{a_0}{2}\int_{-\pi}^{\pi}\cos(mx) dx + \sum_{n=1}^{\infty}a_n \int_{-\pi}^{\pi}\cos(nx)\cos(mx) dx \\+\sum_{n=1}^{\infty}b_n \int_{-\pi}^{\pi}\sin(nx)\cos(mx) dx$$

where $$\int_{-\pi}^{\pi}\cos(nx)\cos(mx) dx = \begin{cases} \pi & n = m \\ 0 & n \neq m \end{cases},$$

$$\int_{-\pi}^{\pi}\cos(mx) dx = \frac{1}{m}\sin{mx}|_{-\pi}^{\pi} = 0,$$ $$\int_{-\pi}^{\pi}\sin(nx)\cos(mx) dx = 0$$ here, $\sin(nx)\cos(mx)$ is an odd function, then we have:

$$\implies a_n = \frac{1}{\pi} \int_{-\pi}^{\pi}f(x)\cos(nx)dx.$$

If, from the first, you use $a_0$ instead of $\frac{a_0}{2}$, then your formulas would be different from each other by a factor: $\frac{1}{2}$. However, in your textbook and also above, it seems for simplification and uniform formulation of the two $a_0$ and $a_n$, it is provided that way. Now, you need to consider (memorize) one formula for $a_n$; then, for $a_0$, just put $n=0$ to make the formula ready for it for calculation.

• How did you get to $\implies a_n = \frac{1}{\pi} \int_{-\pi}^{\pi}f(x)\cos(nx)dx$? What happened to the other expressions? You wrote $\int_{-\pi}^{\pi}f(x)\cos(mx) = \frac{a_0}{2}\int_{-\pi}^{\pi}\cos(mx) dx + \sum_{n=1}^{\infty}a_n \int_{-\pi}^{\pi}\cos(nx)\cos(mx) dx \\+\sum_{n=1}^{\infty}b_n \int_{-\pi}^{\pi}\sin(nx)\cos(mx) dx$, but you do not show how you proceed to $a_n$. – The Pointer Apr 15 '17 at 8:27
• If you do the integrals as above, both of them are zero. And, only for $n=m$ the middle integral has value equal to $\pi$. – Amin Apr 15 '17 at 8:34
• Now, it is shown how it proceeded. – Amin Apr 15 '17 at 8:42

I guess you are familiar with linear algebra. Let $V$ be a $n$-dimensional space over the real numbers, and let $( , )$ be an inner product on $V$. Let $\{\varphi_i\}_{i=1}^n$ be an orthogonal basis of $V$, in the sense that $(\varphi_i,\varphi_j)=0$ for $i\neq j$. Given any vector $v\in V$, we can express $v$ in terms of this basis: $$v=\sum_{i=1}^n a_i\varphi_i.$$ Now we can express $a_j$ in terms of the inner product and $v$ and $\varphi_j$. In fact we have $$(v,\varphi_j)=(\sum_{i=1}^n a_i\varphi_i,\varphi_j)=\sum_{i=1}^na_i(\varphi_i,\varphi_j) =a_j(\varphi_j,\varphi_j)$$ which gives $$a_j=\frac{(v,\varphi_j)}{(\varphi_j,\varphi_j)}.$$

Now in the case of Fourier series, our vector space $V$ consists of functions on $[-\pi,\pi]$, and the inner product on two such functions $f,g$ is given by $$(f,g)=\int_0^1fg\ dx.$$ And an orthogonal basis of this space is given by $\{\frac{1}{2},\cos x, \cos 2x,\cdots, \sin x,\sin 2x,\cdots\}$. Thus by our reasoning above, we can express our function $f$ in terms of this basis: $$f=a_0\cdot\frac{1}{2}+\sum_{n=1}^\infty(a_n\cos nx+b_n\sin nx)$$ and by the formula $a_j=\frac{(v,\varphi_j)}{(\varphi_j,\varphi_j)}$ we have $$a_0=\frac{(f,\frac{1}{2})}{(\frac{1}{2},\frac{1}{2})} =\frac{\int_{-\pi}^{\pi}\frac{1}{2}f(x)\ dx}{\int_{-\pi}^{\pi}(\frac{1}{2})^2\ dx}=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\ dx,$$ $$a_n=\frac{(f,\cos nx)}{(\cos nx,\cos nx)}=\frac{\int_{-\pi}^{\pi}f(x)\cos nx\ dx}{\int_{-\pi}^{\pi}(\cos nx)^2\ dx} =\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\cos nx\ dx$$ $$b_n=\frac{(f,\sin nx)}{(\sin nx,\sin nx)}=\frac{\int_{-\pi}^{\pi}f(x)\sin nx\ dx}{\int_{-\pi}^{\pi}(\sin nx)^2\ dx} =\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\sin nx\ dx.$$ Now if you pick the basis $\{1,\cos x, \cos 2x,\cdots, \sin x,\sin 2x,\cdots\}$ instead and express $$f=a_0\cdot 1+\sum_{n=1}^\infty a_n\cos nx+b_n\sin nx,$$ then a similar computation shows that $$a_0=\frac{(f,1)}{(1,1)} =\frac{\int_{-\pi}^{\pi}f(x)\ dx}{\int_{-\pi}^{\pi}\ dx}=\frac{1}{2\pi}\int_{-\pi}^{\pi}f(x)\ dx,$$ $$a_n=\frac{(f,\cos nx)}{(\cos nx,\cos nx)}=\frac{\int_{-\pi}^{\pi}f(x)\cos nx\ dx}{\int_{-\pi}^{\pi}(\cos nx)^2\ dx} =\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\cos nx\ dx$$ $$b_n=\frac{(f,\sin nx)}{(\sin nx,\sin nx)}=\frac{\int_{-\pi}^{\pi}f(x)\sin nx\ dx}{\int_{-\pi}^{\pi}(\sin nx)^2\ dx} =\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\sin nx\ dx.$$

Both of these two bases work, but the convention of using the basis $\{\frac{1}{2},\cos x, \cos 2x,\cdots, \sin x,\sin 2x,\cdots\}$ instead of $\{1,\cos x, \cos 2x,\cdots, \sin x,\sin 2x,\cdots\}$ is simply because the expression $a_0=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\ dx$, compared to $a_0=\frac{1}{2\pi}\int_{-\pi}^{\pi}f(x)\ dx$, looks like the expression $a_n=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\cos nx\ dx$ for $n\geq 1$, and thus can be combined together to form only one formula $$a_n=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\cos nx\ dx \text{ for all } n\geq 0.$$