Chaitanya's Random Pages

May 28, 2011

Perth’s hot summer

Filed under: climate and weather — ckrao @ 8:09 am

After seeing how hot Perth had been this summer, I decided to graph its temperatures over the recent warm months.

The Perth Metro office only has records going back to 1994, hence the fluctuations in the average temperatures. Data is from the Australian Government’s Bureau of Meteorology website (average temperatures from here).

Perth had a run of 27 consecutive days of 30+ °C (86+ °F) temperatures, from the 6th of February to the 4th of March. This was followed by a second such run of 17 days from the 21st of March to the 6th of April. Fortunately there were not too many 40°C days. The minimum temperature stayed above 20°C (68°F) for 17 days from February 14 to March 2.

Perth has had a run of significantly above-average mean maximum temperatures dating back to September last year. Average maximum and minimum temperatures (in °C) from September 2010 to April 2011 were as follows.

September October November December January February March April
Average Max 21.8 24.6 29.6 29.3 32.5 34.1 31.9 27.3
Average Max (’94-’11) 20.1 23.0 26.4 28.8 31.0 31.5 29.5 25.7
Anomaly +1.7 +1.6 +3.2 +0.5 +1.5 +2.6 +2.4 +1.6
Average Min 8.2 10.7 15.3 16.6 19.5 21 18.6 14.8
Average Min (’94-’11) 9.4 11.2 14.1 16.2 18.0 18.2 16.5 13.6
Anomaly -1.2 -0.5 +1.2 +0.4 +1.5 +2.8 +2.1 +1.2

In addition, while the rest of the Australia has been drenched by much higher than average rainfall in the past year, south western WA has been extremely dry these past 12 months. See here for an interesting map for rainfall, here for a corresponding map for average maximum temperature. In the latter map the most interesting feature is the lack of white in the map (where rainfall was in the 4th-7th decile)!

More reading: – Jim Andrews | Endless Perth Summer; Is It Ending?

Perth in Summer 2011:

Heatwaves in the Perth Area – includes a list of Perth heatwaves to 2003

May 22, 2011

Two proofs of Fermat’s theorem on sums of two squares

Filed under: mathematics — ckrao @ 7:55 am

Way back in 1640 Fermat stated that an odd prime number p can be written as the sum of two squares if and only if it has remainder 1 when divided by 4 (i.e p is of the form p = 4k+1 where k is an integer). It is believed that the first proof was given by Euler in 1747. Below are shown two of my favourite proofs in the “if” direction (the “only if” direction follows from any odd square being 1 modulo 4).  Another cool proof worth looking at is by application of Minkowski’s Theorem for bounded symmetric convex sets [5].

In both proofs we use the fact that if p = 4k+1, then there exists an integer a such that a^2 + 1 \equiv 0 \mod p. For example, we may choose a = (2k)!, since

\begin{array}{lcl} a^2 &\equiv& (1.2\ldots 2k)(1.2\ldots 2k)\ \mod p\\& \equiv & (1.2\ldots 2k)(-1).(-2)\ldots (-2k) (-1)^{2k}\ \mod p\\ &\equiv& (1.2\ldots 2k)(p-1).(p-2)\ldots (p-2k)\ \mod p\\ & \equiv & (p-1)! \ \mod p \\ &\equiv& -1 \mod p,\end{array}

where the last step follows from Wilson’s theorem (in (p-1)! each element can be paired with its multiplicative inverse except for 1 and (p-1) – hence the product of the numbers from 1 to p-1 has remainder (p-1) modulo p).

Proof using Gaussian Integer Factorisation ([1]):

In the set of Gaussian integers (\left\{m + ni: m,n \in \mathbb{Z}, i^2 = -1\right\}), one can divide a number x by another y to obtain a quotient q and remainder r where |r| < |y|. This fact leads to unique factorisation being possible among the Gaussian integers (Euclidean domain implies unique factorisation via the principal ideal domain property.) Using the a found above, since a^2 + 1 is divisible by p and neither of its factors (a+i) nor (a-i) are multiples of p, p cannot be prime in the set of Gaussian integers. Hence we may write p = cd, where c and d are Gaussian integers each with norm greater than 1. This gives

p^2 = |c|^2 |d|^2,

which forces |c|^2 = |d|^2 = p. Therefore if c = x+ iy we have

x^2 + y^2 = |c|^2 = p,

showing that p can be written as the sum of two squares.

Proof by Pigeonhole Principle ([2]):

