Water-Pouring Problem

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?
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.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+