# Finding pdf of $\tan(X)$ when $X \sim U (-\pi ,\pi)$

This question is a particular case of the following:

Suppose that X ∼ U ( $− π/2$ , $π/2$ ) . Find the pdf of Y = tan(X).

I came up at the same solution in the following post, ignoring for a moment the real data of the problem, that is $$X \sim U (-\pi ,\pi)$$ and not $$X \sim U ( -\pi/2 ,\pi/2)$$.

Due to this change in the domain of $$X$$, I split the problem in 3 parts and summed up:

$$P(-\pi/2 \le x \le \arctan(y)) +P(\pi/2 \le x \le \pi-\arctan(y)) +P(-\pi \le x \le - \pi + \arctan(y))$$

Is this approach correct?

If you look at the graph of $$\tan(x)$$, you see that you have two cases:

If $$y<0$$, then:

$$P(Y\le y) = P(\tan(X)\le y)=\\P(-\pi/2\lt X\le \arctan(y))+P(\pi/2\lt x\le\arctan(y)+\pi)$$

If $$y\ge0$$, then:

$$P(Y\le y) = P(\tan(X)\le y)=\\P(-\pi\lt X\le \arctan(y)-\pi)+P(-\pi/2\lt x\le\arctan(y))+P(\pi/2\lt x\lt\pi)$$

In both cases: $$F_Y(y)=P(Y\le y) = \frac{1}{2\pi}(2\arctan(y)+\pi)$$

By differentiation one gets: $$f_Y(y)=\frac{1}{\pi(1+y^2)}$$

• when y $\ge 0$, is $P(\pi/2\lt x\le\arctan(y)+\pi)$ correct? because the first term on the summation is the left part on the graph ($-\pi, -\pi/2$) and the third term is the right part of the graph ($\pi/2, \pi$). While the term in the middle it seems me wrong and instead I would insert: $P(-\pi/2 \le x \le \arctan(y))$. Could you tell me if I'm wrong and explain from where it come from your term? .. I think that I miss something. does not the case Y$\ge 0$ include also the case Y$\le 0$ – Alias__ Sep 24 at 9:20
• Yes, you are right. Corrected. – Momo Sep 27 at 1:06
• the case y$\ge 0$ does not embed also the case when y $\le 0$?? indeed as third term in y$\ge 0$ you inserted the range on $\pi/2\lt x\lt\pi$ that is when y is $\le 0$ – Alias__ Sep 27 at 9:40
• $X$ is continuous, so it doesn't matter whether a particular point of probability zero is included or excluded (and as a matter of fact $\tan(x)$ is not even defined for $x=\pm\pi/2$) – Momo Sep 28 at 15:47
• no, I didn't mean that. – Alias__ Sep 28 at 17:55