Suppose that *m* and *n* are two positive integers, with *m* < *n*. Then *n*^{2} – *m*^{2}, 2*mn*, and *n*^{2} + *m*^{2} is a Pythagorean triple.

It’s easy to check algebraically that the sum of the squares of the first two is the same as the square of the last one.

Here are the first few triples for *m* and *n* between 1 and 10. You can also extend for numbers greater than 10.

| m= 1 2 3 4 5 6 7 8 9 ---+------------------------------------------------------------------------------------------------------------------ n= | 2 | [3,4,5] | 3 | [8,6,10] [5,12,13] | 4 | [15,8,17] [12,16,20] [7,24,25] | 5 | [24,10,26] [21,20,29] [16,30,34] [9,40,41] | 6 | [35,12,37] [32,24,40] [27,36,45] [20,48,52] [11,60,61] | 7 | [48,14,50] [45,28,53] [40,42,58] [33,56,65] [24,70,74] [13,84,85] | 8 | [63,16,65] [60,32,68] [55,48,73] [48,64,80] [39,80,89] [28,96,100] [15,112,113] | 9 | [80,18,82] [77,36,85] [72,54,90] [65,72,97] [56,90,106] [45,108,117] [32,126,130] [17,144,145] | 10 | [99,20,101] [96,40,104] [91,60,109] [84,80,116] [75,100,125] [64,120,136] [51,140,149] [36,160,164] [19,180,181]

Advertisements

Suppose you have a pair of cats given to you as babies. This pair of cats will begin to reproduce when they are two years old. They will produce another pair of cats every year. Each of these pairs of cats will also reproduce–one cat pair per year starting when they are two years old. How many cat pairs will you have after n years?

The answer to this question is a sequence of numbers known as the ‘Fibonacci sequence’:

1,1,2,3,5,8,13,…

These numbers can be described mathematically as follows:

F(n+2) = F(n+1) + F(n)

In other words, each Fibonacci number is the sum of the two preceding Fibonacci numbers. Another way of saying that is, If you know two successive Fibonacci numbers, you can find the next one by adding them together.

There are many reasons why Fibonacci numbers are interesting to mathemeticians. One of the reasons is that Fibonacci numbers are very closely related to the *Golden Ratio*, a number which the ancient Greeks find very interesting.

**60 mph = 1 mile per minute**

- Going 60 mph and the exit is in 10 miles? That’s 10 minutes.
- Been driving a half hour? That’s about 30 miles at highway speeds.

**Feet Per Second = MPH * 1.5**

**MPH = Feet Per Second * 2/3** (derivation)

- 60 mph is about 90 feet per second (88 exactly), so just multiply by 1.5. Or, just add half to itself (60 + 30 = 90).
- Going 100 mph? That’s 150 fps.
- Going 10 fps? That’s about 7 mph (10 * 2/3 is 6.666). Or, just take away 1/3 (10 – 3 = 7).

**speed of light = 1 foot per nanosecond** (derivation)

- The US is about 3000 miles long. There’s about 5000 feet/mile, so that’s about 3000 × 5000 or 15 million feet. 15 million feet takes 15 million nanoseconds, or 15/1000, or 15 milliseconds. That’s the minimum time for a signal to go across the country.
- Inside a microchip, if you have a clock cycle every nanosecond (1 GHz), your signal can only travel 1 foot at most (or less, depending on the material). Even light takes 30ns to cross a 30 foot room.

**1 year = 250 work days = 2000 work hours** (derivation)

- Project takes 1000 man hours? That’s 6 months for 1 person.
- Daily commute of 1/2 hour? That’s .5 * 250 = 125 hours in the car each year.

**$1/hour = $2000/year** (derivation)

- Earn $25/hour? That’s about 50k/year.
- Make 200k/year? That’s about $100/hour. This assumes a 40-hour work week.

**$20/week = $1000/year** (derivation)

- Spend $20/week at Starbucks? That’s a cool grand a year.

**Rule of 72: Years To Double = 72/Interest Rate** (derivation)

- Have an investment growing at 10% interest? It will double in 7.2 years.
- Want your investment to double in 5 years? You need 72/5 or about 15% interest.
- Growing at 2% a week? You’ll double in 72/2 or 36 weeks. You can use this rule for any duration of time, not just years.
- Inflation at 4%? It will halve your money in 72/4 or 18 years.

**Numbers**

**10,000 = hundred hundred**

**million = thousand thousand**

**billion = thousand million**

**trillion = million million**

- 1% of 10k is 100. The Dow is roughly 10k (it’s about 12k now). So if the dow drops 100, it’s about a 1% loss.
- What’s 5k x 50k? That’s 250 * thousand * thousand or 250 million.

**Visualizing numbers **

- 12 days = 1 million seconds
- 1 year = 31 million seconds (about pi * 10 million)
- 30 years = 1 billion seconds
- 30,000 years = 1 trillion seconds

- One “part per million” means an accuracy of 1 second every 12 days. One “part per trillion” means an accuracy of 1 second every 30,000 years.

**Powers of 2**

**2^6 = 64 (the sixes match: six and sixty-four)**

**2^10 ~ thousand** (1 kb)

