# What conditions can lead us to $\arctan(\tan x)=x$?

I happened to find that the graphs of $\cos(\arctan(\tan x))$ and $\cos(x)$ are different. Why?

Is there something wrong with $\arctan(\tan x)=x$?

Thanks!

-
Since $\tan x$ is periodic, $\arctan(\tan x)$ only holds over one period of $\tan x$. You can choose whichever period you want, but the standard choice is the interval $(-\pi/2,\pi/2)$. –  Alex Becker Sep 20 '12 at 19:06
The range of $\arctan$ is $(-\frac{\pi}{2}, \frac{\pi}{2})$, so at best the formula can be valid for $|x| < \frac{\pi}{2}$. –  copper.hat Sep 20 '12 at 19:12
The function $x \mapsto \tan x$ is $\pi$-periodic whereas $x \mapsto \cos x$ is $2\pi$-periodic. Now, $\arctan$ will land you somewhere in the interval $(-\frac{\pi}{2}, \frac{\pi}{2})$, even if your original $\theta$ does not lie in this interval. If $\cos$ were $\pi$-period then it would be fine, but since it isn't, it means that we have things like, for instance, $$\cos(\arctan(\tan \pi)) = \cos(\arctan(0)) = \cos(0) = 1 \ne -1 = \cos \pi$$ More precisely, if $x \in \left(\frac{(2n-1)\pi}{2}, \frac{(2n+1)\pi}{2} \right)$, then $\cos(\arctan(\tan x)) = x$ if and only if $n$ is even, or $-x$ if $n$ is odd, since $\cos(x+(2k+1)\pi)=-\cos x$.
Generally $\arctan(\tan x)=x+n\pi$ for some $n\in \mathbb{Z}$, and $n=0$ if and only if $x \in (-\frac{\pi}{2},\frac{\pi}{2})$.