Posts

The Monty-Hall-Problem at the breakfast table…

Recently, I was having a lovely Sunday breakfast with my even lovelier girlfriend Jessica and she was boiling some lovely eggs. She likes them a little bit more firm, so she boiled her for eight minutes. I had two runny eggs that have been boiled for six minutes. That’s sound like a pretty normal Sunday, right? That’s when our breakfast turned into a game show:

My girlfriend put, by accident, all three eggs in the same bowl with no way to distinguish between them. I, the game show host I am, had my girlfriend choose an egg and put it on her plate. Once she made her choice, I opened up one of the remaining eggs and of course, it was perfectly runny, just like the 6-minute egg I asked for. Then, I asked my girlfriend whether she wants to keep the egg she chose earlier or wants to switch to the egg that is still left. What should she do in order to get her hard-boiled egg?

That is a riddle that actually a lot of very smart people discussed about. This situation is very similar to the game show “Let’s make a deal” and the problem was first formulated by Steve Selvin. The procedure of the game show is somehow the following: A contestant is standing in front of three gates, one containing a prize and two containing a goat (or a Zonk in the German version, a red rat-like stuffed animal). Once the contestant chooses their gate, the host opens another gate containing a goat/Zonk and asks the contestant whether they want to switch their gate for the remaining gate. And the answer is (or at least should be) always yes.

The simplest explanation why one should always switch is, that when the contestant chooses their gate in the first round, they have a one in three (33%) chance of picking the prize. And that’s their chance of winning the game when they stick with it. However, when they are asked to switch gates, they only have two gates to choose from, so their chances of picking the right gate is 50%. So one should always switch when asked. Sounds counterintuitive? That’s because it is! And you’re not the only one to think so. World famous mathematician Paul Erdős didn’t believe it either until he saw numerical simulations.

But does our little Sunday-breakfast situation also follow the same logic? Let’s think about it.

At the start, my girlfriend chooses an egg. The chances that she picks her hardboiled egg is obviously 1/3. In that scenario, I have no other choice than to open one of my runny eggs. When I then ask her whether to change or not, she should obviously stay with her choice.

In the other scenario, the chances of her picking a runny egg is 2/3. After that I have a 50/50 chance of opening a hard boiled or runny egg. If I open her hard boiled egg, the game is over and she does not even get the chance to switch eggs. In the case I open one of my eggs, she ends up in a situation in which she should switch eggs. Both of these cases have a likelihood of 2/3 * 1/2 = 1/3.

Event tree for the breakfast problem. Jessica chooses an egg (green level) and then I open up an egg at random (red level), leaving Jessica in one of three scenarios.

So in total there are three potential situations for Jessica:

I.) With a chance of one in three she makes the right choice initially. In this case she should stay with her choice.

II.) With a chance of one in three she makes the wrong choice initially and I then open a soft egg. In this case she should stay.

III.) With a chance of one in three she makes the wrong choice initially and I then open her hard egg. In this case she does not have a choice at all.

We see that out of the two scenarios in which she is offered the option to switch, one time she should take it and one time she should not. And both of these scenarios are equally likely. But didn’t we just say that the candidate in “Let’s make a deal” should always switch? What did we miss?

The difference is that Monty Hall, the host of the game show and the reason this whole thing is called the “Monty Hall Problem”, always knows in which gate there is a goat and he uses that knowledge to never open a gate with a goat in it.

Transferring that to our breakfast situation, I would need to know which one of the eggs is the hard one. That way, I could always open up a soft egg in the second stage, which would have Jessica end up in situation I with a chance of 1/3 and in situation II with a chance of 2/3, but never in situation III.

Event tree for the case I know which egg is the hard boiled one. Now there is an elevated chance for Jessica to end up in scenario II and no chance to end up in scenario III.

So, the initial question of whether or not Jessica should switch her egg is basically a question of whether I know which egg is the hard one. If so, she should better switch. If not, it does not matter.

But if any of us would know which egg is the hard boiled one, we would not have even ended up in this situation, right?

3D Printed Labyrinth Boxes

I work in a really cool co-working space. Not only can you chat with peeps from other companies while grabbing a cup of coffee, but you can also freely explore all the fun stuff residing in our large communal space.  A whole cupboard full of NERF-guns, ping-pong and fusball tables, a VR flight simulator and last but certainly not least – a 3D printer. While the 3D printer is free for everyone to use, the filament belongs to different people in the office. A user must recover the cost of a coil and compensate a small amount for the filament being used in each print. And it was here when I was doing just that I had an idea!

On Thingiverse are several designs for labyrinth gift boxes available as download as *.stl. My idea was to create a similar box, but as a piggy bank for the filament compensation money. But as each coil of filament usually belongs to somebody else, those piggy banks of course also needed to have individual labyrinths.

By this point I knew I was already vastly overthinking it. Not only was the old “just put that money on whoevers desk that you used the filament from” approach working just fine, but also there was no need to make the piggy banks theft proof as no-one in our office would actually steal any money…especially not if that amounts rarely exceeds a dollar.

But by being German, I had a stereotype of over-engineering everything to live up to, so I started designing little boxes with customizable labyrinths on them.

On mazegenerator.net one can create random mazes and download them as *.svg for non-commercial use. This seemed like a good starting point to me. These SVG files contain only straight lines representing the walls of the labyrinth. These lines in a straight plane, let’s call it the \xi_1-\xi_2 plane with an aspect ratio of width_\xi/height_\xi, need to be mapped onto the cylindrical \Theta-z surface. With a given radius r of the cylinder, the corresponding height h of the cylinder should be set to h_c\,=\,2\,\pi\,r\,\frac{height_\xi}{width_\xi}, so the original labyrinth does not get stretched in either direction on the cylindrical surface. The mapping from the \xi_1-\xi_2 plane onto the cylinder surface can then be defined as

(1)   \begin{align*}\Theta\,&=\,2\,\pi\,\frac{\xi_1}{width_\xi} \\z\,&=\,\xi_2/height_\xi\,h_c\end{align*}

Having the coordinates on the cylinder plane, one can easily transform them to cartesian coordinates. A sweep along a line in the \xi_1-\xi_2 plane can so be mapped onto the cylinder surface and then into the three dimensional space.

As we do not only want to imprint the lines onto the cylinder, but also create walls, we additionally need to sweep a profile along those lines. Here, I chose a trapezoid profile with a lower width of Foot Width, an upper width of Head Width and a height of Profile Height. With some slight adjustments for the head and tail end of the sweep, those faces are then also slightly sloped like the sides. Once all those walls are created, one can just unite them with the original cylinder and use that body for further design.

Bare Cylinder with Labyrinth pathways on it. Screenshot from TinkerCAD.

The cylinder shape creator can be found here. Unfortunately, TinkerCAD limits the computational power one can use for shape generators, so bigger labyrinths are only possible with lower resolution or are not possible at all.

Cylinder used as part of a labyrinth secured piggy bank. Screenshot from TinkerCAD.

Having that cylinder, one can then build all kinds of items from it. The piggy bank mentioned earlier in this post can be found here. Feel free to use it for any non-commercial usecases!

Labyrinths and their SVGs that have been used for this post are obtained from mazegenerator.net and are free to use for non-commercial use. All pictures and models in this post are are subject to a Creative Commons Attribution-NonCommercial 4.0 International License.