10
$\begingroup$

I'm having trouble figuring out the Fourier series of $|\cos(x)|$ from $-\pi$ to $\pi$.

I understand its an even function, so all the $b_n$s are $0$

$$a_0 = \frac 2 \pi \int_0^\pi |\cos(x)|\,dx = 0$$

$$a_n = \frac 2 \pi \int _0^\pi |\cos(x)| \cos(nx) \, dx = \frac 2 \pi \int_0^\pi \cos^2(x)\,dx.$$

since for all $j,k$ not equal the integral is zero.

so only $a_1$ remains. is this correct?

How would I evaluate $\sum_{n=1}^\infty (-1)^{n-1} /(4n^2 - 1)\ {}$?

$\endgroup$
  • 2
    $\begingroup$ The Fourier series for $|\cos x|$ on $[-\pi,\pi]$ is the same as the Fourier series for $\cos x$ on $[-\pi/2,\pi/2]$, so you could just compute the Fourier series for $\cos(x/2)$ on $[-\pi,\pi]$ then replace $x$ with $2x$. $\endgroup$ – Antonio Vargas Mar 3 '14 at 18:08
11
$\begingroup$

Although $ \int_0^\pi \cos(x)\,dx = 0$, $a_0\ne 0$ because $$\int_0^{\pi/2} |\cos(x)|\,dx=\int_{\pi/2}^{\pi} |\cos(x)|\,dx. $$

We can evaluate it as follows, as can be seen in the plot below

$$a_0 = \frac 1 \pi \int_{-\pi}^\pi |\cos(x)|\,dx=\frac 2 \pi \int_0^\pi |\cos(x)|\,dx=\frac 4 \pi \int_0^{\pi/2} |\cos(x)|\,dx = \frac 4 \pi \int_0^{\pi/2} \cos(x)\,dx=\frac 4 \pi.$$ $$\tag{1}$$

Plot of $\cos x$ (doted line) and $|\cos x|$ (solid line) in the interval $[-\pi,\pi]$.

enter image description here

The coefficients $b_n=0$ as you concluded. As for the $a_n$ coefficients only the odd ones are equal to $0$ (see below). The functions $\cos(x)$ and $\cos(nx)$ are orthogonal in the interval $[-\pi,\pi]$, but $|\cos(x)|$ and $\cos(nx)$ are not. Since