**2^20 ~ million** (1 mb)

**2^30 ~ billion** (1 gb)

- Sure, 2 to the tenth = 1024, but 1000 is good enough for government work. (Read on about KB vs KiB).
- Have 32-bit color? That’s 2 + 30 bits, aka 2^2 billion, or 4 billion (4gb exactly).
- Have a 16-bit number? That’s 6 + 10 bits, or 2^6 thousand, or 64 thousand (64 kb).

**a% of b = b% of a**

- It’s not immediately clear, but it’s true: a% of b = .01 * a * b, which is the same as b% of a (.01 * b * a).
- What’s 16% of 25? The same as 25% of 16: 4
- What’s 43% of 200? Same as 200% of 43: 86.

It’s not about **distance** in the sense of walking diagonally across a room. It’s about **any distance**, like the “distance” between our movie preferences or colors.

If it can be measured, it can be compared with the Pythagorean Theorem. Let’s see why.

We agree the theorem works. In any right triangle:

If a=3 and b=4, then c=5. Easy, right?

Well, a **key observation** is that a and b are at right angles (notice the little red box). Movement in one direction has **no impact** on the other.

It’s a bit like North/South vs. East/West. Moving North does not change your East/West direction, and vice-versa — the directions are independent (the geek term is **orthogonal**).

The Pythagorean Theorem lets you use find the **shortest path distance** between orthogonal directions. So it’s not really about right **triangles** — it’s about comparing “things” moving at right angles.

You:

If I walk 3 blocks East and 4 blocks North, how far am I from my starting point?

Me:5 blocks, as the crow flies. Be sure to bring adequate provisions for your journey.

You:Uh, ok.

Well, we could think of c as just a number, but that keeps us in boring triangle-land. I like to think of c as a **combination of a and b**.

But it’s not a simple combination like addition — after all, c doesn’t equal a + b. It’s more a combination of components — the Pythagorean theorem lets us combine **orthogonal components** in a manner similar to addition. And there’s the magic.

In our example, C is 5 blocks of “distance”. But it’s more than that: it contains a **combination** of 3 blocks East and 4 blocks North. Moving along C means you go East and North at the same time. Neat way to think about it, eh?

Let’s get crazy and chain the theorem together. Take a look at this:

Cool, eh? We draw **another** triangle in red, using c as one of the sides. Since c and d are at right angles (orthogonal!), we get the Pythagorean relation: c^{2} + d^{2} = e^{2}.

And when we replace c^{2} with a^{2} + b^{2} we get:

And that’s something: We’ve written e in terms of 3 orthogonal components (a, b and d). Starting to see a pattern?

Think two triangles are strange? Try pulling one out of the paper. Instead of lining the triangles flat, tilt the red one up:

It’s the same triangle, just facing a different way. But now we’re in 3d! If we call the sides x, y and z instead of a, b and d we get:

Very nice. In math we typically measure the x-coordinate [left/right distance], the y-coordinate [front-back distance], and the z-coordinate [up/down distance]. And now we can find the 3-d distance to a point given its coordinates!

As you can guess, the Pythagorean Theorem generalizes to **any number of dimensions**. That is, you can chain a bunch of triangles together and tally up the “outside” sections:

You can imagine that each triangle is in its own dimension. If segments are at right angles, the theorem holds and the math works out.

The Pythagorean Theorem is the basis for computing distance between two points. Consider two triangles:

- Triangle with sides (4,3) [blue]
- Triangle with sides (8,5) [pink]

What’s the distance from the tip of the blue triangle [at coordinates (4,3)] tot the tip of the red triangle [at coordinates (8,5)]? Well, we can create a **virtual triangle** between the endpoints by subtracting corresponding sides. The hypotenuse of the virtual triangle is the distance between points:

- Distance: (8-4,5-3) = (4,2) = sqrt(20) = 4.47

Cool, eh? In 3D, we can find the distance between points (x1,y1,z1) and (x2,y2,z2) using the same approach:

And it doesn’t matter if one side is bigger than the other, since the difference is squared and will be positive (another great side-effect of the theorem).

The theorem isn’t limited to our narrow, spatial definition of distance. It can apply to **any orthogonal dimensions**: space, time, movie tastes, colors, temperatures. In fact, it can apply to any set of numbers (a,b,c,d,e). Let’s take a look.

Let’s say you do a survey to find movie preferences:

1. How did you like Rambo? (1-10)

2. How did you like Bambi? (1-10)

3. How did you like Seinfeld? (1-10)

How do we compare people’s ratings? Find similar preferences? Pythagoras to the rescue!

If we represent ratings as a “point” (Rambo, Bambi, Seinfeld) we can represent our survey responses like this:

- Tough Guy: (10, 1, 3)
- Average Joe: (5, 5, 5)
- Sensitive Guy: (1, 10, 7)

And using the theorem, we can see how “different” people are:

- Tough Guy to Average Joe: (10 – 5, 1 – 5, 3 – 5) = (5, -4, -2) = 6.7
- Tough Guy to Sensitive Guy: (10 – 1, 1 – 10, 3 – 7) = (9, -9, -4) = 13.34

