How many gallons of water must be mixed with 5 gal of 20% salt solution to make a 16% salt solution?

I put 5 over x and .2 over .16 and came up with 1.25 gal, which is the correct answer. I need to know if this is the correct way to work the problem so that I can use it later.