The probability of a one-dimensional random walker starting at location $x = 0$ and landing at position $x = m$ after $n$ steps of length $1$ can be approximated for $n\rightarrow \infty$ as a gaussian (see this link for the explanation):
$P(m, n) = \sqrt{\frac{2}{\pi n}} e^{-\frac{m^2}{2n}}$
I now would like to see how this distribution would transform if I consider the variable $r = |x|$ instead. My guess is that the probability distribution would look like just the right side of $P(m,n)$ but multiplied by a factor of $2$, since the probability of falling at $x = 5$ and the probability of falling at $x = -5$ would add together to the probability of falling at a distance $r = 5$ from the origin). Is my intuition correct? Please show me the rigorous way to get there.
The next thing is that I want to get to the 2D random walker probability distribution. I know that since a 2D random walker can be seen as the result of two 1D random walkers in two different axis, the probability of the 2D random walker must be the joint probability of each of the axis. Since they are independent I see this as
$P(m_x,m_y) = P(m_x,n_x)P(m_y,n_y)=\frac{2}{\pi}\frac{1}{\sqrt{n_x n_y}}e^{-\left(\frac{m_x^2}{2n_x}+\frac{m_y^2}{2n_y}\right)}$
, where $n_x$ and $n_y$ are the number of steps made in the $x$ direction and in the $y$ direction respectively, and $m_x$ and $m_y$ is the net displacement in the $x$ and $y$ direction respectively.
For a large number of steps $n=n_x+n_y$ we would expect that half of them are in the $x$ direction and half in the $y$ direction, thus $n_x = n_y = n/2$. So we have
$P(x = m_x,y = m_y, n) = P(r, n)= \frac{4}{\pi n}e^{-\frac{r^2}{n}}$
, where $r^2 = m_x^2+m_y^2$ is the distance traveled from the origin.
This would make sense to me, but then I go to Python, I make $10^4$ 2D random walkers walk $10**3$ and compute the distance of the final points to the origin. Then I make an histogram of the distance and plot in red the $P(r,n)$ distribution and I get this:
So, clearly there's a difference between the results and what I expected. Somewhere I saw that for the the probability to work I have to multiply everything by the Jacobian $\left|\frac{\partial (x,y)}{\partial r}\right| = r$ (where $x= r\cos\theta$ and $y= r\sin\theta$). When I do that I get
$P(r, n)= \frac{4r}{\pi n}e^{-\frac{r^2}{n}}$
, which is a Rayleigh distribution. And when I plot it I get this
Okay, that seems better, but still I'm missing something since they do not match as well as they should. What am I missing here?
A similar reasoning for 3D random walks would get me here
$P(r, n) = \left(\frac{6}{\pi n}\right )^{3/2}e^{-\frac{3r^2}{2n}}$
or here
$P(r, n) = r^2\left(\frac{6}{\pi n}\right )^{3/2}e^{-\frac{3r^2}{2n}}$
but none of these match what my simulation of a 3D random walk shows:
As you can see they don't match precisely. Also I'm not sure about the $r^2$ in the second attempted equation, since I just multiplied twice the Jacobian instead of making the true Jacobian which is $r^2\sin\theta$. Please, I'm lost. How can I get to the true distribution in 3D?



