Ok so i have this equation which I am having difficulty in figuring out how it was derived.

this is the original equation

this is the equation i cant figure out how to get to.

If someone has the time to do a step by step explanation of how to rearrange it to get r, it would help me immensely.

Thanks.