Showing posts with label relatively prime. Show all posts
Showing posts with label relatively prime. Show all posts

Tuesday, January 29, 2013

Using the generating function for relatively prime Pythagorean triples.

Yesterday's post ended with the statement of the generating function for Pythagorean triples. Take any two distinct whole numbers j and k and let j be the larger. Here are the formulas for a, b and c.

a = j² - k²
b = 2jk
c = j² + k²


Example #1: j = 2, k = 1
a = 4-1 = 3
b = 2 × 2 × 1 = 4
c = 4+1 = 5


Example #2: j = 3, k = 1
a = 9-1 = 8
b = 2 × 3 × 1 = 6
c = 9+1 = 10

Example #3: j = 3, k =2
a = 9-4 = 5
b = 2 × 3 × 2 =12
c = 9+4 = 13

Not surprisingly, using the three smallest pairs around (2, 1) (3, 1) and (3, 2), we get the three smallest Pythagorean triples. But notice that (3, 1) generates 8-6-10 which is not a relatively prime triple, since all the numbers are even. Looking at this carefully, we see that if both j and k are odd, this will make a, b and c even.

a = odd² - odd² = even
b = 2×odd×odd = even
c = odd² + odd² = even

To generate a relatively prime Pythagorean triple, we need two things to be true about j and k.

1. j and k must be relatively prime.
2. j - k must be odd. (Another way to state this is one is odd and the other even.)

Tomorrow, a few more rules about the relatively prime Pythagorean triples.
 

Monday, January 28, 2013

Generating Pythagorean triples.


The Pythagorean Theorem is usually stated as a² + b² = c². If all three numbers are whole numbers, it is called a Pythagorean triple. Here are some examples with small numbers as the entries.

3² + 4² = 5²
12² + 5² = 13²
15² + 8² = 17²
24² + 7² = 25²
21² + 20² = 29²
35² + 12² = 37²

In these examples, no number bigger than 1 divides all three numbers in the set, so these are the relatively prime Pythagorean triples. It is true that 6² + 8² = 10² (36+64=100), but this is just taking the 3-4-5 triangle and multiply each number by two.

Here are a few rules about the relatively prime Pythagorean triples.

They are always of the form odd² + even² = odd². We can have even² + even² = even², like 6-8-10, but all the numbers are divisible by two, so they aren't relatively prime. It turns out that odd² + odd² will be even, of course, but it can never be the square of an even number. All the even squares are divisible by 4 and the sum of two odd perfect squares will always have remainder 2 when divided by 4.

There is a generating function. Take any two distinct whole numbers j and k and let j be the larger. Here are the formulas for a, b and c.

a = j² - k²
b = 2jk
c = j² + k²

Tomorrow, we will look at what choices for j and k will produce the relatively prime Pythagorean triples.


Wednesday, January 9, 2013

Fibonacci numbers


Leonardo of Pisa, known more commonly as Fibonacci, was born in about 1170 and died in 1240. He is considered the greatest mathematician of the Middle Ages in Europe. He greatest lasting contribution is his book Liber Abaci, where he recommended the use of the number system he called The Arab numerals (now known as Hindu-Arabic numbers, the ones we use today) instead of the Roman numerals still used in Europe in his day. But his name survives because of a math puzzle he created, and the series of numbers that answer the puzzle are still called the Fibonacci numbers.

The puzzle went as follows. You have a pair of rabbits. Their breeding cycle is one month. The original pair gives birth to a new pair. The newborn rabbits are too young to breed, but the original pair will produce another pair of rabbits in the next month and the newborn will grow to maturity in a month so they will start breeding. How many pair of rabbits will you have in a year?

Of course, rabbits don't actually breed this way, but let's solve the problem anyway

Beginning of January: 1 pair
Beginning of February: 2 pairs, only 1 fertile
Beginning of March: 3 pairs, only 2 fertile
Beginning of April: 5 pairs, 3 fertile
Beginning of May: 8 pairs, 5 fertile
Beginning of June: 13 pairs, 8 fertile
Beginning of July: 21 pairs, 13 fertile
Beginning of August: 34 pairs, 21 fertile
Beginning of September: 55 pairs, 34 fertile
Beginning of October: 89 pairs, 55 fertile
Beginning of November: 144 pairs, 89 fertile
Beginning of December: 233 pairs, 144 fertile
Beginning of next January: 377 pairs, 233 fertile

This is the beginning of the sequence called the Fibonacci numbers. As you can see, the number of fertile rabbits follows the same pattern as the number of rabbits, just a month behind.

The rule that creates the Fibonacci numbers: The next Fibonacci number is always the sum of the previous two Fibonacci numbers.

