We can pour water back and forth between these containers to come up with exactly 1 gallon, because we can take water of from the container to transform to outside.
This is the way to get it:
Step 1: Pour water in to the 9 gallon container until its full.
Step 2 : Take water from the 9 gallon container to the 7 gallon container until its full.
Now, the 9 gallon container has 2 gallon of water.
Step 3 : Take all the water from the 7 gallon container on to the ground.
Step 4 : Take all the water left from the 9 gallon container to the 7 gallon container.
IF WE MAKE THIS, then each times the 9 gallon container will have 2, then increases 2 more gallon until it is full.
So in step16 , the 7 gallon container is full, so The 9 gallon container have :
8 - 7 = 1 ( gallon )
SO WE GET 1 GALLON OF WATER.