Using the a found above, consider the set of integers ax-y, where integers x and y satisfy 0 \leq x,y < \sqrt{p}. The number of possible pairs (x,y) is \left( \left \lfloor \sqrt{p} \right \rfloor + 1\right)^2 > \left( \sqrt{p} \right)^2, and so applying the pigeonhole principle, there exist two distinct pairs (x_1,y_1) and (x_2,y_2) such that

\displaystyle ax_1-y_1 \equiv ax_2 - y_2\ \mod p.

Hence \displaystyle a(x_1 - x_2) \equiv y_1 - y_2\ \mod p and (y_1-y_2)^2 = a^2(x_1 - x_2)^2 \equiv (-1)(x_1 - x_2)^2 \ \mod p. This means

\displaystyle (x_1 - x_2)^2 + (y_1 - y_2)^2 \equiv 0 \ \mod p.

Since the pairs (x_1,y_1) and (x_2,y_2) are distinct and 0 \leq x_i,y_i < \sqrt{p},

\displaystyle 0 < (x_1 - x_2)^2 + (y_1 - y_2)^2 < \left(\sqrt{p}\right)^2 + \left(\sqrt{p}\right)^2 = 2p.

This forces (x_1 - x_2)^2 + (y_1 - y_2)^2 = p and we are done.

Some more facts:

  • A positive integer can be written as the sum of two squares if and only if any prime factor of the form 4k+3 occurs as an even power in its factorisation. To proves this requires the beautiful fact that if two numbers are each the sum of two squares, so too is their product:

    \begin{array}{lcl}(a^2 + b^2)(c^2 + d^2) &=& (a+bi)(a-bi)(c+di)(c-di)\\ &=& (a+bi)(c+di)(a-bi)(c-di)\\ &=& (ac-bd)^2 + (ad + bc)^2. \end{array}.

  • The number of ways in which the positive integer n = 2^{a_0}p_1^{2a_1}\ldots p^{2a_r} q^{b_1}\ldots q^{b_s} can be written as the sum of two squares (here p_i have the form 4k+3, q_i have the form 4k+1) is

    r(n) = 4(b_1 +1)(b_2+1)\ldots(b_s+1),

    where signs and order are distinguished (e.g. r(5) = 8). [3]

  • We have the limit

    \displaystyle \lim_{N \rightarrow \infty} \frac{1}{N}\sum_{n=1}^N r(n) = \pi.

    This can be proved by counting the number of lattice points inside a circle of radius \sqrt{N}, then in the limit this number becomes the area of the circle. [4]

  • Finally, if signs and order are not to be distinguished (e.g. 5 can be written as the sum of two squares in the one way 2^2 + 1^2), the number of ways n = 2^{a_0}p_1^{2a_1}\ldots p^{2a_r} q^{b_1}\ldots q^{b_s} can be written as the sum of two squares is ([3])

    \displaystyle \frac{1}{2} \left( (b_1 +1)(b_2+1)\ldots(b_s+1) - (-1)^{a_0} \right), if all of the b_i values are even,
    \displaystyle \frac{1}{2} (b_1 +1)(b_2+1)\ldots(b_s+1) otherwise.

    (The first case deals with the possibility of whether n is of the form n = 2x^2, in which case it has the additional representation x^2 + x^2.)



[2] N. Sato, Number Theory Olympiad notes, available at

[3] Weisstein, Eric W. “Sum of Squares Function.” From MathWorld–A Wolfram Web Resource.

[4] Sum of Two Squares Ways – Math Fun Facts

[5] I. Stewart and D. Tall, Algebraic Number Theory and Fermat’s Last Theorem, 3rd edition, 2002.

May 14, 2011

Highest scoring quarters in an AFL game

Filed under: sport — ckrao @ 7:28 am

The other week Essendon scored 15 goals in the first quarter against AFL newcomers Gold Coast. It turns out that this was the second highest score by a team in a quarter in the 114-year history of the league.

