Saturday, December 11, 2010

More on the Fibonacci series and the Golden Ratio

In my previous blog, I had concluded with a relation between the golden ratio and the Fibonacci sequence. It can be stated as below:
pn = Fn+1 p + Fn ---- (1)
Where p is the golden ratio
And the Fibonacci sequence starts off from 1, 1
i.e. 1, 1, 2, 3, 5, 8, 13, 21 etc.

Now I shall use this equality to prove something else about the relation between the Fibonacci sequence and the golden ratio, namely:
lim                     Fn+1
                        -------      =    p
n -> infinity         Fn

Let us suppose that:
R =      lim                   Fn+1
                                 -------
            n -> infinity     Fn
By doing so, we implicitly assume that such a limiting value for the ratio of two successive Fibonacci terms exists.
R is the ratio of the greater of two successive Fibonacci numbers to the lesser of the two, as the numbers become infinitely large. Thus, R can also be expressed as:
R =      lim                    Fn
                                  ------
            n -> infinity      Fn-1

Now, to start the proof, first divide both sides of (1) by Fn
pn                     Fn+1
---        =          -------  p  +  1
Fn                     Fn

pn                   Fn+1
--- - 1  =         -------  p
Fn                   Fn

Fn+1                  (pn / Fn) - 1
------   =         -------------------
Fn                                 p

                        [p(pn-1)/Fn] - 1
            =         -------------------
                                    p

pn-1 = Fn p + Fn-1 so:

                        [p(Fn p + Fn-1)/Fn] - 1
            =         ------------------------------
                                    p

                        p2 + p(Fn-1/Fn) – 1
            =         --------------------------
                                    p

                                  Fn-1               1
            =         p +      -------      –        --
                                  Fn                  p

                      Fn-1                p2 - 1
            =         ------     +        --------
                      Fn                     p

p2 = p + 1 so:

                      Fn-1               p + 1 - 1
            =         -------   +        ----------
                      Fn                    p

Fn+1               Fn-1
-------  =         ------   +  1 ----- (2)*
Fn                  Fn

Now, as we discussed earlier,
R =      lim                   Fn+1
                                 -------
            n -> infinity      Fn
  
R =      lim                  Fn
                                 -------
            n -> infinity     Fn-1

Thus, as n tends to infinity, (2) becomes:
R = 1/R + 1
R = (1 + R)/R
R2 = 1 + R
(This is the same quadratic equation as the one for the golden ratio)
R2 – R – 1 = 0
Then R = [-b +- √ (b2 – 4ac)]/2a
R = [1 +- √ (1 + 4)]/2 = [1 +- √5]/2
Additionally, as all Fibonacci numbers are positive,
R = [1 + √5]/2 (which is equal to the golden ratio)

Therefore, the ratio of the greater to the smaller of two successive terms of the Fibonacci sequence, as we go on to bigger and bigger terms, tends to the Golden Ratio.

* The relation stated in (2) gives us:


Fn+1               Fn-1
-------  =         ------  +  1
Fn                   Fn




In other words, the ratio of two consecutive Fibonacci numbers (greater is to smaller) is equal to one added to the inverse of the ratio of the smaller number to the Fibonacci number immediately before it.
eg. The Fibonacci numbers 5, 8, 13
13/8 = 1/(8/5) + 1
13/8 = 5/8 + 1
13/8 = (5 + 8)/8
13/8 = 13/8

This relation can be derived in a much simpler way, by considering any sequence of three consecutive Fibonacci numbers.
If the first number is a and the second number is b, the third number must be a + b
i.e. Fn-1 = a
Fn = b
Fn+1 = a + b
Now the ratio of the third to the second is (a + b)/b
And the ratio of the second to the first is b/a
If we invert this second ratio and add 1 to it, we get:
1/(b/a) + 1
= a/b + 1
= (a + b)/b
This is the same as the ratio of the third Fibonacci number to the second Fibonacci number.
i.e. (a+b)/b = 1/(b/a) + 1

