# How to solve Real Analysis

Find the Fouries series of the function given below $$f(x) = \lvert\cos t\rvert \quad\hbox{for all t}.$$ What does it means for all $x$? Can someone show me some work done so that I can understand better?

-
Sketch the function $|\cos x|$ for all $x$. It will be periodic (that is, the same shape will repeat over and over), and thus can be represented by a Fourier series. Do you know how to compute the Fourier coefficients of a function that has (least) period different from $2\pi$? –  Dilip Sarwate Sep 3 '12 at 17:41
To find the Fourier series is to find the coefficients of the Fourier series representation of $|\cos x|$. Have you covered how to find the coefficients? You need to multiply $|\cos x|$ against an integer-multiple-of-$2\pi$ dilate of a trigonometric function (either a complex exponential or sine, cosine, depending on what kind of series you're in search of) and then integrate over a fundamental interval (like $(0,2\pi)$ or $(-\pi,\pi)$ or whatever) and normalize by dividing by $2\pi$. You can evaluate the integral by splitting it into two pieces based on when $\cos$ is positive or negative... –  anon Sep 3 '12 at 17:50
Hi Dilip and anon.Thanks for the hints and tips –  Garett Sep 4 '12 at 5:15

One can use Fourier series on a general interval $[a, a + L]$,

$$\sum _{n=-\infty }^{\infty }{\it c\_n}\,{{\rm e}^{{\frac {2\,inx\pi }{ L}}}} \,,$$

where $c_n$ are given by,

$$c_n = \int _{a}^{a+L}\!f \left( x \right) {{\rm e}^{{\frac {-2\,in\pi \,x}{L }}}}{dx}$$

Applying this to our problem, first we note that |cos(x)| is a periodic function of period $\pi$ and $\cos(x)$ is positive on the interval $[-\frac{\pi}{2},\frac{\pi}{2}]$,

$$c_n = \int _{-\frac{\pi}{2}}^{-\frac{\pi}{2}+\pi} \cos(x) {{\rm e}^{{\frac {-2\,in\pi \,x}{L }}}}{dx} = 2\,{\frac { \left( -1 \right) ^{1+n}}{\pi \, \left( 4\,{n}^{2}-1 \right) }} \,.$$

Then the Fourier series of $|\cos(x)|$ is given by,

$$|\cos(x)| = \sum _{n=-\infty }^{\infty }2\,{\frac { \left( -1 \right) ^{1+n}}{\pi \, \left( 4\,{n}^{2}-1\right) }}\,{{\rm e}^{{\frac {2\,inx\pi }{L}}}}\,.$$

Writing the sum as,

$$|\cos(x)| = 2\,{\pi }^{-1}+\sum _{n=1}^{\infty}2\,{\frac { \left( -1 \right) ^{1+n} \left( {{\rm e}^{2\,inx}}+{{\rm e}^{-2\,inx}} \right) }{\pi \, \left( 4\,{n}^{2}-1 \right) }} = 2\,{\pi }^{-1}+\sum _{n=1}^{\infty}4\,{\frac { \left( -1 \right) ^{1+n} \cos \left( 2\,nx \right) }{\pi \, \left( 4\,{n}^{2}-1 \right) }} \,,$$

which gives the desired result.

-
Thank you Mhenni Benghorbal. You really help me on this particular problem. You just so kind to help me. Thanks once again –  Garett Sep 5 '12 at 5:28
@Garett:Any time. You are welcome. I am very happy that you benefitted from my answer and the other ones. –  Mhenni Benghorbal Sep 6 '12 at 18:06

We treat the function $f$ as a $2\pi$-periodic function, so that we can apply the most basic formulae for the Fourier coefficients. The function $f$ is even; whence all sine coefficients $b_k$ are $=0$, and $$a_k={1\over\pi}\int_{-\pi}^\pi f(x)\ \cos(k x)\ dx={2\over\pi}\int_0^\pi f(x)\ \cos(k x)\ dx\qquad(k\geq0)\ .$$ In addition, $f$ is even with respect to the point $x={\pi\over2}$, and this implies that $a_k$ is $=0$ for odd $k$ (to see this draw the graphs of $f$ and of $x\mapsto\cos\bigl((2j+1)x\bigr)$ in the same figure). In the interval $\bigl[0,{\pi\over2}\bigr]$ our function is just $x\mapsto\cos x$. Therefore we get \eqalign{a_{2j}&={4\over\pi}\int_0^{\pi/2}\cos x\cos(2j x)\ dx={2\over\pi}\int_0^{\pi/2}\bigl(\cos((2j+1)x)+\cos((2j-1))x\bigr)\ dx\cr &={2\over\pi}\left.\biggl({1\over2j+1}\sin((2j+1)x)+{1\over2j-1}\sin((2j-1)x)\biggr)\right|_0^{\pi/2} \cr &={2\over\pi}\biggl({(-1)^j\over 2j+1} -{(-1)^j\over 2j-1}\biggr)={4\over\pi}{(-1)^{j-1}\over 4j^2-1}\ .\cr} In particular $a_0={4\over\pi}$. All in all we obtain $$|\cos x|={a_0\over2}+\sum_{j=1}^\infty a_{2j}\cos(2j x)={2\over\pi}-{4\over\pi}\sum_{j=1}^\infty{(-1)^j\over 4j^2-1}\cos(2jx)\ ,$$ and the resulting series is uniformly convergent on ${\mathbb R}$.

-
Hi Christian you are awesome.Thanks man for your effort to help me –  Garett Sep 4 '12 at 5:15

The Fourier series of a function $f(x)$ is a series on the form $${1\over 2}a_0 +\sum_{n=1}^\infty \bigl(a_n \cos(nx) + b_n \sin(nx)\bigr)$$ where the coefficients $a_n$ and $b_n$ are given by the formulas $$a_n ={1\over\pi}\int_{-\pi}^{\pi}f(x)\cos(nx)\,{\rm d}x\qquad n=0,1,2,\dots$$ $$b_n ={1\over\pi}\int_{-\pi}^\pi f(x)\sin(nx)\,{\rm d}x\qquad n=1,2,\dots$$ Since your function $f(x)=|\cos(x)|$ is an even function, all $b_n=0$. (You are integrating an odd function over a symmetric interval about 0.)

For the same reason, you get that $$a_n ={2\over\pi}\int_0^\pi f(x)\cos(nx)\,{\rm d}x$$ Your function $f(x)$ is defined by $f(x)=\cos(x)$ for $0\leq x\leq {\pi\over 2}$, and by $f(x)=-\cos(x)$ for ${\pi\over 2}\leq x\leq \pi$, so it might be wise to divide this integral in two parts when computing it.

When you have computed the Fourier coefficients, try to plot $f(x)$ and the series you get by using the first few terms of the Fourier series. You should get two reasonably similar-looking graphs.

-
Hi Per Manne.Thanks for your effort for showing some work done.You really help me out –  Garett Sep 4 '12 at 5:16

Note that the Fourier coefficients of a function $f(x)$ are given by $$c_n=\frac{1}{2\pi}\int_0^{2\pi}e^{-inx}f(x)dx.$$ For $f(x)=|\cos x|$ we have \begin{align} c_n &=\frac{1}{2\pi}\int_0^{2\pi}e^{-inx}|\cos x|dx\\ &=\frac{1}{2\pi}\int_0^{\pi}e^{-inx}|\cos x|dx+\frac{1}{2\pi}\int_{\pi}^{2\pi}e^{-inx}|\cos x|dx\\ \end{align} and if $n$ is odd we have $e^{-in(x+\pi)}=-e^{-inx}$ so the two integrals cancel. If $n$ is even then $e^{-in(x+\pi)}=e^{-inx}$ so both integrals agree and \begin{align} c_n&=\frac{1}{\pi}\int_0^{\pi}e^{-inx}|\cos x|dx\\ &=\frac{1}{\pi}\int_0^{\pi/2}e^{-inx}\cos xdx+\frac{1}{\pi}\int_{\pi/2}^{\pi}e^{-inx}\cos xdx\\ \end{align} and if $\frac{n}{2}$ is odd we have $e^{-in(x+\pi/2)}=e^{-inx+(n/2)\pi}=-e^{-inx}$ so the integrals again cancel. Thus if $n\neq 4m$ the Fourier coefficient $c_n$ is $0$. If $n=4m$ then we have $e^{-in(x+\pi/2)}=e^{-inx}$ so both integrals agree and \begin{align} c_n&=\frac{2}{\pi}\int_0^{\pi/2}e^{-inx}\cos xdx\\ &=\frac{2}{\pi}\int_0^{\pi/2}\cos nx\cos xdx+\frac{2i}{\pi}\int_0^{\pi/2}\sin nx\cos xdx\\ \end{align} and both of these integrals can be found in many tables, or on Wolfram|Alpha.

-
Hi Alex thanks for your help for this question.It really helps me for your suggestion –  Garett Sep 4 '12 at 5:16