The modern way to count them:  In number theory today, instead of starting with 1 and 2, the Fibonacci sequence starts with 0 and 1. We can write them this way.

f0 = 0
f1 = 1
f2 = 0+1 = 1
f3 = 1+1 = 2
f4 = 1+2 = 3
f5 = 2+3 = 5
f6 = 3+5 = 8
...

When speaking, I would say "f 6 equals 8" or "the sixth Fibonacci number is 8". There are some interesting number theory patterns in the sequence dealing with divisibility.

Rule: Any two consecutive positive Fibonacci numbers are relatively prime.
Rule: The fifth Fibonacci number is 5, and every fifth number in the sequence is divisible by 5.
f10 = 55 and f15 = 233 + 377 = 610. To test it out for yourself, continue the pattern to find f20 and f25.

The answers are in the comments.

Tomorrow: The Fibonacci sequence shows up in nature.

Tuesday, January 8, 2013

Triangular numbers


We learn the perfect squares in school.  Here are the first few starting with 1² = 1.

1² = 1
*

2² =4
* *
* *

3² = 9
* * *
* * *
* * *

4² = 16
* * * *
* * * *
* * * *
* * * *

5² = 25
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *

Another series of numbers base on shape are the triangular numbers. Here are the first five examples starting with 1.

*
1 = 1, the 1st triangular number

*
*  *
1+2 = 3, the 2nd triangular number

*
*  *
*  *  *
1+2+3 = 6, the 3rd triangular number

*
*  *
*  *  *
*  *  *  *
1+2+3+4 = 10, the 4th triangular number


*
*  *
*  *  *
*  *  *  *
*  *  *  *  *
1+2+3+4+5 = 15, the 5th triangular number

So the n-th triangular number is the sum of the numbers from 1 to n. There are games where these numbers show up, notably the ten pins in bowling and the fifteen balls other than the cue in pool. There are many places where these number show up in math, including the total number of handshakes necessary in a room with n+1 people so that every possible pair of people shakes hands.  Let's look at the example with 5 people.

Person #1: Shakes hands with 4 people
Person #2: Already counted the handshake with #1, 3 people left.
Person #3: Already counted the handshakes with #1 and #2, 2 people left.
Person #4: Already counted the handshakes with #1, #2 and #3, 1 person.
Person #5: Already counted all the handshakes.

There is a formula for the n-th triangular number, which is ½[n(n + 1)].

Consider our idea called relatively prime, which we discussed yesterday.

Two consecutive square numbers are always relatively prime, like 4² and 5². This follows from the fact that any two consecutive numbers are relatively prime.

After the first pair of triangular numbers, namely 1 and 3, any two consecutive triangular numbers cannot be relatively prime.

Ignoring 1 and 3, the next pair are 3 and 6, which have 3 in common as a factor.

Next are 6 and 10, which have 2 in common.

Next, 10 and 15 have 5 in common as a factor.

The formula shows us the numbers are  ½[n(n + 1)] and ½[(n + 1)(n + 2)]. If n is even, the common factor will be n + 1. If n is odd, the common factor will be ½(n + 1).

The square and triangular numbers have a connection. The sum of two consecutive triangular numbers is always a square.

1 + 3 = 4
3 + 6= 9
6 + 10 = 16
10 + 15 = 25
etc. ...

Here is a picture of 10 + 15 = 25 to give an idea why this always works.

* * * * *
* * * * *
* * * * *
* * * * *
* * * * *

Tomorrow: the Fibonacci numbers.


Monday, January 7, 2013

Relatively prime.


You might recall the idea of reducing fractions to lowest terms from school. I hope these memories are not accompanied by cold sweat or outbursts of obscenity. The name for the concept behind lowest terms is relatively prime.

Definition. Two numbers a and b are relatively prime to each other if their respective prime factorizations have no primes in common.

Let's use the idea in the concept where most people see it first, reducing fractions.

Example 1: 40% is the same as the fraction 40/100.  This is obviously not in lowest terms, since both are divisible by 10, so 40/100 = 4/10. This is still not in lowest terms since both are even. 4/10 = 2/5, and 2 and 5 are relatively prime. In fact, both 2 and 5 are prime, which might cause some confusion. Let's do a second example of relatively prime number where neither number is prime.

Example 2: 48% is the same as the fraction 48/100, not a relatively prime pair.  Let's reduce to lowest terms.

48/100 = 24/50 = 12/25, which is lowest terms.

12 = 3 × 2 × 2, so it isn't prime.
25 = 5 × 5, also not a prime.

The pair 12 and 25 is an example of a relatively prime pair of numbers where neither number is prime.

Tomorrow: The triangular numbers