Whats is the sum of series for each $0\le x\le 3$?

Let $\psi(x)=\begin{cases}0:& 0<x<1\\ 1:& 1<x<3 \end{cases}$

a) Compute the first 4 terms of its Fourier cosine series explicitly.

b) For each $x (0\le x\le 3)$, whats is the sum of this series?

a) We have that $\phi(x)=\begin{cases}0:& 0<x<1\\ \frac{2}{3}+\sum_{m=1}^{\infty}\frac{-2\sin(m\pi/3)}{m\pi}\cos(\frac{m\pi x}{3}):& 1<x<3 \end{cases}$

Thus the fisrt four terms are $\frac{2}{3}-\frac{2}{\pi}\sin(\frac{\pi}{3})\cos(\frac{\pi x}{3})-\frac{1}{\pi}\sin(\frac{2\pi}{3})\cos(\frac{2\pi x}{3})-\frac{1}{2\pi}\sin(\frac{4\pi}{3})\cos(\frac{4\pi x}{3})$

b) Note that by the interval definition of $x$ we cannot consider $0$ nor $3$ thus in $(0,1),\phi=0$. And now I wonder how will I calculate the sum of the series in $(1,3)?$

I don't think brute force is a solution

Can somebody help me?

edit: I had a typo in the definition of Fourier series, it's 2/3 instead of 4/3. Sorry.

edit 2: According to H.Gutsche's comment, the sum of the series in the interval $0\le x\le 3$ is $\phi(x)=\begin{cases}1/2:& 0\\0:& 0<x<1\\1/2:& 1\\ 1:& 1<x<3\\1/2:& 3 \end{cases}$ by Dirichlet Theorem. I don't know what exactly states that Theorem nor how was applied to get $\phi$. I found this
https://en.wikipedia.org/wiki/Convergence_of_Fourier_series which mention Dirichlet but it says something about an integral and I don't see how that would help.

Please shed some light here, I'm not understanding.

• Isn't the actual question precisely what happens with the series at 0, 1, and 3? If the given series is the Fourier series it should converge to the values of the given function outside of its discontinuities. At the discontinuities there is something happening involving the left and the right limits at these points. – H. Gutsche May 1 '18 at 16:59
• @H.Gutsche Nop, the actual question (as is stated in the text) is as I wrote b) – user441848 May 1 '18 at 17:36
• b) says 0, 1 and 3 are values to be considered. outside of this the Fourier series should precisely do what it is supposed to do i.e. give $0$ for $0<x<1$, and $1$ for $1<x<3$. Then Dirichlet tells me that that the value for $0,1$, and $3$ is $1/2$ – H. Gutsche May 1 '18 at 17:44
• @H.Gutsche Dirichlet? What proposition/result by Dirichlet are you talking about to say that the value for $0,1$ and $3$ is $1/2$? – user441848 May 1 '18 at 18:02
• Do you know what Fourier series do? The sum is the given function plus the 3 special values.You original function is not even defined in these points (but has left and right limits, so we can artificially define it in these points with one of those respective limits). So we come back to my original statement that the only interesting points are 0,1, and 3. If you want to see that numerically just use these values in your series and see if reduces to something simple. Quite often one uses Fourier developments to get some surprising series for well known values (the value of the original) – H. Gutsche May 1 '18 at 22:40

Well, definitely, there has been some confusion around.
Let me try to put some order. I will deal the case "enginering-wise", although rigorously enough.

1) Periodicity

If you are using (asked to use) the Fourier series, that implicitely means that you are considering your function $\phi(x)$ periodic, and that the definition you are reporting is describing just one period of it (as it is normal practice).
Explicitly, it shall be written as $$\bbox[lightyellow] { \varphi (x) = \varphi (x\bmod 3) = \left\{ {\matrix{ {\,0} \hfill & {\left| {\;0 < x < 1\,} \right.} \hfill \cr {\,1} \hfill & {\left| {\,1 < x < 3} \right.} \hfill \cr } } \right. }$$

So your function looks like in the following sketch

and it is a square pulse wave, of period $T=3$, and with duty-cycle $2/3$.

2) Points of non-definition / discontinuity

The fact that $\phi(x)$ is mathematically undefined at $x=0,1$, but has there finite left and right limits, is somehow irrelevant to the Fourier series, which being continuous will (intuitively speaking) provide and "fill the gaps". It is in fact well known that the Fourier series at the discontinuity points (if "finitely many") takes on the average value between the left and right limit: that is the Dirichlet Theorem already mentioned. Have a look at the reference for a rigorous definition.
Thus in our case the Fourier series (the complete one, with infinite terms) will converge at $1/2$ for $x=0$ and $x=1$.
(the first four terms, for $x=0$ return $\phi(x)=0.5288..$).

