Wednesday, December 31, 2008

A Trick With Perfect Squares, or: Why I Love Math

I love perfect squares. Anyone who has conversed with me on the topic will be able to tell you as much, if they paid careful attention.

To reiterate: I love perfect squares.

When I was in 6th grade, we had to memorize all of the perfect squares of integers up to 25, if memory serves (and by extension, I guess, we memorized the perfect squares of all integers between -25 and 25, inclusive, but that's kinda cheating).

We were tested on this, even.

Like most of the 6th graders in the IB program, I was terrified of bad grades and did what any GPA-fearing student would do: I memorized by rote, and wrote them down in a list, like so:

Int -- Sq
1 -- 1
2 -- 4
3 -- 9
4 -- 16
5 -- 25

and so on.

And that's when I noticed a sweet pattern. Take two consecutive integers and their respective squares:

3 -- 9
4 -- 16

The absolute value of the difference between the squares (16 - 9 = 7) is the same as the absolute value of the sum of the integers from which the squares were formed (3 + 4 = 7).

This is true for ANY two consecutive integers (and their respective squares) - if you don't believe me, give it a try on your own.

The thing that's bugged me for the last 11 years or so is why this happens... I couldn't explain it.

UNTIL NOW, that is.

If we call the smaller of the two consecutive integers M, then the larger of the two is (M + 1). To set up our equation mathematically, we end up with

(M + 1)² - M² = M + (M + 1)
(the sum of the integers equals the difference between the squares of those integers).

If my memory of high school algebra serves me right, we can use our good ol' FOIL method to expand and simplify the left hand side of the equation, like so:

(M + 1)² - M² = M + (M + 1)
(M + 1)² - M² = 2M + 1
(M² + 2M + 1) - M² = 2M + 1

2M + 1 = 2M + 1

So we end up with an identity function, basically (I think that's what this is called), when we solve algebraically.

I figured this one out while driving a few months ago, then as soon as I got home I scribbled it all down on a sheet of note-paper to make sure it made sense. Then I showed my freshmen. They were not quite as excited as I am.

I forgave them for this.

* * * * * * * *

Another way to do this is to look at it geometrically. Imagine, if you will, a square with sides of length M (where M is an integer). It might look like this:

Now, we're going to pick the right side and the bottom side, and extend each of them a distance of one (or, to put it another way, we're slapping an (M x 1) rectangle onto the right and bottom sides, each with an area of, you guessed it, M):

Doing this gives us an M² + M + M square units shape.

In order to make it a complete square, we gotta fill in that last gap, which, coincidentally, happens to be a (1 x 1) square.

So we end up with M² + 2m + 1 as the area of our slightly larger square, which happens to have sides of length (M + 1).

Which is pretty friggin' awesome.

* * * * * * * *

What I'd like to do now is figure out if this difference of squares = sum of square roots holds true for non-integers (right now, I'm mostly wondering about decimal numbers (non-irrational / repeating) and fractions... my suspicion is that it does not hold true for decimal numbers (as 1/10th squared is 1/100th, which is a tough number to get when you're adding/subtracting tenths).

But there might be other cool properties that I haven't figured out yet. One can only hope that this is the case.