Let x = the number of gallons of 15% (0.15) salt water and y = the number of gallons of 30% (0.30) salt water.
x + y = 6 gallons (hence x = 6-y)
(0.15)x + (0.30)y = (0.25)*(6 gallons)
To solve, substitute 6-y in place of x:
(0.15)(6-y) + 0.3y = 1.5
0.9 - 0.15y + 0.3y = 1.5
0.15y = 0.6
y = 4 gallons
x = 6-4 = 2 gallons