Questions on solving linear congruences - Please answer whichever ones you can :)

I have to solve the congruence 15x = 45 mod 50. I used the normal equals sign as I can't get the three one.

To solve it, I did this:

General linear congruence is ax = b mod n (a,n)=d, where d is the greatest common factor.

(a,n) = (15,50) = 5 .................. 5 divides 45 => solutions exist.

15x = 45 mod 50 is the same as 3x = 9 mod 10

Greatest common factor of (3,10) = 1, and therefore the inverse of 3 exists, which means that x = 3mod 10.

I don't understand how to get the answer for that very last bit. So what if the inverse exists? Does that mean you simply divide 9 by the number in front of the x? Why not the 10 as well? What if the inverse didn't exist?

Thank you :)