# How do you find the Fourier series of $\max(0, \sqrt{1 - \cos{\theta}})$?

I was trying to express the following periodic function:

$$f(x) = \max \left( 0, \sqrt{1 - \cos{x}} - \frac{\sqrt{2}}{2} \right)$$

as a summation of cosines and sine waves $f(x) \approx a_0 + \sum^N_{n=1} a_n \cos(\frac{n \pi}{L} x) + b_n \sin(\frac{n \pi}{L}x)$.

However, I found that I couldn't even express $a_0$ in closed form and I wasn't sure why. My coefficients seem to explode to infinity. Intuitively, that seems wrong to me since the function is clearly bounded and periodic, so I would have expected its Fourier series to be well behaved. It doesn't have any discontinuities and it looks as follows: further worrying me why my calculations are incorrect for its Fourier coefficients.

Anyway, first I tried the simplest first step and try to get a closed expression for $a_0$:

$$a_0 = \frac{1}{2L} \int^{L}_{-L} f(x) dx$$

One can notice that the function has a period of $2 \pi$. Hence:

$$a_0 = \frac{1}{2 \pi} \int^{\pi}_{-\pi}\max \left( 0, \sqrt{1 - \cos{x}} - \frac{\sqrt{2}}{2} \right) \mathrm{d}x$$

let $x_0 = \arccos \left( \frac{\sqrt{2}}{2} \right)$. So the integral becomes (due to symmetry and integrating zero):

$$\frac{1}{\pi} \int^{\pi}_{x_0} \sqrt{1 - \cos{x}} - \frac{\sqrt{2}}{2} \, \mathrm{d}x$$

But the interesting part is integrating $\int^{\pi}_{x_0} \sqrt{1 - \cos{x}} \, \mathrm{d}x$. The indefinite integral of $\int^{\pi}_{x_0} \sqrt{1 - \cos{x}} \, \mathrm{d}x$ is (according to wolfram alpha, I believe they start of with the half angle identity):

$$\int \sqrt{1 - \cos{x}} \, \mathrm{d}x = -2 (\sqrt{ 1 - \cos x}) \cot \left( \frac{x}{2} \right)$$

so to evaluate it I proceed to do:

$$\int^{\pi}_{x_0} \sqrt{1 - \cos{x}} \, \mathrm{d}x = \left[ -2 (\sqrt{ 1 - \cos x}) \cot \left( \frac{x}{2} \right) \right]^{\pi}_{x_0}$$

$$-2 (\sqrt{ 1 - \cos \pi}) \cot \left( \frac{\pi}{2} \right) - (-2 (\sqrt{ 1 - \cos x_0}) \cot \left( \frac{x_0}{2} \right) )$$

however the issue I am facing is that:

$$\cot \pi = \frac{1}{\tan \pi} = \frac{1}{0}.$$

So I wasn't too sure what I was doing wrong. I suspect that either I have the period of the function wrong or the integral is incorrect. However, it seems both are correct so I wasn't sure what was wrong.

I suspect the period is not incorrect because a periodic function has the property:

$$f(x + L) = f(x)$$

and since:

$$\cos(2 \pi + x) = \cos(x) \implies \sqrt{1 - \cos({2 \pi + x})} = \sqrt{1 - \cos(x)}.$$

So maybe this function can't be expressed as a Fourier series?

• $\cot \frac{\pi}{2}=0.$ – Math-fun Jun 28 '15 at 19:50
• @Math-fun yes I see duh. – Charlie Parker Jun 28 '15 at 20:01
• You could use a little simplification: $2 \sin ^2 \frac x 2 = 1 - \cos x$, so $f(x) = \frac 1 {\sqrt 2} \max (0, 2 |\sin \frac x 2 | - 1)$. – Alex M. Jun 28 '15 at 20:07
• Use the fact that your $f(x)$ is the same thing as $\frac{1}{2}(\sqrt{1-\cos{x}} - \frac{\sqrt{2}}{2} + |\sqrt{1-\cos{x}} - \frac{\sqrt{2}}{2}|)$, and then proceed as usual. – DaveNine Jul 2 '15 at 6:50
• You can also expect your $b_n$'s to be zero since your function is even. – DaveNine Jul 2 '15 at 6:58