Thus we conclude:


Fn+1               Fn-1
-------  =         ------  +  1
Fn                   Fn



This would have been a much shorter method of deriving the proof (don’t ask why I didn’t just use this way).


Addendum: 
Let Rn denote the ratio of the (n+1)th term to the nth term of the Fibonacci sequence:
1, 1, 2, 3, 5, 8, 13…
Then, from the equation in (2),
Rn        = 1 + 1/Rn-1
Rn-1      = 1 + 1/Rn-2
Rn-2      = 1 + 1/Rn-3
Etc.

If we were to put them all together,
Rn        = 1 + 1/Rn-1
            = 1 + 1/(1 + 1/Rn-2)
            = 1 + 1/(1 + 1/(1 + 1/Rn-3))
            ……..
            = 1 + 1/(1 + 1/(1 + 1/(1 + 1/(….. + 1/R1)))))….) 
Further, R1 = 1/1 = 1

So Rn   = 1 + 1/(1 + 1/(1 + 1/(1 + 1/(….. + 1)))))….)
When n tends to infinity, Rn, as we found out, tends to the golden ratio.
Thus, as n tends to infinity, we get the infinite fraction for the golden ratio:
R         =            1 +            1
                                    ---------------------------------
                                    1 +            1
                                                ------------------------
                                                1 +            1
                                                            ----------------
                                                            1 +            1
                                                                        -------
                                                                        1 + …


Friday, December 10, 2010

An interesting relation

I came across this problem while reading Euler’s Elements of Algebra, and decided to solve it in my own way. The question is as thus:
Find two numbers, whose sum is equal to their product, which in turn is equal to the difference of their squares.

Let the two numbers be x and y, such that x >= y
Then, x + y = xy = x2 – y2
The one obvious solution is when both x and y are equal to zero, so we ignore that and look for any other solutions it may have.

Let’s evaluate the following equality:
x + y = x2 – y2
x + y = (x + y)(x – y) ----(1)
Now I state that x + y cannot be equal to zero.
If it were, then x + y = xy = 0 so either x or y is zero.
But since x + y = 0, if any one of them is equal to zero, the other has to be zero as well.
And we already overlooked the case where x = y = 0
So we can cancel out (x + y) from equation (1) to get:
1 = x – y
which means that: x = y + 1 ----(2)

Now let us evaluate another equality:
x + y = xy
Substituting x from (2),
y + y + 1 = (y + 1)y
2y + 1 = y2 + y
y2 = y + 1 ----(3)
Look familiar? Let’s solve it.
y2 – y – 1 = 0
Using the quadratic formula,
y = [1 ± √(1 + 4)]/2
= [1 ± √5]/2
Note: Yes, this is equal to the golden ratio. (Look it up on wikipedia if you don’t know it.)
And x = y + 1 = [3 ± √5]/2

So the two numbers could either be:
[1 + √5]/2 and [3 + √5]/2

or [1 – √5]/2 and [3 – √5]/2

Additional tests:
Firstly, as is the case with the golden ratio, the number y obeys the rule y^2 = y + 1
So that, the square of the number is equal to the number itself increased by 1.
And x = y + 1
So y2 = x
This equality can be added to the list of other interesting equalities we started out with, namely x + y = xy = x2 – y2

Now x + y = xy
y + y + 1 = xy
Inserting x = y2,
2y + 1 = y2 * y
y3 = 2y + 1
Thus, the cube of the golden ratio is twice the number itself increased by 1.

This can also be derived by:
y2 = y + 1
multiplying both sides by y,
y3 = y2 + y --- (4)
replacing the value of y2 from before,
y3 = y + 1 + y
so y3 = 2y + 1

We could similarly extend (4) to higher powers
y4 = y3 + y2
y4 = 2y + 1 + y + 1
y4 = 3y + 2

y5 = y4 + y3
y5 = 3y + 2 + 2y + 1
y5 = 5y + 3

