PDF of uniform distribution over the hypersphere and the hyperball There are some good questions and answers about picking random multivariate points over the surface of the hypersphere and the volume of the hyperball, just like this and this.
However none of the answers provide probability density function (PDF) for these distributions.
The related Wolfram Mathworld articles (this and this) also lack the PDFs.
The missing PDFs should be in the form $P(x; x_0, r)$.
where the parameters are


*

*$x_0$ is the location (center) of the hypersphere/hyperball

*$r$ is the radius of the hypersphere/hyperball



More specifically, the methods in question are the following:
Picking a random multivariate over the hypersphere:
If $X = (X_1, \ldots, X_n)$ are independent (iid) standard normal variates, then $x_0 + r \frac{X}{||X||_2}$ is uniformly distributed over the surface of the n-sphere (in the geometer's sense) with location $x_0$ and radius $r$.
Picking a random multivariate over the hyperball:
If $X = (X_1, \ldots, X_n)$ are independent (iid) standard normal variates, and $Y$ is a standard exponential ($\lambda = 1$) variate, then $x_0 + r \frac{X}{\sqrt{Y + ||X||_2^2}}$ is uniformly distributed over the volume of the n-ball with location $x_0$ and radius $r$.
Alternatively, using a variate $U$ uniformly distributed over $[0,1]$, the expression $x_0 + r U^{1/n} \frac{X}{||X||_2}$ is also uniformly distributed over the hyperball.
 A: Maybe I'm missing something, but I'm not sure why it would be any more complicated than
$$
\mathcal{P}(\vec{x};\vec{x_0},r) = \frac{1}{V_n} \Theta(r - ||\vec{x} - \vec{x_0}||)
$$
for the interior of a hyperball, and 
$$
\mathcal{P}(\vec{x};\vec{x_0},r) = \frac{1}{S_n} \delta(||\vec{x} - \vec{x_0}|| - r)
$$
for the surface of a hypersphere.
The notation here is that


*

*$\Theta(x)$ is the Heaviside step function,

*$\delta(x)$ is the Dirac delta function,

*$S_n = 2 \pi^{n/2} r^{n-1} / \Gamma(n/2)$ is the surface area of an $n$-sphere, and 

*$V_n = S_n r/n$ is the volume of an $n$-ball.



EDIT: to show that these have the correct normalization, we use polar coordinates centered at $\vec{x}_0$;  in other words, we define $\rho = \| \vec{x} - \vec{x}_0 \|$ and let the other $n-1$ coordinates be angular coordinates $\theta_1, \theta_2, \dots$ on the $n$-sphere.  For the surface of a hypersphere, we then have
$$
\int_{\mathbb{R}^n} \mathcal{P}(\vec{x};\vec{x}_0,r) d^n x = \frac{1}{S_n} \int_0^\infty \delta(\rho - r) (\rho^{n-1} \, d\rho \, d\Omega)
$$
where $d^{n-1} \Omega$ stands for the solid angle element in $\mathbb{R}^n$.  This is then equal to
$$
\frac{1}{S_n} \left[ \int_0^\infty \delta(\rho - r) \rho^{n-1} d\rho \right] \left[ \int d \Omega \right]
$$
The integral of the solid angle in $n$ dimensions is a [well-known result], while the "picking property" of the delta function means that the radial integral is equal to $r^{n-1}$;  so the integral becomes
$$
\frac{1}{S_n} \left[ r^{n-1} \right] \left[ \frac{2 \pi^{n/2}}{\Gamma(n/2)} \right] = 1.
$$
The proof for the interior of the hyperball proceeds similarly, except this time the integral over $\rho$ is
$$
\int_0^{\infty} \Theta(r - \rho) \rho^{n-1} \, d \rho = \int_0^r \rho^{n-1} \, d\rho = \frac{r^n}{n}. 
$$
This factor and the angular factor then cancel out with the factor of $1/V_n$.  (In the first equality above, we use the fact that $\Theta(r - \rho) = 0$ for $r > \rho$ and 1 for $r < \rho$.)
