I am working on a problem in probability theory and need to define the determinant of a Jacobian of a variable transform; i.e.,
$$ p(x) = p(y) \left|\frac{\partial y}{\partial x}\right|. $$
My input has been specified as $(x, y, z)$ coordinates, but they are constrained to lie on the surface of the unit sphere. My intuition says to map these variables onto two spherical coordinate angles $(\theta, \phi)$, since the radius is known to be 1. However, now I've transformed three variables into two, and so the Jacobian of the transformation is naively rectangular, which wouldn't even have a determinant. Yet I can't straightforwardly drop a variable, since just knowing that $x^2 + y^2 + z^2 = 1$ isn't enough to reconstruct, for example, $z$ given just $x$ and $y$ — I could only reconstruct $z^2$, and then I've lost information about the sign of $z$.
Is there a typical way of handling this situation, or have I misunderstood? Any help appreciated.
More detail
A couple of people have asked for more info. I'll post what I can. I'm doing density estimation on some scattered data, which were given to me in terms of $(x, y, z)$ coordinates and some other variables (which aren't important for this spatial transform I'm trying to do). Since my data are constrained to be on the surface of a sphere, I know I can transform $(x, y, z) \rightarrow (\theta, \phi)$ uniquely. But any density estimate I get — let's call it $p(\theta, \phi)$ — needs to be transformed back to $p(x, y, z)$ to be useful for this application.
My confusion is that, given the transformation of variables formula for probabilities, it doesn't seem valid to transform three variables into two, even if the mapping is unique, because I need $\det J$, where $J$ is the Jacobian, to transform my probabilities correctly.
To make this more concrete, I propose the mapping
$$ \theta = \arctan \frac{\sqrt{x^2 + y^2}}{z} $$
$$ \phi = \arctan \frac{y}{x} $$.
$$ J = \begin{pmatrix} \frac{\partial \theta}{\partial x} & \frac{\partial \theta}{\partial y} & \frac{\partial \theta}{\partial z} \\ \frac{\partial \phi}{\partial x} & \frac{\partial \phi}{\partial y} & \frac{\partial \phi}{\partial z} \end{pmatrix} = \begin{pmatrix} \frac{x z}{\sqrt{x^2+y^2}} & \frac{y z}{\sqrt{x^2+y^2}} & -\sqrt{x^2+y^2} \\ -\frac{y}{x^2+y^2} & \frac{x}{x^2+y^2} & 0 \end{pmatrix} $$
But this Jacobian is rectangular and therefore has no determinant! This is where I get stuck. Even if I derive a density in terms of these angular variables, there's no way to "go back" to the Cartesian ones that I need if I use the formula above.