# Rapunzel and the Prince

This is a simple mathematical puzzle, which I decided to improve a bit one year after posting. Some of the answers below consider slightly different, but equivalent setting of the problem.

Rapunzel and the prince woke up next to each other and found themselves in surrounded by complete darkness.

“Where are we?” asked the prince.

“It seems that my evil stepmother has left us in the middle of the Room of Despair,” replied Rapunzel.

“I don’t like this name. What do you know about the room?” inquired the prince.

“I know that it is square-shaped, and one of its walls has a little door in the middle. In order to escape, we should leave through that door, but we must be careful. There are werewolves tied to each corner of the room, and if any of us gets in their reach, will be ripped apart.” explained Rapunzel.

“I don't hear any werewolves around. And if I meet one, I can always slay it with my sword.” said the prince.

“Werewolves are mysterious creatures - very silent, very quick, and very strong. I know they are here, they are waiting, and we can't defeat them.” replied Rapunzel.

“OK then, since we don’t have anything else to do, let’s just pick a random direction and hope for the best.” suggested the Prince.

“That’s too much of a risk,” opposed Rapunzel, "It is said that one out of three people who dashes blindly in one direction, gets ripped by a werewolf even before reaching the walls of the room. And I have a better idea anyway.”

What is the idea of Rapunzel?

Remark: The chains the werewolves are tied with have the same length.

• How long is their reach? If it's less than (wall length/2) it's trivial, if more it's impossible. – Deusovi Aug 28 '15 at 5:43
• It is trivial. If you want you can post it or let the non-mathematician give it a try:) – Puzzle Prime Aug 28 '15 at 5:50
• You really want to constrain solutions, otherwise this is going to be VTCed heavily. – Rohcana Aug 28 '15 at 5:58
• Added some constrains, I hope they clarify a bit the problem. – Puzzle Prime Aug 28 '15 at 6:06
• Suggestion Use this pic instead?? – Rohcana Aug 28 '15 at 6:39

If they know the room is rectangular and that they are in the center:

Start rolling the rope in a spiral (it should result in an "almost" circle). The circle will hit the walls first (before the corners). They just have to check if the door is there.

EVEN BETTER

F1 is tied to the rope. F2 holds the rope, while F1, starts running around in circles. At every rotation, F2 release a bit more rope, until F1, hits a wall (he should hit it in the center of the said wall). All it's left is for F1 to find the door (one more rotation), and F2 to follow the rope to the door.

• Doesn't work. You only know the minotaurs 'reach' is z/2 or smaller (or they'd attack eachother) but you do not know how small it is. Your spiral-circle would overlap with the quarter-circles with radius z/2 from the corners. – Tim Couwelier Aug 28 '15 at 6:29
• Yes, they know that. However, how do you manage to roll the rope so precisely? It is very dark and you can not even see it. – Puzzle Prime Aug 28 '15 at 6:32
• @dmg Well,if the reach would be at the upper limit based on the given data, escape would be impossible... We don't know if it is though. Assuming however the friends were brought in through said door, the margin has to be wide enough to let someone through. EDIT: question was edited to wall size / 6. Rendering this irrelevant. – Tim Couwelier Aug 28 '15 at 6:40
• Suggestion to elaborate on the answer: Room with side z, means the distance from center to corner = sqrt(2)/2 *z (=0.7071 z). Distance to wall is 0.5z, max reach of the minotaur is z/6. (= 0.1667z). Therefor you can now be certain you'll hit the wall (at 0.5z from center ) before the minotaur reaches you (0.7071z-0.1667z = 0.54z). So this answer relies very heavily on the later added limit to the reach. – Tim Couwelier Aug 28 '15 at 6:47
• @ArturKirkoryan : Well, if the 1/6 was just a wild guess, you lucked out. one fifth would be cutting it really really close, one fourth would mean the method fails. – Tim Couwelier Aug 28 '15 at 8:47

If one stays at the centre, adjusting the rope as the other moves forward, the shortest distance allowing the latter to hit something will be half of a single side of the square. So if he only hits it 4 times while holding a given amount of the rope and turning it without hitting a minotaur, that means he's hit the door at least once. When he hits the door, the one moving does something like pull the rope thrice to alert the other, then adjusts the rope until the other catches up.

## Preamble

If you travel in a random direction, you will eventually hit a wall. We know $$\frac{1}{3}$$ people meet a werewolf before hitting the wall when travelling in one random direction, so $$\frac{2}{3}$$ survive and reach a wall. If $$w$$ is the distance from the middle of the square to the mid point of a wall, then we know that the length of the chains must be $$\frac{w}{3}$$.

The distance from the midpoint of the room to the midpoint of the wall is $$w$$. The distance to the corner where the werewolf is chained $$\sqrt{2\times w^2}$$.

We can easily verify that $$\frac{w}{3} + w \lt \sqrt{2\times w^2}$$ since $$\sqrt{2} \gt \frac{4}{3}$$. Thus, if you travel $$w$$ in any direction and walk in a circle around the centre, you will touch all four walls without finding a werewolf since none of the werewolves will be able to reach you.

Furthermore, if you have determined that the walls are at least $$r$$ away by inscribing a quarter circle of radius $$r$$, then you can safely try a circle of radius $$\left(\sqrt{2}-\frac{4}{3}\right) \times r$$ for your next quarter circle.

## Solution

Back to the problem at hand.

If the prince and Rapunzel are in the middle of the room, then can be reasonably sure by listening to the werewolves and their own echoes that the walls are at least 4 feet away. So, the prince will measure out 4 feet of hair (1.3 metres), and hold one end while Rapunzel holds the other. Then the prince walks in a circle looking for the wall while Rapunzel stays put. By not moving she can tell when he has gone a quarter of the way around and let out an additional 10cm of hair. When he has gone another quarter, she can let out 11cm. She will keep letting out increasing portions of hair (at a ratio of $$0.08:1$$, a safe amount since $$\sqrt{2}-\frac{4}{3}\gt 0.08088$$), and the prince will keep walking around in a circle keeping the hair taut. After 5 revolutions, they will be inscribing circles of almost 20 feet. After 10 revolutions, the circles will be over 80 feet and she will be adding over 6 feet per quarter turn.

Very quickly, he will find the wall near its midpoint and should be able to find the door by continuing in his direction of travel. Then Rapunzel joins him by following her hair and they escape!!

• That's right, thanks for providing a complete solution to the updated problem:) P.S. The length of the chains actually must be ~0.32x, but this doesn't change much. – Puzzle Prime Sep 29 '16 at 18:24
• @ArturKirkoryan Why .32x? If you survive 2/3 of the time, the chains must be 1/3 or 0.3333. – Trenin Sep 29 '16 at 18:26
• I also messed up the calculations, not 0.32x. Chance of 1/3 means that each werewolf is guarding the corner 30 degrees, and therefore the ratio is more like 0.3x. In any case, the distance from the center to each werewolf is about 1.1 times the distance to the mid-walls. – Puzzle Prime Sep 29 '16 at 19:27

Now, when I look at the picture the floor seems to be made of square tiles.
It is also said that they are in the middle of the room.
So, they just have to feel the floor for the crevices made by the stones on the floor(close to their position).
When they find two corners on the floor, they have to go in the direction facing the center of the two points to reach the center of one of the walls, Rapunzel rolling her hair down to mark the center of the room.
If that doesn't work, they just have to retrace their steps and start over again.

P.S. I am going on the assumption that there are crevices on the floor.