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?

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

,

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)

.

(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*

*and*

*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 ), 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 , and , 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 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 , like through , 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 , and since 50 is one more than the square 49 (the square 7 × 7), we have also. Nevertheless, we can’t get a suitable c from this, because there’s no whole number c with ; 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 . If this number, 100, is a square then it’s of the form 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, ; - 100
*−*49 = 51 (not a square); - 100
*−*36 = 64 (another winner!), so ; - 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 as a sum of two squares, and our calculations prove this fact.

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

Extending our list of squares (, , and ) 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 shows that . Similarly, , 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, and , so

- and

- ; similarly,

- ,

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 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

- ,

showing that . We see that taking , , , and solves our problem. Our procedure shows that the number 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 miles, as you can check. Problem solved!

What about the original problem, where there are 39 stations? What is the smallest c such that 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

- and

- .

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 , , and ) the equation

- ,

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

- .

On the other hand, , so, by both equations,

Then, by using the incredible pair of algebraic identities (from Wikipedia’s entry on the “Brahmagupta–Fibonacci identity”)

- and

- , with , , , and ,

we get

- and

- .

It turns out that 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 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 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 and .