How to show that $X$ has a Cauchy distribution? I am diving into some statistics as self study and I am currently reading the book "Principles of Statistics" by M.G. Bulmer.
In chapter 3, there is a problem that goes:

Suppose that a machine gun is mounted at a distance $b$ from an infinitely long straight wall. If the angle of fire measure from the perpendicular from the gun on the wall is equally likely to be anywhere between $-\frac{\pi}2$ and $+\frac{\pi}2$ and if $X$ is the distance of a bullet from the point on the wall opposite the gun, show that $X$ follows the Cauchy distribution: $$f(x)=\frac{b}{\pi(b^2+x^2)} \quad,\, -\infty<x<\infty$$

I tried already calculating the answer using the Sin of the all possible angles, but I end up with results that are completely differente as the one from the book.
My reasoning is that, given that all the angles are equally probable, my probability function should depend only of the $b$ parameter and $x$. So I define $x$ as:
$$\sin(\pi) \cdot b = x$$
But from there, every answer that I obtained is wrong.
Can someone illustrate me how to arrive to the above equation, given the problem?
 A: From the problem description we know that
$$
\tan\left(\alpha\right)=\frac{X}{b} \iff X = \tan\left(\alpha\right) \cdot b,\\
\alpha = \arctan\left(\frac{X}{b}\right) \sim \mathop{\mathrm{Unif}}\left(\left[-\frac{\pi}{2},\frac{\pi}{2}\right]\right).
$$
With
$$ 
\frac{\mathrm{d}}{\mathrm{d}x}\, \arctan\left(\frac{x}{b}\right) = \frac{1}{1+\left(\frac{x}{b}\right)^2} \cdot \frac{1}{b} = \frac{b^2}{b^2+x^2} \cdot \frac{1}{b} = \frac{b}{b^2+x^2}
$$
a change of variables yields
$$
\begin{align}
\mathop{f_X}\left(x\right) &= \mathop{\mathrm{Unif}}\left(\arctan\left(\frac{x}{b}\right);\left[-\frac{\pi}{2},\frac{\pi}{2}\right]\right) \cdot \left|\frac{\mathrm{d}}{\mathrm{d}x}\, \arctan\left(\frac{x}{b}\right)\right| \\
&= \frac{1}{\pi} \cdot \left| \frac{b}{b^2+x^2}\right|\\
&= \frac{b}{\pi\left(b^2+x^2\right)} \;\; \forall\, x \in \mathbb{R}
\end{align}
$$
for the probability density function $f_X$ of $X$.
A: OK, my review of trigonometry upon drawing a right triangle with the straight distance to the wall being 'b', and the randomly observed bullet (shot at an angle theta) into the wall resting at a distance 'X' from the point on the wall (that is perpendicular from the gun) suggests that tangent of theta equals X/b.
If you wanted to simulate a random deviate for the standardized Cauchy distribution (see Wikipedia on Cauchy distribution), set its cumulative distribution function, to a value of a generated uniform random deviate (U) and solve deriving a tangent function applied to U (generally, this is an example of the application of the Monte Carlo inversion method to simulate a distribution starting with a random uniform deviate).
Note, the general result is supplied by the quantile function also provided on the Wikipedia source.
Do the math and you will see the relationship connecting the trigonometry based tangent relationship to the Cauchy's quantile function, and by my dialect, you may be able to facilely generate its random deviates as well.
