Water-Pouring Problem

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

A classic puzzle starts with two unmarked bottles that can hold 3 liters and 5 liters respectively, and a bathtub with unlimited water. How can 1 liter be measured?

[more]

One method: Start with the 3L bottle empty and the 5L bottle full. This state could be represented as (0, 5). Next, pour from the 5L bottle into the 3L bottle until the 3L bottle is full, to get the state (3, 2). Empty the 3L bottle, changing the state to (0, 2). Pour the 2 liters of water in the 5L bottle into the 3L bottle, to get the state (2, 0). Fill the 5L bottle again; the state is now (2, 5). Pour from the 5L bottle into the 3L bottle until it is full, resulting in the state (3, 4). Empty the 3L bottle; now the state is (0, 4). Pour from the 5L bottle into the 3L bottle until it is full, finishing with the state (3, 1). There is now 1 liter in the 5L bottle.

The various possible states can be shown on the edge of a parallelogram on a triangular grid. The various solution steps trace out a path similar to that of a ball bouncing around a rhombus-shaped pool table.

[less]

Contributed by: Ed Pegg Jr (March 2011)
Open content licensed under CC BY-NC-SA


Snapshots


Details

detailSectionParagraph


Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.
Send