Can you outrun the angry ram?

The Riddler puzzle this week appears simple at first glance, but I promise you it’s not!

You, a hard-driving sheep farmer, are tucked into the southeast corner of your square, fenced-in sheep paddock. There are two gates equidistant from you: one at the southwest corner and one at the northeast corner. An angry, recalcitrant ram enters the paddock from the southwest gate and charges directly at you at a constant speed. You run — obviously! — at a constant speed along the eastern fence toward the northeast gate in an attempt to escape. The ram keeps charging, always directly at you.

How much faster than you does the ram have to run so that he catches you just as you reach the gate?

Here is a very simple solution by Hector Pefo. Minimal calculus required!
[Show Solution]

And here is my solution, which finds an equation for the path of the ram but requires knowledge of calculus and differential equations.
[Show Solution]

Pokémon Go Efficiency

This Riddler puzzle is about a topic near and dear to many hearts: Pokémon!

Your neighborhood park is full of Pokéstops — places where you can restock on Pokéballs to, yes, catch more Pokémon! You are at one of them right now and want to visit them all. The Pokéstops are located at points whose (x, y) coordinates are integers on a fixed coordinate system in the park.

For any given pair of Pokéstops in your park, it is possible to walk from one to the other along a path that always goes from one Pokéstop to another Pokéstop adjacent to it. (Two Pokéstops are considered adjacent if they are at points that are exactly 1 unit apart. For example, Pokéstops at (3, 4) and (4, 4) would be considered adjacent.)

You’re an ambitious and efficient Pokémon trainer, who is also a bit of a homebody: You wish to visit each Pokéstop and return to where you started, while traveling the shortest possible total distance. In this open park, it is possible to walk in a straight line from any point to any other point — you’re not confined to the coordinate system’s grid. It turns out that this is a really hard problem, so you seek an approximate solution.

If there are N Pokéstops in total, find the upper and lower bounds on the total length of the optimal walk. (Your objective is to find bounds whose ratio is as close to 1 as possible.)

Advanced extra credit: For solvers who prefer a numerical question with this theme, suppose that the Pokéstops are located at every point with coordinates (x, y), where x and y are relatively prime positive integers less than or equal to 1,000. Find upper and lower bounds for the length of the optimal walk, again seeking bounds whose ratio is as close to 1 as possible.

The problem of visiting a set of locations while minimizing total distance traveled is known as a Traveling Salesman Problem (TSP), and it is indeed a famous and notoriously difficult problem in computer science. That being said, bounding the solution to a particular TSP instance can be easy if we take advantage of its structure.

Here is my solution to the first part:
[Show Solution]

Here is my solution to the second part:
[Show Solution]

Should the grizzly eat the salmon?

This Riddler puzzle concerns a random process and sequential decision-making.

A grizzly bear stands in the shallows of a river during salmon spawning season. Precisely once every hour, a fish swims within its reach. The bear can either catch the fish and eat it, or let it swim past to safety. This grizzly is, as many grizzlies are, persnickety. It’ll only eat fish that are at least as big as every fish it ate before.

Each fish weighs some amount, randomly and uniformly distributed between 0 and 1 kilogram. (Each fish’s weight is independent of the others, and the skilled bear can tell how much each weighs just by looking at it.) The bear wants to maximize its intake of salmon, as measured in kilograms. Suppose the bear’s fishing expedition is two hours long. Under what circumstances should it eat the first fish within its reach? What if the expedition is three hours long?

Here is my solution:
[Show Solution]

The Traitorous Generals

This Riddler problem is a logic puzzle about liars and truth-tellers.

You are the emperor of Byzantium (lucky you!) and you have N generals working for you. You know that more than half of your generals are loyal, and the rest are traitors. You can ask any general about the loyalty of any other general: If the general you ask is loyal, he will answer correctly, but if he is a traitor he can answer however he likes. Your goal is to find one general you are absolutely certain is loyal while asking the fewest possible questions.

What is the minimum number of questions (in terms of N) that will guarantee a solution, and what strategy produces it?

There is a problem in cryptography known as the Byzantine Generals Problem, which has to do with achieving consensus in the presence of traitors that can sabotage communications. The Riddler problem above also involves liars and truth-tellers, but it’s a very different problem.

The following is adapted from a comment by Guy Moore. A similar solution that obtains the same final result was also found by Dmytro Taranovsky. Thank you both for your insights!

[Show Solution]

Stop the alien invasion!

