# The difference between m and n in calculating a Fourier series

I am studying for an exam in Differential Equations, and one of the topics I should know about is Fourier series. Now, I am using Boyce 9e, and in there I found the general equation for a Fourier series:

$$\frac{a_0}{2} + \sum_{m=1}^{\infty} (a_m cos\frac{m \pi x}{L} + b_m sin\frac{m \pi x}{L})$$

I also found the equations to calculate the coefficients in terms of n, where n is any real integer:

$$a_n = \frac{1}{L} \int_{-L}^{L} f(x) cos\frac{n \pi x}{L}dx$$ $$b_n = \frac{1}{L} \int_{-L}^{L} f(x) sin\frac{n \pi x}{L}dx$$

I noticed that the coefficients are calculated in terms of n, but are used in the general equation in terms of m. I also noticed that at the end of some exercises in my book, they convert from n to m. So my question is: what is the difference between n and m, and why can't I calculate my coefficients in terms of m directly? Why do I have to calculate them in terms of n, and then convert them? I hope that some of you can help me out!

## 2 Answers

m and n are just labels. They don't really mean anything. In this situation m is used as a general label to be summed over, and n is for a specific term in the sum. They're written differently, because that way you can write things like

$$\int_{-L}^L \left( \frac{a_0}{2} + \sum_{m=1}^{\infty} (a_m cos\frac{m \pi x}{L} + b_m sin\frac{m \pi x}{L}) \right)\cos(\frac{n\pi x}{L}) = La_n$$

Which is how we come to the second and third equation you list in your post. Here we need a way to distinguish between the general terms and the specific one we're interested in.

• Thank you. This gives me an intuition about m and n. Must have missed the explanation of them in the lectures :) . – Legion Nov 20 '12 at 20:06
• @Legion No worries - glad I could help! It probably wasn't mentioned in lectures, it's one of those things that is assumed you'll recognise, but of course everyone misses something once in a while! – Tom Oldfield Nov 20 '12 at 20:08

You should know by now that $n$ and $m$ are just dummy indices. You can interchange them as long as they represent the same thing, namely an arbitrary natural number.

If $$f(x) = \sum\limits_{n = 1}^\infty {{b_n}\sin \frac{{n\pi x}}{L}}$$ we can multiply both sides by ${\sin \frac{{m\pi x}}{L}}$ and integrate from $x = 0$ to $x = L$, for example, as follows: $$\int_0^L {f(x)\sin \frac{{m\pi x}}{L}dx = \sum\limits_{n = 1}^\infty {{b_n}\int_0^L {\sin \frac{{n\pi x}}{L}\sin \frac{{m\pi x}}{L}dx}}}$$ but the righthand side is $$\sum\limits_{n = 1}^\infty {{b_n}\frac{L}{2}{\delta _{nm}} = \left\{ {\begin{array}{*{20}{c}} 0&{n \ne m} \\ {{b_m}\frac{L}{2}}&{n = m} \end{array}} \right.}$$ where ${{\delta _{nm}}}$ is the Kronecker delta. It is just a compact way of stating that sines are orthogonal, i.e. $$\int_0^L {\sin \frac{{n\pi x}}{L}\sin \frac{{m\pi x}}{L}dx = \frac{L}{2}}$$ if $n = m$, and $0$ otherwise. So why did we use ${b_m}$? We used ${b_m}$ because the integral evaluates to $0$ when $n \ne m$, and the only term that "survives" is ${b_m}$ because it corresponds to the case $n = m$. Therefore, we can write $$\int_0^L {f(x)\sin \frac{{m\pi x}}{L}} dx = {b_m}\frac{L}{2}$$ and solve for ${b_m}$: $${b_m} = \frac{2}{L}\int_0^L {f(x)\sin \frac{{m\pi x}}{L}}dx.$$ We can solve for ${a_m}$ in exactly the same way because cosines are also orthogonal. At the end we can always change $m$ to $n$. This method for finding the Fourier coefficients works in general and is often referred to "Fourier trick" in physics. Overall, we can use $$\int_{ - L}^L {\sin \frac{{n\pi x}}{L}\sin \frac{{m\pi x}}{L}dx = \left\{ {\begin{array}{*{20}{c}} 0&{n \ne m} \\ L&{n = m \ne 0} \end{array}} \right.}$$ $$\int_{ - L}^L {\cos \frac{{n\pi x}}{L}\cos \frac{{m\pi x}}{L}dx = \left\{ {\begin{array}{*{20}{c}} 0&{n \ne m} \\ L&{n = m \ne 0} \\ {2L}&{n = m = 0} \end{array}} \right.}$$ $$\int_{ - L}^L {\sin \frac{{n\pi x}}{L}\cos \frac{{m\pi x}}{L}dx = 0}$$ to derive the famous Fourier coefficients.