Let [tex]w[/tex] be the amount of water that evaporates. At the start, the solution in the tub consists of 2.5 gallons of salt (5% of 50 gallons). After [tex]w[/tex] gallons of water evaporates, we're left with a solution with total volume [tex]50-w[/tex] gallons, and 8% of this amount should be salt, or [tex]0.08(50-w)[/tex] gallons of salt. The amount of salt in the tank before and after evaporation remains unchanged, so
[tex]2.5=0.08(50-w)\implies2.5=4-0.08w\implies0.08w=1.5\implies\boxed{w=18.75}[/tex]
gallons of water need to be evaporated.