y6 = y5 + y4
y6 = 5y + 3 + 3y + 2
y6 = 8y + 5 
and so on…
Upon closer inspection, we see that the coefficient of y and the constant term, in each successive power of y, follows a Fibonacci sequence, in which the constant term is always one term behind the coefficient of y.
Reasoning: the new coefficient of y is always the sum of the previous two coefficients of y, which follows the rule of a Fibonacci sequence, in which each term after the second term is the sum of the two terms before it. The reasoning is similar for the constant term. The Fibonacci sequence for the coefficient of y starts with the first two terms 1 and 2, while the series for the constant starts with the first two terms as 1 and 1. So:
Sequence 1: 1, 2, 3, 5, 8, 13...
Sequence 2: 1, 1, 2, 3, 5, 8, 13...

Saturday, December 4, 2010

On the remainder of powers of an integer

There’s a certain rule, which says that, when a number “a” divides different powers of another number N i.e. N1, N2, N3 … the remainders appear in cyclic form i.e. they repeat a fixed pattern.
Eg. 31 divided by 5 gives a remainder of 3
32 = 9 divided by 5 gives a remainder of 4
33 = 27 divided by 5 gives a remainder of 2
34 = 81 divided by 5 gives a remainder of 1
35 = 243 divided by 5 gives a remainder of  3
and that’s when the pattern starts repeating (3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1…)

The proof of this is what will now follow. Note: I will only work with the domain of positive integers in the whole of this proof. 

Denote the remainder of any number x, divided by the number a, by the function R(x).

Now, first take a number  N, which, when divided by a, gives a remainder of r.
R(N) = r
Then, N = an + r (where n is an integer)
Raise N to the pth power (p being a positive integer)
Np = (an + r)p
= (an)p + ……… + rp
(by binomial expansion) ---- (1) 
Here, all the terms before rp have an “a” in them, and are therefore together a multiple of a.
So, Np = (multiple of a) + rp
Therefore, rp divided by a will give the same remainder as when Np is divided by a. *
i.e. R(rp) = R(Np) ---- (2)

Now let us prove something first:
If R(rx) = R(ry)
Then R(rx+1) = R(ry+1)

