Hint
Start by filling the 9 gallon container, and then use that to fill the 4 gallon container.
Answer
Here are the contents of the containers after each stage:
A B
9 0 fill A
5 4 fill B from A
5 0 empty B
1 4 fill B from A
1 0 empty B
0 1 fill B from A
9 1 fill A
6 4 fill B from A
6 0 empty B
This leaves 6 gallons in container A.
?
Puzzle 19
If I was in Florida and dropped a heavy ball into a bucket of water which was at a temperature of 45 °F and dropped another identical ball into an identical bucket of water at a temperature of 25 °F …
… which ball would hit the bottom of the bucket first?