The given question
$$f(x) = \sqrt{\frac{8}{1+x} + \frac{8}{{1-x}}}$$ $$g(x) = \frac{4}{f(\sin x)}+\frac{4}{f(\cos x)}$$ find period of $g(x)$?
What I have done
putting $\sin(x)$ and $\cos(x)$ in $f(x)$,
we get $\large{\frac{4}{\cos(x)}}$ and $\large{\frac{4}{\sin(x)}}$ respectively.
Putting these in $g(x)$ we get $\sin(x) + \cos(x)$ which should have period $2\pi$ but the solution provided says that period of $g(x)$ is $\frac{\pi}{2}$. Why?
\begin{align} f(\sin x) &= \sqrt{\dfrac{8}{1+\sin x} + \dfrac{8}{1-\sin x}} \qquad \qquad \\ &= 2\sqrt{2}\sqrt{\dfrac{2}{1-\sin^2 x}} \\ &= \dfrac{4}{\lvert \cos x \rvert} \end{align} Similarly $$f(\cos x) = \dfrac{4}{\lvert \sin x\rvert}.$$ Thus $$g(x) = \lvert \cos x \rvert + \lvert \sin x \rvert,$$ and the period of $g(x)$ is $\dfrac{\pi}{2}$.
In effect $\lvert \cos x \rvert$ and $\lvert \sin x \rvert$ are both $\pi-$periodic but one also has : $$\lvert \cos(x+\pi/2)\rvert = \lvert \sin x\rvert,$$ which implies $$g(x) = g(x+\pi/2).$$