This is why those fitness types from the gym are always carrying around the 1 gallon jugs of water, JUUUUST in case they get dropped into a Diehard movie.
>Fill both half way then dump the 1.5 into the 2.5 Simon says "You've gotto be precise, one ounce more or less will result in detonation." With the irregular jugs he provides filling these jugs exactly half is pretty much impossible. Bruce Willis actually suggests this solution at some point. This approach would work if you are dealing with perfect cylindrical jugs. Can you see how you can fill these exactly halfways?
+Mathologer One ounce tolerance is really tight. Even if the bottles have precise markings for the exact 5 and 3 gallon volumes it is hard. If you put the bottle sideways and try to measure exactly 2.5 gallons, the bottleneck will ruin everything.
+Tapio Hirvikorpi that was the main problem I always had with the bottle ploy. "What constitutes [full]?" Is it when no single drop will fit in the jug? (That's how I would define it, from a scientific standpoint), or are the jugs demarcated in some way--and if they are: How can you be certain the water is at exactly the correct demarcation without a level platform, and some form of linear scale? A 3 gallon jug rarely ever fits exactly 3 gallons and no more, there is almost always room for an air bubble of unknown volume, when there are 3 gallons in said jug (because it would be logistically unfeasible to manufacture, seal and transport the jug efficiently otherwise.)
+Joost Bouten Sideways is okay but you're still eyeballing an unmarked point, along with the already highlighted issue of the neck. For a perfectly cylindrical jug, a better solution would be not sideways but diagonally. If the surface of the water just covers the whole base of the jug and just doesn't cover any of the top surface, you've got half. I.e. looking at it's image side on, you would see a rectangle with the water's surface going corner to corner.
@@Mathologer If you really think that you have any chance of defeating a villain in a movie, watch the YT video "Why Supervillains Always Keep the Good... " Guy Alive, I think it may be. Good for a laugh. Well at least according to movie logic. They want to be defeated, because once they manage to destroy the world, what then will they do? BTW, I once won a bag of cookies for solving a math puzzle. "Open a combination lock within one minute. Here are the combination numbers, but we didn't bother to tell you what order they come in." I instantly recognized it as a permutations problem. (Or is that combinations? Somebody remind me of the difference?) Choose 1 of 3, 2 of the remaining 2, 1 of the remaining 1. 3! or 6 possible ways to order those numbers. My 4th try opened the lock. Yay! Cookies.
There's another interesting way to examine the solvability of these problems, though not necessarily find an immediate solution. To solve the two bucket challenge, we essentially have two operations: filling a bucket and emptying a bucket. Transferring water from one bucket to another isn't really important for examining solvability as I'll explain. When we fill a bucket initially, we are either filling bucket A (+A) or B (+B). When we transfer without spillage from one bucket to another, we keep the same amount of water, so no expression is needed to keep track of the total amount of water between the two buckets. When we empty a bucket, we are either emptying it from full (-A or -B) or from however much water is in it. However, this latter operation is unnecessary, because if we have a bucket that is not completely full, we have done transferring to reach its special fill value and should not wish to undo our work. So, for the first problem (A = 5 gallon, B = 3 gallon) , we have two particular solutions: The first is to start with a full 5 gallon (+A), pour as much as possible into bucket B (still A amount of water), empty B (A - B), transfer from A to B (still A - B amount of water), fill A again (2A - B), transfer as much as possible from A to B (still 2A - B), then finally empty B again (2A - 2B = 2(5) - 2(3) = 10 - 6 = 4 gallons) The second is to start with a full 3 gallon (+B), pour completely into A (still B amount), fill B again (2B), pour as much as possible into A (still 2B) empty the now full A (-A + 2B), fill B again (-A + 3B) and transfer completely into A (still -A + 3B = -(5) + 3(3) = -5 + 9 = 4). The general solution for this particular scenario is the plane 5x + 3y = z, where x is the number of 5 gallon operations, y is the number of 3 gallon operations and z is the final amount to end up with. Whenever x, y and z are integers, this is potentially solvable, as 5 and 3 are coprime. It requires a bit more effort to find particular solutions, but since integers are closed on addition and multiplication, it is consistent that a sum of products of integers would be an integer. The second problem can be analyzed in the same way. By setting it up as 15x + 6y = 5, since 15 and 6 are not coprime, we can factor and divide to give 5x + 2y = 5/3. This becomes unsolvable if x and y are integers, as a sum of products of integers will only give an integer and never a rational number. Thus there is no solution to the second problem.
You are absolutely right! I once wrote up a little bit of an analysis of what is and what is not possible with the billiards ball method along the lines you are suggesting (for a fun maths course that I am teaching at Monash uni). If you are interested I put it here for you: www.qedcat.com/billiards1.pdf
Isn't the easiest to just fill up A(5 gallons), pour into B(3 gallons), and you're left with 2 gallons. Pour all of B away, move the 2 gallons into B, fill up A, pour enough into B so that it's full, and boom, A has 4 gallons.
Does this have to do with Bezout's identity? It seems like it, but I think it requires z to be the gcd of a and b (5 and 3 here) and just says that there are solutions in Z for ax+by= gcd(a, b).
+Milan Golob > I am curious: is it theoretically possible to solve problem with one infinitely big bottle? (on one side "pool table" would run from 0 to ∞)? >>> Sure, why not. Let's say your remaining finite bottle can hold 5 gallons just like the one in the movie. Then your new table would be bounded by three edges, a horizontal one of length 5 and two parallel infinite rays making 60 degree angles with this horizontal. When you now shoot the billiards ball it will zigzag up the infinite table. This corresponds to you filling the 5 gallon jug over and over and tipping its contents into the infinite bottle. >And why 60° degree angle. >>> Well, just try to imagine what would happen if you left everything in out setup the same but changed the angle. Would things still work out? No, it would not, but other interesting things start happening if you use other specific angles, and these other things can be put to good use to model other interesting problems. For example, a regular rectangular billiards table of integer dimensions n and m can be used to calculate the least common multiple of n and m. B.t.w. the Die Hard setup also calculates the greatest common divisor of n and m. Can you see how?
+Mathologer There is a simler easy way if you do like this: What about Fill 3 Pour 3 gallons into 5 gallon Fill 3 Pour 2 gallons into 5 gallon Empty 5 gallons Pour 1 gallon into 5 gallon Fill 3 gallon Pour 3 gallon into 5 gallon :)
+Mathologer Make a video on the occasions math was wrong. Anyone can appear right when all they do is point out when they were. Make a video on where mathematicians were wrong. I know it would run on for an amazing amount of time. Lets break it down to a quick 20 minutes of historically inaccurate mathematical assumptions to test your humility. Can you admit you can be wrong.
so you'd need a third jug with a maximum volume that's not divisible by 3 to not Die Hard 25. The easiest way to quickly visualize this is to take a full 15 gallon jug, and just keep filling your mystery third jug with it until this mystery jug is full (doesn't matter how often you have to do this). Then, throw away the third jug because you don't need it anymore; you now have the 15 gallon jug with a volume that is not divisible by 3, allowing you to "shoot the ball" from a side of the table that you couldn't hit before. As long as that number is within the formula 3n+2, it should work; if not, I'm not sure if the mystery jug would work. Another way to visualize it would be to imagine you're in a room that's slanted in both the X and Z axes... in space. With a cue. Firing off a cueball from one corner at an angle I don't even want to try calculating. Now that'd be one hell of a weird game. Personally though, if I were John McClane I'd keep a 1 gallon jug on my person at all times and not bother with all the mental space sports shenanigans.
A great insight! I would add two points: rather than start at 0,5 or 3,0. I would say we assume to start from 0,0. Then the first move is along one edge or the other. That way there's no question about what is an acceptable starting position. Also in the first example you mention that you can get 8 (3+5) but the line didn't touch there. Again, running the ball along the edge shows the appropriate move to make.
Yes, absolutely, it is possible to start at 0,0 and also allow the ball to run along the sides of the table. This gives a complete picture of what can happen and I actually think about the whole setup in this way. However, over the years I've found that when I try to explain this trick to other people I get better results by doing what I did in the video rather than go for the complete picture. I am not sure absolutely sure what it is that confuses people about the complete picture. It could be the red lines running along sides, the way I explain it, ... Anyway, thank you very much for bringing this up.
I agree it add a level of difficultly to the understanding, you'd then need to explain why a red line only counts when it hits a boundary and not all the points in between - in your 6/15 example. And that would just add complexity to your clean and crisp explanation. 😊 I really enjoy your videos - even if the topic is something I think I'm familiar with you always have a fantastic new perspective on it.
I would like to thank you a lot for your effort in educating us in such an amazing way. I enjoyed every single video on your channel and I love the way you visually demonstrate all these concepts. You are able to transform something that many times scares and bores so many people into something pleasant and fullfilling. Please, keep posting so we can learn more and more!
I'm kind of surprised you started at (5,0) or (0,3) on the grid when explaining the process - rather than at (0,0) which presents you with the two initial choices: fill the 3 or fill the 5. Otherwise, as ever, a beautiful solution
I saw that too. You're actually presented with such a "choice" everytime the billiard hits the edge. However, making such a choice always puts you in one of the four corners, reducing the problem to a situation that would have the same result as starting in a corner. Thus, WLOG, we can iterate over running the billiards simulation over the corners without having to worry about making "choices"
Also using a scale to weigh the water means there has to be only one correct solution, as the 5 gallon jug is going to weigh 67% more assuming they're made of the same material
@@Steffystr8mobbin Actually, the 5 gallon jug will be less than 67% heavier. The jug is a thin shell, so its weight depends on its surface area, not the volume it contains. Assuming you keep the same proportions on the jug, scaling up from 3 gallons to 5 gallons only requires (5/3)^(2/3) = 1.41 times as much plastic, i.e., 41% more.
I found it helpful to use a Cartesian grid with a 45 degree lines drawn between (0,1) -- (1,0); (0,2) -- (2,0); etc. Basically a deskewed version of this graph. You can create a rectangle for the bounds of the problem. Filling up a jar directly takes you on horizontal or vertical paths. The angled path follows a function which describes volume of one jug going into the other. That is, if you have 5 gal in one jug and slowly pour it into the 3 gallon jug, the volumes follow the straight path between (5,0) and (2,3). It's easy to see why the function has a negative slope. This disrupts the billiard analogy but the difference between filling a jug directly and transferring water is much easier to see.
To be technically correct you need to start at (0,0) every time. But doing this doesn't let you bounce nicely from the bottom right corner. So the rules need to change from strict bouncing when you hit an edge to this: Start at (0,0), then at any point you can choose to go any direction at all provided you follow a line all the way to the edge. Because if you really wanted to, you could go from (0,0) to (5,0) back to (0,0) to (0,3) to (3,0) to (5,0). It breaks the nice billiards analogy, but it works in real life.
Exactly. You could also go from say (2,3) to (0,3) or (5,3). It just wouldn't be productive because you've basically reset the jugs to "easy" values (full or empty).
one way is to fill 3 gal jar and pour in into 5 gal jar and fill the 3 gal jar again and pour in into 5 jar untill you reach 5 gal. you leave with 1 gal in the 3 gal jar. empty the 5 gal and pour 1 gal into 5 gal and refill the 3 gal jar and pour in into 5 gal jar and u get 4.
H it includes more 2 more steps, but 3 gallons fills and empties relatively faster. In a turn based problem, its slower, but in a time based problem, its faster. Its exactly why the shortest route from city A to city B is often not the fastest route.
@@H0A0B123 @ H For ease of math, let us presume 10 seconds per gal transfer time. Step 1: Fill the 5 gal jug 50 seconds Step 2: Pour 3 gal of the 5 gal jug into the empty 3 gal jug 30 seconds Step 3: Empty out the 3 gal jug 30 seconds Step 4: Pour the remaining 2 gals into the 3 gal jug 30 seconds Step 5: Fill the 5 gal jug 50 seconds Step 6: Pour 1 gal of the 5 gal jug into the 3 gal jug 10 seconds Done: The 5 gal jug would have 4 gals 200 seconds Step 1: Fill the 3 gal jug 30 seconds Step 2: Pour 3 gal jug into the empty 5 gal jug 30 seconds Step 3: Fill the 3 gal jug 30 seconds Step 4: Pour 2 gals into the 5 gal jug leaving 1 gal in the 3 gals 20 seconds Step 5: Empty the 5 gal jug 50 seconds Step 6: Pour 1 gal of the 3 gal jug into the 5 gal jug 10 seconds Step 7: Fill the 3 gal jug 30 seconds Step 8: Pour 3 gal jug into the 5 gal jug 30 seconds Done: The 5 gal jug would have 4 gals 230 seconds
This is the one I came up with. Why it physically may be better or worse: The other solution requires 10g from the fountain, 6g poured bottle-to-bottle (5g going 5gb to 3gb and 1g going 3gb to 5gb), and pouring 3g out from the 3gb, a total movement of 19 gallons. This solution requires only 9g from the fountain (good for conservation), 9g poured bottle-to-bottle all from the 3gb to the 5gb, and 5g poured out from the 5gb, a total movement of 23 gallons which in the essence of time would seem to be a disadvantage. First, I note the bottle necks are the same diameter. If the neck of the 5gb were larger, there would be a greater chance of spillage going from the 5gb to 3gb, slowing the process in the other solution. When time is critical, if the fountain is very slow, 9g vs 10g might be an advantage but probably not much. There are also 2 guys to share the work of pouring and filling. The slowest process is going to be bottle-to-bottle since one must be careful not to spill any. The fastest process is emptying bottles on the ground. Other than that, I won't make any precise assumptions or calculate flow rates through openings of a given size. In neither solution can much effective use be made of manpower as there is no opportunity of simultaneous independent operations on the two bottles. That puts this solution at a 4g time disadvantage, all flows being equal. But they are not. This solution's 23g includes 5g of dumping and 18g other, while the other solution has only 3g of dumping and 16g of other, which reduces the time disparity. And 9g from the fountain rather than 10g is a further slight time benefit. Another issue affecting time and care is the amount of weight that must be lifted and handled and in what ways. There is 8.35 pounds to 1 US gallon. In this solution, the full 3gb (25.05 pounds) is lifted and poured bottle-to-bottle 3 times, twice fully and once in 2 stages, between which the 3g bottle may be held ready, offering the only slight opportunity for both men to work together. The 5gb is only dumped and need not be lifted much at all except to put the final 4g (33.4 pounds) on the scale. Total lift is 3x25.05+1x33.4=108.55 pounds. In the other solution, it is the heavier 5gb (41.75 pounds) that is lifted most. Not that these guys are weaklings but the extra weight makes lifting and pouring bottle-to-bottle just a bit slower, more delicate and time-consuming without spilling. This is yet another time disadvantage of the other solution. The 5gb is lifted twice to pour into the 3gb, once in 2 parts between which it may also be held ready as the 3gb is dumped and once to pour 1g into the 3gb. The remaining 4g (33.4 pounds) may be placed directly on the scale. Total lift is 2x41.75=83.5 pounds. Fewer lifts and less total weight probably cancels the ease of handling individual weights, especially for 2 tough guys. Experimentation would be useful if one had the time for multiple trials. But IMO, the other solution, the first presented in the video, has a very slight advantage, somewhat closer than 19-23 in raw gallons moved. Thank you for reading.
I just realized something, the action of "shooting a billiards ball" can be also said as a series of 3 actions 1) pour the container with the most water into the other container 2) empty the full container 3) fill the empty container For each step, do the action highest up on the list that is possible that doesn't result in backtracking. For the original problem, it looks like this. (0,5) start (3,2) pour biggest -> smallest (0,2) empty full (2,0) pour biggest -> smallest (2,5) fill empty (since pouring again would backtrack) (3,4) pour biggest -> smallest, and we're done!
And you can measure up any volume you want if you have two jars with irrational volume ratio. Well, almost any. To be preicise: A lot, except almost all. But still all you will ever need.
You don't have to draw like 60 degree rhombus. You can draw it like the traditional right angled X-Y grid, which is easier to comprehend the underlying meaning of the graph. X ranges from 0 to 5, Y ranges from 0 to 3. The starting point is (0,0), since both containers are initially empty of course. The traverse lines can be either horizontal, vertical or diagonal, as long as they obey one rule: X and Y must go different directions (e.g. X increases while Y decreases, or X decreases while Y increases; increase/decrease by 0 is accepted). And each traverse line must not stop until it reaches the other outer boundary.
The square graph makes sense in mathematical formulation, but no sense at all when using the physics analogy of a billiard ball bouncing off the table boundary. Also, offering a "choice" of where to go at any given point makes no sense in the real-world application of the bottles. Say you're at 2,3: Choosing to follow along a wall destroys the progress you previously made, by either completely filling or emptying the 5-gallon bottle, which had 2. Now you're at either 0,3, or 5,3, and basically starting over from nothing. You wasted time and the bomb has killed you.
My approach was this: 1st: Fill up the 3 gallon container. 2nd: Pour the 3 gallons into the 5 gallon container. 3rd: Fill up the 3 gallon container again. 4th: pour as much as possible from the 3 gallon container into the 5 gallon container. 5th: Empty the 5 gallon container. 6th: Pour the rest of the 3 gallon container into the 5 gallon container. 7th: Fill up the 3 gallon container. 8th/Final step: Pour the 3 gallons into the 5 gallon container. Nice Video!
I survived! My solution is different from the one in this video. Fill the 3 gallon, pour it into the 5 gallon, fill the 3 gallon, pour it into the 5 gallon stopping when it is full, leaving 1 gallon in the 3 gallon, empty the 5 gallon, pour the one gallon from the 3 gallon into the 5 gallon, fill the 3 gallon, pour that into the 5 gallon, and you have four gallons in it. The solution given in the video is simpler, but I need to get the job done in 30 seconds! The best answer is *not* required. It took me 17 seconds to devise my answer so I need to really hustle filling and pouring. I have no time to look for a short sequence.When I finish watching the video I see my solution presented at 8:13, but I solved it at the beginning within 30 seconds of being presented with the problem.
I think, just off the top of my head, if you create your 3 dimensional shape and start at 0,0,0 and choose which direction to start, which equates to filling one of the jugs, that would be a 1 in 3 choice to start. Then I think at every 'bounce' you would have to choose which direction you want to bounce, which equates to which 2 jugs you want to interact with. So it would be a lot more complicated to find a solution. And yes I know this is a 5 year old post.
I would've used the 5 gallon for displacement instead. fill the 3. pour it in the 5. fill the 3 again pour it in the 5 until full. dump the 5. pour the remaining 1 gallon from the 3 into the 5. fill the 3 again. pour it in. place on scale. And while that sounds like a lot of steps it could be faster since you only move around 9 gallons of water instead of 10. :-P Continued watching and realized you covered this anyways hahaha Love your videos btw
This method is so simple and amazing! I love that your channel is full of interesting stuff like this and you explain things very clearly. So glad to have discovered another great math channel. :)
I got another solution when I tried this myself :) Fill the 3gal, poor it all into the 5gal, fill the 3gal again, poor all from the 3gal into the 5gal until the 5gal is filled, now there is 1gal left in the 3gal, empty the 5gal, poor the 1gal from the 3gal into the 5gal, fill the 3gal again and poor it all into the 5gal and you end up with the 5gal filled with 4gals :P
how would you be sur to have on galon left in the 3 galon container? the first way Matologer shows us is tossing out the unriliable bit and fils the jug to the brim everytime
@@rubenjanssen1672 1: This comment thread is 3 years old, you are lucky to even get a reply from me (as i just watched the video today) 2: Fill the 3 gallon, poor into the 5 gallon; the 5 gal only has space for 2 gal more. fill the 3 gal again and poor into the 5 gal until full, that means you poor exactly 2 gal out of the 3 gal, so your left with exactly 1 gal in the 3 gal container. Empty the 5 gal and put the 1 gal of water in it, now that the 3 gal is empty, you can get 3 gal and add it to the 1 gal of water in the 5 gal, and you have the 4 gallons of water exactly 3: The video even talks about this and shows a visual at 8:10
One thing you haven't mentioned is that the "rebound" of the red line isn't predetermined; once you hit the border, you can (as in reality) choose the direction among the ones available (and as you explained, every direction represent a specific action, fill or empty one of the jugs, or transfer between the jugs). I was thinking about this because the fact that the plane is skewed seemed to be functional to the rebound, but in the end it's only an aesthetic choice - I imagine determined by the fact that the other diagonal direction (North-East) wouldn'r represent any meaningful action in a non-skewed plane.
Yes, for 2 jars, there are at max 2 interesting directions. Since a rebound requires 1 incoming direction and 1 outgoing direction; the rebound is predetermined. But for n>=3 jars, you can have n(n+1)/2) interesting directions... so there choice comes into play and you the rebound isn't predetermined.
Asking for 4 was actually genious in the original film as you would not have to consider the weight difference of the two containers. If Simon asked for 3 or less there would have been two different weight possible and the bomb would still have a 50/50 chance to explode still with the correct answer.
For the DH25 puzzle, Simon might have provided one of the jugs with a specified amount initially. This toughens the puzzle as BW can no longer experiment. Once the initial "pre-loaded" jug has been added to or subtracted from, the initial conditions cannot be replicated. The entire puzzle must be solved in their heads (or on paper if any is available) before pouring into or from the pre-loaded jug. By choosing a jug and initial (partial) amount, the graph can be initialized at any point on the edge. By providing an initial (partial) amount in both jugs, the graph can be started from any interior point as well.
Maybe, for example, he had 2 gal. in one (and only one)? For this to work, in gallons it would just need to be one under a multiple of 3 (because the desired volume is too and the GCF of the container sizes is 3)
Fill the 5 gallon bucket, then use it to fill the 3 gallon bucket, which would leave 2 gallons of water in the 5 gallon bucket. Mark the water level of the 5 gallon bucket with a marker. Dump the 3 gallon bucket out and pout the leftover 2 gallons from the 5 gallon bucket into the 3 gallon bucket. Fill the 5 gallon bucket to the line that you marked it with, then pour the contents of the 3 gallon bucket back into the 5 gallon bucket. Total = 4 gallons. Took me less than 30 seconds to think of, but it would take more than 30 seconds to execute.
Hu Go - Considering the core math problem here is unit-less - it could just as easily be “fill a jug to 4 liters given a 3 & 5 liter jug” - your reply makes zero sense and comes off as pretentious rather than humorous _(humor needs to play off of reality; you're just combining uncorrelated things)_ . And people wonder why the USA uses different standards of measurements- whenever a non-US-citizen tries to convince us to use Metric, their argument is illogical, non-sensical, and snide! No thank you. In reality, the US is already a dual-measurement country. Metric is used almost universally in sciences, US Customary Units are used more frequently for casual day-to-day measurements, and mechanical/technical fields use either- every hardware store has both US & Metric nuts, screws, bolts; nearly every ruler has both US & Metric measurements, and so on. I won't go into the benefits of the US system here - mainly, how the units are sized to be human-relative rather than atomic-relative and how that makes them less cumbersome for everyday use - but there's clearly benefits to both systems, and we use both.
@@PeteBobGee America's customary measure has drifted significantly from Imperial. A close examination of the history of the Pint is most illustrative en.wikipedia.org/wiki/Pint
@@CapnSlipp imperial is just illogical, in the metric system you basically have a standard unit. size is m, weight is g, and so on. we use si-prefixes (Powers of ten), instead of things like: 1foot = 12 inches. If you want to convert from inches to foot you will be very likely less accurate compared to dm to cm for example.
I just use whatever units that I am given and treat them like variables throughout my calculations, then I do all the unit conversion crap at the very end. =P
@@CapnSlipp in metric, if a unit is not "human sized" you can just use a multiple (as it's done with g->kg) and its not true that imperial (customary) system units are in general more "human sized", for example litres fit better everyday liquid (milk, water...) needs of a human being than gallons. So the only advantage of the consumary system is that people in the US are already habituated to it. There's literally no other advantage.
Fill the 3 gallon jug (J3) and pour it into the five (J5). Then do it again. You now have 1 gallon left in J3. Empty J5 and pour the one gallon in from J3. Now fill J3 again and pour it in on top - 4 gallons! Thank you, I'm here all week. Edit: then I watched the rest. Oh well. :)
@Mathologer - you NEED to make an extension of this to explain graph search. I'm a computer science engineer and this can be generalized to a graph search problem and we can use different types of graph search traversals (like BFS/DFS/A* search) to get to a solution from any state to any other state in the most minimal number of moves. The same can be extended to solving Rubik's cube and so on. With A*, you need to create a mathematical heuristic which helps you get to the answer faster.
1:40 fill 5 gallon(leaving 2 gallons) pour into 3 gallon. DISCARD 3 gallons. pour remaining from 5 gal into 3 gallon refil 5 gallon. finish filling 3 gallons (currently holds 2 gallons, 2+1=3) with 5 gallon jug. 5 gallon jug now contains 4 gallons 5-1=4
thanks, i was always thinking how they've done it cause i came up with a different solution that works as well. fill 3 gallon bottle and pour all in 5 gallon bottle. then again fill 3 gallon bottle and fill the rest of the 5 gallon from the 3 gallon bottle. then you will have 1 gallon remaining in the 3 gallon bottle. pour the 5 gallon bottle out and fill that remaining 1 gallon in the empty 5 gallon bottle. the fill the 3 gallon bottle and pour all in the 5 gallon bottle. and then you have it. :-)
But how would the ball bouncing analogy work? At every point you'll have 2 different routes to go instead of just one. How would you make out a 5 of container sizes 6, 8 and 15?
The analogy could still work -- you just need to imagine you're bouncing off of a 3-d space's walls, rather than a 2-d plane's walls. You can in fact have an indefinite amount of jugs, and the basic principle remains unchanged.
Yes, as long as you have two co-prime containers, you can ignore the rest. But if you fear it will take a long time to reach your target, then using more containers would be beneficial. With 2 jars, there are at max 3 possible actions at any point in the process: 1) Completely fill/empty the first jar, 2) Completely fill/empty the second jar, 3) Completely transfer contents from first to second / second to first jars. That's why Mathologer uses 3 axes in his diagram, to represent the 3 different possible routes. Each action must necessarily either completely deplete (0) the donating body or completely fill (3 or 5) the receiving body or both. Technically, we always start from (0.0); in the first solution, he moved to (5,0) and in the second solution he moved to (0,3) in his first step. In either case, starting from the boundary, we can only move to another point on the boundary and so on. Though we always have 3 options, completely filling/emptying one of the jars would move us to a corner point; which can easily be reached without this complication. So there's actually only 2 interesting directions. By constructing the axes to be 60 deg to each other, he can compare the trajectory of a solution to the bouncing of a billiard ball off walls. With n jars, you'll have at max (n+nC2) routes. So moving from boundary point to boundary point (meaning at least one the jars is either completely empty of completely filled), you can have at max all these n(n+1)/2 routes as interesting when n>=3. For 3 jars, that means 6 interesting directions from a point. Mathologer was able to use the bouncing analogy for 2 jars since there were at max 2 interesting directions; and bouncing requires 1 incoming direction, 1 outgoing direction, and 0 other interesting directions.
You can still use the bouncing algorithm for higher dimensional space; but a single run wouldn't be able to yield the complete solution space. Because for at least one of the points in the trajectory, you'll have multiple directions in which to bounce off.
Given N jugs, is there an analogous N-dimensional graph that tells you the solution(s) or does that introduce a >1 branching factor making it a harder problem?
Would this also work with three bottles? i,e in 3D inside a parallelepiped. It's quite hard to visualise but i have a feeling it would. the volume of water in the third bottle would be represented on the y axis and the reflection off of a boundary would be in the plane which is defined by normal of the boundary and the incident. Also if you have n bottles with volumes equal to the first n primes, does that mean there would be a solution for any volume less than or equal to n?
Good idea! There are a number of restrictions on how the ball can bounce around in the parallelepiped imposed by what is physically possible/we can control. In particular, movements have to always correspond to us pouring water from just one jug into one of the other jugs or filling or emptying one of the jugs. (You can pour water from or into two jugs simultaneously, but to be sure about the resulting amount of water in the different jugs you have to be able to replace the simultaneous action by one or two of these "single" actions.) Anyway, what this says is that meaningful movements of the ball should be parallel to the faces of the parallelepiped. At this point it's probably a good idea to have a look at an example. Say you have a 3-gallon jug, a 4-gallon jug, and a 5-gallon jug. Then you can think of the faces of the parallelepiped as billiards tables of dimensions 3-4, 3-5, and 4-5 on which the ball can move around as usual. There are some more parallel copies of these different billiards tables hidden inside the solid on which the billiard ball can move around, but to get a sense of what is possible with this approach it probably helps to just ponder the ball bouncing around on the tables that make up the surface. Have fun! The answer to your question is `Yes'. In fact, you only need two of your jugs to make all the numbers you are after: the largest one of the jugs and any of the other ones. If you use all the jugs you can make all integer volumes from 0 up to the sum of the first n primes.
Mathologer Ahh, I understand. If you're moving in all dimension it would be simulating both possibilities for an "empty A into " action. Depending on the volume, one jug would fill (collide) first so the coordinate of the collision would contain the partial solution for the other possibility. Only traveling on the faces would remove that problem. Sounds like a good task for a future assignment 1 :D p.s I know you hate emails so i'll ask here instead. What time/day will you be in your office next? I need to collect assignments
Mathologer If you think about it, it is only possibly for the ball to move along the surfaces of this 3D shape. Meaning that all points where the ball bounces on the edges it is point on both surfaces that touch that edge.
I would really be interested in the visualisation of a harder version of this problem: a 3 dimensional version (3 water containers). Obviously a lot harder, since you can choose one of two paths after hitting every edge, but that just makes it more interesting.
It's just a coordinate system as he explains. The shear only makes it easier to visualize the reflective property. You always have to go to the end of a line and you start in the bottom left. You either can: -go to a corner (all empty or filled)[useless] -go back where you came from [useless] Or -go the unknown way (reflect) In the beginning you start from a corner (fill the right containers to get the shortest solution) and then reflect of the wall otherwise it's counterproductive...
You can approach 5 from a 6x3: Empty x & y. Fill x to 6. Fill y ~1/3 full from x so x~5 & label the levels x="5?" & y="1?". Empty y. Fill y to 3 from x so x~2 & label the level "2?". Empty x into y, refill x to "2?", empty y into x & label the doubled level "2*2?". Fill y to "1?". Empty y into x so x~1. Fill y to 3. Empty y into x so x~4. If below "2*2?", "5?">5. If above "2*2?", "5?"
In the game Rusty Lake: The Hotel, there is a mini-game in Mr Deer's room which is similar, but with three flasks: 10 dL, 5 dL, and 6 dL. And the goal is to get 8 dL. But there is the added condition that you have exactly 11 dL to work with. This means that you are working within the triangle a+b+c = 11, which turns this 3D puzzle into a 2D puzzle, and you can solve it like above. You have to take some slices off the triangle, to account for the sizes of the flasks. Each corner of the triangle is where there would be 11 in one, and 0 in the other two. So from the Ten corner, slice off a 1by1by1 triangle, from the Five corner, slice off a 6by6by6, and from the Six corner, slice off a 5by5by5. So you're left with a pentagon with corners (10,0,1), (10,1,0), (6,5,0), (0,5,6), (5,0,6). It starts you off on the point (5,0,6). And so you can solve it in the same method as above! (5,0,6)__________(10,0,1) / \ / /(10,1,0) / / / / /___________/ (0,5,6) (6,5,0)
He doesn't have hairs, I have it 😂 But he has brain, I don't have it 🤐
8 лет назад
How do you see where you have to point? Your hand is behind the graphics and you don't look at the camera or something like that. Is there a transparent screen and you somehow photoshop the frame out? Or is it a hologram? Or do you set the graphics in editing depending on where you pointed in the video?
Amazing video ! I discovered this type of puzzle when I was young (a long, long time ago) in a book about Sam Loyd's puzzle. If I remember correctly, he used sometimes a third jug and the diagramm was truncated, but I forgot the details. Do you know ?
Thank you for this technique!! Could this “billiard method of coordinates” also be applied to something e.g. like “the TOWERS OF HANOI?" Perhaps I might assign a numerical value each ring and treat them like water jugs → coordinates? Idk...I'm speculating; my best game is 120moves and 63 is optimal, (so I could use a boost!! LOL.) Thank again for this.
There's a very simple and optimal mathematical solution to Towers of Hanoi. Check this video by 3Blue1Brown ruclips.net/video/2SUvWfNJSsM/видео.html Unfortunately, after having watched the video, the game is 100% solved and there's no point in playing anymore.
Is there a reason that you didn't make the "state grid" rectangular? Having the filling and emptying horizontal en vertical respectively and diagonal lines (i.e. x + y = C) meaning pouring from one into the other would seem more clear to me... is it because of the bouncing of the "billiard ball" at proper angles? For me that just complicated matters. Anyway thanks for a great video and insight into this problem!
In general, you can only achieve volumes that can be expressed by mA + nB, where m and n are integers and A and B are the capacity of the containers. In the first case, A = 5 and B = 3, so since you can express 4 as 2*5 - 2*3 (or 3*3 - 1*5), this means that 4 gallons is achievable. 7 gallons is also achievable, since 7 = 2*5 - 1*3 or 4*3 - 1*5. In the second case, A = 15 and B = 6, thus the expression is m*15 + n*6, Since m*15 + n*6 = 3*(m*5 + n*2), no matter what we have inside the parenthesis, the result will always be a multiple of 3. So, we can achieve only multiples of 3 (gallons). Congratulations for your videos. You got a new inscription (from Brazil).
+Paulo Bouhid Glad you like our videos and thank you for saying so. You are absolutely right! I once wrote up a little bit of an analysis of what is and what is not possible with the billiards ball method along the lines you are suggesting (for a fun maths course that I am teaching at Monash uni). If you are interested I put it here for you: www.qedcat.com/billiards1.pdf
+Mathologer I thank you... we all learn something new with your videos, even about subjects we already know. Ans tk you for the link... I´ll take a look. Greetings from Brazil.
A) fill 5/5 then pour from it until 3/3 -> we get 2/5, empty 0/3, fill with remainder -> 2/3. fill again 5/5, pour from it until 3/3 -> remainder is 4/5 = win. work: fills: 2 pours:3 empties:1 B) fill 3/3, pour over -> 3/5. fill again 3/3, pour from it until 5/5 -> remainder 1/3. empty 0/5, pour from other so 1/5. add another 3/3 and pour it over -> 4/5 = also win. work: fills: 3 pours:4 empties:1 good vid. you reference all thet hings i like, math, simpsons, futurama, die hard... since i saw the movie i already thought about that a long time ago. 2 solutions come to mind, but i would say its physically impossible, since in 30 filling the jug and being carefully at the same time so you dont splash a little seems impossible for the process required. even with haste... think about it, you probably take around 10 secs to fill your a waterboiler... anway i liked it in the movie and i like it now :D riddles!
Actually, you start at (0,0) (the two empty jugs) then proceed to (5,0). Also you might want to explain why you must start in a corner (each jug must be fully empty or fully filled). How do you extend the method to N jugs?
@@youcantspellslaughterwitho4353 Germany was founded in 1871. Austria was left over from the part of Bavaria Germany didn't get. There have been 5 famous Austrians: Mozart, Straus, Freud, Swartzenegger and Hitler.
@@angrytedtalks I'd probably add Hundertwasser to the list. And Haydn. Schrödinger. Wittgenstein … Niki Lauda is also quite well-known. And think about royalty … Marie Antoinette was Austrian. But I have to admit they might not be the first one thinks about. Theyʼre famous people, though.
@2:15 "I think anybody who actually thinks about this a little bit will come up with this solution" I thought first of another solution where mostly the 3-gal jug is moved (which is easier): Fill 3-gal jug and pour all the water into 5-gal jug. Fill 3-gal jug again and pour water into 5-gal jug until full. Then 1 gallon is left in 3-gal jug. Pour out 5-gal jug (only one move with this jug) and fill the 1 gallon into 5-gal jug. Fill 3-gal jug and pour all the water into 5-gal. Now, there are 4 gallons in the 5-gal jug.
At the end, it seems like we can prepare any volume in full gallons if and only of the two volumes in gallons do NOT share a common divisor larger than 1. If they share a divisor larger than 1, like 2 or 3, then we can make prepare only volumes of multiple of that common divisor in gallons. Nice diagram.
I started watching your first Simpsons math video yesterday evening and now I'm here and somehow it's a new day and already getting dark again outside... :-o
You may also think of this as a regular Cartesian coordinate grid with the diagonals being lines of the form x + y = n where n is an integer. So (x,y) are your amounts in the jugs and since you can only start with one jug full, the solutions must always be integers. n is how much water you have total. The verticals and horizontals are just the actions of entirely filling an empty jug or emptying a jug that is already full.
I could barely even understand the problem when I first saw this movie as a little kid, and I left the movie still not getting what had happened. Flash forward to my present day 17 year old self, and I figured it out in the 30 seconds allotted. Decade younger me would be proud.
In the case of any quantity of liquid that is less than or equal to 3, the choice of which container you will use becomes relevant. With greater than 3 gallons and less than or equal to 5 gallons it is implied that you must use the larger container, and thus you would expect the weight of the container itself + that many gallons would be what the scale is tuned to measure. With less, using the wrong container would lead to your death because weight of the containers themselves also contributes to the weight. If it is tuned to weigh, for example, 2 gallons in the smaller container but you used 2 gallons in the larger container, boom. If it is tuned to 2 gallons in the larger container and you used 2 gallons in the smaller container, boom. There is only a clear choice for the higher range of values, unless you pretend that the containers weigh less than an ounce, as that's the tolerance that was communicated. Per google, an empty 5 gallon jug weighs about 12oz and a 3 gallon weighs about 8oz. Oddly, in the clip he also states to put the 4 gallons in "one of the containers" implying either one would work. That would only make sense if there were two different valid ranges of weights that would be accepted by the scale.
The fountain has a steady flow rate and looks like it might be fast enough to fill in 30 seconds. As an alternative but risky method, count how long to fill the 3 gallon container (x seconds) and use the formula x + x/3 to fill the 5 gallon container to 4 gallons.
I think I came with a different solution: fill the small jug full and pour it in the bigger one, then fill again the small one and start pouring the water on the bigger until it's full, at this moment you have 5 gal in the big and 1 in the small. Then empty the bigger jug and pour 1 gal into the bigger one. then fill the small with 3 gal and pour it into the big for exactly 4 gal .n/ but I'm not sure if irregularities in the jugs could prevent this to a tolerance of +-1 once as simon says
Great video and a marvellous way to show that Math is a way to think and not just do calculations. I had seen the video before but only now I'll comment a bit: 1) that 60° angle serves only has a way to make the billiards analogy work. Why that number? Will it only work for this angle? Was this ever physically built? 2) This question (how to get 4 gallons with a 3 and a 5 gallon jags) makes me think of the diophantine equation 5x + 3y = 4. Do you think this "method" could be similar to solving diophantine equations? Every time a jag is filled is a plus and every time it'emptied is a minus? This link with diophantine equations also explains why the last situation (a 6 jag and a 15 jag to get 5) isn't possible since all 3 have to be coprimes for an integer solution in an diophantine equation to exist. (it has been a while since I dealt with D.E.'s but it is an interesting question to dive again in them). Thanks for another great video. It would be more fun to explore this "jag-filling" problem with beer instead of water. Oktoberfest is near so it will be a great time to do this. ;) Prost.
I paused and had some found another solution :) (don't know if it's in the rest of the video yet) Fill the 3 gallon completely. Empty it into the 5 gallon. Fill the 3 gallon again. Pour all of the available water into the 5 gallon. The 5 gallon only has space for 2 gallons so there will be 1 gallon remaining in the 3. Pour all of the 5 gallon out into the fountain. Pour the 1 gallon from the 3 gallon container into the 5 gallon. Fill the 3 gallon again. Pour the remaining into the 5 gallon. Problem solved!
I worked out the second way, fill the 5l jug twice leaving 1l in the 3l jug. For the 15l jug you could poke a hole and time how long it takes to empty. Then calculate how long it would take for the relevant amount to drain, leaving the required amount. Given that you only have 30 seconds, perhaps you could cut the whole bottom off.
I guess I'm the only one who would notice things like the difference in the weight of the two containers would be more than an ounce, so if a variation of one ounce causes the bomb to go off, there's a chance you're getting blown up even if you manage to get the 2 gallons exactly (depending on which container he used when accounting for the weight. More importantly, mass production containers (which those clearly are), will never be "exactly 3 gallons" and "exactly 5 gallons". If you get a 3 gallon container, it is 3 gallons plus a certain amount of extra air space (and in this situation, you don't know that amount). For this to be in any way practical, you'd need bespoke containers, or at least have drawn on lines showing the fill levels (in which case you're going to run out of time trying to get them filled exactly to that point). So yeah, no matter what, short of blind luck, you're getting blown up.
Let a and b with a>b be the sizes of the jugs. When you pour water between them the total water quantity changes by one of +a, +b, -a, -b so the water quantity changes by +b or -b mod a. That means the quantities that can be obtained in the jug a are the elements of the subgroup generated by b in (Z_a, +), that is, all the multiples of gcd(a,b) ( mod a )
I've binge watched about half of your videos now and this one is my absolute favourite so far (which says a lot since all of them are amazing). I'd love it if you made another video about the "table" where you go more in depth into it. Maybe there are ones with different shapes that work with more than two bottles? Hexagons?
Great, glad you like this one so much :) I've been thinking about building a physical table whose sides are made from mirrors and such that two of these mirror (up and right) can be moved to make tables of different sizes. Then replacing the billiards ball by a laser beam would make for a nice analog computer for calculating the gcd of two integers.
Mathologer Wow, you might not believe me but I had the same idea while watching the video. You just have to cover the piece of mirror with the desired result and you have your route. You might also need some smoke. Looking forward to this.
So is there some sort of requirement that amount of liquid each jug can hold is co-prime to the other one? (let's say jug 'm' and jug 'n') And if so, are you guaranteed to be able make every amount from 1 to (m + n)?
This is just great. Elegantly way to solve this problem graphically. I am curious: is it theoretically possible to solve problem with one infinitely big bottle?(on one side "pool table" would run from 0 to ∞)? And why 60° degree angle. What would happen with different angle (is this analogous to evaporation or shrinking)?
This is very mind-blowing. I really enjoy your VDO. But I have one question.How do you come up with the idea of the table (From any theory behind it or something like that?)
for 1 gallon you could fill the 3 and poor it into the 5, then do that again and you will have 1 gallon left for the scales. for 2 you just fill the five and poor into the 3
6:45, you know you could start at 0,3. 9:50, so left to right is filling or pouring jugs out. The diagonal lines is pouring water from one jug to the other. 10:50, oh, darn, I was part wrong. Ah well. But you know, if the graph wasn't canted, those would be virtical lines.
The state machine like approach is quite interesting... I also looked your hidden cube in simpsons video which also has a state machine approach. Really nice videos :)
Great video. I really enjoyed the mathematical billiards explanation, quite amazing.
Wow, fancy seeing you here...
MindYourDecisions wow, you watch someone else i know
MindYourDecisions Didn't expect to see you commenting, hello there!
wow fancy seeing you here
I completely read that comment with your voice.
This is why those fitness types from the gym are always carrying around the 1 gallon jugs of water, JUUUUST in case they get dropped into a Diehard movie.
>Fill both half way then dump the 1.5 into the 2.5
Simon says "You've gotto be precise, one ounce more or less will result in detonation." With the irregular jugs he provides filling these jugs exactly half is pretty much impossible. Bruce Willis actually suggests this solution at some point. This approach would work if you are dealing with perfect cylindrical jugs. Can you see how you can fill these exactly halfways?
Mathologer Just put the jugs sideways and see if the water passes the middle of the cylinder :D
Joost Bouten Exactly :)
+Mathologer One ounce tolerance is really tight. Even if the bottles have precise markings for the exact 5 and 3 gallon volumes it is hard. If you put the bottle sideways and try to measure exactly 2.5 gallons, the bottleneck will ruin everything.
+Tapio Hirvikorpi that was the main problem I always had with the bottle ploy. "What constitutes [full]?"
Is it when no single drop will fit in the jug? (That's how I would define it, from a scientific standpoint), or are the jugs demarcated in some way--and if they are: How can you be certain the water is at exactly the correct demarcation without a level platform, and some form of linear scale?
A 3 gallon jug rarely ever fits exactly 3 gallons and no more, there is almost always room for an air bubble of unknown volume, when there are 3 gallons in said jug (because it would be logistically unfeasible to manufacture, seal and transport the jug efficiently otherwise.)
+Joost Bouten Sideways is okay but you're still eyeballing an unmarked point, along with the already highlighted issue of the neck. For a perfectly cylindrical jug, a better solution would be not sideways but diagonally. If the surface of the water just covers the whole base of the jug and just doesn't cover any of the top surface, you've got half. I.e. looking at it's image side on, you would see a rectangle with the water's surface going corner to corner.
You should be the next villain in a Die Hard movie, throwing all kinds of math puzzles at the heroes :)
mishmosh77 Can you nominate me :)
Nah, he should play the Riddler!
@@Mathologer
If you really think that you have any chance of defeating a villain in a movie, watch the YT video "Why Supervillains Always Keep the Good... " Guy Alive, I think it may be. Good for a laugh. Well at least according to movie logic. They want to be defeated, because once they manage to destroy the world, what then will they do?
BTW, I once won a bag of cookies for solving a math puzzle. "Open a combination lock within one minute. Here are the combination numbers, but we didn't bother to tell you what order they come in." I instantly recognized it as a permutations problem. (Or is that combinations? Somebody remind me of the difference?) Choose 1 of 3, 2 of the remaining 2, 1 of the remaining 1. 3! or 6 possible ways to order those numbers. My 4th try opened the lock. Yay! Cookies.
@@yosefmacgruber1920 Yea... remembering this from yearrs back from "Megamind"
There's another interesting way to examine the solvability of these problems, though not necessarily find an immediate solution.
To solve the two bucket challenge, we essentially have two operations: filling a bucket and emptying a bucket. Transferring water from one bucket to another isn't really important for examining solvability as I'll explain.
When we fill a bucket initially, we are either filling bucket A (+A) or B (+B). When we transfer without spillage from one bucket to another, we keep the same amount of water, so no expression is needed to keep track of the total amount of water between the two buckets.
When we empty a bucket, we are either emptying it from full (-A or -B) or from however much water is in it. However, this latter operation is unnecessary, because if we have a bucket that is not completely full, we have done transferring to reach its special fill value and should not wish to undo our work.
So, for the first problem (A = 5 gallon, B = 3 gallon) , we have two particular solutions:
The first is to start with a full 5 gallon (+A), pour as much as possible into bucket B (still A amount of water), empty B (A - B), transfer from A to B (still A - B amount of water), fill A again (2A - B), transfer as much as possible from A to B (still 2A - B), then finally empty B again (2A - 2B = 2(5) - 2(3) = 10 - 6 = 4 gallons)
The second is to start with a full 3 gallon (+B), pour completely into A (still B amount), fill B again (2B), pour as much as possible into A (still 2B) empty the now full A (-A + 2B), fill B again (-A + 3B) and transfer completely into A (still -A + 3B = -(5) + 3(3) = -5 + 9 = 4).
The general solution for this particular scenario is the plane 5x + 3y = z, where x is the number of 5 gallon operations, y is the number of 3 gallon operations and z is the final amount to end up with.
Whenever x, y and z are integers, this is potentially solvable, as 5 and 3 are coprime. It requires a bit more effort to find particular solutions, but since integers are closed on addition and multiplication, it is consistent that a sum of products of integers would be an integer.
The second problem can be analyzed in the same way. By setting it up as 15x + 6y = 5, since 15 and 6 are not coprime, we can factor and divide to give 5x + 2y = 5/3. This becomes unsolvable if x and y are integers, as a sum of products of integers will only give an integer and never a rational number. Thus there is no solution to the second problem.
You are absolutely right! I once wrote up a little bit of an analysis of what is and what is not possible with the billiards ball method along the lines you are suggesting (for a fun maths course that I am teaching at Monash uni). If you are interested I put it here for you: www.qedcat.com/billiards1.pdf
Isn't the easiest to just fill up A(5 gallons), pour into B(3 gallons), and you're left with 2 gallons. Pour all of B away, move the 2 gallons into B, fill up A, pour enough into B so that it's full, and boom, A has 4 gallons.
Does this have to do with Bezout's identity? It seems like it, but I think it requires z to be the gcd of a and b (5 and 3 here) and just says that there are solutions in Z for ax+by= gcd(a, b).
Well... I'm a mathemitician and I like action movies.
Concise and straight to the point :)
@Bob Trenwith I was quoting the guy in the video!!! Did you even watch it or are you just looking to complain?
@Bob Trenwith No, just claiming that you're a douche. Which is evident.
As soon as he put the coordinates I breathed out and just thought "that's brilliant"
Michael, glad you like this video but please don't disable the reply button if you'd like me to reply to questions in your comments :)
+Mathologer Ok. i guess? :)
+Milan Golob > I am curious: is it theoretically possible to solve problem with one infinitely big bottle? (on one side "pool table" would run from 0 to ∞)?
>>> Sure, why not. Let's say your remaining finite bottle can hold 5 gallons just like the one in the movie. Then your new table would be bounded by three edges, a horizontal one of length 5 and two parallel infinite rays making 60 degree angles with this horizontal. When you now shoot the billiards ball it will zigzag up the infinite table. This corresponds to you filling the 5 gallon jug over and over and tipping its contents into the infinite bottle.
>And why 60° degree angle.
>>> Well, just try to imagine what would happen if you left everything in out setup the same but changed the angle. Would things still work out? No, it would not, but other interesting things start happening if you use other specific angles, and these other things can be put to good use to model other interesting problems. For example, a regular rectangular billiards table of integer dimensions n and m can be used to calculate the least common multiple of n and m. B.t.w. the Die Hard setup also calculates the greatest common divisor of n and m. Can you see how?
+Mathologer There is a simler easy way if you do like this:
What about
Fill 3
Pour 3 gallons into 5 gallon
Fill 3
Pour 2 gallons into 5 gallon
Empty 5 gallons
Pour 1 gallon into 5 gallon
Fill 3 gallon
Pour 3 gallon into 5 gallon
:)
+nikolaj møller it was the second solution.
+Mathologer Make a video on the occasions math was wrong. Anyone can appear right when all they do is point out when they were. Make a video on where mathematicians were wrong. I know it would run on for an amazing amount of time. Lets break it down to a quick 20 minutes of historically inaccurate mathematical assumptions to test your humility. Can you admit you can be wrong.
This channel deserves definitely more likes and subscriptions.
I readed "How to Die Hard with Math", i clicked it.
Calculus kills me everytime.
so you'd need a third jug with a maximum volume that's not divisible by 3 to not Die Hard 25.
The easiest way to quickly visualize this is to take a full 15 gallon jug, and just keep filling your mystery third jug with it until this mystery jug is full (doesn't matter how often you have to do this). Then, throw away the third jug because you don't need it anymore; you now have the 15 gallon jug with a volume that is not divisible by 3, allowing you to "shoot the ball" from a side of the table that you couldn't hit before. As long as that number is within the formula 3n+2, it should work; if not, I'm not sure if the mystery jug would work.
Another way to visualize it would be to imagine you're in a room that's slanted in both the X and Z axes... in space. With a cue. Firing off a cueball from one corner at an angle I don't even want to try calculating.
Now that'd be one hell of a weird game.
Personally though, if I were John McClane I'd keep a 1 gallon jug on my person at all times and not bother with all the mental space sports shenanigans.
:)
WHAT IS THE DIAGRAM CALLED.I SEARCH AND LEARN
or the villains evil doctor Simpson!
... what??
A great insight!
I would add two points: rather than start at 0,5 or 3,0. I would say we assume to start from 0,0. Then the first move is along one edge or the other. That way there's no question about what is an acceptable starting position.
Also in the first example you mention that you can get 8 (3+5) but the line didn't touch there. Again, running the ball along the edge shows the appropriate move to make.
Yes, absolutely, it is possible to start at 0,0 and also allow the ball to run along the sides of the table. This gives a complete picture of what can happen and I actually think about the whole setup in this way. However, over the years I've found that when I try to explain this trick to other people I get better results by doing what I did in the video rather than go for the complete picture. I am not sure absolutely sure what it is that confuses people about the complete picture. It could be the red lines running along sides, the way I explain it, ... Anyway, thank you very much for bringing this up.
I agree it add a level of difficultly to the understanding, you'd then need to explain why a red line only counts when it hits a boundary and not all the points in between - in your 6/15 example. And that would just add complexity to your clean and crisp explanation. 😊
I really enjoy your videos - even if the topic is something I think I'm familiar with you always have a fantastic new perspective on it.
Haha, came to the comments to say the same :D
@@Mathologer
you can draw dots whenever the current position reaches another by following a straight line instead of tracing the entire line
I would like to thank you a lot for your effort in educating us in such an amazing way. I enjoyed every single video on your channel and I love the way you visually demonstrate all these concepts. You are able to transform something that many times scares and bores so many people into something pleasant and fullfilling. Please, keep posting so we can learn more and more!
+Henrique Feijo It's comments like this that make my day :)
I'm kind of surprised you started at (5,0) or (0,3) on the grid when explaining the process - rather than at (0,0) which presents you with the two initial choices: fill the 3 or fill the 5. Otherwise, as ever, a beautiful solution
I saw that too. You're actually presented with such a "choice" everytime the billiard hits the edge. However, making such a choice always puts you in one of the four corners, reducing the problem to a situation that would have the same result as starting in a corner. Thus, WLOG, we can iterate over running the billiards simulation over the corners without having to worry about making "choices"
Also using a scale to weigh the water means there has to be only one correct solution, as the 5 gallon jug is going to weigh 67% more assuming they're made of the same material
@@Steffystr8mobbin Both solutions end up with four gallons in the five gallon jug
@@Steffystr8mobbin There is no way you can have 4 gallons in the 3-gallon jug
@@Steffystr8mobbin Actually, the 5 gallon jug will be less than 67% heavier. The jug is a thin shell, so its weight depends on its surface area, not the volume it contains. Assuming you keep the same proportions on the jug, scaling up from 3 gallons to 5 gallons only requires (5/3)^(2/3) = 1.41 times as much plastic, i.e., 41% more.
I found it helpful to use a Cartesian grid with a 45 degree lines drawn between (0,1) -- (1,0); (0,2) -- (2,0); etc. Basically a deskewed version of this graph. You can create a rectangle for the bounds of the problem. Filling up a jar directly takes you on horizontal or vertical paths. The angled path follows a function which describes volume of one jug going into the other. That is, if you have 5 gal in one jug and slowly pour it into the 3 gallon jug, the volumes follow the straight path between (5,0) and (2,3). It's easy to see why the function has a negative slope. This disrupts the billiard analogy but the difference between filling a jug directly and transferring water is much easier to see.
I never knew this kind of problems had such a enormously enlightening picture as this one. GREAT JOB!!!!!!!!!!!!
To be technically correct you need to start at (0,0) every time. But doing this doesn't let you bounce nicely from the bottom right corner. So the rules need to change from strict bouncing when you hit an edge to this: Start at (0,0), then at any point you can choose to go any direction at all provided you follow a line all the way to the edge. Because if you really wanted to, you could go from (0,0) to (5,0) back to (0,0) to (0,3) to (3,0) to (5,0). It breaks the nice billiards analogy, but it works in real life.
Absolutely :)
Exactly. You could also go from say (2,3) to (0,3) or (5,3). It just wouldn't be productive because you've basically reset the jugs to "easy" values (full or empty).
one way is to fill 3 gal jar and pour in into 5 gal jar and fill the 3 gal jar again and pour in into 5 jar untill you reach 5 gal. you leave with 1 gal in the 3 gal jar. empty the 5 gal and pour 1 gal into 5 gal and refill the 3 gal jar and pour in into 5 gal jar and u get 4.
yeh that's how i did it, and it's faster
he showed both solutions. and i don't think this is faster
H it includes more 2 more steps, but 3 gallons fills and empties relatively faster. In a turn based problem, its slower, but in a time based problem, its faster.
Its exactly why the shortest route from city A to city B is often not the fastest route.
@@H0A0B123 @ H
For ease of math, let us presume 10 seconds per gal transfer time.
Step 1: Fill the 5 gal jug 50 seconds
Step 2: Pour 3 gal of the 5 gal jug into the empty 3 gal jug 30 seconds
Step 3: Empty out the 3 gal jug 30 seconds
Step 4: Pour the remaining 2 gals into the 3 gal jug 30 seconds
Step 5: Fill the 5 gal jug 50 seconds
Step 6: Pour 1 gal of the 5 gal jug into the 3 gal jug 10 seconds
Done: The 5 gal jug would have 4 gals 200 seconds
Step 1: Fill the 3 gal jug 30 seconds
Step 2: Pour 3 gal jug into the empty 5 gal jug 30 seconds
Step 3: Fill the 3 gal jug 30 seconds
Step 4: Pour 2 gals into the 5 gal jug leaving 1 gal in the 3 gals 20 seconds
Step 5: Empty the 5 gal jug 50 seconds
Step 6: Pour 1 gal of the 3 gal jug into the 5 gal jug 10 seconds
Step 7: Fill the 3 gal jug 30 seconds
Step 8: Pour 3 gal jug into the 5 gal jug 30 seconds
Done: The 5 gal jug would have 4 gals 230 seconds
This is the one I came up with. Why it physically may be better or worse: The other solution requires 10g from the fountain, 6g poured bottle-to-bottle (5g going 5gb to 3gb and 1g going 3gb to 5gb), and pouring 3g out from the 3gb, a total movement of 19 gallons. This solution requires only 9g from the fountain (good for conservation), 9g poured bottle-to-bottle all from the 3gb to the 5gb, and 5g poured out from the 5gb, a total movement of 23 gallons which in the essence of time would seem to be a disadvantage. First, I note the bottle necks are the same diameter. If the neck of the 5gb were larger, there would be a greater chance of spillage going from the 5gb to 3gb, slowing the process in the other solution. When time is critical, if the fountain is very slow, 9g vs 10g might be an advantage but probably not much. There are also 2 guys to share the work of pouring and filling. The slowest process is going to be bottle-to-bottle since one must be careful not to spill any. The fastest process is emptying bottles on the ground. Other than that, I won't make any precise assumptions or calculate flow rates through openings of a given size. In neither solution can much effective use be made of manpower as there is no opportunity of simultaneous independent operations on the two bottles. That puts this solution at a 4g time disadvantage, all flows being equal. But they are not. This solution's 23g includes 5g of dumping and 18g other, while the other solution has only 3g of dumping and 16g of other, which reduces the time disparity. And 9g from the fountain rather than 10g is a further slight time benefit. Another issue affecting time and care is the amount of weight that must be lifted and handled and in what ways. There is 8.35 pounds to 1 US gallon. In this solution, the full 3gb (25.05 pounds) is lifted and poured bottle-to-bottle 3 times, twice fully and once in 2 stages, between which the 3g bottle may be held ready, offering the only slight opportunity for both men to work together. The 5gb is only dumped and need not be lifted much at all except to put the final 4g (33.4 pounds) on the scale. Total lift is 3x25.05+1x33.4=108.55 pounds. In the other solution, it is the heavier 5gb (41.75 pounds) that is lifted most. Not that these guys are weaklings but the extra weight makes lifting and pouring bottle-to-bottle just a bit slower, more delicate and time-consuming without spilling. This is yet another time disadvantage of the other solution. The 5gb is lifted twice to pour into the 3gb, once in 2 parts between which it may also be held ready as the 3gb is dumped and once to pour 1g into the 3gb. The remaining 4g (33.4 pounds) may be placed directly on the scale. Total lift is 2x41.75=83.5 pounds. Fewer lifts and less total weight probably cancels the ease of handling individual weights, especially for 2 tough guys. Experimentation would be useful if one had the time for multiple trials. But IMO, the other solution, the first presented in the video, has a very slight advantage, somewhat closer than 19-23 in raw gallons moved. Thank you for reading.
I just realized something, the action of "shooting a billiards ball" can be also said as a series of 3 actions
1) pour the container with the most water into the other container
2) empty the full container
3) fill the empty container
For each step, do the action highest up on the list that is possible that doesn't result in backtracking. For the original problem, it looks like this.
(0,5) start
(3,2) pour biggest -> smallest
(0,2) empty full
(2,0) pour biggest -> smallest
(2,5) fill empty (since pouring again would backtrack)
(3,4) pour biggest -> smallest, and we're done!
Neat- just in case you don't have the iso grid "pool table" handy!
You can choose any two coprime numbers in order to make it possible to hit every point on your "billiards table" :)
Correct :)
And you can measure up any volume you want if you have two jars with irrational volume ratio.
Well, almost any.
To be preicise: A lot, except almost all.
But still all you will ever need.
Mathologer i think it might work with any size containers which don’t have common factors
@@guestuser2373
yes, that's what 'co-prime' means
You don't have to draw like 60 degree rhombus. You can draw it like the traditional right angled X-Y grid, which is easier to comprehend the underlying meaning of the graph.
X ranges from 0 to 5, Y ranges from 0 to 3. The starting point is (0,0), since both containers are initially empty of course.
The traverse lines can be either horizontal, vertical or diagonal, as long as they obey one rule: X and Y must go different directions (e.g. X increases while Y decreases, or X decreases while Y increases; increase/decrease by 0 is accepted). And each traverse line must not stop until it reaches the other outer boundary.
The square graph makes sense in mathematical formulation, but no sense at all when using the physics analogy of a billiard ball bouncing off the table boundary. Also, offering a "choice" of where to go at any given point makes no sense in the real-world application of the bottles. Say you're at 2,3: Choosing to follow along a wall destroys the progress you previously made, by either completely filling or emptying the 5-gallon bottle, which had 2. Now you're at either 0,3, or 5,3, and basically starting over from nothing. You wasted time and the bomb has killed you.
My approach was this:
1st: Fill up the 3 gallon container.
2nd: Pour the 3 gallons into the 5 gallon container.
3rd: Fill up the 3 gallon container again.
4th: pour as much as possible from the 3 gallon container into the 5 gallon container.
5th: Empty the 5 gallon container.
6th: Pour the rest of the 3 gallon container into the 5 gallon container.
7th: Fill up the 3 gallon container.
8th/Final step: Pour the 3 gallons into the 5 gallon container.
Nice Video!
i really love the representation of the problem, and how the structure solves it. kinda satisfying.
I survived! My solution is different from the one in this video. Fill the 3 gallon, pour it into the 5 gallon, fill the 3 gallon, pour it into the 5 gallon stopping when it is full, leaving 1 gallon in the 3 gallon, empty the 5 gallon, pour the one gallon from the 3 gallon into the 5 gallon, fill the 3 gallon, pour that into the 5 gallon, and you have four gallons in it. The solution given in the video is simpler, but I need to get the job done in 30 seconds! The best answer is *not* required. It took me 17 seconds to devise my answer so I need to really hustle filling and pouring. I have no time to look for a short sequence.When I finish watching the video I see my solution presented at 8:13, but I solved it at the beginning within 30 seconds of being presented with the problem.
Could you use this method 3-dimensionally for more than two containers?
Steven Boliek I replied to a similar question a couple of weeks ago. Should be easy to find :)
I think, just off the top of my head, if you create your 3 dimensional shape and start at 0,0,0 and choose which direction to start, which equates to filling one of the jugs, that would be a 1 in 3 choice to start. Then I think at every 'bounce' you would have to choose which direction you want to bounce, which equates to which 2 jugs you want to interact with.
So it would be a lot more complicated to find a solution.
And yes I know this is a 5 year old post.
3:18 grid run
9:13 proof
13:13 formula
I would've used the 5 gallon for displacement instead. fill the 3. pour it in the 5. fill the 3 again pour it in the 5 until full. dump the 5. pour the remaining 1 gallon from the 3 into the 5. fill the 3 again. pour it in. place on scale. And while that sounds like a lot of steps it could be faster since you only move around 9 gallons of water instead of 10. :-P
Continued watching and realized you covered this anyways hahaha Love your videos btw
Very very interesting !!!
1. This video
2. RUclips recommending this video after 4 years it's been posted
This method is so simple and amazing! I love that your channel is full of interesting stuff like this and you explain things very clearly. So glad to have discovered another great math channel. :)
Jing F Glad you like our videos and thank you very much for saying so.
This is awesome. i've always loved that scene for the puzzle aspect. This is an awesome video!
I got another solution when I tried this myself :)
Fill the 3gal, poor it all into the 5gal, fill the 3gal again, poor all from the 3gal into the 5gal until the 5gal is filled, now there is 1gal left in the 3gal, empty the 5gal, poor the 1gal from the 3gal into the 5gal, fill the 3gal again and poor it all into the 5gal and you end up with the 5gal filled with 4gals :P
SmileyMPV That also works. I actually also discuss this second solution in the video. Have another close look :)
SmileyMPV This way takes longer but for me its more logical lol i mean its the first solution i came up with
how would you be sur to have on galon left in the 3 galon container? the first way Matologer shows us is tossing out the unriliable bit and fils the jug to the brim everytime
@@rubenjanssen1672
1: This comment thread is 3 years old, you are lucky to even get a reply from me (as i just watched the video today)
2: Fill the 3 gallon, poor into the 5 gallon; the 5 gal only has space for 2 gal more. fill the 3 gal again and poor into the 5 gal until full, that means you poor exactly 2 gal out of the 3 gal, so your left with exactly 1 gal in the 3 gal container. Empty the 5 gal and put the 1 gal of water in it, now that the 3 gal is empty, you can get 3 gal and add it to the 1 gal of water in the 5 gal, and you have the 4 gallons of water exactly
3: The video even talks about this and shows a visual at 8:10
That's the one I first came up with too
One thing you haven't mentioned is that the "rebound" of the red line isn't predetermined; once you hit the border, you can (as in reality) choose the direction among the ones available (and as you explained, every direction represent a specific action, fill or empty one of the jugs, or transfer between the jugs).
I was thinking about this because the fact that the plane is skewed seemed to be functional to the rebound, but in the end it's only an aesthetic choice - I imagine determined by the fact that the other diagonal direction (North-East) wouldn'r represent any meaningful action in a non-skewed plane.
You're right!
Damn, nice observation!
Yes, for 2 jars, there are at max 2 interesting directions. Since a rebound requires 1 incoming direction and 1 outgoing direction; the rebound is predetermined.
But for n>=3 jars, you can have n(n+1)/2) interesting directions... so there choice comes into play and you the rebound isn't predetermined.
Asking for 4 was actually genious in the original film as you would not have to consider the weight difference of the two containers. If Simon asked for 3 or less there would have been two different weight possible and the bomb would still have a 50/50 chance to explode still with the correct answer.
Two jugs of different capacities could still weigh the same. 😛
Maybe the masses of the jugs were negligible.
For the DH25 puzzle, Simon might have provided one of the jugs with a specified amount initially. This toughens the puzzle as BW can no longer experiment. Once the initial "pre-loaded" jug has been added to or subtracted from, the initial conditions cannot be replicated. The entire puzzle must be solved in their heads (or on paper if any is available) before pouring into or from the pre-loaded jug.
By choosing a jug and initial (partial) amount, the graph can be initialized at any point on the edge. By providing an initial (partial) amount in both jugs, the graph can be started from any interior point as well.
Maybe, for example, he had 2 gal. in one (and only one)? For this to work, in gallons it would just need to be one under a multiple of 3 (because the desired volume is too and the GCF of the container sizes is 3)
Fill the 5 gallon bucket, then use it to fill the 3 gallon bucket, which would leave 2 gallons of water in the 5 gallon bucket. Mark the water level of the 5 gallon bucket with a marker. Dump the 3 gallon bucket out and pout the leftover 2 gallons from the 5 gallon bucket into the 3 gallon bucket. Fill the 5 gallon bucket to the line that you marked it with, then pour the contents of the 3 gallon bucket back into the 5 gallon bucket. Total = 4 gallons. Took me less than 30 seconds to think of, but it would take more than 30 seconds to execute.
+ByRecentDesign yeah because everybody ever has a marker handy at times like those
"How not to Die Hard with Math"
Simple answer: use the metric system.
Hu Go - Considering the core math problem here is unit-less - it could just as easily be “fill a jug to 4 liters given a 3 & 5 liter jug” - your reply makes zero sense and comes off as pretentious rather than humorous _(humor needs to play off of reality; you're just combining uncorrelated things)_ .
And people wonder why the USA uses different standards of measurements- whenever a non-US-citizen tries to convince us to use Metric, their argument is illogical, non-sensical, and snide! No thank you.
In reality, the US is already a dual-measurement country. Metric is used almost universally in sciences, US Customary Units are used more frequently for casual day-to-day measurements, and mechanical/technical fields use either- every hardware store has both US & Metric nuts, screws, bolts; nearly every ruler has both US & Metric measurements, and so on. I won't go into the benefits of the US system here - mainly, how the units are sized to be human-relative rather than atomic-relative and how that makes them less cumbersome for everyday use - but there's clearly benefits to both systems, and we use both.
@@PeteBobGee America's customary measure has drifted significantly from Imperial. A close examination of the history of the Pint is most illustrative en.wikipedia.org/wiki/Pint
@@CapnSlipp imperial is just illogical, in the metric system you basically have a standard unit. size is m, weight is g, and so on.
we use si-prefixes (Powers of ten), instead of things like: 1foot = 12 inches.
If you want to convert from inches to foot you will be very likely less accurate compared to dm to cm for example.
I just use whatever units that I am given and treat them like variables throughout my calculations, then I do all the unit conversion crap at the very end. =P
@@CapnSlipp in metric, if a unit is not "human sized" you can just use a multiple (as it's done with g->kg) and its not true that imperial (customary) system units are in general more "human sized", for example litres fit better everyday liquid (milk, water...) needs of a human being than gallons. So the only advantage of the consumary system is that people in the US are already habituated to it. There's literally no other advantage.
Fill the 3 gallon jug (J3) and pour it into the five (J5). Then do it again. You now have 1 gallon left in J3. Empty J5 and pour the one gallon in from J3. Now fill J3 again and pour it in on top - 4 gallons! Thank you, I'm here all week.
Edit: then I watched the rest. Oh well. :)
@Mathologer - you NEED to make an extension of this to explain graph search.
I'm a computer science engineer and this can be generalized to a graph search problem and we can use different types of graph search traversals (like BFS/DFS/A* search) to get to a solution from any state to any other state in the most minimal number of moves. The same can be extended to solving Rubik's cube and so on. With A*, you need to create a mathematical heuristic which helps you get to the answer faster.
Thx for the explanation. What's the name of the "billard-table"-thing in terms of math? Never seen it, but looks interesting.
1:40 fill 5 gallon(leaving 2 gallons) pour into 3 gallon. DISCARD 3 gallons.
pour remaining from 5 gal into 3 gallon refil 5 gallon.
finish filling 3 gallons (currently holds 2 gallons, 2+1=3) with 5 gallon jug.
5 gallon jug now contains 4 gallons 5-1=4
thanks, i was always thinking how they've done it cause i came up with a different solution that works as well.
fill 3 gallon bottle and pour all in 5 gallon bottle. then again fill 3 gallon bottle and fill the rest of the 5 gallon from the 3 gallon bottle. then you will have 1 gallon remaining in the 3 gallon bottle. pour the 5 gallon bottle out and fill that remaining 1 gallon in the empty 5 gallon bottle. the fill the 3 gallon bottle and pour all in the 5 gallon bottle. and then you have it. :-)
There are multiple solutions...
Now I'm prepared for the next time a villain has me opening an armed bomb and tells me weigh 4 gallons of water with 5 and 3 gallon bottles
That's great :)
If you have a third jar, I think this table can work in 3 dimensions (looks like an oblique parallelepiped)
But how would the ball bouncing analogy work? At every point you'll have 2 different routes to go instead of just one.
How would you make out a 5 of container sizes 6, 8 and 15?
The analogy could still work -- you just need to imagine you're bouncing off of a 3-d space's walls, rather than a 2-d plane's walls. You can in fact have an indefinite amount of jugs, and the basic principle remains unchanged.
You'd just forget the 6-gallon container and do it with the 8 and the 15, seeing as they're coprime.
Yes, as long as you have two co-prime containers, you can ignore the rest. But if you fear it will take a long time to reach your target, then using more containers would be beneficial.
With 2 jars, there are at max 3 possible actions at any point in the process: 1) Completely fill/empty the first jar, 2) Completely fill/empty the second jar, 3) Completely transfer contents from first to second / second to first jars. That's why Mathologer uses 3 axes in his diagram, to represent the 3 different possible routes.
Each action must necessarily either completely deplete (0) the donating body or completely fill (3 or 5) the receiving body or both. Technically, we always start from (0.0); in the first solution, he moved to (5,0) and in the second solution he moved to (0,3) in his first step.
In either case, starting from the boundary, we can only move to another point on the boundary and so on. Though we always have 3 options, completely filling/emptying one of the jars would move us to a corner point; which can easily be reached without this complication. So there's actually only 2 interesting directions.
By constructing the axes to be 60 deg to each other, he can compare the trajectory of a solution to the bouncing of a billiard ball off walls.
With n jars, you'll have at max (n+nC2) routes. So moving from boundary point to boundary point (meaning at least one the jars is either completely empty of completely filled), you can have at max all these n(n+1)/2 routes as interesting when n>=3.
For 3 jars, that means 6 interesting directions from a point. Mathologer was able to use the bouncing analogy for 2 jars since there were at max 2 interesting directions; and bouncing requires 1 incoming direction, 1 outgoing direction, and 0 other interesting directions.
You can still use the bouncing algorithm for higher dimensional space; but a single run wouldn't be able to yield the complete solution space. Because for at least one of the points in the trajectory, you'll have multiple directions in which to bounce off.
wow this is really the best explaination I found online, thank you!
Given N jugs, is there an analogous N-dimensional graph that tells you the solution(s) or does that introduce a >1 branching factor making it a harder problem?
Would this also work with three bottles? i,e in 3D inside a parallelepiped. It's quite hard to visualise but i have a feeling it would. the volume of water in the third bottle would be represented on the y axis and the reflection off of a boundary would be in the plane which is defined by normal of the boundary and the incident.
Also if you have n bottles with volumes equal to the first n primes, does that mean there would be a solution for any volume less than or equal to n?
Good idea! There are a number of restrictions on how the ball can bounce around in the parallelepiped imposed by what is physically possible/we can control. In particular, movements have to always correspond to us pouring water from just one jug into one of the other jugs or filling or emptying one of the jugs. (You can pour water from or into two jugs simultaneously, but to be sure about the resulting amount of water in the different jugs you have to be able to replace the simultaneous action by one or two of these "single" actions.) Anyway, what this says is that meaningful movements of the ball should be parallel to the faces of the parallelepiped. At this point it's probably a good idea to have a look at an example.
Say you have a 3-gallon jug, a 4-gallon jug, and a 5-gallon jug. Then you can think of the faces of the parallelepiped as billiards tables of dimensions 3-4, 3-5, and 4-5 on which the ball can move around as usual. There are some more parallel copies of these different billiards tables hidden inside the solid on which the billiard ball can move around, but to get a sense of what is possible with this approach it probably helps to just ponder the ball bouncing around on the tables that make up the surface. Have fun!
The answer to your question is `Yes'. In fact, you only need two of your jugs to make all the numbers you are after: the largest one of the jugs and any of the other ones. If you use all the jugs you can make all integer volumes from 0 up to the sum of the first n primes.
Mathologer Ahh, I understand. If you're moving in all dimension it would be simulating both possibilities for an "empty A into " action. Depending on the volume, one jug would fill (collide) first so the coordinate of the collision would contain the partial solution for the other possibility. Only traveling on the faces would remove that problem. Sounds like a good task for a future assignment 1 :D
p.s I know you hate emails so i'll ask here instead. What time/day will you be in your office next? I need to collect assignments
Mathologer If you think about it, it is only possibly for the ball to move along the surfaces of this 3D shape. Meaning that all points where the ball bounces on the edges it is point on both surfaces that touch that edge.
Guys, if you have found this, give the comment a like so that everyone else can see
Nice videos, but I've got a side question: how can you precisely point in the white background elements which are added later in post-production?
psionic0 We project a faint image of the slideshow on a white wall and then match up the slides in post production.
Mathologer That works great, thanks for explanation!
I would really be interested in the visualisation of a harder version of this problem: a 3 dimensional version (3 water containers). Obviously a lot harder, since you can choose one of two paths after hitting every edge, but that just makes it more interesting.
@Mathologer
Why 60 degrees? Where did that come from?
It's just a coordinate system as he explains. The shear only makes it easier to visualize the reflective property.
You always have to go to the end of a line and you start in the bottom left.
You either can:
-go to a corner (all empty or filled)[useless]
-go back where you came from
[useless]
Or
-go the unknown way (reflect)
In the beginning you start from a corner (fill the right containers to get the shortest solution) and then reflect of the wall otherwise it's counterproductive...
This has to be my favorite maths problem in Hollywood. Subscribed :D
You can fill the small one, pour it into the big one twice until you have 1 gal left, empty the big one, and pour the 1 gal and a 3 gal into it.
You can approach 5 from a 6x3:
Empty x & y. Fill x to 6. Fill y ~1/3 full from x so x~5 & label the levels x="5?" & y="1?". Empty y. Fill y to 3 from x so x~2 & label the level "2?". Empty x into y, refill x to "2?", empty y into x & label the doubled level "2*2?".
Fill y to "1?". Empty y into x so x~1. Fill y to 3. Empty y into x so x~4. If below "2*2?", "5?">5. If above "2*2?", "5?"
In the game Rusty Lake: The Hotel, there is a mini-game in Mr Deer's room which is similar, but with three flasks: 10 dL, 5 dL, and 6 dL. And the goal is to get 8 dL. But there is the added condition that you have exactly 11 dL to work with. This means that you are working within the triangle a+b+c = 11, which turns this 3D puzzle into a 2D puzzle, and you can solve it like above.
You have to take some slices off the triangle, to account for the sizes of the flasks. Each corner of the triangle is where there would be 11 in one, and 0 in the other two. So from the Ten corner, slice off a 1by1by1 triangle, from the Five corner, slice off a 6by6by6, and from the Six corner, slice off a 5by5by5. So you're left with a pentagon with corners (10,0,1), (10,1,0), (6,5,0), (0,5,6), (5,0,6). It starts you off on the point (5,0,6). And so you can solve it in the same method as above!
(5,0,6)__________(10,0,1)
/ \
/ /(10,1,0)
/ /
/ /
/___________/
(0,5,6) (6,5,0)
Also nice. Maybe also have a look at this page www.cut-the-knot.org/ctk/Water.shtml :)
He doesn't have hairs, I have it 😂
But he has brain, I don't have it 🤐
How do you see where you have to point? Your hand is behind the graphics and you don't look at the camera or something like that. Is there a transparent screen and you somehow photoshop the frame out? Or is it a hologram? Or do you set the graphics in editing depending on where you pointed in the video?
Amazing video !
I discovered this type of puzzle when I was young (a long, long time ago) in a book about Sam Loyd's puzzle.
If I remember correctly, he used sometimes a third jug and the diagramm was truncated, but I forgot the details.
Do you know ?
Just fantastic!
Thank you for this technique!! Could this “billiard method of coordinates” also be applied to something e.g. like
“the TOWERS OF HANOI?" Perhaps I might assign a numerical value each ring and treat them like
water jugs → coordinates?
Idk...I'm speculating; my best game is 120moves and 63 is optimal, (so I could use a boost!! LOL.) Thank again for this.
There's a very simple and optimal mathematical solution to Towers of Hanoi. Check this video by 3Blue1Brown ruclips.net/video/2SUvWfNJSsM/видео.html
Unfortunately, after having watched the video, the game is 100% solved and there's no point in playing anymore.
@@the-coding-fox huh i found that when i was like 10
Amazing... Such elegant diagramatic explanation
Is there a reason that you didn't make the "state grid" rectangular? Having the filling and emptying horizontal en vertical respectively and diagonal lines (i.e. x + y = C) meaning pouring from one into the other would seem more clear to me... is it because of the bouncing of the "billiard ball" at proper angles? For me that just complicated matters. Anyway thanks for a great video and insight into this problem!
In general, you can only achieve volumes that can be expressed by mA + nB, where m and n are integers and A and B are the capacity of the containers.
In the first case, A = 5 and B = 3, so since you can express 4 as 2*5 - 2*3 (or 3*3 - 1*5), this means that 4 gallons is achievable. 7 gallons is also achievable, since 7 = 2*5 - 1*3 or 4*3 - 1*5.
In the second case, A = 15 and B = 6, thus the expression is m*15 + n*6, Since m*15 + n*6 = 3*(m*5 + n*2), no matter what we have inside the parenthesis, the result will always be a multiple of 3. So, we can achieve only multiples of 3 (gallons).
Congratulations for your videos. You got a new inscription (from Brazil).
+Paulo Bouhid Glad you like our videos and thank you for saying so. You are absolutely right! I once wrote up a little bit of an analysis of what is and what is not possible with the billiards ball method along the lines you are suggesting (for a fun maths course that I am teaching at Monash uni). If you are interested I put it here for you: www.qedcat.com/billiards1.pdf
+Mathologer I thank you... we all learn something new with your videos, even about subjects we already know. Ans tk you for the link... I´ll take a look. Greetings from Brazil.
All under control then. Greetings from Melbourne :)
A) fill 5/5 then pour from it until 3/3 -> we get 2/5, empty 0/3, fill with remainder -> 2/3. fill again 5/5, pour from it until 3/3 -> remainder is 4/5 = win. work: fills: 2 pours:3 empties:1
B) fill 3/3, pour over -> 3/5. fill again 3/3, pour from it until 5/5 -> remainder 1/3. empty 0/5, pour from other so 1/5. add another 3/3 and pour it over -> 4/5 = also win. work: fills: 3 pours:4 empties:1
good vid. you reference all thet hings i like, math, simpsons, futurama, die hard... since i saw the movie i already thought about that a long time ago. 2 solutions come to mind, but i would say its physically impossible, since in 30 filling the jug and being carefully at the same time so you dont splash a little seems impossible for the process required. even with haste... think about it, you probably take around 10 secs to fill your a waterboiler...
anway i liked it in the movie and i like it now :D riddles!
:)
Awesome demonstration!
I like your disclaimer above Mathologer!
Thank you for posting this... good work!
Actually, you start at (0,0) (the two empty jugs) then proceed to (5,0). Also you might want to explain why you must start in a corner (each jug must be fully empty or fully filled). How do you extend the method to N jugs?
The German accent makes you the villain...
We love Germans, honestly...
especially hitler ❤️❤️
@@youcantspellslaughterwitho4353 Hitler was Austrian.
@@angrytedtalks austria wasnt a thing
@@youcantspellslaughterwitho4353 Germany was founded in 1871. Austria was left over from the part of Bavaria Germany didn't get.
There have been 5 famous Austrians: Mozart, Straus, Freud, Swartzenegger and Hitler.
@@angrytedtalks I'd probably add Hundertwasser to the list. And Haydn. Schrödinger. Wittgenstein … Niki Lauda is also quite well-known. And think about royalty … Marie Antoinette was Austrian. But I have to admit they might not be the first one thinks about. Theyʼre famous people, though.
Excellent work man!!! I like the way you bring mathematical problems on the table.... 1000👍
Great channel! Thanks for doing this!
Never thought I’d see Mathologer do a Christmas episode… and to think they already had one, many years before I’d even heard their name!
@2:15 "I think anybody who actually thinks about this a little bit will come up with this solution"
I thought first of another solution where mostly the 3-gal jug is moved (which is easier):
Fill 3-gal jug and pour all the water into 5-gal jug.
Fill 3-gal jug again and pour water into 5-gal jug until full. Then 1 gallon is left in 3-gal jug.
Pour out 5-gal jug (only one move with this jug) and fill the 1 gallon into 5-gal jug.
Fill 3-gal jug and pour all the water into 5-gal. Now, there are 4 gallons in the 5-gal jug.
The second solution @8:10 is well visible in the diagram. Well done.
At the end, it seems like we can prepare any volume in full gallons if and only of the two volumes in gallons do NOT share a common divisor larger than 1. If they share a divisor larger than 1, like 2 or 3, then we can make prepare only volumes of multiple of that common divisor in gallons. Nice diagram.
I started watching your first Simpsons math video yesterday evening and now I'm here and somehow it's a new day and already getting dark again outside... :-o
Great explanation ... does the same thing work if you have 3 jugs and make a 3-D billiard table?
This was beautiful! 🌞
You may also think of this as a regular Cartesian coordinate grid with the diagonals being lines of the form x + y = n where n is an integer. So (x,y) are your amounts in the jugs and since you can only start with one jug full, the solutions must always be integers. n is how much water you have total. The verticals and horizontals are just the actions of entirely filling an empty jug or emptying a jug that is already full.
Yep, that works, too :)
I could barely even understand the problem when I first saw this movie as a little kid, and I left the movie still not getting what had happened. Flash forward to my present day 17 year old self, and I figured it out in the 30 seconds allotted. Decade younger me would be proud.
Robert Cohn what kind of seven year old is watching die hard 2?
A cool one
Mitch Harris I don't know, but this was Die Hard 3.
In the case of any quantity of liquid that is less than or equal to 3, the choice of which container you will use becomes relevant. With greater than 3 gallons and less than or equal to 5 gallons it is implied that you must use the larger container, and thus you would expect the weight of the container itself + that many gallons would be what the scale is tuned to measure. With less, using the wrong container would lead to your death because weight of the containers themselves also contributes to the weight. If it is tuned to weigh, for example, 2 gallons in the smaller container but you used 2 gallons in the larger container, boom. If it is tuned to 2 gallons in the larger container and you used 2 gallons in the smaller container, boom. There is only a clear choice for the higher range of values, unless you pretend that the containers weigh less than an ounce, as that's the tolerance that was communicated. Per google, an empty 5 gallon jug weighs about 12oz and a 3 gallon weighs about 8oz. Oddly, in the clip he also states to put the 4 gallons in "one of the containers" implying either one would work. That would only make sense if there were two different valid ranges of weights that would be accepted by the scale.
The area actually stays the same, well worth doing the math :)
The fountain has a steady flow rate and looks like it might be fast enough to fill in 30 seconds.
As an alternative but risky method, count how long to fill the 3 gallon container (x seconds) and use the formula x + x/3 to fill the 5 gallon container to 4 gallons.
I think I came with a different solution: fill the small jug full and pour it in the bigger one, then fill again the small one and start pouring the water on the bigger until it's full, at this moment you have 5 gal in the big and 1 in the small. Then empty the bigger jug and pour 1 gal into the bigger one. then fill the small with 3 gal and pour it into the big for exactly 4 gal
.n/
but I'm not sure if irregularities in the jugs could prevent this to a tolerance of +-1 once as simon says
Dang! I just saw it's mentioned later in the video and comments XD
Yeah same here :-)
I always wondered how they came up with the solution in the movie, cause i had the same idea as you!
Great video and a marvellous way to show that Math is a way to think and not just do calculations. I had seen the video before but only now I'll comment a bit:
1) that 60° angle serves only has a way to make the billiards analogy work. Why that number? Will it only work for this angle? Was this ever physically built?
2) This question (how to get 4 gallons with a 3 and a 5 gallon jags) makes me think of the diophantine equation 5x + 3y = 4. Do you think this "method" could be similar to solving diophantine equations? Every time a jag is filled is a plus and every time it'emptied is a minus? This link with diophantine equations also explains why the last situation (a 6 jag and a 15 jag to get 5) isn't possible since all 3 have to be coprimes for an integer solution in an diophantine equation to exist. (it has been a while since I dealt with D.E.'s but it is an interesting question to dive again in them). Thanks for another great video. It would be more fun to explore this "jag-filling" problem with beer instead of water. Oktoberfest is near so it will be a great time to do this. ;) Prost.
Maybe have a look at this (ignore the first part): www.qedcat.com/misc/billiards.pdf :)
I paused and had some found another solution :) (don't know if it's in the rest of the video yet)
Fill the 3 gallon completely.
Empty it into the 5 gallon.
Fill the 3 gallon again.
Pour all of the available water into the 5 gallon. The 5 gallon only has space for 2 gallons so there will be 1 gallon remaining in the 3.
Pour all of the 5 gallon out into the fountain.
Pour the 1 gallon from the 3 gallon container into the 5 gallon.
Fill the 3 gallon again.
Pour the remaining into the 5 gallon. Problem solved!
Great minds think alike: I came up with the same procedure....
What if I had 3 tanks? Does this coordinate system extend accordingly?
Haha awesome guy, so German! First video of this channel I saw, and will subscribe
I worked out the second way, fill the 5l jug twice leaving 1l in the 3l jug. For the 15l jug you could poke a hole and time how long it takes to empty. Then calculate how long it would take for the relevant amount to drain, leaving the required amount. Given that you only have 30 seconds, perhaps you could cut the whole bottom off.
I guess I'm the only one who would notice things like the difference in the weight of the two containers would be more than an ounce, so if a variation of one ounce causes the bomb to go off, there's a chance you're getting blown up even if you manage to get the 2 gallons exactly (depending on which container he used when accounting for the weight. More importantly, mass production containers (which those clearly are), will never be "exactly 3 gallons" and "exactly 5 gallons". If you get a 3 gallon container, it is 3 gallons plus a certain amount of extra air space (and in this situation, you don't know that amount). For this to be in any way practical, you'd need bespoke containers, or at least have drawn on lines showing the fill levels (in which case you're going to run out of time trying to get them filled exactly to that point). So yeah, no matter what, short of blind luck, you're getting blown up.
Let a and b with a>b be the sizes of the jugs. When you pour water between them the total water quantity changes by one of +a, +b, -a, -b so the water quantity changes by +b or -b mod a. That means the quantities that can be obtained in the jug a are the elements of the subgroup generated by b in (Z_a, +), that is, all the multiples of gcd(a,b) ( mod a )
I've binge watched about half of your videos now and this one is my absolute favourite so far (which says a lot since all of them are amazing). I'd love it if you made another video about the "table" where you go more in depth into it. Maybe there are ones with different shapes that work with more than two bottles? Hexagons?
Great, glad you like this one so much :) I've been thinking about building a physical table whose sides are made from mirrors and such that two of these mirror (up and right) can be moved to make tables of different sizes. Then replacing the billiards ball by a laser beam would make for a nice analog computer for calculating the gcd of two integers.
Wow that is a GREAT IDEA, do it!!!!!!!!!!!! Please.
Mathologer Wow, you might not believe me but I had the same idea while watching the video. You just have to cover the piece of mirror with the desired result and you have your route. You might also need some smoke. Looking forward to this.
Great video. What projection technique did you use for your presentation? Is it a projector or a large monitor?
Understanding your solution was easy, actually figuring out how you came to that solution is leaving me stumped.
So is there some sort of requirement that amount of liquid each jug can hold is co-prime to the other one? (let's say jug 'm' and jug 'n')
And if so, are you guaranteed to be able make every amount from 1 to (m + n)?
The short answer is that make any multiple of the greatest common divisor of m and n (up to m+n) :)
From the thumbnail, I thought Bruce Willis was goona giva a math class
This is just great. Elegantly way to solve this problem graphically.
I am curious: is it theoretically possible to solve problem with one infinitely big bottle?(on one side "pool table" would run from 0 to ∞)? And why 60° degree angle. What would happen with different angle (is this analogous to evaporation or shrinking)?
This is very mind-blowing. I really enjoy your VDO. But I have one question.How do you come up with the idea of the table (From any theory behind it or something like that?)
Great video, awesome explanations.
Thanks !
This could actually sort of work as a real-life game.
I see a lot of potential there.
for 1 gallon you could fill the 3 and poor it into the 5, then do that again and you will have 1 gallon left for the scales. for 2 you just fill the five and poor into the 3
6:45, you know you could start at 0,3.
9:50, so left to right is filling or pouring jugs out. The diagonal lines is pouring water from one jug to the other.
10:50, oh, darn, I was part wrong. Ah well. But you know, if the graph wasn't canted, those would be virtical lines.
very late comment but how would you adapt this method if there are 3 gallons? Seems difficult to sketch that in 3 dimensions.
Mathologer you are the one to blame for my insomnia!
The state machine like approach is quite interesting... I also looked your hidden cube in simpsons video which also has a state machine approach. Really nice videos :)
This is an amazing method and understanding of the idea.
Thank you, Bruce!!! (since you look like him :) )