17.4 106 Q4 South Melbourne 2.5 6.7 12.11 29.15 189 St Kilda 0.0 2.2 2.6 2.6 18 Lake Oval 26-Jul-1919
15.4 94 Q1 Essendon 15.4 18.4 25.8 31.11 197 Gold Coast 0.1 5.3 7.5 8.10 58 Docklands 01-May-2011
14.3 87 Q4 Geelong 7.4 16.9 23.14 37.17 239 Brisbane Bears 2.2 2.4 7.8 11.9 75 Carrara 03-May-1992
14.2 86 Q2 Adelaide 5.1 19.3 23.6 26.10 166 Fitzroy 1.4 1.5 3.11 9.13 67 Football Park 28-Jul-1996
14.1 85 Q2 Carlton 1.4 15.5 22.9 27.13 175 Essendon 5.1 9.2 13.3 15.5 95 Windy Hill 05-Jul-1975
13.7 85 Q4 Sydney 5.4 15.8 23.13 36.20 236 Essendon 5.2 8.2 10.5 11.7 73 S.C.G. 26-Jul-1987
13.6 84 Q4 Brisbane Lions 3.4 9.9 12.15 25.21 171 Fremantle 6.2 8.4 15.6 19.8 122 Gabba 29-Apr-2001

Essendon ended up scoring 20 more goals than behinds (31-11), just 3 shy of the record of 23 set by Geelong against Richmond (35-12) in 2007.

Edit (July 30 2011): Geelong today scored 37-11 against Melbourne so the new record is 26 more goals than behinds.


May 8, 2011

Interesting identities through partial fractions

Filed under: mathematics — ckrao @ 5:14 am

While working on my previous mathematical post on fractions, I stumbled across the following nice identities:

\displaystyle \frac{1}{x(x+1)} = \frac{1}{x} - \frac{1}{x+1}

\displaystyle \frac{1}{x(x+1)^2} = \frac{1}{x} - \frac{1}{x+1} - \frac{1}{(x+1)^2}

\displaystyle \frac{1}{x(x+1)^3} = \frac{1}{x} - \frac{1}{x+1} - \frac{1}{(x+1)^2} - \frac{1}{(x+1)^3}

In general,

\displaystyle \frac{1}{x(x+1)^n} = \frac{1}{x} - \sum_{i=1}^n\frac{1}{(x+1)^i}.

We can go further and raise both x and (x+1) to powers:

\displaystyle \frac{1}{x^2(x+1)^2} = -\frac{2}{x} + \frac{1}{x^2} + \frac{2}{x+1} + \frac{1}{(x+1)^2}

\displaystyle \frac{1}{x^2(x+1)^3} = -\frac{3}{x} + \frac{1}{x^2} + \frac{3}{x+1} + \frac{2}{(x+1)^2} + \frac{1}{(x+1)^3}

\displaystyle \frac{1}{x^2(x+1)^n} = -\frac{n}{x} + \frac{1}{x^2} + \sum_{i=1}^n \frac{n+1-i}{(x+1)^i}


\displaystyle \frac{1}{x^3(x+1)^3} = \frac{6}{x} - \frac{3}{x^2} + \frac{1}{x^3} - \frac{6}{x+1} - \frac{3}{(x+1)^2} - \frac{1}{(x+1)^3}

\displaystyle \frac{1}{x^3(x+1)^4} = \frac{10}{x} - \frac{4}{x^2} + \frac{1}{x^3} - \frac{10}{x+1} - \frac{6}{(x+1)^2} - \frac{3}{(x+1)^3} - \frac{1}{(x+1)^4}

This suggests a connection with binomial coefficients. We conjecture

\displaystyle \frac{1}{x^m(x+1)^n} = \sum_{i=1}^m \frac{A_i}{x^i} + \sum_{i=1}^m \frac{B_i}{(x+1)^i},

where \displaystyle A_i = (-1)^{m-i}\binom{m+n-1-i}{n-1}, B_i = (-1)^m\binom{m+n-1-i}{m-1}.

To prove this, we use the technique mentioned in my previous fractions post. To find the A_i we multiply both sides by x^i and move terms with powers of x in the denominator to the other side:

\begin{array}{rcl} \frac{1}{x^{m-i}(x+1)^n} &=& A_1x^{i-1} + A_2x^{i-2} + ... + A_i + \frac{A_{i+1}}{x} + ... + \frac{A_m}{x^{m-i}} + \sum_{j=1}^n \frac{B_jx^i}{(x+1)^j}\\ \Rightarrow A_1 x^{i-1} + A_2 x^{i-2} + ... + A_i + \sum_{j=1}^n\frac{B_jx^i}{(x+1)^j} &=& \frac{1}{x^{m-i}(x+1)^n} -\left(\frac{A_{i+1}}{x} + ... + \frac{A_m}{x^{m-i}} \right)\\ &=& \frac{1-p(x)(x+1)^n}{x^{m-i}(x+1)^n},\end{array}

