Hints for the Yellow Brick Road

Samuel J. Ferguson, a mathematics PhD student and friend of the Belin-Blank Center (check out his other posts here), made a video about how to solve a simplified version of a problem posed by the Yorkshire Post in 1976.  Now he’s offering a few hints as to how to solve this tricky problem.

It is a long journey, through a country that is sometimes pleasant and sometimes dark and terrible. . . . The road to the City of Emeralds is paved with yellow brick, so you cannot miss it.

—L. Frank Baum, The Wonderful Wizard of Oz

‘Pooh’, said the wizard, ‘is where we are now. The railway starts here and runs in a straight line via 39 intermediate and equally spaced stations to the terminus at Oz.

‘Unfortunately, the railwaymen are on strike, so you’ll have to go by bus. The bus goes along the Yellow Brick Road, which runs in a straight line from here to the outlying village of Bah, where it turns through a right-angle and goes in a straight line back to the first railway station after Pooh. From there it goes in a straight line to the next outlying village, where it turns through a right-angle and proceeds in a similar zig-zag fashion all the way to Oz, alternately calling at railway stations and outlying villages. Each of the 80 straight stretches of road is a different whole number of miles long. Rail distances are also whole numbers of miles.

‘The fare is one ozzle per mile, but you needn’t be alarmed, as all distances are as short as they can be.’

I was alarmed, and it turned out that I had good reason to be. My money was running short, for the Wizardry of Oz had been suffering from hyper- inflation lately.

Unfortunately the Wizard had vanished before I could ask him the vital question, how long is the yellow brick road?

—1976 Yorkshire Post Christmas problem of the Yellow Brick Road, reproduced courtesy of the Yorkshire Post

What if there’s only one intermediate rail station between Pooh and Oz, instead of 39? If you go to YouTube and search for “How long is the Yellow Brick Road?” you’ll see my video answering this. It has been viewed in more than a dozen states and in such countries as England, India, Germany, and Finland! Here is a drawing of my solution. How did I find it?

Pooh_Bah_Oz

The thing to notice, when there’s an intermediate station, is that the rail distance c between Pooh and the station is the same as the distance c between the station and Oz (I found that c = 25 is the smallest c that works). The rail distance from Pooh to Oz is now 2 × c. We let

a^2 + b^2 = c^2,

with a the distance from Pooh to Bah, and b that from Bah to the station (this relation between a, b, and c comes from the Pythagorean theorem). Moreover, with f the distance from the station to the next village, and g the distance from there to Oz, we have (since c is also the distance from the station to Oz)

f^2 + g^2 = c^2.

(We skipped a couple of letters, in case you like to use d for “distance” or e for “Euler’s number,” roughly two and a half.) Now we can write out our problem precisely.

Problem 1 (Yellow Brick Road with 1 station). What is the smallest positive whole number c (rail length) such that

a^2 + b^2 = c^2

and

f^2 + g^2 = c^2

for some positive whole numbers a, b, f, and g, all different? Having found c, what is the sum a + b + f + g (length of the Yellow Brick Road)?

The difficulty is that a, b, f , and g are all different. Otherwise, we could use c = 5 (because 3^2 + 4^2 = 5^2), taking a = f = 3 and b = g = 4, getting 3 + 4 + 3 + 4 = 14 miles for the length of the Yellow Brick Road. Since we actually need a\neq b, a\neq f, a\neq g, b\neq f, b\neq g , and f\neq g , it’s hard to see in advance how to solve this. The number c = 5 doesn’t work because, if we took a = 3 and b = 4, then the only positive whole numbers less than 5 left to use for f and g (which must be different) would be 1 and 2, and 1^2 + 2^2 is 5, not 52.

Since we can’t use c = 5, we have to use bigger numbers. Will 6 work for c? It turns out that 6^2 , like 1^2 through 4^2 , can’t be written as a sum of two squares at all (let alone two ways). We’ve gone from an uncommon property (being a sum of squares) to a property that’s genuinely rare (being a sum of squares two different ways). It’s hardly clear that there are any numbers with the latter property, but a calculator-aided search showed me that there are some. The smallest number which is a sum of two positive squares in two different ways is 50. Indeed, 50 = 2 × 25, so certainly 5^2 + 5^2 = 50 , and since 50 is one more than the square 49 (the square 7 × 7), we have 7^2 + 1^2 = 50 also. Nevertheless, we can’t get a suitable c from this, because there’s no whole number c with c^2 = 50 ; c = 7 is too small, c = 8 is too big, and there are no whole numbers in between.

