If $X \thicksim\text{Uniform}[-2\pi,2\pi]$, find the PDF of $Y=\tan(X)$

probabilityprobability distributions

Suppose that $X$ is uniformly distributed on $[-2\pi,2\pi]$. Find the probability density function of $Y=\tan(X).$

What I have so far:

First I note that
$$f_{X}(x)=
\begin{cases}
\displaystyle\frac{1}{4\pi}&\text{if }x\in[-2\pi,2\pi]\\0&\text{otherwise. }\end{cases}$$

Now we observe that to find the PDF of $Y$, we can first find its CDF and then differentiate. By definition, we have for $y\in \mathbb{R},$
$$F_{Y}(y)=\mathsf P(Y\leq y)=\mathsf P(\tan(X)\leq y)=\mathsf P(X\leq \arctan(y)).$$
Therefore we find that
$$F_{Y}(y)=\frac{\arctan(y)}{4\pi}$$
if $y\in[-2\pi,2\pi]$ and $F_{Y}(y)=0$ otherwise. Now we can differentiate $F_{Y}$ to obtain
$$f_{Y}(y)= \begin{cases}\displaystyle\frac{1}{4\pi(1+y^2)}&\text{if }y\in[-2\pi,2\pi]\\0&\text{otherwise. }\end{cases}$$


Is the approach above the correct one? If not, could you please provide a hint to point me in the right direction, please, no solutions, only hints.

Thank you for your time, and appreciate any feedback.

Best Answer

If we instead had $X\sim U\left[-\frac{\pi}{2},\,\frac{\pi}{2}\right]$ so $Y$ would be monotonic in $X$, we'd have $$P(Y\le y)=P(X\le\arctan x)=\frac{1}{\pi}\arctan x+\frac{1}{2}\implies f_Y(y)=\frac{1}{\pi(1+y^2)}.$$This respects unitarity, i.e. $\int_{\Bbb R}f(y) dy=1$, so we can't e.g. change $\pi$ to $4\pi$. The effect of switching back to $X\sim U\left[-2\pi,\,2\pi\right]$ is to run over four periods of $Y$'s dependence on $X$. What's more, these periods inject, albeit not in an order-preserving way because of asymptotes at half-odd multiples of $\pi$. Therefore, the above pdf is actually correct in this example too.