There is enough water for 500 soldiers for 10 days. Say that each soldier has one unit of water a day. So there are 500 units for one day and 500 × 10 = 5000 units for the 10 days. So as per the question after 3 days some soldiers left the fort, it means 500 × 3 = 1500 units are consumed by the time some soldiers left. Total unit left = 5000 - 1500 = 3500 units. Now we know that x units are consumed a day, and the water lasted for 20 days more. so the following formula is used to solve this problem.
Number of soldiers left × Days of water will last = Unit of left
x × 20 = 3500
x = 3500 ÷ 20
x = 175
175 soldiers left in the fort.
500 - 175 = 325 soldiers had left the fort.