3) The Series

$\phi(x)$, when periodically continued, is symmetric (even) around $x=1/2$, as well around $x=-1$. So you can express it in terms of only cosines (the even components) of $x-1/2$, or $x+1$.

Thus your expression shall be corrected as: \bbox[lightyellow] { \eqalign{ & \varphi (x) = {2 \over 3} - \sum\limits_{1\, \le \,k} {{2 \over {k\pi }}\sin \left( {{{k\pi } \over 3}} \right)\cos \left( {{{2k\pi } \over 3}\left( {x - {1 \over 2}} \right)} \right)} = \cr & = {2 \over 3} + \sum\limits_{1\, \le \,k} {{2 \over {k\pi }}\sin \left( {{{2k\pi } \over 3}} \right)\cos \left( {{{2k\pi } \over 3}\left( {x + 1} \right)} \right)} \cr} } The following sketch shows the sum up to the eleventh term.

4) the Sum

Coming to your question b), it is a known property of sinusoidal signals that, if you divide the period into $2 \le n$ equal parts and take $n$ samples of the signal (at the beginning or at the end of each interval), the samples' average will be equal to the continuous mean of the signal: thus $0$, unless the frequency is null.
In mathematical terms: $$\sum\limits_{0\, \le \,k\, \le \;n - 1} {\cos \left( {\alpha + 2\pi {k \over n}} \right)} = 0\quad \left| {\;2 \le n} \right.$$ which is easy to demonstrate by converting into $e^{ix}$.

Now, if you keep the division of the base period into $n$ parts, and increase the frequency by multiples of the fundamental one, and sum the samples, you get $$\bbox[lightyellow] { \sum\limits_{0\, \le \,k\, \le \;n - 1} {\cos \left( {\alpha + 2\pi m{k \over n}} \right)} = \left\{ {\matrix{ 0 & {n\rlap{--} \backslash m} \cr {n\cos \alpha } & {n\backslash m} \cr } } \right. }$$ which is the Frequency Aliasing effect, famous in the western movies for the wagon wheel effect.

In our case, we are dividing the period by $3$ and taking three samples at $x=1,2,3$. That would be the same if we take them at $(2,3,4)$ or at $(1/2,3/2,5/2)$, ..., so we can forget about the shift of $-1/2$ or $+1$ attached to $x$ in the formula above.
And for what told above we shall just consider the frequencies multiple of $3$.
But because the amplitudes (for $0<k$) contain the factor $\sin(k \pi /3)$, they are all null.

Therefore the sum of the series for $x=1,2,3$ (same as for $(0,1,2)$ or $(1/2,3/2,5/2)$, ...), independently of how many terms of it you consider, will always be $3 \times mean$, i.e. $$\bbox[lightyellow] { 3 \cdot 2/3 = 2 }$$ and since it is valid for whichever number of terms, thus also for the complete series, then it is as well equal to $1/2+1+1/2$.

• Thank you for your answer! – user441848 May 8 '18 at 20:51
• Glad to help and clear-up a "simple" matter that went messed, and thanks for the bounty. Best wishes for your study on the fascinating world of Fourier coefficients (by the way, just for curiosity, are you a student ? in engineering or maths ?) – G Cab May 8 '18 at 21:21
• :) yes of course I'm a student, mathematic student. Althoug I've taken courses that have nothing to do with mathematics for instance philosophy courses at first it was really hard becuase I didn't understand anything, but then things become clearer by the pass of the time.. – user441848 May 8 '18 at 23:19
• @Alt.: well, then ad majora! – G Cab May 9 '18 at 0:36

From MoonKnight comments we can deduce the following

$\phi(x=0) = 0.5[\lim_{x->0^+}\phi(x) + \lim_{x->0^-}\phi(x)] = 0.5[\lim_{x->0^+}\phi(x) + \lim_{x->3^-}\phi(x)] = 0.5[0+1]=.5$

$\phi(x=1) = 0.5[\lim_{x->1^+}\phi(x) + \lim_{x->1^-}\phi(x)] = 0.5[1+0] = 0.5$

$\phi(x=3) = 0.5[\lim_{x->3^+}\phi(x) + \lim_{x->3^-}\phi(x)] = 0.5[\lim_{x->0^+}\phi(x) + \lim_{x->3^-}\phi(x)] = 0.5[0+1]=.5$

Hence

$\phi(x)=\begin{cases}1/2, 0\\0, 0<x<1\\1/2, 1\\ 1, 1<x<3\\1/2, 3 \end{cases}$