If girlfriend buy native a link in this post, I may earn a commission. This go not impact the price girlfriend pay. As an Amazon Associate ns earn indigenous qualifying purchases. Learn more.

You are watching: 3 gallon jug and 5 gallon jug riddle

Posted February 4, 2013 by Presh Talwalkar. Read about me, or email me.

This is a difficulty that is prominently featured in the film *Die hard With a Vengeance*.

You have actually a 3-gallon and also a 5-gallon jug that you deserve to fill indigenous a fractional of water.

The difficulty is to fill one of the jugs v *exactly* 4 gallons of water. Exactly how do you do it?

**Video: Die hard 3 The Water Jug math Riddle**

.** ."All will be fine if you usage your mind for your decisions, and mind just your decisions." because 2007, i have devoted my life to share the happiness of video game theory and mathematics. Keolistravelservices.com now has actually over 1,000 cost-free articles v no ads many thanks to community support! aid out and also get early access to articles with a pledge on Patreon.**

**. . . . . . M ns N D . Y O U R . D E C ns S i O N S . W E E K together Y . P U Z Z together E . . . . Answer come the water jug riddle**

**Math In Movies: The Water Jug Riddle indigenous Die hard With A Vengeance (1995)**

The an initial attempt world have is to shot and estimate 4 gallons by including 3 gallons the water come 1/3 the the 3 gallon jug. But the riddle is asking for a specific measurement and so this solution cannot work.

The cheat is to establish that:

5 – 3 = 2** and 5 – (3 – 2) = 4**

**Here is one means to find the answer:**

**Incidentally, the reason we can find a solution is due to the fact that the 2 numbers 5 and also 3 are reasonably prime–that is, they have no common divisors. We can actually generate any kind of volume of water from 1 to 5 (in fact, us did get measurements of 1, 2, 3, 4, and also 5 along the means in our solutions).**

**The more general problem is recognize integer services for the equation ax + by = c. Remedies (x,y) exist when the greatest usual divisor the a and also b is a aspect of c. This is an ancient problem. Because that more, review this article: http://mathforum.org/library/drmath/view/51595.html ——————————————————— (This is the solution in level text)**

**1. To fill up the 5-gallon jug 2. Fill up the 3-gallon jug making use of the water from the 5-gallon jug (leaving 2 gallons in the 5-gallon jug) 3. Pour the end the 3-gallon jug right into the spring 4. Deliver the 2 gallons from the 5-gallon jug into the 3-gallon jug 5. Fill up the 5-gallon jug 6. Carry water native the 5-gallon jug till the 3-gallon jug is full. Due to the fact that the 3-gallon jug currently had 2 gallons that water, over there is room for just 1 gallon. 7. The quantity of water in the 5-gallon jug is precisely 4 gallons**

**If we signify the contents of the jugs as the pair (5-gallon jug amount, 3-gallon jug amount), the sequence of events is:**

**(5, 0)–>(2, 3)–>(2, 0)–>(0, 2)–>(5, 2)–>(4, 3)**

**That’s no the only path. Us can also consider the route:**

**1. Fill up the 3-gallon jug 2. Transport to the 5-gallon jug 3. Fill up the 3-gallon jug again 4. Transport water to fill up the 5-gallon jug, leaving 1 gallon in the 3-gallon jug 5. Empty the end the 5-gallon jug 6. Deliver the 1 gallon to the 5-gallon jug 7. To fill up the 3-gallon jug and also transfer the to the 5-gallon jug 8. The 5-gallon jug has 4 gallons of water**

**The sequence here is:**

**(0, 3)–>(3, 0)–>(3, 3)–>(5, 1)–>(0, 1)–>(1, 0)–>(1, 3)–>(4,0)**

### PRESH TALWALKAR

I run the keolistravelservices.com channel on YouTube, which has actually over 1 million subscribers and also 200 million views. I am also the author of The delight of game Theory: An advent to strategic Thinking, and also several other books which are easily accessible on Amazon.

