## Merry Christmas!!!

Posted: December 24, 2012 in Mathematics

## The video I watched in the previous blog

Posted: December 23, 2012 in Mathematics

Someone asked me the url of the youtube video I mention on my previous blog, so here it is. I am not that great in mandarin plus he talked really fast in the video. I only understand what he wrote on the paper and maybe one-tenth of the words that came out of his mouth. ðŸ™‚

## approximating square root of nature numbers with Pell’s equation

Posted: December 21, 2012 in Mathematics

This post could be my last post before the world ends, or it could be the celebration for “Hey, we are still alive in the day of doom”.Â  Last night after I had the last hotpot supper with my friends and a nice sauna at the gym I went home and continue working on my project, but instead I watched youtube and I stumbled upon on an interesting video talking about Diophantine equations and Fermat’s method of ascent.Â  In the video, he illustrates how to find integral solution of Pell’s equation by Fermat’s method of ascent.Â  And now I am going to investigate further on Pell’s equation.Â  In Diophantine equation, we only find solution in integers.

History of Pell’s equation:

So what is Pell’s equation?Â  There is an interesting story about it.Â  The equation was named after a mathematician John Pell who didn’t study it.Â  Euler mistakenly confused William Brouncker, who was the first European studying the equations of this kind, with John Pell.Â  Pell’s equation is any Diophantine equation of the form:

$x^2-my^2=1$

where $m$ is any positive integer which is not a perfect square.Â  Why can’t $m$ be a perfect square?Â  If it is a perfect square, then there exists $t\in\mathbb{Z}$ such that $x^2-(ty)^2=1$.Â  Contradiction, since the difference between two perfect squares cannot equal to 1.

Method of solving Pell’s equation:

Solving Pell’s equation sometimes isn’t really that difficult.Â  Let’s say you wanna solve the Pell’s equation

$x^2-2y^2=1$.

The trivial solution would be $x=1$ and $y=0$.Â  But can you find more solution?Â  Yes, without any difficulty you should be able to spot another solution of ${x=3, y=2}$.Â  Then the next question is:Â  Is there more solution?Â  And how to find them?Â  In fact there are infinitely many solution to this Pell’s equation.Â  They can be found by the following recursive formula:

$x_{n+1}=3x_n+4y_n$

$y_{n+1}=2x_n+3y_n$

So, if

$x_0=3$

$y_0=2$

then

$x_1=3(3)+4(2)=17$

$y_1=2(3)+3(2)=12$

To check it, let’s plug them back to the equation,

$17^2-2(12^2)=289-2(144)=289-288=1$

So indeed it works.Â  To show that it always work, we need to plug in the $x_{n+1}$ and the $y_{n+1}$

$(x_{n+1})^2-2(y_{n+1})^2=(3x_n+4y_n)^2-2(2x_n+3y_n)^2$

$=9x_n^2+16y_n^2+24x_ny_n-8x_n^2-18y_n^2-24x_ny_x$

$=x_n^2-2y_n^2=1$

Now you may ask “How to figure out the coefficient of 3 and 4 in $x_{n+1}=3x_n+4y_n$ or 2 and 3 in $y_{n+1}=2x_n+3y_n$?”

Here is how you find them:

Let Pell’s equation

$x^2-my^2=1$

with non perfect square $m$.Â  If $x_0, y_0$ is particular solution such that

$x_0^2-my_0^2=1$,

then let

$x_{n+1}=ax_n+by_n$

$y_{n+1}=cx_n+dy_n$

where $a, b, c, d \in \mathbb{Z^+}$

then

$(x_{n+1})^2-m(y_{n+1})^2=(ax_n+by_n)^2-m(cx_n+dy_n)^2=1$

$a^2x_n^2+b^2y_n^2+2abx_ny_n-mc^2x_n^2-md^2y_n^2-2cdmx_ny_n=1$

then collect like terms and comparing with $x_n^2-my_n^2=1$

$2ab-2cdm=0 \Longrightarrow ab=cdm \Longrightarrow a^2b^2=c^2d^2m^2$

$a^2-mc^2=1 \Longrightarrow a^2=1+mc^2$

$b^2-md^2=-m \Longrightarrow b^2=md^2-m$

hence

$a^2b^2 = md^2-m+c^2d^2m^2-m^2c^2=c^2d^2m^2$

then

$md^2-m-m^2c^2=0$

$d^2-1-mc^2=0$

$d^2-mc^2=1$

Now if $d=x_0, c=y_0$, then

$a^2=1+my_0^2=x_0^2$

$\therefore a=x_0$

$b^2=mx_0^2-m=m(x_0^2-1)=m(my_0^2)$

$\therefore b=my_0$

Therefore,

$x_{n+1}=x_0x_n+my_0y_n$

$y_{n+1}=y_0x_n+x_0y_n$

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So for $x^2-2y^2=1, m=2, x_0=3, y_0=2$

then

$x_{n+1}=3x_n+4y_n$

$y_{n+1}=2x_n+3y_n$

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If we divide both sides of the equation $x^2-my^2=1$ by $y^2$, we have

$\left(\dfrac{x}{y}\right)^2-m=\dfrac{1}{y^2}$

$\dfrac{x}{y}=\sqrt{m+\dfrac{1}{y^2}}$

