Why is $\frac1\pi$ the answer for this Cauchy Distribution? So I have this problem here, and I know what the correct answer is but I'm not sure of why it's the right answer. It says: Let $X$ be a random variable with the density function $$f(x)= \frac{1}{\pi (1+x^2)}, \quad -\infty \lt x \lt \infty$$ Find the density function of $Z=arctan(X).$
So I know that the answer is $\frac1\pi$, but... Why? I thought for a change of variable problem we would go through the whole process of finding the inverse of $Z$, taking the derivative, etc. I mean I see that $X=tan(Z)$ and that $\left( -\frac\pi2 \lt Z \lt \frac\pi2 \right)$ but I'm just not sure about this how this works or why.
 A: This is a special case of a much more general result. I do not know whether you are supposed to appeal to the general result, or compute explicitly for this case.  So we compromise and assume that the general result is still not available, but derive the result using a general technique. 
We will (sort of) find the cumulative distribution function $F_Z(z)$ of $Z$. By the definition of $Z$,
$$F_Z(z)=\Pr(Z\le z)=\Pr(\arctan X \le z).$$
Note that this is $0$ if $z\le -\frac{\pi}{2}$ and $1$ if $z\ge \frac{\pi}{2}$. So we only need to deal with $-\frac{\pi}{2}\lt z\lt \frac{\pi}{2}$.  
Since $\arctan t$ is an increasing function of $t$, we have $\arctan X\le z$ iff $X\le \tan z$ (we took the $\tan$ of both sides). Thus in the interval $-\frac{\pi}{2}\lt z\lt \frac{\pi}{2}$ we have 
$$F_Z(z)=\Pr(X\le \tan z) =\int_{-\infty}^{\tan z} \frac{dx}{\pi(1+x^2)}.\tag{$1$}$$
Now we can take two approaches, the slow one and the fast one.  The slow way is to integrate and substitute. The fast way, since ultimately we will want $f_Z(z)$, the density function, is to differentiate the right-hand side of $(1)$ directly.  By the usual rules for differentiating under the integral sign, we get
$$f_Z(z)=\sec^2 z\frac{1}{\pi(1+\tan^2 z)}.$$
But $1+\tan^2 z=\sec^2 z$, so there is very nice cancellation, and we conclude that $f_Z(z)=\dfrac{1}{\pi}$. (Recall this was only for $-\pi/2\lt z\lt \pi/2$.)
A: The cumulative distribution function of $X$ is $$F_X(x)=\int_{-\infty}^x f(t)\,dt=\frac12+\frac1\pi\arctan x.$$
Now $Z\le z\Leftrightarrow \tan Z\le \tan z\Leftrightarrow X\le\tan z$,
so $$F_Z(z)=F_X(\tan z)=\frac12+\frac z\pi.$$
Now differentiate this to get the desired result.
The above is of course only valid for $\lvert z\rvert<\pi/2$, but that's okay, for $Z$ cannot take values outside of that interval, so the density function is $0$ for $\lvert z\rvert>\pi/2$.