(As you might expect, the links for my books go to their listings ~ above Amazon. Together an Amazon Associate i earn indigenous qualifying purchases. This walk not influence the price you pay.)

By method of history, I began the Mind your Decisions blog earlier in 2007 to share a little of math, an individual finance, an individual thoughts, and also game theory. It"s been quite a journey! I give thanks to everyone that has shared my work, and I am an extremely grateful for coverage in the press, consisting of the Shorty Awards, The Telegraph, Freakonomics, and many other popular outlets.

I learned Economics and Mathematics in ~ Stanford University.

People frequently ask just how I do the videos. Like countless YouTubers i use popular software come prepare my videos. You have the right to search for animation software tutorials on YouTube come learn just how to do videos. Be prepared--animation is time consuming and also software have the right to be expensive!

Feel cost-free to send me an email

### MY BOOKS

If you purchase through these links, I might be compensated because that purchases do on Amazon. Together an Amazon Associate i earn from qualifying purchases. This walk not influence the price you pay.

Book ratings are from June 2021.

(US and global links) https://keolistravelservices.com/blog/my-books**Mind her Decisions** is a compilation that 5 books:

**(2) 40 Paradoxes in Logic, Probability, and Game concept (3) The Irrationality Illusion: exactly how To make Smart Decisions and also Overcome bias (4) The ideal Mental math Tricks (5) Multiply number By illustration Lines**

**The pleasure of video game Theory** shows just how you can use math to out-think your competition. (rated 4.2/5 stars top top 200 reviews)

**40 Paradoxes in Logic, Probability, and also Game Theory** contains thought-provoking and counter-intuitive results. (rated 4.1/5 stars on 30 reviews)

**The Irrationality Illusion: how To make Smart Decisions and Overcome Bias** is a handbook that explains the numerous ways we space biased about decision-making and also offers methods to make smart decisions. (rated 4/5 stars ~ above 17 reviews)

**The finest Mental mathematics Tricks** teaches exactly how you have the right to look choose a mathematics genius by solving problems in her head (rated 4.2/5 stars on 57 reviews)

**Multiply number By illustration Lines** This book is a reference guide for my video clip that has actually over 1 million see on a geometric method to multiply numbers. (rated 4.1/5 stars top top 23 reviews)

**Mind her Puzzles** is a collection of the three "Math Puzzles" books, volumes 1, 2, and 3. The puzzles topics include the math subjects including geometry, probability, logic, and game theory.

**Math Puzzles Volume 1** functions classic mind teasers and also riddles with complete solutions for troubles in counting, geometry, probability, and also game theory. Volume 1 is rated 4.4/5 stars ~ above 75 reviews.

**Math Puzzles Volume 2** is a sequel publication with more an excellent problems. (rated 4.3/5 stars on 21 reviews)

**Math Puzzles Volume 3** is the 3rd in the series. (rated 4.3/5 stars on 17 reviews)

### KINDLE UNLIMITED

Teachers and students about the people often email me about the books. Since education deserve to have together a large impact, I try to make the ebooks accessible as commonly as feasible at together low a price together possible.

Currently you deserve to read many of my ebooks v Amazon"s "Kindle Unlimited" program. Contained in the subscription you will get accessibility to numerous ebooks. Girlfriend don"t require a Kindle device: you deserve to install the Kindle application on any kind of smartphone/tablet/computer/etc. I have compiled links to program in some nations below. Please check your regional Amazon website for ease of access and program terms.

See more: How Many Ounces Is A Quart? ? Ounces In A Quart (Easy Conversion Chart!)

**UK, list of my books (UK) Canada, book results (CA) Germany, list of my publications (DE) France, perform of my publications (FR) India, list of my books (IN) Australia, book results (AU) Italy, list of my publications (IT) Spain, list of my publications (ES) Japan, list of my books (JP) Brazil, book results (BR) Mexico, book results (MX)**

### MERCHANDISE

**Grab a mug, tshirt, and much more at the official site because that merchandise: Mind your Decisions in ~ Teespring**.