# Simple probability question about a 2-sphere

1. Jan 5, 2017

### binbagsss

1. The problem statement, all variables and given/known data

I have probabilty density $\rho(\theta,\phi)=\frac{1}{4\pi} sin \theta d\theta d\phi$
The question is let $\theta$ be measured with respect to the z-axis, find the probability $p_{z}(z) dz$ that the particle lies between $z$ and $z+dz$?

2. Relevant equations

see above

3. The attempt at a solution

My method:

$z=cos \theta$

$\frac{d\theta}{dz}= \frac{-1}{sin\theta}$

$\int^{2\pi}_{0} d\phi \int \frac{1}{4\pi} sin \theta dz . \frac{d\theta}{dz}$

= $2\pi \frac{-1}{4\pi} = - \frac{1}{2}$

This is wrong by a minus sign and the solutions instead do:

$P_{z}(z)=...=p(\theta) |\frac{d\theta}{dz}|= 1/2$?

(the '...' being the integration over $\phi$. )

MY QUESTION:

I don't understand where or why the modulus signs come from in the transformation variables : $|\frac{d\theta}{dz}|$?

Many thanks

2. Jan 5, 2017

### BvU

it also is not of the form $p_{z}(z) dz$ at all.
With $z = \cos\theta$ you seem to be working on a unit sphere. Is that a correct assumption ?

You correctly have $dz = \sin\theta\;d\theta = -d\cos\theta$
The minus sign is only because the directions of $z$ and $\theta$ are opposite.
You are looking at a probability density function and the probability (area between $z$ and $z+dz$) is probability density times $|dz|$
With no phi dependence you get the $1\over 2$ so the correct answer to the question should be ${1\over 2} dz$, not just $1\over 2$

3. Jan 5, 2017

### binbagsss

okay thanks I think that is making more sense.

However from what i understand you've just said , that it is probability density times $|dz|$, I get $- 1 \over 2$ $|dz|$, instead
Because the probability density comes with the minus sign, and then you say that rather than multiplying by just $dz$ we should multiply by $|dz|$?

Many thanks

4. Jan 5, 2017

### Ray Vickson

Before I start:
(1) the probability density is just $\frac{1}{4\pi} \sin \theta$; it does not include $d \theta$ and $d \phi$, which refer to integration of the density.
(2) do not write $sin \theta$ and $cos \theta$; they look ugly and are hard to read. Instead, write $\sin \theta$ and $\cos \theta$, which you do by putting a "\" in front of the sin and cos (so write "\sin" instead of "sin", etc). That holds as well for all the other trig functions and things like "arcsin", etc., as well as for "exp", "log", "ln", "max", "min", "lim", and all the hyperbolic functions like "sinh", etc.

Rather than using canned formulas, I, personally, prefer to work first with the cumulative distribution, then differentiate it to get the density. So, if $Z$ is your $z$-random variable, we have
$$F_Z(z) = P(Z \leq z) = P\{(\theta, \phi) : \cos \theta \leq z\} = \int_{\phi=0}^{2\pi} \int_{\theta=\arccos(z)}^{\pi} \rho(\theta,\phi)\, d \phi \, d \theta.$$
The $\theta$ limits go from $\arccos(z)$ to $\pi$ because we are looking at points on the sphere that lie below $z$.

Now the probability density of $Z$ is $f_Z(z) = dF_Z(z)/dz$, which is easily calculated using standard rules for differentiation of integrals with respect to their upper or lower limits.

The correct answer for the density function of $Z$ is, indeed, $f_Z(z) = 1/2$; it should not have a $dz$ in it, because the $dz$ comes into play only when you integrate the density; it is not part of the density itself. See, eg.,
https://en.wikipedia.org/wiki/Probability_density_function or
https://onlinecourses.science.psu.edu/stat414/node/97 .

Last edited: Jan 5, 2017
5. Jan 7, 2017

### haruspex

For polar integration, shouldn't there be a $\sin \theta$ factor in the integrand?

6. Jan 7, 2017

### Ray Vickson

That factor is already embedded in $\rho(\theta, \phi)$.

7. Jan 7, 2017

### haruspex

Is it? If ρ is the surface density then the integral is ∫∫ρ sin(θ)dθdφ. The factor sin(θ) in the function ρ is extra, no?

Edit: the question is, is the density $\frac 1{4\pi}$ or, as you wrote in post #4, $\frac 1{4\pi}\sin(\theta)$?

Last edited: Jan 7, 2017
8. Jan 7, 2017

### Ray Vickson

In post #1 the OP defined $\rho(\theta,\phi) = \sin(\theta)/4\pi$ (but mistakenly including the differentials $d\theta$ and $d\phi$.

9. Jan 7, 2017

### haruspex

Well, it's not clear to me whether it should have said
$\rho(\theta,\phi)=\frac 1{4\pi}$, $\int\int \rho \sin(\theta).d\theta d\phi=\int\int \frac 1{4\pi} \sin(\theta).d\theta d\phi$, or
$\rho(\theta,\phi)=\frac 1{4\pi}\sin(\theta)$, $\int\int \rho \sin(\theta).d\theta d\phi=\int\int \frac 1{4\pi} \sin^2(\theta).d\theta d\phi$,
but you cannot have it both ways.

10. Jan 7, 2017

### Ray Vickson

If (as I think the person setting the problem intended) we regard the angles $\Theta$ and $\Phi$ as random variables, then for a uniform distribution on the sphere's surface we have
$$P(\theta < \Theta < \theta + d \theta, \phi < \Phi < \phi + d \phi) = c \sin(\theta) d\theta d\phi,$$
so the density of $(\Theta, \Phi)$ is $f_{\Theta, \Phi} (\theta, \phi) = c \sin (\theta)$, because by definition of a bivariate probability density we have
$$\text{probability} = \text{density} \times d \text{(variable 1)}\; \times d \text{(variable 2)}.$$
The density includes the Jacobian, etc. See, eg.,
https://www.cs.ubc.ca/~murphyk/Teaching/Stat406-Spring08/homework/changeOfVariablesHandout.pdf
or
http://math.arizona.edu/~jwatkins/n-bivariate.pdf

11. Jan 7, 2017

### haruspex

Ok, so ρ is not the surface density. Haven't come across that source of confusion before.
Thanks for explaining.