As $y\to\infty, \sqrt{m+\dfrac{1}{y^2}} \to \sqrt{m}$

Therefore we can approximate square root of any non-perfect numbers by Fermat’s method of ascent on Pell’s equation.

For example, to approximate $\sqrt{2}$, takes $m=2, x_0=3, y_0=2, x^2-2y^2=1$

$x_{n+1}=3x_n+4y_n$

$y_{n+1}=2x_n+3y_n$

$x_1=3(3)+4(2)=17$

$y_1=2(3)+3(2)=12$

$x_2=3(17)+4(12)=99$

$y_2=2(17)+3(12)=70$

$x_3=3(99)+4(70)=577$

$y_3=2(99)+3(70)=408$

$x_4=3(577)+4(408)=3363$

$y_4=2(577)+3(408)=2378$

$\therefore \sqrt{2} \approx \dfrac{3363}{2378}$

———————————————————————–

Let’s do one more, $\sqrt{3}$

Consider

$x^2-3y^2=1$

Since $7^2-3(4)^2=1 \Rightarrow x_0=7, y_0=4, m=3$

then

$x_{n+1}=x_0x_n+my_0y_n$

$y_{n+1}=y_0x_n+x_0y_n$

becomes

$x_{n+1}=7x_n+12y_n$

$y_{n+1}=4x_n+7y_n$

$x_1=7(7)+12(4)=97$

$y_1=4(7)+7(4)=56$

$x_2=7(97)+12(56)=1351$

$y_2=4(97)+7(56)=780$

$\therefore \sqrt{3} \approx \dfrac{1351}{780}$

More iterations will achieve better approximation.

## 0 = -1 proof

Posted: December 9, 2012 in Mathematics

I think some of you may have seen many 0=1 proofs already.Â  Today I am going to show you another one.Â  So let’s begin.

Theorem:Â  1=0.

Proof:

Just for fun let’s integrate $\tan x$,

$\displaystyle \int \tan x\;dx=\int \frac{\sin x}{\cos x}\;dx$

Next we let,

$\displaystyle u=\frac{1}{\cos x}, dv=\sin x\;dx$

$\displaystyle du=\frac{\sin x}{\cos^2 x} \;dx, v=-\cos x$

Integration by Parts then give us,

$\displaystyle \int\tan x\;dx=\frac{-\cos x}{\cos x}-\int(-\cos x)\frac{\sin x}{\cos^2 x}\;dx=-1+\int\tan x\;dx$

Subtract the integral from both sides, we have,

$0=-1$

add 1 onto both sides of the equation, and therefore 1=0. $\square$

Of course everyone knows zero can’t possible equal to one, but can you find where the error is? ðŸ˜€

## not every 4 years a leap year?

Posted: December 4, 2012 in Mathematics
Tags: ,

I have just found out that not every four years there is a leap year. It maybe true for my lifetime and probably yours, but it may not be true for your kids or grandkids.

Before I go any further, I have to define what a leap year is. A leap year is when there is a Feb 29th in the particular year. For those years that do not have Feb 29th are called common years. The reason that a leap year has an extra day (366 days) is that the planet Earth rotates around the sun in approximately 365.242374 days. So that’s about 365.25 days. And if you multiply this number by 4, you will get an extra day every four years.

$365.25 \times 4 = (365+0.25) \times 4 = 365\times 4+1$

So this is how we were taught in elementary school that whenever the year is a multiple of 4, it is a leap year. For example, year 2000, 2004, 2008, 2012, etc all have the leap day Feb 29th. But if you look further beyond the calendar, you will find that there is no Feb 29th in the year 2100. You can check it in your electronic devices like laptop or iPhone. Certainly 2100 is a multiple of 4, and if you keep adding a 4 in the sequence 2000, 2004, 2008, …, etc; 2100 is in the list. So what the hell is happening?

I looked that up in wikipedia, this is what I found out in pseudocode:

if year modulo 400 is 0 then is_leap_year else if year modulo 100 is 0 then not_leap_year else if year modulo 4 is 0 then is_leap_year else not_leap_year 

In simple English, usually every 4 years is a leap year except for those years that are a multiple of 100 but not a multiple of 400. For example, 2100, 2200, and 2300 are multiple of 100, so those are considered common years. The year 2000 is a multiple of 400, so it is still considered a leap year and so as year 2400. If you can live that long, you will witness 7 consecutive common years: 2097, 2098, 2099, 2100, 2101, 2102, 2103.

Certainly I will be dead by then. But maybe our kids or grandkids can live through the year 2100.

## god is hiding in mathematics

Posted: December 1, 2012 in Mathematics
Tags: , ,

What equals to 100% in life?Â  How to get that extra one percent?Â  Here is a little math that might help answering the questions.

Suppose A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z are represented by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26.

We have,

H-A-R-D-W-O-R-K
8+1+18+4+23+15+18+11=98%

and

K-N-O-W-L-E-D-G-E
11+14+15+23+12+5+4+7+5=96%

but

A-T-T-I-T-U-D-E
1+20+20+9+20+21+4+5=100%

then, look how far the love of god will give you

L-O-V-E-O-F-G-O-D
12+15+22+5+15+6+7+15+4=101%

Therefore one can conclude that while hard work and knowledge will get you close, and attitude will definitely get you there, but it’s the love of god that will put you over the top!