You have a 5-gallon jug and a 3-gallon jug. How do you measure exactly 4 gallons?

You have a 5-gallon jug and a 3-gallon jug. How do you measure exactly 4 gallons?

Approach: Use difference of capacities.

1. Fill 5-gallon. 2. Pour from 5 to 3 until 3 is full (leaves 2 in 5). 3. Empty 3. 4. Pour the 2 from 5 to 3. 5. Fill 5. 6. Pour from 5 to 3 until 3 is full (needs 1 gallon, leaving 4 in 5).

Follow-up: General solution for jugs of size a,b?

Key concepts: modular arithmetic, gcd, measurement.