Today’s puzzle is from The Riddler, and has to do with spherical geometry.

A guardian constantly patrols a spherical planet, protecting it from alien invaders that threaten its very existence. One fateful day, the sirens blare: A pair of hostile aliens have landed at two random locations on the surface of the planet. Each has one piece of a weapon that, if combined with the other piece, will destroy the planet instantly. The two aliens race to meet each other at their midpoint on the surface to assemble the weapon. The guardian, who begins at another random location on the surface, detects the landing positions of both intruders. If she reaches them before they meet, she can stop the attack.

The aliens move at the same speed as one another. What is the probability that the guardian saves the planet if her linear speed is 20 times that of the aliens’?

Here is my solution for the case of interest, where the guardian is faster than the intruders.
[Show Solution]

Here is a partial solution for the more complicated case where the guardian is slower than the intruders.
[Show Solution]

Random walk with endpoints

The Riddler post for today is about a bar game where you flip a coin and move forward or backward depending on the result. Here is the problem:

Consider a hot new bar game. It’s played with a coin, between you and a friend, on a number line stretching from negative infinity to positive infinity. (It’s a very, very long bar.) You are assigned a winning number, the negative integer -X, and your friend is assigned his own winning number, a positive integer, +Y. A marker is placed at zero on the number line. Then the coin is repeatedly flipped. Every time the coin lands heads, the marker is moved one integer in a positive direction. Every time the coin lands tails, the marker moves one integer in a negative direction. You win if the coin reaches -X first, while your friend wins if the coin reaches +Y first. (Winner keeps the coin.)

How long can you expect to sit, flipping a coin, at the bar? Put another way, what is the expected number of coin flips in a complete game?

Here is my solution:
[Show Solution]

and here is a much slicker solution, courtesy of Daniel Ross:
[Show Solution]

Cutting polygons in half

This Riddler puzzle is about cutting polygons in half. Here is the problem:

The archvillain Laser Larry threatens to imminently zap Riddler Headquarters (which, seen from above, is shaped like a regular pentagon with no courtyard or other funny business). He plans to do it with a high-powered, vertical planar ray that will slice the building exactly in half by area, as seen from above. The building is quickly evacuated, but not before in-house mathematicians move the most sensitive riddling equipment out of the places in the building that have an extra high risk of getting zapped.

Where are those places, and how much riskier are they than the safest spots? (It’s fine to describe those places qualitatively.)

Extra credit: Get quantitative! Seen from above, how many high-risk points are there? If there are infinitely many, what is their total area?

Here is my solution:
[Show Solution]

And here is a bonus interactive graphic showing the solution

How to beat Roger Federer at Wimbledon

This Riddler problem is about the game of tennis!

Your wish has been granted, and you get to play tennis against Roger Federer in his prime in the Wimbledon final. You have only a 1 percent chance to win each point, but Roger, sporting gentleman that he is, offers to let you name any score and begin the match at that point. (So, if you’ve entertained a fantasy of storming back after being down three match points in the fifth set, now’s the time to live it.) What score can you name that gives you the best chance to win, and what is your chance of winning the title?

A rough (and approximate) solution:
[Show Solution]

A more detailed (and exact) solution:
[Show Solution]

What if robots cut your pizza?

This Riddler puzzle is about random chords of a circle and the regions they describe.

At RoboPizza™, pies are cut by robots. When making each cut, a robot will randomly (and independently) pick two points on a pizza’s circumference, and then cut along the chord connecting them. If you order a pizza and specify that you want the robot to make exactly three cuts, what is the expected number of pieces your pie will have?

Here is a simple solution, which was pointed out to me in a comment to my original post.
[Show Solution]

The following solution is a bit more complicated, and computes the entire distribution rather than just its expected value.
[Show Solution]

If you’ve already read the solution above and you’re interested in the distribution of pieces for the general case, read on!
[Show Solution]

The puzzle of the picky eater

Today’s Riddler post is a neat problem about calculating areas.

Every morning, before heading to work, you make a sandwich for lunch using perfectly square bread. But you hate the crust. You hate the crust so much that you’ll only eat the portion of the sandwich that is closer to its center than to its edges so that you don’t run the risk of accidentally biting down on that charred, stiff perimeter. How much of the sandwich will you eat?

Extra credit: What if the bread were another shape — triangular, hexagonal, octagonal, etc.? What’s the most efficient bread shape for a crust-hater like you?

Here is my solution:
[Show Solution]