It was an unusually warm day, and Alice had taken the opportunity to walk to a field not far from her house. She had just prepared a tea party for a select few of her stuffed animals. They were finishing their tea, though she never actually saw them drinking. Alice was sitting on a comfortable patch of grass, chaperoning to make sure their napkins didn't blow away. She detected some motion out of the corner of her eye and got up to investigate. Alice hoped it wasn't her neighbors' dog. The last time she had had a tea party, he had nearly made off with her stuffed llama. Fortunately there was no dog this time. Instead she saw a group of small animals scampering by in a pink and yellow speckled flurry. Snatching up her stuffed animals, she chased after them. They led her around in circles a few times and finally stopped just near the picnic blanket where they disappeared down a surprisingly large hole.
Cautiously, Alice approached the hole. She knelt down beside it, leaned over, and peered in. It appeared to be a long tunnel, but she couldn't see how long it was or where it went because of the darkness. She stood up and inspected her dress to make sure it hadn't gotten dirty. Mother would throw a fit if it had. Another little yellow creature leaped from behind her and jumped down the hole. Startled, Alice jumped too, losing her grip on her favorite teddy bear. ``Oh no,'' she cried out, as she watched it fall down the hole. She thought for a moment. Then, she carefully wrapped up her other animals in the blanket and put them in the basket she had used to carry them to the field. ``I'll be back soon,'' she said, kissing them each once. ``Do not worry.'' And in another moment, down went Alice after her bear and the pink and yellow creatures, never once considering where the hole would lead her and how in the world she was to get out again.
The hole went straight on for some way. It was like being on a roller coaster or a slide. Alice held her skirt to keep it from blowing. She supposed she was going downward, though she really couldn't tell. ``I'm falling, so it must be downward,'' she rationalized. Down, down, down, with nothing but the whoosh of the wind. As she slid, she wondered if she would ever stop falling. She wondered how far she had traveled and where she was. She tried to calculate how far she must have fallen and how fast she was falling, but she found it difficult to remember her sister's physics lessons while falling. She found that fact to be rather inconvenient. ``What's the point of such learning,'' she thought ``if I can't use it when I might need it?''
She wondered if she would end up in the center of the earth. Or perhaps she would come out the other side. Or, even stranger still, she could return to where she started, only to find everything changed. Or maybe she would find everything the same but that she had changed. She thought she wouldn't like that very much at all, but then she wouldn't be herself anymore so maybe she would. And here Alice began to get rather sleepy, until suddenly she landed  thump  on a pile of yellow books, and the fall was over. There was nothing except for the books. Alice had fallen into a dark cave with cold stone walls. Elaborate torches lined the walls.
She was not a bit hurt, but she was slightly disoriented, and she thought she saw a yellow pig. Or, it is more accurate to say, she thought what she saw couldn't have possibly been a yellow pig even though she was certain that was what she was seeing. Things became still curiouser as she suddenly found herself singing under her breath a song she had never heard before.
Alice looked around for her teddy. On the ground beside her lay a thick blue velvet ribbon. This she recognized as the ribbon she had tied around the bear's neck. The bear was nowhere in sight. ``But what was that piglike animal?'' she asked herself. ``Perhaps it can help me find my bear.''
Alice ran off in the direction of the peculiar animal, but it seemed to get smaller and then it vanished before her eyes. She stopped running just before a wall which did not appear to be a wall at all. It was a mirror that reflected Alice and what was behind her, causing her to see an infinite tunnel of Alices. She thought it very strange that a pig had been there and was no longer, but as it wasn't much odder than seeing a yellow pig in the first place, she tried to dismiss it. It was, after all, a Thursday.
She looked to her left and right. On either side of her was a stone wall. There was no source of light, but somehow Alice was able to see. The corridor looked as though it were frequently traveled, as it didn't seem either dusty or lonely. She briefly considered asking it if it were lonely, but didn't for fear that the girl in front of her who looked just like her would think she was a ridiculous child, talking to hallways as though they could answer. ``That's silly,'' she said aloud. ``It's just my reflection, and it won't think anything of me talking to the hall.'' Sure enough, as she spoke, so did the other girl. She would have said more, but it occurred to her that someone might arrive, and then wouldn't she look even more ridiculous, talking to her own image!
Alice turned around and walked back down the corridor. All the way at the other end was a red door. Above it was a sign that read ``Enter'' and below it another sign that said ``Exit''. Poor Alice, knowing not whether to enter or exit, sat in front of the door considering her predicament for quite some time. At last she decided to open the door without either entering or exiting. ``After all, I'm only entering if I think I am going somewhere. And I'm only exiting if I think I'm leaving somewhere. But I don't know where I would go, and I don't know where I am, and I'm certainly not thinking very clearly at all today.'' And so she opened the door slowly and cautiously.
Alice had expected to find herself in another room, but instead she found herself outside. She must have been outside because there was sunlight. Unless she had been outside and in this strange land the sun was only inside. But that didn't seem right. Alice stepped out, or rather, through the door into one of the most magnificent meadows she had ever seen. Flowers dotted the grass as far as she could see. A bubbling creek wound its way through the flower beds. To one side was a grove of trees; above Alice was an expansive bright blue sky, a backdrop on which wispy white clouds had been painted. The aroma of the flowers was stronger than anything Alice thought she had smelled before, and though it was entirely pleasant, it made her dizzy.
Always drawn to water, Alice walked to the small pond which the creek had formed. The water was clear and it sparkled like liquid diamonds. She cupped her hands and dipped them in the pond and then drew the water to her mouth. The water was colder than she expected, but it felt good as the sun was quite warm. The water tasted clean, and immediately Alice felt refreshed. She lay down on a patch of flowers and dipped her long hair into the pond. Staring upward, she watched the clouds change shape. ``That one looks like a bunny,'' she thought, ``and that one a dragon.'' The odd shapes and their boundaries entertained her until she detected a slight motion out of the corner of her eye.
It was a yellow pig; she was now quite certain that it was a yellow pig, as it appeared to be both yellow and a pig. She called out to it, ``Hello, Pig.'' Startled, the Pig turned around and ran toward the trees. For the second time that day, Alice took off after him. She ran and ran through the green blur of trees. The trees were very thin, but they seemed to be laid out in a square grid as if to trap her, and as she ran through the spaces between the trunks, she had to be careful so as not to run into them. ``Running into trees would not be good,'' she thought to herself.
She was gaining on him. Suddenly he stopped and turned around. ``Do you know why I will be able to outrun you?'' he asked. Without waiting for an answer, he chortled, ``Because I am running irrationally!'' And with that, he resumed running.
``Wait,'' Alice called out after it. ``What do you mean?'' Again, he stopped and turned around. He stared at Alice for a very long moment. In this moment Alice was finally able to observe the mysterious pig. He looked like a normal pig, though perhaps he was a bit larger than most pigs. He had a yellow pencil tucked behind his right ear and a calculator tucked behind his left ear. He was a deep yellow in color, somewhere between a golden orange and the color of lemons, with some darker spots on his belly.
``Would you really like to know?'' he asked.
``Oh, yes, very muchly,'' replied Alice, who was intrigued by the talking pig and didn't want it to run off again. Surely this pig could help her find her bear and tell her how to return home. She had fallen such a long way.
And so the Pig bounded over to Alice and motioned for her to sit down. He proceeded to stand upright on his two hind legs, remove the pencil from behind his ear, and speak, in a manner that wasn't much different from preaching.
The Pig began: ``The trees in this forest are laid out in a most regular pattern, as I'm sure you have already noticed. Consider not the trees, but the center of each tree trunk. If you look at all of these points, they make up a rectangular lattice.''
``A rectangular lettuce?'' interrupted Alice.
``Not a lettuce, a lattice,'' responded the Yellow Pig. ``A rectangular lettuce would be unproductive, not to mention silly. A lattice is just a grid, like the corners of squares. Or, like the intersections of streets.'' And so saying, he picked up a stick and drew a series of evenly spaced parallel lines in the dirt. Then he drew more evenly spaced lines that intersected those at right angles. ``All of these points of intersection are lattice points.'' Indeed, an aerial view of the forest would have looked very much like a square grid of evenly spaced points.
``In a unit square lattice, points are separated by one unit from their horizontal and vertical neighbors. It doesn't matter what this one unit is, but it's the same distance.''
Again Alice interrupted, ``But those two points,'' she said pointing, ``are further apart than those two.''
``Let's call them Lorina and Edith,'' Alice suggested.
``Well, I was thinking of simpler names than that,'' the Pig explained. ``Let's call this point at the bottom (0,0). And that one just to the right of it (1,0), then (2,0), and so on. And the ones going up in the left column (0,0), (0,1), (0,2), ... . The first number in the pair refers to how far to the right the point is, and the second number refers to how far up it is. The two points you mentioned are (0,0) and (3,4). They are in both different rows and columns. You see how the naming works? The name of a point identifies its location.''
``But those are boring names. Lorina and Edith would be much better.''
``Perhaps, but my naming is more logical, because with numerical names, we can calculate the distance between any two points. The distance between (0,0) and (0,1) is 1. I have described the points using what are known as ordered pairs. The first number in both pairs is the same: 0. It is only the second number that has changed. To determine the distance between them, we need only to subtract 0 from 1. Similarly, the distance between (1,0) and (3,0) is 2. This time the second number in the pairs is the same so we subtract 1 from 3. Now do you understand? It would make no sense at all to subtract Lorina from Edith.''
``Yes, but you haven't attempted to subtract Lorina from Edith either,'' pointed out an indignant Alice, who didn't see why the Pig wouldn't take her naming suggestions. ``You picked two points that are in the same row or two points that are in the same column. Lorina and Edith aren't in the same row or column, so they wouldn't have either the first or second number in their pairs in common. How could you subtract them?''
``Well, it would be quite a bit more complicated to do,'' admitted the Pig, ``but I assure you I can. I want to explain a little bit about how I was running before I answer your question. There are all kinds of diagonals in this lattice. You pointed out one of them to me already. The diagonal through (0,0) and (1,1) goes through (2,2) and (3,3) and (n,n), for any n. There's another diagonal parallel to it that goes through (0,1), (1,2), (2,3), and so on. And there are diagonals perpendicular  that is, at a ninety degree angle  to these, such as the one that goes through (0,5), (1,4), and (2,3). Or the one through (3,4) and (4,3). I only need to specify two points to determine the line. That's a very important fact. I can refer to each line by an equation or just in terms of how steeply it slopes.''
``Oh, you are making my head hurt,'' said Alice. ``I feel as though I am in a math class with all of this talk about equations.'' Alice found math class to be confusing.
``Equations are just a way of expressing something, just as my pointpairs are a way of identifying points with two values, an x and a y. Pictures are another way of expressing concepts,'' he said, pausing to sketch some diagrams in his notebook. Alice watched as he drew a grid of points and labeled several lines. She was impressed at how well he could draw, being a pig and thus not having the advantage of a thumb.
``The y decreases by 1! So if I chose an entirely different two points, like your (0,0) and (1,3), then as the x increases by 1, the y increases by 3.'' Alice's head still hurt, but not as much anymore.
``Absolutely correct,'' praised the Pig, and Alice beamed. ``The slope in that case would be 3. Now maybe you'll see what slope has to do with running. I was running in a straight line with a certain slope. Only I couldn't run in a straight line with slope 1. Look at our graph. The line from my origin  that's the point (0,0) on the graph  with a slope of 1 intersects a point. That point represents a tree, and I certainly didn't want to run into a tree. I couldn't run in a straight line with a slope of 2 or 3 or 5 because I would eventually hit a tree then, too. Nor could I run in a line with a slope of ^{1}/_{2}. That is, whenever the x changes by 2, the y changes by 1. Slope is just the change in y divided by the change in x. Running at a slope of ^{1}/_{2} is not very different from running at a slope of 2, and so I would hit a tree in the same amount of time. Running at a slope of ^{3}/_{2} or ^{4}/_{3} isn't any better. Because if you look at lines starting from that bottom left corner with those slopes, they all intersect points.''
``I think so,'' said Alice, hoping that maybe the Pig would make more sense if he continued.
``Good, because here is the tricky part. I wanted to run in such a way that I would never hit a tree, but running at any slope ^{x}/_{y} would cause me to hit a tree. I didn't want to just run so I wouldn't hit a tree for a long long time, but so that I would never ever hit a tree. So I just picked a number that isn't ^{x}/_{y}. That way, I will never intersect one of those (x,y) treepoints,'' the Pig said, waving his pencil gloriously.
``A number that isn't ^{x}/_{y}?'' repeated Alice.
``There are a lot of numbers, surely you can't expect to be able to represent them all so easily.'' He paused and scratched his forehead. ``Oh dear, I have to explain to you about numbers. Well, think about a number line. And pay close attention because I have a lot of terms to define here. On a number line are integers, numbers like 17, 16, 15, 0, 1, 2, 3, and 1729, to name a few. The positive integers are all the ones greater than 0; that's 1, 2, 3, and so on. They are called the natural numbers or counting numbers. And between these natural numbers are fractions like ^{1}/_{2}, [1/ 17], [17/ 42]. These are called rational numbers because they express ratios between two integer numbers. Even if we draw all of these rational numbers on a line, we would still be missing most of the points on the line. Because in between the rational numbers, there are so many more nonrational numbers. The number line contains the rational and irrational numbers; that's all of the real numbers.''
``Please do explain. But first, tell me a few things,'' requested Alice, who was always full of questions. ``What are irrational numbers? What did you mean by there being more irrational numbers than rational ones? Have you seen a teddy bear? Are you a yellow pig? Oh,'' she said, remembering her manners, ``My name is Alice.''
``I am a yellow pig, and I'm pleased to meet you. Welcome to Mathland,'' said the Pig.
``Mathland?'' repeated Alice. ``Is that where I am?''
``It is,'' said the Pig, ``so we should do math. You asked about irrational numbers. Irrational numbers are simply those that aren't rational. It's hard to understand this without any examples, so if you wait a little while I'll tell you about the first irrational number to be discovered. It's also difficult to explain why there are more irrational numbers than rationals. It has to do with being able to list numbers. How many natural numbers are there? Remember, that's the numbers 1, 2, 3, ... .''
``A lot,'' said Alice. ``More than I could count even if I count for my entire life.''
``Right,'' the Yellow Pig said. ``But for mathematicians, that's not always precise enough. There are an infinite number of natural numbers. But this doesn't bother them, because they can still describe the natural numbers. That's because they are ordered. If you give me a natural number, any natural number, I can give you the next natural number by adding one to it. We can list all of the natural numbers: 1, 2, 3, ... , n, n+1, n+2, ... .''
``I see,'' said Alice.
``Now, here's where it starts to get tricky,'' warned the Pig. ``How many integers are there? Integers are all of the natural numbers, all of the natural numbers with negative signs in front of them, and zero.''
``Infinitely many,'' said Alice.
``Right,'' agreed the Pig. ``But compare that `infinitely many' with the number of natural numbers. Are there more integers than natural numbers? Less?''
``There must be more,'' concluded Alice, ``because all of the natural numbers are integers. There are twice as many integers as natural numbers because there are the negative numbers as well. And there's a zero, so that's even more than twice as many.''
``It seems so, doesn't it?'' the Pig replied. ``But think about that number zero. How much difference does one number make? You already have an infinite number of numbers. Why consider it at all? Isn't it enough to say you have twice as many integers as natural numbers?
``It seems so. One number is meaningless when compared with so many,'' Alice agreed.
``Then by the same logic,'' taunted the Pig, ``what difference does twice as many numbers make? Twice something infinite is just something infinite.''
``I guess so,'' said Alice. ``I hadn't thought of that. All infinity is infinity. There's nothing bigger.''
``Not quite,'' said the Pig. ``There are different kinds of infinities, but we don't need to get into that. The number of elements in the set of natural numbers is the same as the number of elements in the set of the integers. Or rather, their order or cardinality is the same. That's just a fancy way of saying that there is a one to one correspondence between the natural numbers and the integers. So, we can list all of the integers. Any idea how?''
``We can list all of the positive integers first, then zero, and then the negative integers,'' Alice suggested.
``We could,'' said the Pig, ``but I'm afraid we would never get past the positive numbers to list the negative ones. We are much better off writing them like this: 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, ... . You see, it is just like our listing of natural numbers, only we have stuck a zero at the beginning and inserted negative numbers after each positive one. This makes it clear how the integers are related to the natural numbers.''
``You mean to tell me that both of these lists have the same number of elements, even though one list is contained in the other?'' asked Alice incredulously.
``More or less. They have the same cardinality. I know that sounds fishy,'' said the Pig.
Alice wasn't sure she believed him, but it did seem that one infinity shouldn't be bigger than another. Certainly not significantly bigger, so she let it go. She didn't quite understand what the Pig meant by cardinality, but it sounded interesting. She wondered if he would ever get back to the distance between Lorina and Edith.
``Now we have another set of numbers,'' the Pig said, ``known as the rational numbers. Those are the numbers in the form ^{x}/_{y}, where x and y are both integers. Thinking of how to list all the rational numbers is much trickier, but there is a way. We make a table with the positive rational numbers. It could begin like this.'' He wrote:





























``In the top row we have a bunch of fractions with 1 as their numerator. That means ^{1}/_{1}, ^{1}/_{2}, ^{1}/_{3}, ^{1}/_{4}, ^{1}/_{5}, et cetera. In the second row we have fractions where the numerator is 2. Like ^{2}/_{1}, ^{2}/_{2}, ^{2}/_{3}, ^{2}/_{4}, ^{2}/_{5}. What do the columns look like?'' he asked.
``Each column has the same whatdoyoucallit? The bottom number in the fraction.''
``Denominator,'' supplied the Pig.
``Thank you,'' said Alice politely. ``The first column has ^{1}/_{1}, ^{2}/_{1}, ^{3}/_{1}, ^{4}/_{1}, ^{5}/_{1}. The second column has ^{1}/_{2}, ^{2}/_{2}, ^{3}/_{2}, ^{4}/_{2}, ^{5}/_{2}.''
``Right,'' said the Pig. ``And these numbers go on and on in two directions. The rows and the columns. There are infinitely many rational numbers in the table.''
``Wait,'' interrupted Alice. ``Some of the numbers on your table occur twice, like ^{1}/_{2} and ^{2}/_{4}. How can you be sure that there are infinitely many rationals when you have the same numbers so many times?''
``Excellent question,'' said the Pig. ``If we consider only fractions reduced to their lowest terms, like ^{1}/_{2} instead of ^{2}/_{4}, we avoid that problem. At any rate, every single positive rational number is contained in our table. We may have duplicates, but we aren't missing any numbers. And because our rationals are derived from the natural numbers, there are the same number of rational numbers as natural numbers. We can order them, too, though that is a bit more complicated.''
``But aren't they already in order?'' asked Alice, confused.
``I suppose they are,'' said the Pig, ``but I meant something more specific. If I were to write a list in this order, it would start ^{1}/_{1},^{2}/_{1}, ^{3}/_{1}, ^{4}/_{1}, ^{5}/_{1}, º, ^{1}/_{2},º. But that's no good, because it would have lots of huge gaps. When I say I want to list the rational numbers, I mean that there shouldn't be leaps in the list. To accomplish this we need to look at some diagonals in our table.'' Alice watched him draw arrows:
``Wow,'' Alice exclaimed, looking over the Pig's shoulder, ``that's neat. We've ordered an awful lot of numbers.''
``We have,'' the Pig agreed. ``But you've gotten me off on a tangent. I meant to be telling you about distance, not cardinality.''
``Well, then do that, too,'' instructed Alice. ``But,'' she asked again, ``have you seen a stuffed teddy bear?''
``I'm afraid I haven't,'' he replied. ``Why?''
``Because I have lost my bear,'' said Alice sadly. ``I dropped it down a hole, and I climbed in after it to try to find it. But I found only its ribbon.''
The Pig looked at her consolingly. ``Don't worry. You'll find your bear. I'll help you. But first, I'll explain about triangles so we can subtract Lorina from Edith.''
``I'll explain to you how to find the distance between the two points you chose in the lattice. Think about your two points as being opposite corners of a square,'' he said drawing a square.
``The question is to find the length of the diagonal of the square with side length one. Let's look first at the area of the square. It is 1 square unit because the area of a square is just the length of the side squared. Now I'm going to add another square to our diagram, this one with the diagonal as a side. This new square has a center at (1,1). And each of its corners is one unit away from the center. Do you know what its corners are?'' asked the Pig.
``I think so,'' said Alice. ``The point above (1,1) is (1,2). The point below (1,1) is (1,0). The point to the left of (1,1) is (0,1), and the point to the right of it is (2,1). So those are the four corners.''
``The Greeks were just concerned with geometry; what we think of as algebra was, for them, just another way of representing geometry. We can rewrite many problems of algebra in terms of geometry. We can also rewrite problems in geometry as problems in algebra. From our picture, we get the equation side^{2} = 2. Do you know what a square root is?'' he asked.
Alice nodded. ``A square root is a funny sign that looks like a cross between the long division sign and a check mark. It means the opposite of squaring a number. So since 3^{2} is 9, the square root of 9 is 3.''
``Right,'' said the Pig. ``Actually, the square root of 9 is also 3, but we don't want to worry about negative numbers. They don't make any sense geometrically. To solve for the length of the side, we need to take the square root of 2. That is, the length of each side of the larger square is ÷2.''
``That's not equal to 1, or 2, or 3, or any such number,'' remarked Alice, puzzled.
``It isn't,'' said the Pig. ``It isn't even equal to a fraction. It's an irrational number.''
``I don't think it's nice to call a number irrational,'' said Alice.
``Perhaps not, but that's how the Greeks thought of them, as illogical numbers, as numbers that didn't fit into their way of thinking of ratios. And the square root of two was the first number to puzzle them in this way.
``Now I'm ready to tell you about the distance between any two points. This is where we use the Pythagorean theorem. The Pythagorean theorem says that a^{2}+b^{2} = c^{2}, where a and b are the lengths of the sides of a right triangle and c is the length of the hypotenuse.''
``Hippopotamus?'' asked Alice.
``No, hypotenuse.''
``A hippo in a noose? What would you do with a hippo in a noose?''
``No, not a `hippo in a noose' either. A highpotenoose. The hypotenuse of a right triangle is the longest side, the one across from the right angle.''
``Oh. That's a really silly name for it. Is that always the longest side?'' asked Alice.
``Always,'' replied the Yellow Pig. ``And not only is it the longest, but we have an explicit formula for finding its length, given the lengths of the other two sides. That's our Pythagorean theorem,'' he said, writing:

