joshmccraney said:
Are you sure? Perhaps I'm missing something big here. I am thinking for the asimuthal angle ##\theta \in [0,2\pi]## each degree is symmetric, so it doesn't seem like we'd be denser in the west than the east. Isn't the same tru for the polar angle ##\phi\in [0,\pi]##? It doesn't seem like you'd populate more of the northern than southern hemisphere.
EDIT: okay, nevermind, I see your point. Letting ##\phi=10^\circ## implies the ##\theta## "ring" is much smaller, and therefore denser than ##\phi=90^\circ##. But how do we account for this? I'm trying to think surface metrics here: given ##r## and ##\phi##, we have a circumference of length ##2\pi (r\sin\phi)## where ##\theta## then selects the specific location on. We somehow want to normalize the distribution of ##\phi## such that ##2\pi (r\sin\phi)## receives the same average points per length for all ##\phi##. So we want the distribution of ##\phi## to be more concentrated around ##\phi=90^\circ## and less concentrated around ##\phi = 0^\circ,180^\circ##.
I don't know why, but intuitively I'm thinking perhaps we distribute ##\phi## like a circle, so that ##\phi = 90^\circ - \sqrt{90^2-x^2}## if ##x \in [0^\circ,90^\circ]## and ##\phi = 90^\circ - \sqrt{90^2-(x-180)^2}## if ##x \in [90^\circ,180^\circ]## where ##x## is the random number normalized from 0 to ##2\pi##.
First, let's look at the general situation where we have a random variable ##x## with pdf ##p(x)## mapped onto a second r.v. by ##y = g(x)##. What is the pdf for ##y##? Call it ##f(y)##?
First, the probability that ##y## lies between ##y## and ##y + dy## is ##f(y)dy##.
This is the same as the probability that ##x## lies between ##x + dx##, where ##y = g(x)## and ##y + dy = g(x + dx)##.
Using a Taylor expansion to linear order we see that:
$$dy = g(x + dx) - g(x) = g'(x)dx$$Which is just the usual "differential" equation.
This gives us$$f(y)g'(x)dx = p(x)dx$$Hence $$f(y) = f(g(x)) = \frac{p(x)}{g'(x)}$$To see how this works, for the circle we need probability of a point lying inside radius ##r## to be proportional to the area of that smaller circle. As area is proportional to ##r^2##, we need:
$$p(r \le a) \sim a^2$$And, as the cdf is the integral of the pdf, this means that the pdf for ##r## must be linear. For a circle of radius ##R## this gives:
$$f(r) = \frac{2r}{R^2}$$Now, if we have ##x## uniformly distributed on ##[0,1]##, then ##p(x) = 1## and we have an equation for ##r = g(x)##:
$$f(r) = f(g(x)) = \frac{2g(x)}{R^2} = \frac{1}{g'(x)}$$This gives us:
$$g(x)g'(x) = \frac{R^2}{2}$$Hence:
$$\frac d {dx} \big (g(x)^2 \big ) = 2g(x)g'(x) = R^2$$And this gives us the required mapping from ##x## to ##r##:$$r = g(x) = R\sqrt x$$We can also confirm this by calculating the probability of choosing a point in a more general area of the circle, between ##r_1## and ##r_2## and ##\varphi_1## and ##\varphi_2##:
$$A = \int_{r_1}^{r_2} \int_{\varphi_1}^{\varphi_2} r \ d\varphi \ dr = \frac 1 2 (r_2^2 - r_1^2)(\varphi_2 - \varphi_1)$$Now, we use the mappings from ##x,y## which are uniform on ##[0,1]##:
$$\varphi = 2\pi y, \ r = R\sqrt x \ \ \text{hence} \ \ y = \frac{\varphi}{2\pi}, \ x = \frac{r^2}{R^2}$$And:
$$p(A) = p(\frac{\varphi_1}{2\pi} \le y \le \frac{\varphi_2}{2\pi})p(\frac{r_1^2}{R^2} \le x \le \frac{r_2^2}{R^2}) = \frac{1}{2\pi R^2}(\varphi_2 - \varphi_1)(r_2^2 - r_1^2) = \frac{A}{\pi R^2}$$So, the probability of choosing a point in such an area is indeed proportional to the area.
For the sphere, we can have simply ##\varphi = 2\pi y##, but we need to map ##x## and ##z## to ##r## and ##\theta## taking account of the factors in the spherical volume element.