Current concentration =5%
Current volume = 50 gallons
Current brine content = 0.05*(50 gallons) = 2.5 gallons.
Let x = gallons of water that evaporated.
Then
Final volume = (50 -x) gallons
Final concentration = 8%
Final brine content = 0.08*(50 - x) = 4 - 0.08x gallons
The brine content did not change, therefore
4 - 0.08x = 2.5
-0.08x = -1.5
x = 18.75 gallons
Answer: 18.75 gallons