Actually, it's also pretty straight forward to derive the probability density function
geometrically rather than analytically.
Start with our uniform sampling of the unit square:

When we project this sampling to the quarter circle (green), we're really integrating along each ray (blue) of angle θ (grey):

If we had only considered the points inside the circle then we would indeed have a uniform sampling as this integral is then independent of θ. This invites a scheme called rejection sampling: choose x,y in the unit cube but only keep those inside the circle.

It's the points that lie outside the circle that cause this kind of sampling to be biased, non-uniform.

We can compute the integral along this ray geometrically. Since the sampling is uniform, it amounts to just computing the length of the line segment. We just need to know for a given angle θ where the ray intersects the unit square.
First let's consider θ≤π/4. We know that x = 1 and by the polar coordinations we have that y = r cosθ, thus the radius and the length of these line segments are 1/cos θ. Likewise for θ>π/4 we have line segments of length 1/sin θ. These values are the length of the line segments, and since we're integrating a uniform density function, they're also the
mass accumulated along the line segment. Finally we must account for the change in units, exchanging each small change in angle with a change in area. Namely by exactly this length divided by two (two because the thin space between two close rays is a triangular, rather than rectangular). Thus, by multiplying our
mass by this change we have:
fΘ(θ) | = { |
(1/cos2θ)/2
(1/sin²θ)/2 |
θ≤π/4 θ>π/4, |
which matches the analytic result above.