# What is the Fourierseries of the following equation?

## $f \left(x\right) = | \sin \left(x\right) |$

Jul 20, 2018

$\left\mid \sin x \right\mid = \frac{2}{\pi} - \frac{4}{\pi} {\sum}_{n = 1}^{\infty} \frac{\cos \left(2 n x\right)}{4 {n}^{2} - 1}$

#### Explanation:

graph{y = abs(sin x) [-10, 10, -1, 3]}

The function has period $\pi$ and is even, ie $f \left(x\right) = f \left(\text{-} x\right)$, which means a cosine series. Using this definition:

• $\left\{\begin{matrix}{a}_{0} = \frac{1}{L} {\int}_{0}^{2 L} f \left(x\right) \mathrm{dx} \\ {a}_{n} = \frac{1}{L} {\int}_{0}^{2 L} f \left(x\right) \cos \left(\frac{n \pi x}{L}\right) \mathrm{dx} \\ f \left(x\right) = \frac{1}{2} {a}_{0} + {\sum}_{n = 1}^{\infty} {a}_{n} \cos \left(\frac{n \pi x}{L}\right) \\ 2 L = \pi\end{matrix}\right.$

${a}_{0} = \frac{2}{\pi} {\int}_{0}^{\pi} \sin x \mathrm{dx} = \frac{4}{\pi}$

${a}_{n} = \frac{2}{\pi} {\int}_{0}^{\pi} \sin x \cos 2 n x \setminus \mathrm{dx}$

Using this ID:

• $2 \setminus \sin \setminus \theta \setminus \cos \setminus \varphi = \setminus \sin \left(\setminus \theta + \setminus \varphi\right) + \setminus \sin \left(\setminus \theta - \setminus \varphi\right)$

$\therefore {a}_{n} = \frac{1}{\pi} {\int}_{0}^{\pi} \sin \left(2 n + 1\right) x + \sin \left(1 - 2 n\right) x \setminus \mathrm{dx}$

$= \frac{1}{\pi} {\left[- \frac{\cos \left(2 n + 1\right) x}{2 n + 1} + \frac{\cos \left(2 n - 1\right) x}{2 n - 1}\right]}_{0}^{\pi}$

$= \frac{1}{\pi} {\left[\frac{\left(2 n + 1\right) \cos \left(2 n - 1\right) x - \left(2 n - 1\right) \cos \left(2 n + 1\right) x}{4 {n}^{2} - 1} \setminus\right]}_{0}^{\pi}$

$2 n - 1$ and $2 n + 1$ are both odd, $\implies \cos \left(2 n - 1\right) \pi = \cos \left(2 n + 1\right) \pi = - 1$

$= \frac{1}{\pi} \setminus \left\{\left[\frac{\left(2 n + 1\right) \left(- 1\right) - \left(2 n - 1\right) \left(- 1\right)}{4 {n}^{2} - 1} \setminus\right] - \left[\frac{\left(2 n + 1\right) - \left(2 n - 1\right)}{4 {n}^{2} - 1} \setminus\right] \setminus\right\}$

$= \frac{1}{\pi} \setminus \left\{\left[\frac{- 2 n - 1 + 2 n - 1}{4 {n}^{2} - 1} \setminus\right] - \left[\frac{2 n + 1 - 2 n + 1}{4 {n}^{2} - 1} \setminus\right] \setminus\right\}$

$= - \frac{4}{\pi \left(4 {n}^{2} - 1\right)}$

From the definition:

$\left\mid \sin x \right\mid = \frac{2}{\pi} - \frac{4}{\pi} {\sum}_{n = 1}^{\infty} \frac{\cos \left(2 n x\right)}{4 {n}^{2} - 1}$

Looks like this for first few terms:

graph{(y - 2/pi + 4/pi ( ( cos (2x) )/3+ ( cos (4 x) ) / 15 + ( cos(6x) ) / 35 ))(y - |sin x|) = 0 [0, 5, -0.1 , 1.25]}