[Math] period of a function $\lvert\sin x\rvert+\lvert\cos x\rvert$

functionstrigonometry

I have read that $$y=\lvert\sin x\rvert+ \lvert\cos x\rvert $$ is periodic with fundamental period $\frac{\pi}{2}$.

But Wolfram says it is periodic with period $\pi$.

Please tell what is correct.

Best Answer

Don't trust Wolfram when also you have pen and paper available.

Of course, $x\mapsto \sin x$ and $x\mapsto \cos x$ are functions with period $2\pi$. Composing them with some other function (here the absolute value) gives us functions having $2\pi$ as a period as well. But since $\sin(x+\pi)=-\sin x$ (and similarly for cosine), the absolute value in fact introduces the smaller period $\pi$. Finally adding two functions having $\pi$ as a period gives another function having $\pi$ as a period. But since $|\sin(x+\frac\pi2)|=|\cos x|$ and $|\cos(x+\frac\pi2)|=|\sin x|$, swapping the summands introduces a shorter period again, that is $\frac\pi2$ is a period of our function. To see that it is fundamental, i.e. that there is no smaller positive number with $f(x+p)=f(x)$ for all $x$, observe that $f(x)=1$ iff $x=\frac\pi2k$ for some $k\in \mathbb Z$ (why?) or that $f$ fails to be differentibale precisely for $x=\frac\pi2 k$ (why?) or that $f$ is strictly increasing on $[0,\frac\pi4]$ (why? and why doe sthat show that $\frac\pi2$ is minimal?) or look for other distinctive features preventing smaller periods ...

Related Question