Getting 4 gal from a 5 gal container + a 3 gal container

I’m confused (more likely, stupid.)

You have a 3 gallon container and a 5 gallon container, and you are looking to get exactly 4 gallons while being provided with an 8 gallon container full of water.

How do you execute the transfers from container to container without measuring devices?

8, 5, 3 -> 4

Fill the 3 gallon container and dump it into the 5.

Fill the 3 gallon again and dump it into the 5. Only 2 fit , so you have 1 gallon in the 3. DUmp the 5 back into the 8 and dump the 1 into the now empty 5.

Fill the 3, add to the 1 in the 5.

3+1= 4

Hey!! That’s brilliant, thank you!

Hmmm, I’ve always solved this with a unlimited water source by:

  1. Filling up the 5 gal.
  2. Filling the 3 gal from the 5 gal, leaving 2 gallons in the 5 gal.
  3. Emptying the 3 gal and tranfering the remaining 2 gallons from the 5 to the 3.
  4. Refilling the 5 gal and then filling the 3 gal (which will only hold 1 more gallon since it already has 2 gallons in it). This leaves 4 gallons in the 5 gal.

But this takes 10 gallons of water.

I’m sure one of the other brilliant Dopers is posting the answer (which is probably totally obvious) as I type this :slight_smile:

Tremorviolet, if you dump the three gallons (as in step three) back into the orignal reservoir, your method only needs seven gallons.

ARGH! Of course, pouring the water back into the 8 gallon container as jk1245 suppested never occured to me… :smack:

A potential ‘cheat’ for this sort of problem, I learnt here on the SDMB, is …
If the 8 gallon container has a flat bottom and parallel sides (cylinder, cube, rectangaloid,…) you can simply measure 4 gallons by pouring water out of the 8 gallon container until the water line can precisely bisect the lip of the container and the opposite bottom corner of the container when the container is heald at an angle.

If you have two containers that hold a and b gallons (where the greatest common divisor of a and b is 1), you can always get 1 gallon out, and that means you can get n gallons rather easily.

Let’s assume a < b. What you do is fill up the a gallon container and pour it into the b gallon container. Continue until the b gallon container is full. Now the a gallon container contains the remainder upon dividing b by a. Pour that into the b gallon container, and keep going. Repeat this, and you’ll eventually have 1 gallon in the a gallon container.

The proof relies on two facts:

  1. Because a and b are relatively prime, [a] has order b in Z[sub]b[/sub].
  2. The pigeonhole principle.

Those who are mathematically inclined can work out the details, and those who aren’t needn’t worry.

Similarly, if you only had the 3-gallon and 5-gallon containers, (but did not have the 8-gallon container), then Bippy’s method described above could still be used.

  1. Hold the 3-gallon container at an angle and start filling it with water until the water line is exactly at the lip of the container and the opposite corner bottom. This container now has 1.5 gallons of water.

  2. Hold the 5-gallon container at an angle and start filling it with water until the water line is exactly at the lip of the container and the opposite corner bottom. This container now has 2.5 gallons of water.

  3. Pour the contents of the 3-gallon container into the 5-gallon container.

1.5 + 2.5 = 4 gallons

But this method really isn’t valid, because the containers that DirtyKash mentioned in the original problem are not said to be nicely symmetrical with flat bottoms. They might be any weird shape.

My head hurts from following ultrafilter’s answer, even though I think that’s what my answer did.

OK, the procedure I posted was good, but the explanation was totally wrong.

After the first step, the amount of water in the smaller container is b mod a. After the second step, it’s 2b mod a. So on and so forth…

Because gcd(a, b) = 1, there will be some water in the smaller container until the ath step. If you look at the sequence of remainders, you know that 0 doesn’t show up until the end, and that there are no repeats in the first a - 1 positions (otherwise the sequence would repeat without ever hitting 0). So by the pigeonhole principle, you must hit 1 at some point.

8, 5, and 3, eh? An alternate solution:

  1. Fill up the five gal container, and pour into the three. You are left with two gallons in the five gallon container. Pour this into the eight gallon container.
  2. Repeat step one.

You now have four gallons in the eight gallon container, and no water was wasted! (writing from a drought stricken area)

Level3, in the OP problem, the 8 gal. container started out full, and was the source of the water.

Ah, forgive my error. I originally heard this as only a 5 gal and 3 gal near an unlimited supply of water (a stream or such).

“Reading the OP” is my friend.

My stock answer to this one was always the following:

  1. Get several friends.

  2. Fill the three gallon bucket.

  3. Add fruit punch mix and your choice of white liquors to the 8 gallon bucket until it’s full again.

  4. Drink the contents of the 8 gallon bucket.

  5. Screw yer dem mettal ginnastics, ya bastard. Leese we gots a pot to piss in!

You guys!! The problem has been solved as of the 1st reply. You’re all just busting your brains uselessly.

Drink the contents of the 8 gallon container. When you have to pee, alternate between the 5 gallon container and the ground. One second ground, one second fiver. . .

You’re welcome.

Since there’s a lot of mathematical nitpicking already going on here, I’ll point out that this solution works only if the container’s cross section has a symmetric shape. I think symmetry about a point would be neccessary and sufficient.

Curt C has a good point. This works for barrels that have wider middles than top/bottoms. But why even go that far if we’re nitpicking. Obviously the only requirement is that the volume above and below the “line can precisely bisect the lip of the container and the opposite bottom corner of the container when the container is heald at an angle”.

It’s just rectangular and cylindrical water containers are rather common.

If I counted correctly, the first reply post takes 8 pours to accomplish the task.

My (admittedly random) attempt to solve the problem accomplishes the same thing with only 6 pours, and I start off and use only the water in a full 8-gal container, as the OP states.

[list=1]
[li]Fill the 5-gal container from the 8-gal container. Only 5 gal fit, so 3 gal are left in the 8-gal container.[/li][li]Fill the 3-gal container from from the 5-gal container. Only 3 gal fit, so 2 gal are left in the 5-gal container.[/li][li]Dump the 3-gal container into the 8-gal container.[/li][li]Dump the 2 gal in the 5-gal container into the 3-gal container.[/li][li]Fill the 5-gal container from the 6 gal in the 8-gal container. Only 5 gal fit, so 1 gal is left in the 8-gal container.[/li][li]Fill the 3-gal container (which contains only 2 gal) with the 5 gallons in the 5-gal container. Only 1 gal will fit, which leaves 4 gallons in the 5-gal container.[/li][/list=1]

I’m an engineer. There’s always a better way. :smiley: (And I’m not saying that mine is the best, either.)