There are so few squares (1, 4, 9, 16, 25, 36, 49, 64, 81, 100, . . . ) that perhaps the smart thing to do is to test them individually for the property we want (“sum-of-two-squares-two-different-waysness”). How do we test them? Grab a calculator and a square, such as 10^2 . If this number, 100, is a square then it’s of the form a^2 + b^2   for some positive a and b less than 10. So if, at some point, you subtract a square from 100 and obtain a square (like when you write 25 9 = 16), then you can write 100 as a sum of two squares (like when 9 + 16 = 25). Let’s do this for 100.

  • 100 81 = 19 (not on our list of squares);
  • 100 64 = 36 (success!), so 64 + 36 = 100, that is, 8^2 + 6^2 = 10^2 ;
  • 100 49 = 51 (not a square);
  • 100 36 = 64 (another winner!), so 6^2 + 8^2 = 10^2 ;
  • 100 25 = 75 (no luck);
  • 100 16 = 84 (nope);
  • 100 9 = 91 (nada);
  • 100 4 = 96 (still nothing);
  • 100 1 = 99 (no dice).

If you follow this procedure and never get a square from such subtractions, it must be because what you started with can’t be written as a sum of two squares at all. Let’s see this for 36. We successively subtract off each of the positive squares smaller than 36, looking for a square answer.

  • 36 25 = 11;
  • 36 16 = 20;
  • 36 9 = 27;
  • 36 4 = 32;
  • 36 1 = 35.

In no case did our procedure give us a way to write 36 as a sum of two squares. The only remaining possibility is that it must be impossible to write 6^2 as a sum of two squares, and our calculations prove this fact.

Returning to our problem, we ask if c = 10 (and the square 10^2 = 100 ) gives the answer. While 8^2+6^2 = 10^2 and 6^2+8^2 = 10^2 , these aren’t sufficiently different to finish the problem. While 8\neq 6 and 6\neq 8 , it’s not true that all four of the bases (8, 6, 6, and 8) are different.

Extending our list of squares (11^2 = 121, 12^2 = 144, and 13^2 = 169) and following our procedure (you’re invited to do this with a calculator), we find that neither 11 nor 12 can be written as a sum of two squares, while 169 - 144 = 25 shows that 12^2 + 5^2 = 13^2. Similarly, 5^2 + 12^2 = 13^2, which is a neat fact (the Egyptians knew it) but not different enough to solve our problem. Continuing on in this way, extending the list and calculating (the author didn’t go beyond 25), we achieve no success for would-be c’s, except for the bases 15, 20, and 25. In fact, 15^2 - 12^2 = 81 and 20^2 - 16^2 = 144, so

  • 9^2 + 12^2 = 15^2 and
  • 12^2 + 16^2 = 20^2; similarly,
  • 15^2 + 20^2 = 25^2,

as you can check with your calculator. This news isn’t much of a surprise, however, since we can get these more quickly by taking 3^2 + 4^2 = 5^2 and multiplying all of the bases by 3, 4, and 5, respectively. The bases 15 and 20 don’t solve our problem but, remarkably, right when we start our procedure for 25 we get

  • 25^2 - 24^2 = 49,

showing that 7^2 + 24^2 = 25^2. We see that taking a = 15, b = 20, f = 7, and g = 24 solves our problem. Our procedure shows that the number c = 25 is the smallest whose square can be written as a sum of two squares in two (completely) different ways. Thus, the length of the Yellow Brick Road, the sum of the lengths of the four straight stretches, is 15+20+7+24 = 66 miles, as you can check. Problem solved!

What about the original problem, where there are 39 stations? What is the smallest c such that c^2 is a sum of two positive squares in 40 different ways? We could start by looking at numbers like 5 and 13, whose squares can at least be written as a sum of two positive squares in one way, namely

  • 3^2 + 4^2 = 5^2 and
  • 5^2 + 12^2 = 13^2.

Using the “multiply the bases” trick, we can find c’s which can be written as sums of squares in more than one way. For example, mutiplying all of the bases in the first equation by 13 gives (since 3\times 13 = 39, 4\times 13 = 52, and 5\times 13 = 65) the equation

  • 39^2 + 52^2 = 65^2,

while multiplying all the bases in the second equation by $5$ gives

  • 25^2 + 60^2 = 65^2.

On the other hand, 65^2 = (5\times 13)\times (5\times 13) = 5^2\times 13^2, so, by both equations, 65^2 = (3^2 + 4^2)(5^2 + 12^2).
Then, by using the incredible pair of algebraic identities (from Wikipedia’s entry on the “Brahmagupta–Fibonacci identity”)

  • (a^2 + b^2)(c^2 + d^2) = (ac + bd)^2 + (ad - bc)^2 and
  • (b^2 + a^2)(d^2 + c^2) = (bd-ac)^2 + (bc + ad)^2, with a = 3, b = 4, c = 5, and d = 12,

we get

  • 65^2 = 63^2 + 16^2 and
  • 65^2 = 33^2 + 56.

It turns out that c = 65 solves the problem of the yellow brick road when there are 3 stations (8 stretches of road)! In that case, the length of the road is 39 + 52 + 25 + 60 + 63 + 16 + 33 + 56 = 344 miles. With the “multiply the bases” trick and the above two algebraic identities, you can really find a c, in fact the smallest such c, such that c^2 is a sum of positive squares in forty completely different ways—solving the original problem. As a final hint, if you get stuck, try applying what we’ve just done to the equations 15^2 + 8^2 = 17^2 and 21^2 + 20^2 = 29^2.

Leave a comment