where p(x) is a polynomial. Taking the limit of both sides as x \rightarrow 0 requires (m-i) applications of l’Hôpital’s rule on the right side (using the fact that 1-p(x)(x+1)^n has root x=0 with multiplicity m-i). We end up with

\begin{array}{lcl}\displaystyle A_i &=& \frac{1}{(m-i)!}\lim_{x \rightarrow 0}\left(\frac{d}{dx}\right)^{m-i} \frac{1}{(x+1)^n}\\ &=& \frac{1}{(m-i)!}\lim_{x \rightarrow 0} (-n)(-n-1)...(-n-(m-i) + 1)(x+1)^{-n-(m-i)}\\&=& (-1)^{m-i}\binom{m+n-1-i}{n-1}.\end{array}


\begin{array}{lcl}\displaystyle B_i &=&\frac{1}{(n-i)!}\lim_{x \rightarrow -1}\left(\frac{d}{dx}\right)^{n-i} \frac{1}{x^m}\\&=&\frac{1}{(n-i)!}\lim_{x \rightarrow -1} (-m)(-m-1)...(-m-(n-i)+1)x^{-m-(n-i)}\\&=& (-1)^{n-i-m-n+i}\binom{m+n-i-1}{n-i}\\&=&(-1)^m\binom{m+n-1-i}{m-1},\end{array}

as was to be shown.

May 1, 2011

Shrews and Moles

Filed under: nature — ckrao @ 5:54 am

Shrews and moles are both small insectivorous mammals and may look alike, but according to at least one study they diverged on the evolutionary tree at least 80 million years ago. Moles live in underground tunnels, so have enlarged forefeet with long claws and webbing designed for burrowing, while shrews are mostly on the ground in a wide range of habitats, have small feet like mice, and may make tunnels through leaf litter at best. Shrews have hair on their snout while moles do not. Moles are generally larger than shrews too.

There are many life forms with the word shrew or mole in them!

shrew  any of 376 species in the family Soricidae
treeshrew  any of 20 species in the order Scandentia, found in the tropical forests of SE Asia, more closely related to primates than rodents or shrews
elephant shrew  any of 17 insectivorous species in the order Macroscelidea found in Africa, characterised by their long snout
otter shrew  any of 3 species in Afrosoricida (the order also containing tenrecs and golden moles) -> Tenrecidae -> Potamogalinae, found in subsaharan Africa
West Indies shrew  any of 6-12 now-extinct species of the family Nesophontidae
shrew mouse  either another name for shrew, or one of various rodents thought to resemble shrews
shrew opossum  any of 6 marsupial species of the order Paucituberculata living in the Andes mountains
shrew mole  any of 7 species of mole that resemble shrews
mole shrew  any of 6 species of shrew that resemble moles!
shrew gymnure or shrew hedgehog  single species of gymnure found in China, Myanmar and Vietnam
shrew rat  any of several species of rodents found in Sulawesi (Indonesia) and the Philippines
shrew tenrec  any of 22 species of the genus Microgale (including the interestingly named shrew-toothed shrew tenrec!)
shrew-faced squirrel  also known as the long-nosed squirrel, a single species found in SE Asia
shrewish short-tailed opossum  also known as the Southern Red-sided Opossum, a single species of opossum (not shrew opossum!), found in Argentina, Brazil and Paraguay
shrewlike rat  any of 4 species of the rat genus Rynchomys, found only on the island of Luzon (Philippines), also known as tweezer-beaked rats
mole  most of the mammals of the family Talpidae (42 out of 44 species), including 7 shrew mole species mentioned above
golden mole  any of 21 species of the family Chrysochloridae, from Southern Africa
marsupial mole  any of 2 species of the order Notoryctemorphia from Western Australia, very similar in appearance to golden moles as an example of convergent evolution
mole-rat  one of various burrowing rodents from several groups
mole crab  also known as sand crabs, any member of Hippoidea, a super-family of crabs
mole cricket  any member of the cricket family Gryllotalpidae
Mexican mole lizard  also known as the five-toed worm lizard or Ajolote lizard, one of four amphisbaenians (worm lizards) to have legs
mole lobster  also known as a furry lobster, any member of the family Synaxidae (3 species)
mole plant  a species of spurge from southern Europe and north Africa through to western China
mole salamander  any of 32 species of North American salamanders of the family Ambystomatidae
mole snake  the single species of snake Pseudaspis cana
mole viper  any of 66 species of snake in the family Atractaspididae

Reference: – Difference Between a Mole and a Shrew

Create a free website or blog at

%d bloggers like this: