## Thursday, January 7, 2016

### Lesson 13-8: Exterior Angles of Polygons (Day 79)

Lecture 5 of David Kung's Mind-Bending Math is called "Zeno's Paradoxes of Motion." In the title, Dave Kung refers to the ancient Greek mathematician Zeno of Elea, who lived about a century and a half before Euclid.

Zeno's Paradoxes are so well-known that it's easy to find links to them. The following link mentions the first two of them:

When Kung gives the story of Achilles and the tortoise, he doesn't give any specific numbers, but the above link does. We say that Achilles is running at 10 m/s (about the same speed as an Olympian sprinter like Usain Bolt) and the tortoise can only walk at 1 m/s. So how long does it take for Achilles to catch up to the tortoise? At first the answer may appear to be one second since that's how long it takes for Achilles to run 10 meters, but in that second, the tortoise has moved up one meter. And then Achilles can cover that meter in 0.1 second -- but by then, the tortoise has moved another 10 cm. And so on -- and that is Zeno's first paradox.

Kung points out that nowadays, we know that Zeno's reasoning is flawed. His Achilles' heel was that he didn't have the benefit of modern Calculus. We now know that the sum of infinitely many terms, such as 1 + 0.1 + 0.01 + ..., can be finite -- we call this an infinite series.

By the way, it's ironic (almost a paradox in itself) that in modern Calculus classes, students tend to make the opposite mistake from Zeno. Instead of believing that infinite series never converge, a common error is to assume that infinite series (those whose terms approach zero) always converge -- including the harmonic series 1 + 1/2 + 1/3 + 1/4 + 1/5 + .... Kung shows us a trick to show why the harmonic series diverges -- the first term is 1 and the second term is one-half. Then the next two terms, 1/3 + 1/4, add up to more than 1/2 (so we're past 2 so far), then the next four terms add up to more than 1/2 (so we're past 2.5), the the next eight terms add up to more than 1/2 (which gets up past 3), and so on. Each time the number of terms doubles, we add another 1/2. And since we can keep adding 1/2 until the cows come home, the series diverges, albeit very slowly.

But the paradox leads us right into today's Quick Conundrum. Kung tells us that it's possible to stack DVD's (and I notice that naturally he uses Great Courses DVD's) near the edge of the table in such a way that the top DVD is lying completely over the edge. It turns out that in physics, we can stack the second DVD 1/2 the length over the first. and then the third can stick out an additional 1/4 length above the second, and then the fourth can stick out an additional 1/6 the length, and so on. This means that the fifth DVD gives us an additional 1/8 length -- and as 1/2 + 1/4 + 1/6 + 1/8 exceeds 1, the fifth DVD is now completely over the edge. Indeed, since this is exactly half of the divergent harmonic series, we can extend the stack of DVD's an arbitrary length past the edge of the table -- but then every time we need an extra 1/4 length, we'd have to double the size of the stack -- so in practice we can't get very far past the edge. Still, it's interesting to see how the divergent harmonic series corresponds to something that we can demonstrate in the real world (and in the classroom).

We now consider Lesson 13-8 of the U of Chicago text. It is all about exterior angles of polygons -- and this naturally follows Lesson 13-7 on the exterior angles of triangles. This is what I wrote last year on this topic:

Lesson 13-8 of the U of Chicago text is on the Exterior Angles of Polygons -- not just triangles. This lesson is mostly straightforward. The way I like to introduce exterior angles is by showing a triangle, square, and pentagon with its exterior angles, and then imaging shrinking the polygon so that only the exterior angles remain. Then it becomes obvious that these angles add up to 360.

We notice that this lesson, just like Lesson 2-3, refers to computer programming. This time, the programming language is not BASIC, but Logo. Speaking of my generation once again, it's noted that elementary schools in the 1980's often taught Logo to us students.

Here's a link to a website that discusses the Logo programming language:

http://www.cs.berkeley.edu/~bh/v1ch10/turtle.html

As it turns out, Logo is a very sophisticated programming language. The author of the link above, Brian Harvey (another Berkeley professor, just like Dr. Wu), points out that Logo originally had nothing to do with turtle graphics:

"Historically, this idea that Logo is mainly turtle graphics is a mistake. As I mentioned at the beginning of Chapter 1, Logo's name comes from the Greek word for word, because Logo was first designed as a language in which to manipulate language: words and sentences. Still, turtle graphics has turned out to be a very powerful addition to Logo."

Indeed, here's a link to another page on Harvey's website. The author uses Logo to solve a common logic problem:

"You are at the side of a river. You have a three-liter pitcher and a seven-liter pitcher. The pitchers do not have markings to allow measuring smaller quantities. You need two liters of water. How can you measure two liters?"

http://www.cs.berkeley.edu/~bh/v1ch14/pour.html

Here are the programs given in the U of Chicago text. The first one draws a regular 18-gon:

