Welcome to The Riddler. Every week, I offer up problems related to the things we hold dear around here: math, logic and probability. Two puzzles are presented each week: the Riddler Express for those of you who want something bite-size and the Riddler Classic for those of you in the slow-puzzle movement. Submit a correct answer for either,1 and you may get a shoutout in next week’s column. If you need a hint or have a favorite puzzle collecting dust in your attic, find me on Twitter.
From Nick Harper comes a question of tempered temperatures:
On a warm, sunny day, Nick glanced at a thermometer, and noticed something quite interesting. When he toggled between the Fahrenheit and Celsius scales, the digits of the temperature — when rounded to the nearest degree — had switched. For example, this works for a temperature of 61 degrees Fahrenheit, which corresponds to a temperature of 16 degrees Celsius.
However, the temperature that day was not 61 degrees Fahrenheit. What was the temperature?
From Abijith Krishnan comes a game of coin flipping madness:
You have two fair coins, labeled A and B. When you flip coin A, you get 1 point if it comes up heads, but you lose 1 point if it comes up tails. Coin B is worth twice as much — when you flip coin B, you get 2 points if it comes up heads, but you lose 2 points if it comes up tails.
To play the game, you make a total of 100 flips. For each flip, you can choose either coin, and you know the outcomes of all the previous flips. In order to win, you must finish with a positive total score. In your eyes, finishing with 2 points is just as good as finishing with 200 points — any positive score is a win. (By the same token, finishing with 0 or −2 points is just as bad as finishing with −200 points.)
If you optimize your strategy, what percentage of games will you win? (Remember, one game consists of 100 coin flips.)
Extra credit: What if coin A isn’t fair (but coin B is still fair)? That is, if coin A comes up heads with probability p and you optimize your strategy, what percentage of games will you win?
Solution to last week’s Riddler Express
Congratulations to 👏 Steve Schaefer 👏 of Carlsbad, California, winner of last week’s Riddler Express.
Last week, you undertook an urban planning challenge in Riddler City, which was a large, circular metropolis, with countless square city blocks that each had a side length of 1 km. At the very center of the city was Riddler City Hall, whose many employees all walked to and from work, and their homes were evenly scattered across the city. The sidewalks they walked along had always been adjacent to the streets.
But recently, several employees requested that the sidewalks instead cut diagonally across the city blocks, connecting nearby street intersections. These were represented by the thicker blue lines in the diagram below, which showed a small section (some readers missed this!) of the city:
What fraction of City Hall employees would have had a shorter walk home (that is, to the street intersection nearest to their home) if the city replaced its traditional sidewalks with these diagonal sidewalks?
First off, many readers pointed out that for employees whose front doors were on a street and halfway down a block, these new sidewalks wouldn’t even get them to their front door. Indeed, last week’s puzzle was ambiguous about exactly how an employee would enter their home once they had reached their block. Because it was stated that Riddler City was very, very large, you could safely assume that virtually all of each employee’s commute was spent just trying to reach their block. They’d then get into their home some way or another.
Okay, back to the problem. Most solvers used a coordinate grid in thinking about their answer, where City Hall was located at the point (0, 0), and an employee’s home (i.e., the intersection nearest their home) was located at (x, y). Here, x represented how many blocks east of City Hall their home was located, and y represented the number of blocks north of City Hall. So if x was negative, then the employee lived west of City Hall; if y was negative, the employee lived south of City Hall.
Under the original system of sidewalks, the employee would have had to walk a total of |x| blocks east or west, and a total of |y| blocks north or south. (We took the absolute values of x and y so that the number of blocks walked would be positive — you can’t walk a negative number of blocks!)
But what about when the sidewalks were diagonal, as the puzzle stated? It helps to look at a specific point close to City Hall, like (5, 3), as illustrated in the diagram below.
There are several ways to travel from City Hall to the home at (5, 3) using the diagonal sidewalks, and one such way is shown in red. First, you’d walk northeast to the point (4, 4), a distance of 4√2, and from there you’d walk an additional √2 southeast to reach the point (5, 3). In general, to reach the point (x, y), the employee would have to walk a distance of |x+y|/√2 northeast (or southwest), and then a distance |x−y|/√2 southeast (or northwest).
So when was this new commute shorter than the original? As solver Kimberly Powell noted, the original sidewalks resulted in shorter commutes for homes closer to the x and y axes, while the diagonal sidewalks resulted in shorter commutes to homes closer the lines y = x and y = −x — that is, along lines that made 45 degree angles with the axes.
With a little trigonometry, solver Mike Strong found that Riddler City was precisely carved in half. That is to say, half the employees would have a shorter commute with the new sidewalks.
If you’re still not convinced, here’s an animation showing the original and diagonal sidewalk paths to each block. When it’s a shorter walk via the original sidewalks, the intersection is shown as a gray dot; when it’s faster via diagonal sidewalks, the intersection is a blue dot. Sure enough, the diagonal sidewalks resulted in a shorter commute for half the blocks.
So when it came to diagonal sidewalks, the employees were evenly split. No wonder the measure didn’t pass.
Solution to last week’s Riddler Classic
Congratulations to 👏 Mark Jackson 👏 of Rochester, New York, winner of last week’s Riddler Classic.
Moving beyond diagonal sidewalks, you were next asked to consider octagonal sidewalks (similar to those found in Barcelona), as shown in the diagram below.
If the city replaced its traditional sidewalks with these octagonal sidewalks, now what fraction of employees had a shorter walk home?
Once again, many readers pointed out that some front doors might be inaccessible via these new sidewalks, or even that entire homes might have been bulldozed to make way for these rhomboidal intersections! And once again, these concerns could be treated as negligible due to the vastness of Riddler City.
To solve this puzzle, it was helpful to have a bathroom floor with octagonal tiles.
If you didn’t have one of those, it was also helpful to start with a diagram of an employee who just happened to live very close to City Hall, which we said could be represented by the point (0, 0). For example, consider an employee who lived near the intersection (5, 3):
The red path represents this employee’s shortest path home. How long is it? Well, they started at (0, 0) in the lower left corner and first walked up toward (3, 3), represented by the black point. During this part of the trip, walking along the diagonal sidewalks shaved off some distance compared to the original sidewalks. For homes like this, where x and y were positive and x > y, the distance saved turned out to be 2yd(√2−1), where d was the length of the short diagonal segments on each block.
Upon reaching (3, 3), the path straightened out, heading due east toward home. But not exactly due east, thanks to the diagonal sidewalks at the intersections. During this part of the trip, the diagonals added some distance, since it would have been a straight line to home with the original sidewalks. Again, for homes where x and y were positive and x > y, the additional distance turns out to be (x−y)d(2−√2).
Thus, the problem became a balancing act: When did the distance saved exceed the distance gained? When this happened, an employee would prefer the octagonal sidewalks; otherwise, they’d prefer the original grid.
Combining these shortening and lengthening effects meant the octagonal sidewalks wouldn’t affect the commute when 2yd(√2−1) — the reduction in distance — equaled (x−y)d(2−√2) — the additional distance. After rearranging some equations (amazingly, the length of the diagonal segments of the sidewalk didn’t matter), these effects canceled out when y = (√2−1)x. Employees who lived above this line, and closer to the line y = x, preferred the octagonal sidewalks, while employees who lived below this line, and closer to the x intercept, preferred the original sidewalks.
But that was just for the case when x and y were both positive, and x > y — that is, below the line y = x. Similar results could be worked out for all the other cases (in all four quadrants). And for those of you who worked through the trigonometry of last week’s Riddler Express, you might have noticed that the Riddler Classic gave you the exact same result! That is, in the case of a very, very large Riddler City (as stated in the puzzle), half of the employees preferred octagonal sidewalks, while the other half preferred to keep the original sidewalks. This symmetry did not go unnoticed by Riddler Nation.
After all this analysis, it would appear that Riddler City is stuck in gridlock when it comes to sidewalk legislation.
Want more riddles?
Well, aren’t you lucky? There’s a whole book full of the best puzzles from this column and some never-before-seen head-scratchers. It’s called “The Riddler,” and it’s in stores now!
Want to submit a riddle?
Email Zach Wissner-Gross at firstname.lastname@example.org.