# Thread: Fourier Series and Mean Error

1. ## Fourier Series and Mean Error

Suppose the function f(x) is defined on the interval (-L,L) and $\int_{-L}^L f^2(x)~dx$ is finite.

We want to approximate f(x) by a finite series of (co-)sines:

$f(x) \approx g_N(x) = A_0 + \sum_{n=1}^N A_n\cos{\left(\frac{n\pi}{L}x\right)} + B_n\sin{\left(\frac{n\pi}{L}x\right)}$

where parameters $A_0$, $A_n$, and $B_n$ are freely variable.

The mean square error of the approximation is defined as:

$E_N = \int_{-L}^L (f(x) - g_N(x))^2~dx$

a) Show that the choice: $A_0 = a_0$, $A_n = a_n$ and $B_n = b_n$, where $a_0$, $a_n$, and $b_n$ are the Fourier coefficients of f, minimizes $E_N$

I think I can figure the rest of it out when I get this, so I won't bother typing it... I have never worked with the mean error before so I'm a bit confused as to how to start. Any help would be appreciated.

2. Originally Posted by Aryth
Suppose the function f(x) is defined on the interval (-L,L) and $\int_{-L}^L f^2(x)~dx$ is finite.

We want to approximate f(x) by a finite series of (co-)sines:

$f(x) \approx g_N(x) = A_0 + \sum_{n=1}^N A_n\cos{\left(\frac{n\pi}{L}x\right)} + B_n\sin{\left(\frac{n\pi}{L}x\right)}$

where parameters $A_0$, $A_n$, and $B_n$ are freely variable.

The mean square error of the approximation is defined as:

$E_N = \int_{-L}^L (f(x) - g_N(x))^2~dx$

a) Show that the choice: $A_0 = a_0$, $A_n = a_n$ and $B_n = b_n$, where $a_0$, $a_n$, and $b_n$ are the Fourier coefficients of f, minimizes $E_N$

I think I can figure the rest of it out when I get this, so I won't bother typing it... I have never worked with the mean error before so I'm a bit confused as to how to start. Any help would be appreciated.
To save writing, put $c_n(x) = \cos\left(\frac{n\pi}{L}x\right)$ and $s_n(x) = \sin\left(\frac{n\pi}{L}x\right)$.

Here's how to start the calculation:

$E_N = \int_{-L}^L \Bigl(f(x) -\sum(A_mc_m(x) + B_ms_m(x)\Bigr) \Bigl(f(x) -\sum(A_nc_n(x) + B_ns_n(x)\Bigr)\,dx$. (You'll notice that I'm being a bit vague about the sums. They go from 0 to m or n for the cosines, and from 1 to m or n for the sines. It gets messy if you write this all out really carefully.) Now multiply out those parentheses and notice that a lot of the terms disappear or simplify when you integrate them from –L to L. For example, $\int_{-L}^Lc_m(x)c_n(x)\,dx$ is zero unless m=n, in which case it is 1. Also, $\int_{-L}^Lf(x)c_n(x)\,dx = a_n$, with a similar result for $s_n(x)$ and $b_n$.

When you have finished that calculation, you should be able to write it in the form

$E_N = \int_{-L}^Lf(x)^2dx - \sum(a_n^2+b_n^2) + \sum\bigl((a_n-A_n)^2 + (b_n-B_n)^2)\bigr).$

That is obviously minimised by taking $A_n=a_n$ and $B_n=b_n$ for each n.

3. I really appreciate this, it got me on the right track... But I'm having trouble getting the sums to simplify to the given final expression... It's a lot of tedious typing that I'll do if you really want me to... But I ended up with:

$\int_{-L}^L f^2(x) - 2\sum (a_n^2 + b_n^2) + \sum (A_n^2 + B_n^2) ~dx$

Would you show a couple of steps in the integration?? You don't have to show them all, I know it is a bit tedious.

4. Originally Posted by Aryth
I really appreciate this, it got me on the right track... But I'm having trouble getting the sums to simplify to the given final expression... It's a lot of tedious typing that I'll do if you really want me to... But I ended up with:

$\int_{-L}^L f^2(x) - 2\sum (a_n^2 + b_n^2) + \sum (A_n^2 + B_n^2) ~dx$

Would you show a couple of steps in the integration?? You don't have to show them all, I know it is a bit tedious.
That's very much along the right lines, except that you should have $- 2\sum (a_nA_n + b_nB_n)$ instead of $- 2\sum (a_n^2 + b_n^2)$. Also, all the terms except for $f^2(x)$ are constants and should not be integrated any further.

Now use the fact that $(a_n-A_n)^2 = a_n^2 - 2a_nA_n + A_n^2$, which you can write in the form $- 2a_nA_n + A_n^2 = -a_n^2 + (a_n-A_n)^2$. Substitute that (and the similar identity for $b_n$ and $B_n$) into the expression $\int_{-L}^L f^2(x)\,dx - 2\sum (a_nA_n + b_nB_n) + \sum (A_n^2 + B_n^2)$ and you'll get the answer.

5. Awesome, I got it. Just one last question, what are the indices of the sums in the final expression? Zero to N?

6. Originally Posted by Aryth
Awesome, I got it. Just one last question, what are the indices of the sums in the final expression? Zero to N?
As always with Fourier series, the cosine terms ( $a_n$ and $A_n$) go from 0 to N, the sine terms ( $b_n$ and $B_n$) go from 1 to N.

7. Alright, I'm stumped on another part of this... It says:

State the value of the minimum of $E_N$

8. Originally Posted by Opalg
$E_N = \int_{-L}^Lf(x)^2dx - \sum(a_n^2+b_n^2) + \sum\bigl((a_n-A_n)^2 + (b_n-B_n)^2)\bigr).$

That is obviously minimised by taking $A_n=a_n$ and $B_n=b_n$ for each n.
Originally Posted by Aryth
Alright, I'm stumped on another part of this... It says:

State the value of the minimum of $E_N$
So the minimum occurs when $A_n=a_n$ and $B_n=b_n$ for each n, and then $\boxed{E_N = \int_{-L}^Lf(x)^2dx - \sum(a_n^2+b_n^2).}$

9. That's what I thought... But is it the same as $\min{(E_N)}$?