It's very basic math. Forget what the numbers stand for. If you have a formula like:
a = b / c
But you already have a and b, but want to know c, here's what you do.
In any formula, you can multiply both sides of the = sign with the same amount while retaining validity. Or divide each side by the same amount, or add or subtract the same amount. As long as you do the same thing consistently to both sides. And remember, a divided by a equals 1.
So I multiply both sides of the previous formula by c, to get:
a * c = b / c * c
which equals
a * c = b * c/c
which equals
a * c = b * 1
which equals
a * c = b
Then I divide both sides by a:
a * c / a = b / a
which equals
a/a * c = b / a
which equals
1 * c = b / a
which equals c = b / a
As I said, very basic math.
By the same token:
Density = mass / volume (a = b / c)
Density * volume = mass (a * c = b)
volume = mass / density (c = b / a)