TO REGGON
REPEAT 18 [FORWARD 7 RIGHT 20]
END

And the other draws a regular 180-gon -- which ends up looking more like a circle:

TO 180GON
REPEAT 180 [FORWARD 3 RIGHT 2]
END

Here's how Harvey writes a more complicated polygon program:

```to poly :size :angle
forward :size
right :angle
poly :size :angle
end```

```
```
`I decided to keep the Logo problems in my worksheet. Unfortunately, unlike BASIC, Logo isn't easy to convert into TI-BASIC. Logo is mentioned in this section because the angles mentions in the RIGHT commands are in fact exterior angles. If the students don't have access to Logo (Harvey discusses how one can download Berkeley logo on his webpage), one can change it to simple angle questions -- for example, my Question #3 becomes, "What is the exterior angle of a regular octagon?" (rather than draw one in Logo).`

So that is what I wrote last year. This year I decided to go back to the Berkeley Logo and show you some more interesting programs. One of my favorites is Tic-Tac-Toe:

https://www.cs.berkeley.edu/~bh/v1ch6/ttt.html

This set of procedures combines both list processing (for the strategy) and turtle graphics (to draw the X and O symbols). We can recognize most of the turtle graphic procedures:

```to drawx
pendown
repeat 4 [forward 25.5 back 25.5 right 90]
end```

This procedure obviously draws the X's. The only procedure with which we might be unfamiliar is the line setheading 45. Of course the 45 refers to 45 degrees. What this line does is tilt the turtle 45 degrees so that the symbol looks more like an X than like a + symbol.

Now that we've seen drawx, we may be curious to see what drawo looks like -- perhaps it's similar to the 180GON that we see in the U of Chicago text. Well, actually it isn't:

```to drawo
pendown
arc 360 18
end```

Of course, we can easily figure out what the line arc 360 18 does -- the 360 obviously means 360 degrees, and I think that 18 refers to the radius of the arc (in turtle units).

Most of the link above discusses Tic-Tac-Toe strategy and how to implement it. Harvey writes:

At the beginning of the discussion about strategy, I suggested that one possibility would be to make a complete list of all possible move sequences, with explicit next-move choices recorded for each. How many such sequences are there? If you write the program in a way that considers rotations of the board as equivalent, perhaps not very many. For example, if the computer moves first (in the center, of course) there are really only two responses the opponent can make: a corner or an edge. Any corner is equivalent to any other. From that point on, the entire sequence of the game can be forced by the computer, to a tie if the opponent played a corner, or to a win if the opponent played an edge. If the opponent moves first, there are three cases, center, corner, or edge. And so on.

Actually, the problem of Tic-Tac-Toe strategy has already been completely solved. The solution is given by the website xkcd, which describes itself as "A webcomic of romance, sarcasm, math [ha! -- dw], and language":

https://xkcd.com/832/

By the way, xkcd has created webcomics for several math topics. I was able to find two different webcomics involving Zeno's Paradoxes!

https://xkcd.com/1153/
https://xkcd.com/994/

Harvey goes on to write:

If you're tired of tic-tac-toe, another possibility would be to write a program that plays some other game according to a strategy. Don't start with checkers or chess! Many people have written programs in which the computer acts as dealer for a game of Blackjack; you could reverse the roles so that you deal the cards, and the computer tries to bet with a winning strategy. Another source of ideas is Martin Gardner, author of many books of mathematical games.
[emphasis mine]

What the -- here's yet another Martin Gardner reference! (And we're discussing Logo now, not anything to do with Kung's lectures!) Well, that just goes to show how popular Gardner and his math games column was!

Actually, before taking up Harvey's suggestion the challenge would be to implement xkcd's game strategy in Logo. Notice that xkcd's Tic-Tac-Toe strategy is in fact foolproof, in that if the computer were programmed to follow it, the computer will always either win or tie. So in the procedure:

```to ttt
local [me you position]
draw.board
init
if equalp :me "x [meplay 5]
forever [
if already.wonp :me [print [I win!] stop]
if tiedp [print [Tie game!] stop]
youplay getmove                         ;; ask person for move
if already.wonp :you [print [You win!] stop]
if tiedp [print [Tie game!] stop]
meplay pickmove make.triples            ;; compute program's move
]
end```

we can delete the line that says You win! (where "you" refers to you, the computer user) because that line can never be reached. In other words, you have about as much chance of beating xkcd's strategy as Achilles has of beating the tortoise ....

Oh, and speaking of Zeno, Kung wraps up the lecture by pointing out that scientists are now working on String Theory -- remember Stephen Hawking and his attempt to find a Theory of Everything? Now according to some versions of String Theory, there may exist a smallest unit of time (often called the Planck time). This would correspond to the "instant" that appears in some of Zeno's paradoxes. If a smallest time interval exist, Zeno would suddenly appear to be correct -- motion really is impossible!