Thursday, August 6, 2015

Gauss Explained

So I was reading this really great book called the Joy of X, and in the first chapter, it had an explanation of Gauss's (is that how you write it?) Formula of adding the numbers 1-100 without going 1+2+3+4... There are a bunch of techniques for this but the one I like best is the Triangle method. So, lets say you're back at elementary school and your teacher is having a bad day, so she gives you a challenge. "Can you add up all the numbers from 1 to 100?". Then, the teacher, confident that they couldn't solve it, leans back and relaxes, drinking a cup of dark coffee. But you're very smart, so you decide to play around with the problem before solving it. And, just for no reason, you make a triangle out of the problem: x xx xxx xxxx xxxxx xxxxxx xxxxxxx xxxxxxxx xxxxxxxxx xxxxxxxxxx And just for kicks, you decide to mirror it like so: oooooooooo xooooooooo xxoooooooo xxxooooooo xxxxoooooo xxxxxooooo xxxxxxoooo xxxxxxxooo xxxxxxxxoo xxxxxxxxxo xxxxxxxxxx So what do you do now? Well, let's say the total number of x's and o's are called "S". And remember the formula for the area of a triangle? It was bh/2. And these sure look like triangles, don't they? So you can apply the formula to them. So it would look like this: S=bh/2 Or, if you substitute b for n: S=nh/2 But, you realize, it isn't a perfect square. The x's and o's make a rectangle, so how would you account for that? The total thing is a rectangle because on the very top and bottom rows, it is filled with just x's and just o's. So it makes it into a rectangle. And so to account for that, You can do this: S=nh+1/2 Or, if you want to make it easier to read: S=n(h+1)/2 You can add the parenthesis because nh is equal to n(h) because both mean they are being multiplied. But h, the height is just the same thing as n, because both are made of x's and o's. So the formula can look like this: S=n(n+1)/2 Which is what the actual formula looks like! That teacher must have been very impressed.