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

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.

• Is $\tan x \le y$ equivalent to $x \le \arctan(y)$ for $x\in[-2\pi,2\pi]$? Also remember that the range for $Y$ should be all of $\mathbb{R}$, not just $[-2\pi,2\pi]$ (that is for $X$). Commented Mar 5, 2019 at 11:33
• $\arctan (\tan(X )$ is not the same as $X$. Your $f_Y$ is not a density function. Commented Mar 5, 2019 at 11:44
• @KaviRamaMurthy Should I break it into cases depending on the value of $y$? For instance, apply $\arctan$ if $y\in[-\pi/2,\pi/2]$, and then handle the other cases separately. Commented Mar 5, 2019 at 12:01
• You have to split $x\in [-2\pi,2\pi]$ into $x\in [-\pi /2,\pi /2]$, etc. Commented Mar 5, 2019 at 12:04

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.
• I find pdf of $Y$ by dividing in 4 part. and got same pdf. But how you conclude that we take o $X\sim U\left[-2\pi,\,2\pi\right]$ or o $X\sim U\left[\frac{-\pi}{2},\,\frac{\pi}{2}\right]$. we get same pdf .please explain logic behind Therefore, the above pdf is actually correct in this example too.? Commented Oct 14, 2023 at 12:21
• @MeetPatel The conditional PDF on each of four monotonic cases is the same. Now average, as each has probability $\frac14$.