\begin{equation*} \left\vert \cos (x)\right\vert =\left\{ \begin{array}{c} \cos (x) \\ -\cos (x) \end{array} \begin{array}{c} \text{if} \\ \text{if} \end{array} \begin{array}{c} 0\leq x\leq \pi /2 \\ \pi /2\leq x\leq \pi, \end{array} \right. \tag{2} \end{equation*}

we have that

\begin{eqnarray*} a_{n} &=&\frac{1}{\pi }\int_{-\pi }^{\pi }\left\vert \cos (x)\right\vert\cos (nx)\,dx=\frac{2}{\pi }\int_{0}^{\pi }\left\vert \cos (x)\right\vert \cos (nx)\,dx \\ &=&\frac{2}{\pi }\int_{0}^{\pi /2}\left\vert \cos (x)\right\vert \cos (nx)\,dx+\frac{2}{\pi }\int_{\pi /2}^{\pi }\left\vert \cos (x)\right\vert \cos (nx)\,dx \\ &=&\frac{2}{\pi }\int_{0}^{\pi /2}\cos (x)\cos (nx)\,dx-\frac{2}{\pi } \int_{\pi /2}^{\pi }\cos (x)\cos (nx)\,dx. \\ a_{1} &=&\frac{2}{\pi }\int_{0}^{\pi /2}\cos ^{2}(x)\,dx-\frac{2}{\pi }\int_{\pi /2}^{\pi }\cos ^{2}(x)\,dx=0. \end{eqnarray*}

Using the following trigonometric identity, with $a=x,b=nx$, \begin{equation*} \cos (a)\cos (b)=\frac{\cos (a+b)+\cos (a-b)}{2},\tag{3} \end{equation*}

we find

\begin{eqnarray*} a_{2m} &=&\frac{4}{\pi \left( 1-4m^{2}\right) }\cos (\frac{2m\pi }{2})=\frac{ 4}{\pi \left( 1-4m^{2}\right) }(-1)^{m} \\ a_{2m+1} &=&\frac{4}{\pi ( 1-4(2m+1)^{2}) }\cos (\frac{(2m+1)\pi }{2})=0,\qquad m=1,2,3,\ldots.\tag{4} \end{eqnarray*}

The expansion of $\left\vert \cos (x)\right\vert $ into a trigonometric Fourier series in the interval $[-\pi ,\pi ]$ is thus

\begin{equation*} \left\vert \cos x\right\vert =\frac{a_{0}}{2}+\sum_{n=1}^{\infty }\left( a_{n}\cos (nx)+b_{n}\sin (nx)\right) =\frac{2}{\pi }+\frac{4}{\pi } \sum_{m=1}^{\infty }\frac{(-1)^{m}}{1-4m^{2}}\cos (2mx)\tag{5} \end{equation*}

enter image description here

$$|\sin(x)|\ \text{(blue) and the partial sum }\frac{2}{\pi }+\frac{4}{\pi } \sum_{m=1}^{5 }\frac{(-1)^{m}}{1-4m^{2}}\cos (2mx) \ \text{(red) in }[-\pi,\pi]$$

Setting $x=0$ in $(5)$, we obtain

\begin{equation*} 1=\frac{2}{\pi }+\frac{4}{\pi }\sum_{m=1}^{\infty }\frac{(-1)^{m}}{1-4m^{2}}=\frac{2}{\pi }-\frac{4}{\pi }\sum_{n=1}^{\infty }\frac{(-1)^{n-1}}{1-4n^{2}}.\tag{6} \end{equation*}

Hence

\begin{equation*} \sum_{n=1}^{\infty }\frac{(-1)^{n-1}}{1-4n^{2}}=\frac{1}{2}-\frac{\pi }{4}.\tag{7} \end{equation*}

$\endgroup$
  • 1
    $\begingroup$ This helps so much! Thank you! $\endgroup$ – Cloud15 Mar 5 '14 at 2:21
  • $\begingroup$ @Cloud15 You are welcome! $\endgroup$ – Américo Tavares Mar 5 '14 at 13:13
4
$\begingroup$

It is not correct. $$ \int_0^\pi|\cos x|\cos(n\,x)\,dx=\int_0^{\pi/2}\cos x\cos(n\,x)\,dx-\int_{\pi/2}^\pi\cos x\cos(n\,x)\,dx. $$ Compute the integrals and you will see that the result is not $0$.

$\endgroup$
  • $\begingroup$ aren't cos(x) and cos(nx) orthogonal so the integral is zero? $\endgroup$ – Cloud15 Mar 3 '14 at 18:31
  • $\begingroup$ Why is the second integral negative? $\endgroup$ – Cloud15 Mar 3 '14 at 19:23
  • $\begingroup$ Because $\cos x$ is negative on $[\pi/2,\pi]$, so that $|\cos x|=-\cos x$ if $\pi/2\le x\le\pi$. $\endgroup$ – Julián Aguirre Mar 3 '14 at 21:22
  • $\begingroup$ $\cos(x)$ and $\cos(nx)$ are orthogonal if you integrate over the entire interval $[0,\pi]$. This just integrates over $[0,\pi/2]$ and $[\pi/2,\pi]$. $\endgroup$ – Neal Mar 4 '14 at 19:02
1
$\begingroup$

You must breakup the integral into three intervals: $\left[-\pi \cdots -\frac{\pi}{2} \right]$, $\left[-\frac{\pi}{2} \cdots \frac{\pi}{2} \right]$, and $\left[\frac{\pi}{2} \cdots \pi \right]$

Which represent the regions where the sign of $\cos x$ changes. \begin{equation*} \left\vert \cos x\right\vert = \begin{cases} -\cos x & -\pi \le x \le -\frac{\pi}{2} \\ \cos x & \frac{\pi}{2} \le x \le \frac{\pi}{2} \\ -\cos x & \frac{\pi}{2} \le x \le \pi \end{cases} \end{equation*}

When I plugged the integral over the three regions into Maple I got:

\begin{align*} a_n &=\frac{1}{2 \pi} \int\limits_{t=-\pi}^{\pi} \left\vert \cos(t) \right\vert \cos(nt) \\ &= \frac{1}{2 \pi} \int\limits_{t=-\pi}^{-\frac{\pi}{2}}(-\cos(t)) \cos(nt) \\ &+ \frac{1}{2 \pi} \int\limits_{t=-\frac{\pi}{2}}^{\frac{\pi}{2}}\cos(t) \cos(nt) \\ &+ \frac{1}{2 \pi} \int\limits_{t=\frac{\pi}{2}}^{\pi}(-\cos(t)) \cos(nt) \\ &=-4{\frac {\cos \left( \frac{1}{2} \pi n \right) }{ \left( -1+{n}^{2} \right) \pi }} \end{align*}

Since, $\left\vert \cos t \right\vert$ is even you could break the integral in two and find $a_n$ as in Julián's answer. \begin{align*} a_n &=\frac{2}{\pi} \int\limits_{t=0}^{\pi} \left\vert \cos(t) \right\vert \cos(nt) \\ &= \frac{2}{\pi} \int\limits_{t=0}^{\frac{\pi}{2}}\cos(t) \cos(nt) \\ &+ \frac{2}{\pi} \int\limits_{t=\frac{\pi}{2}}^{\pi}(-\cos(t)) \cos(nt) \\ &=-4{\frac {\cos \left( \frac{1}{2} \pi n \right) }{ \left( -1+{n}^{2} \right) \pi }} \end{align*} for $1 < n$ and $a_0 = \frac{2}{\pi}$

My answer is simply an amplification of Julián's answer, but, I hope it helps.

$\endgroup$
-1
$\begingroup$

Bro, here you have to understand that, $\cos(x)$ is positive in first quadrant and negative in 2nd quadrant, so according to the rule of modulus, we will need to break the limits again to $0$ to $\frac{π}{2}$ and $\frac{π}{2}$ to $π$, in order to calculate term $a_0$ of the Fourier series. To make it more clear and understand it better, let's say we have $|\sin(x)|$ here the $\sin$ is positive in both the 1 and 2 quadrant. So we don't need to break the limits again like we have to in $\cos(x)$.

All trigonometry are positive in first quadrant Sin and cosine is positive in 2nd (all other are negative in this quadrant) Tan and cot is positive in 3rd. all other are negative in this quadrant Cos and sec is positive in 4th. all other are negative in this quadrant

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.