# Getting two different periods for the same function

Let

$$f(x)=\frac{1}{2}\left(\frac{|\sin x|}{\cos x}+\frac{|\cos x|}{\sin x}\right)$$

Then find it's period.

My teacher did this question with graphs. He considered the following intervals $$0\to\frac{\pi}{2}$$, $$\frac{\pi}{2}\to\pi$$, $$\pi\to\frac{3\pi}{2}$$ and $$\frac{3\pi}{2}\to2\pi$$

He then drew the graph in all the four quadrants and concluded that the period is $$2\pi$$. But I did it algebraically and find that it's period is something else. Let me show.

My attempt

If $$f(x)$$ is periodic, then $$f(x+T)=f(x)$$ where $$T$$ is the period $$\implies\frac{1}{2}\left(\frac{|\sin (x+T)|}{\cos (x+T)}+\frac{|\cos (x+T)|}{\sin (x+T)}\right)=\frac{1}{2}\left(\frac{|\sin x|}{\cos x}+\frac{|\cos x|}{\sin x}\right)$$ Putting $$x=0$$ on both sides, we get $$\frac{1}{2}\left(\frac{|\sin T|}{\cos T}+\frac{|\cos T|}{\sin T}\right)=\frac{1}{2}\left(\frac{|\sin 0|}{\cos 0}+\frac{|\cos 0|}{\sin 0}\right)$$ $$\implies \frac{|\sin T|}{\cos T}+\frac{|\cos T|}{\sin T}=\frac{\left|\cos\frac{\pi}{2}\right|}{\sin\frac{\pi}{2}}+\frac{\left|\sin\frac{\pi}{2}\right|}{\cos\frac{\pi}{2}}$$ $$\implies T=\frac{\pi}{2}$$ Hence the period is $$\frac{\pi}{2}$$

Now who is right and who is wrong and why$$?$$

Any help is greatly appreciated.

• $$\frac{\cos 0}{\sin 0}=\frac{1}0$$ Commented May 29, 2023 at 11:21

The way followed from your teacher is fine, since both $$\sin x$$ and $$\cos x$$ are periodic with period $$2\pi$$ the given function has $$2\pi$$ as a period, and showing that there is not a smaller period, by consideration on the graph, complete the proof.
What you have tried to show is that $$f(0+T)=f(0)$$ but this condition doesn't suffice in general to determine the period. Moreover, as already noticed, the expression you have found is not well defined, therefore this is neither a proof for that fact.