Say R(rx) = R(ry) = R' 
rx = nxa + R'
rx+ 1 = rx . r 
Thus, rx+1 = (nxa + R')r = r nxa + R'r
Similarly, ry = nya + R'
ry+1 = ry . r
ry+1 = (nya + R')r = r nya + R'r
Then, both rx+1 and ry+1 are in the form (multiple of a) + R'r
So R'r divided by a gives the same remainder as rx+1 divided by a
R'r divided by a also gives the same remainder as ry+1  divided by a
=> rx+1 divided by a gives the same remainder as ry+1 divided by a
R(rx+1) = R(ry+1) Proved.

From (2),
If R(Nx) = R(Ny)
Then R(Nx+1) = R(Ny+1) ---- (3)

Take R(Np) as R. If R is not equal to 0, then R can go from 1, 2, 3, 4, … upto a-1. That is a maximum of a-1 possibilities for the value of R. If every next R is different, then we can have at most (a-1) different R’s, after which, R will repeat a value already obtained before, and the rule stated in (3) will cause R to cycle among its fixed values.
Therefore, in the series R(N), R(N2), R(N3), R(N4) etc., we need only find a single repetition in the value of R to ensure that R will repeat in the same fashion ad infinitum.





* Addendum: We can use the rule stated in (2) to simplify finding the remainder of powers of large numbers, for example: 8725 divided by 7.
We note that 87 = 12*7 + 3
Thus, the remainder gotten when 8725 is divided by 7 is the same as the remainder when 325 is divided by 7. Then,
1. 3 / 7 -> 3 ---(1)
2. 9 / 7 -> 2 ---(2)
3. 27 / 7 -> 6 ---(3)
4. 81 / 7 -> 4 ---(4)
5. 243 / 7 -> 5 ---(5)
6. 729 / 7 -> 1 ---(6)
7. 2187 / 7 -> 3 ---(1)
That’s where the repetition starts. So it starts at 3 and cycles every 6 powers. 25 = 6*4 + 1. Thus, the remainder when 325 is divided by 7 is 3, and consequently, the remainder when 8725 is divided by 7 is also 3.

Thursday, December 2, 2010

On the reflection of a point over a line

Did some brain-storming to come up with this (even if it is probably already done) formula to find the reflection P'(x2, y2) of a point P(x1, y1) over a line:
Ax + By + C = 0 --- (1)

 Idea: I will use two equations in x2 and y2, containing constants A, B, C, x1 and y1, to derive the value of x2 and y2 in terms of the said constants. For the first equation, I shall take the help of the equation of the straight line passing through P and P'. For the second equation, I shall use the midpoint formula for the point M(a, b) that lies on line (1) and lies between P and P'.

Ok, let’s look at the figure first. Suffice to say, it represents the reflection of any point over a general straight line.

PP' is a line that is perpendicular to (1)
So the equation of PP’ would be:
Bx – Ay + K = 0 --- (2)
where K is a constant
[reason: the slope of line (1) is found to be –A/B, and since line (2) is perpendicular to line (1), its slope must be B/A (to give a product of –1), which gives us equation (2)]
As P(x1, y1) lies on line (2),
Bx1 – Ay1 + K = 0
K = Ay1 – Bx1
Thus, line (2) can be written as:
Bx – Ay + (Ay1 – Bx1) = 0 --- (2)
As P'(x2, y2) also lies on this line,
Bx2 – Ay2 + (Ay1 – Bx1) = 0
=> Ay2 = Bx2 + (Ay1 – Bx1)
=> y2 = [Bx2 + (Ay1 – Bx1)]/A --- (A)

Now let us look at the point M(a, b) which lies on line (1) and is half-way between P and P'
(As P' is the reflection of P over line (1), PM = MP')
By the mid-point formula,
(x1 + x2)/2 = a
(y1 + y2)/2 = b
(a, b) lies on line (1), so:
Aa + Bb + C = 0
=> A(x1 + x2)/2 + B(y1 + y2)/2 + C = 0
=> [Ax1 + Ax2 + By1 + By2 + 2C]/2 = 0
=> Ax2 + By2 + [Ax1 + By1 + 2C] = 0
=> By2 = -Ax2 – (Ax1 + By1 + 2C)
=> y2 = [-Ax2 – Ax1 – By1 – 2C]/B --- (B)


Thus from (A) and (B),
Bx2 + (Ay1 – Bx1)     =      -Ax2 – Ax1 – By1 – 2C
A                                         B
B2x2 + B(Ay1 – Bx1) = -A2x2 – A2x1 – ABy1 – 2AC
(A2 + B2)x2 = - ABy1 + B2x1 – A2x1 – ABy1 – 2AC
x2 = (B2 – A2)x1 – 2ABy1 – 2AC
                   (A2 + B2)
Therefore, from (A),
y2 = B[(B2 – A2)x1 – 2ABy1 – 2AC]/(A2 + B2) + Ay1 – Bx1
                                                A
= B3x1 – A2Bx1 – 2AB2y1 – 2ABC + A3y1 + AB2y1 – A2Bx1 – B3x1
                                    A(A2 + B2)
= A3y1 – 2A2Bx1 – AB2y1 – 2ABC
                        A(A2 + B2)
= A2y1 – 2ABx1 – B2y1 – 2BC
                        (A2 + B2)
y2 = (A2 – B2)y1 – 2ABx1 – 2BC
                   (A2 + B2)


Let’s try this formula for a certain case, when a point is reflected on the line:
y = -x
i.e. x + y = 0
Then, A = 1, B = 1, C = 0
x2 = 0 – 2y1 – 0   = -y1
            1 + 1
y2 = 0 – 2x1 – 0   = -x1
            1 + 1