A satellite is moving in circular motion round a planet.
From the physics we know that
$$\Sigma F_r = ma_r = \frac{GMm}{r^2}$$
So I wanted to find the equation for $M$ knowing also that $$v = \omega r = \frac{2\pi r}{T}$$ and
$$a_r = \frac{v^2}{r}$$
Thus,
$$ma_r = \frac{GMm}{r^2}$$ $$a_r = \frac{GM}{r^2}$$ $$\frac{v^2}{r} = \frac{GM}{r^2}$$ $$\frac{\left(\frac{2\pi r}{T}\right)^2}{r} = \frac{GM}{r^2}$$ $$\frac{\frac{4\pi^2r^2}{T^2}}{r} = \frac{GM}{r^2}$$ $$\frac{4\pi^2r^3}{T^2} = \frac{GM}{r^2}$$ $$\frac{4\pi^2r^5}{T^2} = GM$$ $$\frac{4\pi^2r^5G}{T^2} = M$$
However, this is wrong! It should be:
$$M = \frac{4\pi^2r^3}{GT^2}$$
What was my mistake in Mathematics? Please don't migrate it to physics because my misunderstanding is on math.
Note: I would be very happy if you show my mistake, instead of showing me another way to get to the equation.
The mistake lies in these steps:
Actually, it should have been:
$$\frac{\frac{4\pi^2r^2}{T^2}}{r} = \frac{GM}{r^2}$$ $$\frac{4\pi^2r}{T^2} = \frac{GM}{r^2}$$ $$\frac{4\pi^2r^3}{T^2} = GM$$ $$\frac{4\pi^2r^3}{GT^2} = M$$