Let's say we have a probability distribution in x,y space:
$$ p(x, y)=\frac{1}{4 \pi} \sqrt{x^2+y^2} \exp \left(- \sqrt{x^2+y^2}\right) $$
This can be converted into polar coordinates as:
$$ p(r, \theta)=\frac{1}{4\pi} r^2 \exp (-r), r\geq0 $$
Now let's say we want to know the most probable distance from the centre, that is r = argmax p. This can be done in two ways.
We differentiate $p(r,\theta)$ with respect to $r$, and solve for $$ \frac{\partial p(r, \theta)}{\partial r} = 0 $$ this gives $r=2$
We rewrite $p(x,y)$ as
$$ p(x, y)=\frac{1}{4 \pi} r \exp \left(-r\right) $$
Then solving $ \frac{\partial p(x, y)}{\partial r} = 0 $ instead gives $r=1$.
This yields two different answers -- even though they should refer to the same quantity (the most probable distance from the centre).
Questions are -- which is correct? and why? and if both are correct then how do we face this contradiction?
Related questions seem to be on bayesian inference so I included those tags -- though my question is on generic distributions.