As we suspected, there’s a large gap between the Tough and Sensitive Guy, with Average Joe in the middle. The theorem helps us **quantify this distance** and do interesting things like **cluster similar results**.

This technique can be used to rate Netflix movie preferences and other types of **collaborative filtering** where you attempt to make predictions based on preferences (i.e. Amazon recommendations). In geek speak, we represented preferences as a vector, and use the theorem to find the distance between them (and group similar items, perhaps).

Measuring “distance” between colors is another useful application. Colors are represented as red/green/blue (RGB) values from 0(min) to 255 (max). For example

- Black: (0, 0, 0) — no colors
- White: (255, 255, 255) — maximum of each color
- Red: (255, 0, 0) — pure red, no other colors

We can map out all colors in a “color space”, like so:

We can get distance between colors the usual way: get the distance from our (red, green, blue) value to black (0,0,0) [formally labeled delta e]. It appears humans can’t tell the difference between colors only 4 units apart; heck, even 30 units looks pretty close to me:

How similar do these look to you? The color distance gives us a **quantifiable** way to measure the distance between colors (try for yourself). You can even unscramble certain blurred images by cleverly applying color distance.

If you can represent a set of characteristics with numbers, you can compare them with the theorem:

- Temperatures during the week: (Mon, Tues, Wed, Thurs, Fri). Compare successive weeks to see how “different” they are (find the difference between 5-dimensional vectors).
- Number of customers coming into a store hour-by-hour, day-by-day, or week-by-week
- SpaceTime distance: (latitude, longitude, altitude, date). Useful if you’re making a time machine (or a video game that uses one)!
- Differences between people: (Height, Weight, Age)
- Differences between companies: (Revenue, Profit, Market Cap)

You can tweak the distance by weighing traits differently (i.e., multiplying the age difference by a certain factor). But the core idea is so important I’ll repeat it again: **if you can quantify it, you can compare it using the the Pythagorean Theorem.**

Your x, y and z axes can represent any quantity. And you aren’t limited to 3 dimensions. Sure, mathematicians would love to tell you about the other ways to measure distance (aka metric space), but the Pythagorean Theorem is the most famous and a great starting point.

There’s so much to learn when revisiting concepts we were “taught”. Math is beautiful, but the elegance is usually buried under mechanical proofs and a wall of equations. We don’t need more proofs; we need interesting, intuitive results.

For example, the Pythagorean Theorem:

- Works for
**any shape**, not just triangles (like circles) - Works for
**any equation with squares**(like 1/2 m v^{2}) - Generalizes to
**any number of dimensions**(a^{2}+ b^{2}+ c^{2}+ …) - Measures
**any type of distance**(i.e. between colors or movie preferences)

A magic square is an arrangement of the numbers from **1** to **n^2** (n-squared) in an **n**x**n** matrix, with each number occurring exactly once, and such that the sum of the entries of any row, any column, or any main diagonal is the same. It is not hard to show that this sum must be **n(n^2+1)/2**.

The simplest magic square is the **1×1** magic square whose only entry is the number **1**.

The next simplest is the **3×3** magic square

and those derived from it by symmetries of the square. This **3×3** square is definitely magic and satisfies the definition given above.

The **4×4 Dürer magic square** (or, what is essentially the same, the 4×4 magic square I use) has many interesting special properties that are not shared by magic squares in general. They are so interesting that they are often pointed out when this square is presented. That is good, but can sometimes lead to misunderstandings as to which is the meat and which is the gravy. The meat is the definition I gave above. The gravy (or some of it), suggested by Jerome S. Meyer in his book, *Fun with Mathematics ,* follows.

In the case of this **4×4** magic square:

in addition to having the sum 34 (= 4(4^2+1)/2) in each row, column and main diagonal,

- The four corners add to 34.
- The four numbers in the center add to 34.
- The 15 and 14 in the top row and the 3 and 2 facing them in the bottom row add to 34.
- The 12 and 8 in the first column and the 9 and 5 facing them in the last column add to 34.
- The four squares in the corners add to 34.
- If you go clockwise around the square and choose the first squares away from the corners (15,9,2,8), they add to 34. The same holds if you go counterclockwise.
- If you replace each entry by its square, you get the following square:This square is not magic, but it has some noteworthy properties:
- The first and last column have the same sum; likewise the 2nd and 3rd columns have the same sum;
- The same holds with rows instead of columns (although the sums one gets are different from the sums for the columns);
- From (1) and (2), it follows that the left half of the square has the same sum as the right half and that this is one-half the sum of all of the numbers in the square. The same holds for the top half and the bottom half; hence the left half equals the right half equals the top half equals the bottom half. Furthermore, this also equals the sum of the 8 numbers on the diagonals and the sum of the 8 numbers off the diagonals.

- If instead you replace each entry by its cube, you get the following square:This square has the property that the sum of the 8 numbers on the diagonals equals the sum of the 8 numbers off the diagonals. – http://www.mytutorfriend.com

Formula:

x is the smaller number of the two. y is the larger one.

This formula has the advantage that it can be used quickly for huge numbers of integers, such as databases and arrays. -www.mytutorfriend.com

]]>