``So this hypotenuse thing is always the same length?''
``In relation to the other sides, yes. I'll show you. Let's see ... today is a Thursday, so I'll give you the Thursday proof.''
``There's more than one proof?'' Alice asked.
``Why, pigheavens, I bet there are over thirtyseven proofs, and they all explain the same thing in a different way. I'll show you a few of the proofs. This first one is a proof by picture. Our algebraic expression a^{2}+b^{2} = c^{2} is represented geometrically by this picture.'' Alice studied the picture carefully.
``The area of the outer square with sides of length (a+b),'' supplied Alice.
``Right. So when we say that in a right triangle a^{2}+b^{2} = c^{2}, what we mean is that the sum of the area of two squares with side lengths a and b is equal to the area of a larger square with side length c. I can draw a square on side a and a square on side b and their combined area will equal the area of the square on side c. Does that make sense?''
``Yes, I think so,'' said Alice.
``Good. Now, for some algebra,'' continued the Pig. ``The area of the larger square is (a+b)^{2}. And that has to equal the area of the small inner square, which is c^{2}, plus the area of the four triangles surrounding it. Each of these right triangles has sides of lengths a and b. So the area of each triangle is ^{1}/_{2}ab, and since there are four of them, the combined area of the triangles is 2ab. Now we need to find the value of (a+b)^{2}.''
``Isn't that a^{2}+b^{2}?'' Alice inquired.
``No,'' said the Pig, ``try an example.''
Alice thought aloud, ``(1+2)^{2} = 3^{2} = 9, and 1^{2}+2^{2} = 1+4 = 5. I guess it isn't,'' she concluded. ``So what is (a+b)^{2}?''
``You have to be careful when multiplying polynomials  expressions like a+b. It's like when you learned to multiply numbers. Think about squaring 17, which is really the same as squaring (10+7). First, we multiply 7 by 7. Then, we multiply 7 by 1, which is really 10. This gives us 17 times 7. Next, we multiply 1, or 10, by 7, and then by 1. This gives us 17 times 10. We add these two results together to get 17 times 17.''
He continued, ``The same principle applies to squaring (a+b), that is, calculating (a+b)(a+b). We use a method known as FOIL. That stands for first, outer, inner, last. We multiply the first two terms, the outer two terms, the inner two terms, and the last two terms. Then we add all of those together. We can represent this with a diagram.'' He wrote:
``I guess it does,'' agreed the Pig. ``And it shows us how to obtain the product (a+b)(a+b) using the FOIL method. The first two terms are a and a, so we get a^{2}. The outer terms are a and b; we multiply those to get ab. The inner terms are b and a, yielding ba, and the last terms are b and b, or b^{2}. We add all of the terms together to get a^{2}+ab+ba+b^{2} or a^{2}+2ab+b^{2}.
``So, the area of the whole square is a^{2}+b^{2}+2ab,'' said the Pig. ``And it is also c^{2}+2ab. This gives us the equation a^{2}+b^{2}+2ab = c^{2}+2ab. Both sides have a 2ab so we can cancel them out. We are left with precisely what we wanted to prove: a^{2}+b^{2} = c^{2}.''
``That's the first logical thing I've seen all day,'' Alice remarked.
``Yes, it's very logical. Most of what you will see here is logical, although it might not appear to be so at first. This is a world ruled by mystery and logic. Let me show you a second picture.''
``Yup. In this diagram it's the outer square that has side length c. And the inner square has side length (ba). Again, there are four triangles with legs of lengths a and b.''
``So, the area of those four triangles is still 2ab,'' Alice thought out loud.
``Right. And the area of the larger square is c^{2}, and the area of the smaller square is (ba)^{2}.'' The Pig looked at Alice. She remained silent. He continued, ``ba is really just b+(a), so we can use the FOIL method again.'' He drew:
``Correct,'' said the Pig, ``and that's just a^{2}2ab+b^{2}.''
``Right,'' agreed Alice. ``I think I can finish the proof now. The area of the small square and the four triangles has to equal the area of the large square. So a^{2}+b^{2}2ab+2ab = c^{2}. And the 2ab+2ab part goes away, leaving us with a^{2}+b^{2} = c^{2}.''
``Absopositivelutely correct,'' praised the Pig. ``Those are my two favorite proofs of the Pythagorean theorem, but there are many others that are quite different. One, credited to a mathematician named Legendre, is based on the idea of similar triangles. Similar triangles are triangles with different side lengths but the same angle measures. I'll show you another geometric proof that you should be able to understand if you analyze this picture carefully,'' he said, sketching a right triangle and forming squares on all three sides. He then split the largest square into a small square, which was the same size as the small square on one of the sides of the triangle, and four equally shaped quadrilaterals. He also split the medium sized square into the same four equally shaped quadrilaterals. ``Now you can see that the combined area of the small square and the medium sized square on the sides of the triangle is equal to the area of the larger square.''
``Back to Lorina and Edith. Lorina was the point (0,0) and Edith was the point (3,4) in my naming scheme. We can make a right triangle from Lorina and Edith, like so,'' he said, drawing:
``I see,'' said Alice. ``The square of the distance is the square of the hypotenuse which is equal to 3^{2}+4^{2}. That's 9+16 or 25. Then the distance between Lorina and Edith is ÷[25] which is 5,'' she concluded. ``Is that right? Is the distance 5 units?''
``It is,'' said the Pig. ``I'm very pleased that you were able to calculate the distance between Lorina and Edith. Now you know how to calculate the distance between any two points.'' Alice was pretty pleased herself. She thought that the Pythagorean formula was quite useful.
``Let's use our formula to calculate some more distances,'' the Pig continued. ``If we know the horizontal and vertical distances a and b, we can calculate the diagonal distance c. Most of the time c is an irrational number, like ÷2.''
``But for 3 and 4, we got 5,'' remarked Alice.
``We did,'' said the Pig. ``There are an infinite number of such integer solutions to a^{2}+b^{2} = c^{2}. Even though there are infinitely many integer solutions, it's not very clear how to find them. The Greeks knew of a few triples with integer values for side lengths. The smallest of these is our (3,4,5). Two more triples are (6,8,10) and (9,12,15). They work because they are larger versions of (3,4,5). We say they are multiples of (3,4,5).''
The Pig continued, ``It turns out that all such triples can be written in the form (p^{2}q^{2},2pq,p^{2}+q^{2}).''
``What do you mean?'' asked Alice.
``Just pick two whole numbers, p and q, with p greater than q.''
``Like 2 and 1?'' asked Alice.
``Good example,'' said the Pig. ``Then p^{2}q^{2} is 2^{2}1^{2} = 3. And 2pq is 2 ·2 ·1.''
``That's 4,'' said Alice.
``Right,'' said the Pig. ``And do you know what p^{2}+q^{2} is?''
``Let's see,'' started Alice, ``it must be 2^{2}+1^{2} which is 4+1 or 5.''
``Exactly,'' said the Pig. ``See? That's our triple: 3, 4, and 5.''
``Neat,'' said Alice. ``Can I make another triple?''
``You sure can,'' said the Pig.
``I'll try 2 and 3,'' Alice said. ``That makes the first number in the triple is 3^{2}2^{2} or 5. The second number in the triple is 2 ·3 ·2 which is 12. And the third number is 3^{2}+2^{2} = 9+4 or 13. Is that a Pythagorean triple?''
``We can check: 5^{2} is 25, 12^{2} is 144, and 13^{2} is 169. What's 25+144?''
``That's 169,'' answered Alice. ``And 5^{2}+12^{2} = 13^{2}, so it works. But,'' she paused, ``why does it work?''
``I'm glad you asked. In mathematics it's important not to accept everything, but to try to understand why things are true. It's fairly difficult to find that magical formula,'' said the Pig, ``but fortunately, we already know it, so it's fairly easy to see that it will produce Pythagorean triples. We can verify that it works in the same way we checked that (5,12,13) was a triple. We just use substitution. The Pythagorean theorem says that a^{2}+b^{2} = c^{2}. We let a = p^{2}q^{2}, b = 2pq, and c = p^{2}+q^{2}. That's a lot of numbers and variables, so hold on to your hat,'' he warned.
``I'm not wearing a hat,'' said Alice, slightly confused.
``It's just a figure of speech,'' the Pig said with a smile. ``It means that you should pay close attention. Here's what we want to show: (p^{2}q^{2})^{2}+(2pq)^{2} = (p^{2}+q^{2})^{2}.''
``Well, (p^{2}q^{2})^{2} is p^{4}  2p^{2}q^{2} + q^{4}. And (2pq)^{2} = 4p^{2}q^{2}. So when you add those two together you get p^{4} + 2p^{2}q^{2} + q^{4}. That's a^{2}+b^{2}. Our c^{2} is (p^{2}+q^{2})^{2} or p^{4} + 2p^{2}q^{2} + q^{4}, which is the same thing we got for a^{2}+b^{2}. Sure enough, a^{2}+b^{2} = c^{2}. Did you follow that?''
Alice had to admit that while it seemed logical, she would have to look over the details before she could really be convinced. She borrowed the Pig's notebook and slowly worked out the algebra for herself. ``It sure is neat,'' she said.
``It is,'' agreed the Pig. ``And there's even a Pythagorean triple with the number 17. That's my favorite number.''
``What's so special about seventeen?'' Alice asked.
``A lot,'' said the Yellow Pig. The Pig continued talking, but Alice was having trouble following him, for he had suddenly become almost frighteningly excited. Instead, she dozed off and took a short nap, filled with dreams of hippos and a's and b's.