Chaitanya's Random Pages

April 30, 2015

Number of countries that have abolished the death penalty by year

Filed under: Uncategorized — ckrao @ 11:36 am

The graph below is generated from data at this Wikipedia page.

By 1978 only 20 or so countries had abolished the death penalty but over 80 countries have followed suit since. Around 36 countries still retain capital punishment in law and practice with the remaining 50+ countries inactive in its use.


April 19, 2015

Distances to a line from vertices of a regular polygon

Filed under: mathematics — ckrao @ 11:01 am

If we take a regular polygon and any line through its centre, then the sum of the squares of the distances from the vertices of the polygon to the line is independent of the orientation of the line or polygon. For example, in the following two diagrams, the sum of the squares of the lengths of the 5 blue line segments is the same.


Such a result is amenable to a proof via complex numbers. Without losing generality the real number line may be our line of interest and the points of the n-sided polygon may be described by the complex numbers z_k := R\exp(2\pi i k / n + i \phi) for k = 0, 1, ..., n-1, where R is the circumradius of the polygone and \phi is an arbitrary real-numbered phase. Then the squared distance from a point to the real line is R^2\cos^2 (2\pi k / n + \phi) = \left(z_k + \overline{z_k})\right)^2/4 where \overline{z_k} = R^2/z_k. Summing this over k gives our sum of squared distances as

\begin{aligned} \frac{1}{4} \sum_{k=0}^{n-1} \left(z_k + \overline{z_k}\right)^2  &= \frac{1}{4} \sum_{k=0}^{n-1} \left(z_k^2 + 2z_k\overline{z_k} + \overline{z_k}^2\right)\\  &= \frac{1}{4} \sum_{k=0}^{n-1} \left(z_k^2 + 2R^2 + \overline{z_k}^2\right)\\  &= \frac{nR^2}{2} + \frac{1}{4} \left(\sum_{k=0}^{n-1} z_k^2 + \sum_{k=0}^{n-1} \overline{z_k}^2\right).\quad\quad(1)\end{aligned}

 Each of these sums is geometric in nature so can be simplified. For example,

\begin{aligned}\sum_{k=0}^{n-1} z_k^2 &= \sum_{k=0}^{n-1} R^2\exp(4\pi i k / n + 2i\phi)\\&= R^2 \exp(2i\phi)\sum_{k=0}^{n-1} \exp(4\pi i k / n)\\  &= \begin{cases}R^2 \exp(2i\phi)\frac{1-\exp(4\pi i n / n)}{1- \exp(4\pi i / n)}, & \text{if }\exp(4\pi i/n)\neq 1 \\  R^2 \exp(2i\phi)n, & \text{if }\exp(4\pi i/n)= 1 \end{cases}\\  &= R^2 \exp(2i\phi)\frac{1-\exp(4\pi i)}{1- \exp(4\pi i / n)}, \quad \text{as }n \geq 3\text{ means }\exp(4\pi i/n)\neq 1\\  & = 0.\quad\quad(2)\end{aligned}

Similarly, \sum_{k=0}^{n-1} \overline{z_k}^2 = 0, being the conjugate of (2), and so from (1) our required sum of squared distances is nR^2/2, which is independent of \phi proving the orientation independence.

More generally,

\begin{aligned}\sum_{k=0}^{n-1} z_k^m &= R^m\exp(i m \phi) \sum_{k=0}^{n-1} \exp(2\pi i k m / n) \\  &= \begin{cases} R^m\exp(i m \phi) n, & \text{if }m/n \text{ is an integer}\\ 0, & \text{otherwise}\end{cases}.\quad\quad(3)\end{aligned}

This enables us to generalise the above result to the following.

Given a regular n-sided polygon and line through its circumcentre, the sum of the mth power signed distances from the vertices of the polygon to the line is independent of the orientation when n > m.

By signed distances, we mean that points on different sides of the line will have distances of opposite sign.

To prove this, we define z_k := R\exp(2\pi i k / n + i \phi) as before and this time our desired sum is

\begin{aligned}\sum_{k=0}^{n-1} \left(\frac{z_k + \overline{z_k}}{2}\right)^m  &= \frac{1}{2^m}\sum_{k=0}^{n-1} \sum_{j=0}^m z_k^j \overline{z_k}^{m-j} \binom{m}{j}\\  &= \frac{1}{2^m}\sum_{k=0}^{n-1} \sum_{j=0}^m z_k^j (R^2/z_k)^{m-j}\binom{m}{j}\\  &= \frac{1}{2^m}\sum_{k=0}^{n-1} \sum_{j=0}^m z_k^{2j-m} (R^2)^{m-j}\binom{m}{j}\\  &= \frac{1}{2^m} \sum_{j=0}^m (R^2)^{m-j}\binom{m}{j}\sum_{k=0}^{n-1}z_k^{2j-m}. \quad\quad(4)\\  \end{aligned}

By (3), \sum_{k=0}^{n-1}z_k^{2j-m} = 0 unless (2j-m)/n is an integer. For m < n this can only occur in the case j = m/2 (if m is even). Hence (4) becomes

\begin{aligned}\sum_{k=0}^{n-1} \left(\frac{z_k + \overline{z_k}}{2}\right)^m &= \begin{cases} \left(\frac{R}{2}\right)^m\binom{m}{m/2}n, & \text{if }m\text{ is even,}\\ 0, & \text{otherwise.}\end{cases}\end{aligned} \quad\quad(5)

Finally, what if the line does not pass through the centre of the polygon but is instead at distance d from the centre?


This corresponds to replacing \left(\frac{z_k + \overline{z_k}}{2}\right) with \left(\frac{z_k + \overline{z_k}}{2}-d\right) in the above calculations and we find

\begin{aligned} \sum_{k=0}^{n-1} \left(\frac{z_k + \overline{z_k}}{2}-d\right)^m &= \sum_{k=0}^{n-1} \sum_{j = 0}^m\left(\frac{z_k + \overline{z_k}}{2}\right)^j (-d)^{m-j} \binom{m}{j}\\  &= \sum_{j = 0}^m (-d)^{m-j} \binom{m}{j}\sum_{k=0}^{n-1} \left(\frac{z_k + \overline{z_k}}{2}\right)^j\\  &= \sum_{i = 0}^{\lceil{m/2}\rceil} (-d)^{m-2i} \binom{m}{2i} \left(\frac{R}{2}\right)^{2i}\binom{2i}{i} n\\  &= (-1)^m n \sum_{i = 0}^{\lceil{m/2}\rceil} \frac{m!}{(m-2i)!i!i!}d^{m-2i}\left(\frac{R}{2}\right)^{2i}.\quad\quad(6)\end{aligned}

Once again we find the sum is independent of the orientation of the line or polygon. In the particular case of m=2 this sum is nR^2/2 + nd^2, which also may be obtained by an application of the parallel axis theorem.

March 31, 2015

2015 ICC Cricket World Cup Attendances

Filed under: cricket,sport — ckrao @ 10:26 am

The 2015 ICC Cricket World Cup held in Australia and New Zealand saw over one million people attend its 49 matches, with attendances shown below, taken from here.

Match # Date Match Venue Attendance
1 14/02/15 New Zealand d Sri Lanka Hagley Oval, Christchurch 17,228
2 14/02/15 Australia d England Melbourne Cricket Ground 84,336
3 15/02/15 South Africa d Zimbabwe Seddon Park, Hamilton 8,332
4 15/02/15 India d Pakistan Adelaide Oval 41,587
5 16/02/15 Ireland d West Indies Saxton Oval, Nelson 4,143
6 17/02/15 New Zealand d Scotland University Oval, Dunedin 4,684
7 18/02/15 Bangladesh d Afghanistan Manuka Oval, Canberra 10,972
8 19/02/15 Zimbabwe d UAE Saxton Oval, Nelson 2,643
9 20/02/15 New Zealand d England Westpac Stadium, Wellington 30,148
10 21/02/15 West Indies d Pakistan Hagley Oval, Christchurch 14,461
11 21/02/15 Australia v Bangladesh Gabba, Brisbane washed out
12 22/02/15 Sri Lanka d Afghanistan University Oval, Dunedin 2,711
13 22/02/15 India d South Africa Melbourne Cricket Ground 86,876
14 23/02/15 England d Scotland Hagley Oval, Christchurch 12,388
15 24/02/15 West Indies d Zimbabwe Manuka Oval, Canberra 5,544
16 25/02/15 Ireland d UAE Gabba, Brisbane 5,249
17 26/02/15 Afghanistan d Scotland University Oval, Dunedin 3,229
18 26/02/15 Sri Lanka d Bangladesh Melbourne Cricket Ground 30,012
19 27/02/15 South Africa d West Indies Sydney Cricket Ground 23,612
20 28/02/15 New Zealand d Australia Eden Park, Auckland 40,053
21 28/02/15 India d UAE WACA Ground, Perth 8,718
22 1/3/2015 Sri Lanka d England Westpac Stadium, Wellington 18,183
23 1/3/2015 Pakistan d Zimbabwe Gabba, Brisbane 9,847
24 3/3/2015 South Africa d Ireland Manuka Oval, Canberra 8,831
25 4/3/2015 Pakistan d UAE McLean Park, Napier 2,406
26 4/3/2015 Australia d Afghanistan WACA Ground, Perth 12,710
27 5/3/2015 Bangladesh d Scotland Saxton Oval, Nelson 3,491
28 6/3/2015 India d West Indies WACA Ground, Perth 17,557
29 7/3/2015 Pakistan d South Africa Eden Park, Auckland 22,713
30 7/3/2015 Ireland d Zimbabwe Blundstone Arena, Hobart 4,048
31 8/3/2015 New Zealand d Afghanistan McLean Park, Napier 10,022
32 8/3/2015 Australia d Sri Lanka Sydney Cricket Ground 39,951
33 9/3/2015 Bangladesh d England Adelaide Oval 11,963
34 10/3/2015 India d Ireland Seddon Park, Hamilton 10,192
35 11/3/2015 Sri Lanka d Scotland Blundstone Arena, Hobart 3,549
36 12/3/2015 South Africa d UAE Westpac Stadium, Wellington 4,901
37 13/03/15 New Zealand d Bangladesh Seddon Park, Hamilton 10,347
38 13/03/15 England d Afghanistan Sydney Cricket Ground 9,203
39 14/03/15 India d Zimbabwe Eden Park, Auckland 30,076
40 14/03/15 Australia d Scotland Blundstone Arena, Hobart 12,177
41 15/03/15 West Indies d UAE McLean Park, Napier 1,221
42 15/03/15 Pakistan d Ireland Adelaide Oval 9,889
43 18/03/15 QF1: South Africa d Sri Lanka Sydney Cricket Ground 27,259
44 19/03/15 QF2: India d Bangladesh Melbourne Cricket Ground 51,552
45 20/03/15 QF3: Australia d Pakistan Adelaide Oval 35,516
46 21/03/15 QF4: New Zealand d West Indies Westpac Stadium, Wellington 30,250
47 24/03/15 SF1: New Zealand d South Africa Eden Park, Auckland 41,279
48 26/03/15 SF2: Australia d India Sydney Cricket Ground 42,330
49 29/03/15 Final: Australia d New Zealand Melbourne Cricket Ground 93,013

If we compare these numbers with the ground capacities shown below (largely taken from ground pages at ESPNcricinfo), we can make a graph of ground occupancy for each game.

Ground Capacity
Melbourne Cricket Ground 95,000
Adelaide Oval 50,000
Sydney Cricket Ground 44,000
Eden Park, Auckland 41,000
Gabba, Brisbane 37,000
Westpac Stadium, Wellington 33,500
WACA Ground, Perth 24,500
Hagley Oval, Christchurch 18,000
Blundstone Arena, Hobart 16,200
Manuka Oval, Canberra 12,000
Seddon Park, Hamilton 12,000
McLean Park, Napier 10,500
Saxton Oval, Nelson 6,000
University Oval, Dunedin 5,000



We see that most of the first 10 matches (up to the wash-out between Australia and Bangladesh) were close to capacity, while some of the later matches leading up the quarter final had attendances well under 50% of capacity.

Finally, the table below shows the total attendances for games involving each country, as well as average ground occupancy percentages for their matches.

Team total attendance average % occupancy #matches attendance per match
New Zealand    277,024 94.2 9 30,780
Australia    360,086 83.7 8 45,011
India    288,888 73.8 8 36,111
South Africa    223,803 65.1 8 27,975
Scotland      39,518 63.7 6 6,586
Afghanistan      48,847 63.1 6 8,141
West Indies      96,788 60.4 7 13,827
Sri Lanka    138,893 58.6 7 19,842
England    166,221 57.8 6 27,704
Bangladesh    118,337 57.6 6 19,723
Pakistan    136,419 51.3 7 19,488
Ireland      42,352 47.8 6 7,059
Zimbabwe      60,490 47.4 6 10,082
UAE      25,138 23.8 6 4,190

Australia had a lowish attendance for its game against Afghanistan while New Zealand had every match at least 86% full.

March 28, 2015

A triangle centre arising from central projections

Filed under: mathematics — ckrao @ 10:23 pm

In this recent post, the following figure was formed by considering two triangular regions in three-dimensional space, where a,b,c > 0:

\displaystyle ax + by + cz = 1, 0 \leq x, 0 \leq y, 0 \leq z,

\displaystyle ax + by + cz = 1, x \leq 1, y \leq 1, z \leq 1.

2trianglesThe intersection of the two triangles is the cross-section of a cube, but in this post we wish to explore further the centre of similarity of the two triangles.

The line joining (1/a, 0, 0) and ((1-b-c)/a, 1, 1) satisfies

\begin{aligned} (x,y,z) &= (1/a, 0, 0) + t\left[ ((1-b-c)/a, 1, 1)-(1/a, 0, 0) \right]\\ &= (t,t,(1-ta-tb)/c), t \in \mathbb{R}. \end{aligned}

Similarly, the line joining (0,1/b,0) and (1,(1-a-c)/b,1) satisfies

(x,y,z) = (u, (1-ua-uc)/b, u), u \in \mathbb{R}.

Equating the two expressions gives t = u and t = (1-ta-tc)/b from which t = u = 1/(a+b+c). The point of intersection is therefore at (t,t,(1-ta-tb)/c) = (1/(a+b+c), 1/(a+b+c), 1/(a+b+c)). By symmetry of this expression the line joining (0,0,1/c) and (1,1,(1-a-b)/c) also passes through this point. This is the point on the plane ax + by + cz = 1 that is equi-distant from the xy-, yz- and xz- coordinate planes. It is also the central projection of the origin onto the plane along the vector parallel to (1,1,1).

In terms of the original two triangles this point is neither the centroid, incentre, orthocentre, circumcentre nor other commonly encountered triangle centre. Let us find the barycentric coordinates of this point (call it S) in terms of the triangle with vertices at A(1/a,0,0), B(0,1/b,0), C(0,0,1/c).


The first barycentric coordinate will be the ratio of the area of \triangle SBC to the area of \triangle ABC. Since B and C have the same x-coordinate, this will be the ratio of the x-coordinates of S to A, which is 1/(a+b+c) / (1/a) = a/(a+b+c). By symmetry it follows that the barycentric coordinates have the attractive form

\displaystyle \frac{a}{a+b+c} : \frac{b}{a+b+c} : \frac{c}{a+b+c}.

Let the side lengths of \triangle ABC be BC = x, CA = y, AB = z. Then by Pythagoras’ theorem, x^2 = 1/b^2 + 1/c^2, y^2 = 1/a^2 + 1/c^2, z^2 = 1/a^2 + 1/b^2. Hence

x^2 + y^2 - z^2 = 2/c^2.

By the cosine rule, x^2 + y^2 - z^2 = 2xy \cos C (where C = \angle ACB) which equals 2/c^2 from the above expression. Therefore c^2 = \sec C/xy and similarly we obtain a^2 = \sec A/yz, b^2 = \sec B/xz. Then

\begin{aligned} \frac{a}{a+b+c} &= \frac{\sqrt{\sec A}/\sqrt{yz}}{\sqrt{\sec B}/\sqrt{xz} + \sqrt{\sec C}/\sqrt{xy} + \sqrt{\sec A}/\sqrt{yz}}\\ &= \frac{\sqrt{x\sec A}}{\sqrt{x\sec A} + \sqrt{y\sec B} + \sqrt{z\sec C}}.\end{aligned}

By the sine rule, x = 2R\sin A (R being the circumradius of \triangle ABC) from which x \sec A = 2R\sin A/\cos A = 2R\tan A. Hence the barycentric coordinates of S may be written in non-normalised form as

\displaystyle {\sqrt{\tan A}} : {\sqrt{\tan B}} : {\sqrt{\tan C}}.

Comparing this with the coordinates of the orthocentre \tan A : \tan B : \tan C, the point S is known as the square root of the orthocentre (see Theorem 1 of [1]). Note that the real existence of the point requires \triangle ABC to be acute, which it is when a,b,c > 0. A geometric construction of the square root of a point is given in Section 8.1.2 of [2].


[1] Miklós Hoffmann, Paul Yiu. Moving Central Axonometric Reference Systems, Journal for Geometry and Graphics, Volume 9 (2005), No. 2, 127–134.

 [2] Paul Yiu. “Introduction to the Geometry of the Triangle”.

February 28, 2015

Large US+Canada box office openings

Filed under: movies and TV — ckrao @ 1:38 pm

The site lists the opening weekend grosses of movies in the US and Canada dating back to the early 1980s. Via this page on top opening weekends, I worked out movies that at their time of release attained the n’th highest grossing opening weekend where n ranges from 1 to 10 (all dollar amounts in $US). It gives a perspective on how big some movies were at the time. It also shows how movie grosses have grown through inflation and more frontloading over the years. Note that only opening weekends are shown here – for example Superman’s third weekend was once the largest grossing weekend at the time, but is not listed here.


n=1 (i.e. current and previous record-breaking openings):

Title Opening Date (mm/dd/yyyy)
Marvel’s The Avengers $207,438,708 5/4/2012
Harry Potter and the Deathly Hallows Part 2 $169,189,427 7/15/2011
The Dark Knight $158,411,483 7/18/2008
Spider-Man 3 $151,116,516 5/4/2007
Pirates of the Caribbean: Dead Man’s Chest $135,634,554 7/7/2006
Spider-Man $114,844,116 5/3/2002
Harry Potter and the Sorcerer’s Stone $90,294,621 11/16/2001
The Lost World: Jurassic Park $72,132,785 5/23/1997
Batman Forever $52,784,433 6/16/1995
Jurassic Park $47,026,828 6/11/1993
Batman Returns $45,687,711 6/19/1992
Batman $40,489,746 6/23/1989
Ghostbusters II $29,472,894 6/16/1989
Indiana Jones and the Last Crusade $29,355,021 5/24/1989
Beverly Hills Cop II $26,348,555 5/20/1987
Indiana Jones and the Temple of Doom $25,337,110 5/23/1984
Return of the Jedi $23,019,618 5/25/1983
Star Trek II: The Wrath of Khan $14,347,221 6/4/1982
Superman II $14,100,523 6/19/1981
Star Trek: The Motion Picture $11,926,421 12/7/1979
Every Which Way But Loose $10,272,294 12/20/1978


n=2 (i.e. the second largest opening at the time)

Title Opening Date
Iron Man 3 $174,144,585 5/3/2013
Star Wars: Episode III – Revenge of the Sith $108,435,841 5/19/2005
Shrek 2 $108,037,878 5/19/2004
The Matrix Reloaded $91,774,413 5/15/2003
Planet of the Apes (2001) $68,532,960 7/27/2001
The Mummy Returns $68,139,035 5/4/2001
Star Wars: Episode I – The Phantom Menace $64,820,970 5/19/1999
Independence Day $50,228,264 7/3/1996
Lethal Weapon 3 $33,243,086 5/15/1992
Terminator 2: Judgment Day $31,765,506 7/3/1991
Rocky III $12,431,486 5/28/1982
The Cannonball Run $11,765,654 6/19/1981
Smokey and the Bandit II $10,883,835 8/15/1980
The Empire Strikes Back $10,840,307 6/20/1980



Title Opening Date
The Dark Knight Rises $160,887,295 7/20/2012
The Hunger Games $152,535,747 3/23/2012
The Twilight Saga: New Moon $142,839,137 11/20/2009
Shrek the Third $121,629,270 5/18/2007
Harry Potter and the Prisoner of Azkaban $93,687,367 6/4/2004
Harry Potter and the Chamber of Secrets $88,357,488 11/15/2002
Star Wars: Episode II – Attack of the Clones $80,027,814 5/16/2002
Hannibal $58,003,121 2/9/2001
Mission: Impossible II $57,845,297 5/24/2000
Toy Story 2 $57,388,839 11/24/1999
Austin Powers: The Spy Who Shagged Me $54,917,604 6/11/1999
Men in Black $51,068,455 7/2/1997
The Lion King $40,888,194 6/24/1994
Rambo: First Blood Part II $20,176,217 5/22/1985
Star Trek III: The Search for Spock $16,673,295 6/1/1984



Title Opening Date
X-Men: The Last Stand $102,750,665 5/26/2006
Harry Potter and the Goblet of Fire $102,685,961 11/18/2005
X2: X-Men United $85,558,731 5/2/2003
Austin Powers in Goldmember $73,071,188 7/26/2002
Rush Hour 2 $67,408,222 8/3/2001
Pearl Harbor $59,078,912 5/25/2001
Mission: Impossible $45,436,830 5/22/1996
Twister $41,059,405 5/10/1996
Back to the Future Part II $27,835,125 11/22/1989
Rocky IV $19,991,537 11/27/1985
Beverly Hills Cop $15,214,805 12/5/1984
Jaws 3-D $13,422,500 7/22/1983
Superman III $13,352,357 6/17/1983



Title Opening Date
The Twilight Saga: Breaking Dawn Part 1 $138,122,261 11/18/2011
Iron Man 2 $128,122,480 5/7/2010
Pirates of the Caribbean: At World’s End $114,732,820 5/25/2007
How the Grinch Stole Christmas $55,082,330 11/17/2000
Interview with the Vampire $36,389,705 11/11/1994
Home Alone 2: Lost in New York $31,126,882 11/20/1992
Bram Stoker’s Dracula $30,521,679 11/13/1992
Star Trek IV: The Voyage Home $16,881,888 11/26/1986
The Best Little Whorehouse in Texas $11,874,268 7/23/1982
E.T.: The Extra-Terrestrial $11,835,389 6/11/1982



Title Opening Date
The Hunger Games: Catching Fire $158,074,286 11/22/2013
Harry Potter and the Deathly Hallows Part 1 $125,017,372 11/19/2010
Alice in Wonderland (2010) $116,101,023 3/5/2010
The Passion of the Christ $83,848,082 2/25/2004
Monsters, Inc. $62,577,067 11/2/2001
X-Men $54,471,475 7/14/2000
Ace Ventura: When Nature Calls $37,804,076 11/10/1995
Robin Hood: Prince of Thieves $25,625,602 6/14/1991
Total Recall $25,533,700 6/1/1990
Teenage Mutant Ninja Turtles $25,398,367 3/30/1990
Ghostbusters $13,578,151 6/8/1984
Staying Alive $12,146,143 7/15/1983



Title Opening Date
Transformers: Revenge of the Fallen $108,966,307 6/24/2009
Spider-Man 2 $88,156,227 6/30/2004
Batman and Robin $42,872,605 6/20/1997
Lethal Weapon 2 $20,388,800 7/7/1989
Star Trek V: The Final Frontier $17,375,648 6/9/1989



Title Opening Date
The Twilight Saga: Breaking Dawn Part 2 $141,067,634 11/16/2012
The Lord of the Rings: The Return of the King $72,629,713 12/17/2003
Godzilla $44,047,541 5/20/1998
The Flintstones $29,688,730 5/27/1994
Gremlins $12,511,634 6/8/1984



Title Opening Date
Finding Nemo $70,251,710 5/30/2003
The Mummy $43,369,635 5/7/1999
Deep Impact $41,152,375 5/8/1998



Title Opening Date
Toy Story 3 $110,307,189 6/18/2010
Indiana Jones and the Kingdom of the Crystal Skull $100,137,835 5/22/2008
Iron Man $98,618,668 5/2/2008
Dick Tracy $22,543,911 6/15/1990

(To create the above lists the movie lists in decreasing order of gross were pasted into Excel and the opening weekend date was converted to a number by creating a new column with formula =–TEXT(,”mm/dd/yyyy”). This was then converted to a rank by a countif formula to count the number of occurrences with higher gross that predated each movie. Finally a filter was applied to select ranks 1 to 10.)

February 27, 2015

Cross sections of a cube

Filed under: mathematics — ckrao @ 9:59 pm
When a plane intersects a cube there is a variety of shapes of the resulting cross section.
  • a single point (a vertex of the cube)
  • a line segment (an edge of the cube)
  • a triangle (if three adjacent faces of the cube are intersected)
  • a parallelogram (if two pairs of opposite faces are intersected – this includes a rhombus or rectangle)
  • a trapezium (if two pairs of
  • a pentagon (if the plane meets all but one face of the cube)
  • a hexagon (if the plane meets all faces of the cube)

The last five of these (the non-degenerate cases) are illustrated below and at . Some are demonstrated in the video below too.

cs1 cs2 cs3 cs4 cs5

One can use [1] to experiment interactively with cross sections given points on the edges or faces, while [2] shows how to complete the cross section geometrically if one is given three points on the edges.

Let us be systematic in determining properties of the cross sections above. Firstly, if the plane is parallel to an edge (any of four parallel edges), the cross section can be seen to be a line or rectangle with the longer dimension of length at most \sqrt{2} times the other. That rectangle becomes a square if the plane is parallel to a face.

If the plane is not parallel to a face, we may set up a coordinate system where a unit cube is placed in the first octant aligned with the coordinate axes and the normal to the plane has positive x, y and z coordinates. In other words, we may assume the plane has equation ax + by + cz = 1 and intercepts at (1/a,0,0), (0,1/b,0) and (0,0,1/c), where a, b, c are positive.


The cross section satisfies ax + by + cz = 1 and the inequalities 0 \leq x \leq 1, 0 \leq y \leq 1 and 0 \leq z \leq 1. This can be considered the intersection of the two regions

\displaystyle ax + by + cz = 1, 0 \leq x, 0 \leq y, 0 \leq z,

\displaystyle ax + by + cz = 1, x \leq 1, y \leq 1, z \leq 1,

each of which is an acute-angled triangle in the same plane (acute because one can show that the sum of the squares of any two sides is strictly greater than the square of the third side). Note that the triangles have parallel corresponding sides, being bounded by the pairs of parallel faces of the cube x = 0, x=1, y = 0, y= 1, z=0, z=1. Hence the two triangles are oppositely similar with a centre of similarity.

The following diagram shows the coordinates of the vertices of the two triangles, which in this case intersect in a hexagon.


The centre of similarity of the two triangles is the intersection of two lines joining corresponding sides – this can be found to be the point (1/(a+b+c), 1/(a+b+c), 1/(a+b+c)), which is the intersection of the unit cube’s diagonal from the origin (to (1,1,1)) and the plane ax + by + cz = 1.

Side lengths of the triangles and distances between corresponding parallel sides may be found by Pythagoras’ theorem and are shown below for one pair of corresponding sides (the remaining lengths can be found by cyclically permuting a,b,c).


To sum up, all of the possible cross sections of a cube where the plane is not parallel to an edge can be described by the intersection of two oppositely similar triangles with corresponding sides parallel.

The type of polygon obtained depends on which vertices of the figure below are selected, as determined by the values of a,b,c.constraints

In this figure a vertex for the cross-sectional polygon is chosen if the constraint associated with it is satisfied. A red vertex has a conflicting constraint with its neighbouring two blue vertices, so either a red point or one or more blue points in this area can be chosen. Note that for the plane to intersect the cube at all we require (1,1,1) to be on the different side of the plane from the origin, or in other words, a + b + c \geq 1.

Let us look at a few examples. Firstly, if a, b, c are all greater than 1 we choose the following triangle.


Similarly if a+b, b+c, c+a all are less than 1, the oppositely similar triangle on the red vertices would be chosen.

Next, if c > 1, a < 1, a+b < 1 we obtain the following parallelogram.




If c > 1, a < 1, a+b > 1 we obtain either a pentagon (parallelogram truncated at a vertex) or a trapezium depending on whether b < 1 or b \geq 1 respectively.

b < 1:

pentagoncaseb\geq 1:

Finally, if a, b, c are less than 1 and a+b, b+c, c+a are greater than 1, we obtain a hexagon.


For details on calculating the areas of such polygons refer to [3], especially the method applying the area cosine principle that relates an area of a figure to its projection. For calculating volumes related to regions obtained by the cross section refer to [4].


[1] Cross Sections of a Cube:

[2] Episode 16 – Cross sections of a cube:

[3] calculus – Area of the polygon formed by cutting a cube with a plane – Mathematics Stack Exchange

[4] integration – Volume of cube section above intersection with plane – Mathematics Stack Exchange

January 30, 2015

AB de Villiers’ fastest ODI century

Filed under: cricket,sport — ckrao @ 12:51 pm

Recently we witnessed the fastest century in one-day cricket history, with AB de Villiers coming in during the 39th over at the fall of South Africa’s first wicket (1/247) and proceeding to blast an incredible 149 off 44 balls in just 59 minutes propelling the team to 2/439 (Amla also made 153* and Rossouw 128). The match produced all types of records including many instances of most runs in n consecutive overs, documented in other blog post here.

Here is the ball-by-ball breakdown of his innings followed by a graph of runs versus balls.

4 2 1 | 1 4 6 4 6 | 6 . 2 2 LB | 1 6 6 6 4 | 6 1 4 1 | 1 . 4 4 | . 6 | 4 6 6 6 | LB 6 | 1 | 6 6 4 6 6 2 | 2 . out


We see that three times he hit 28 runs in 5 balls and 26 runs in another space of 5 balls – that’s 110 runs in just 20 balls with 15 6s and 5 4s right there! He was already 82 off 27 balls (7 6s, 7 4s) and then made 63 off his next 13 balls including 9 6s and 2 4s to surge to 145 off 40 balls!! I have never seen such a concentration of 6 hitting. More analysis of his strike rate is at this @dualnoise post.

Here is what he scored (with balls faced) against the four bowlers who were up against him:

Taylor: 30 (13)
Holder: 45 (9)
Russell: 35 (12)
Smith: 39 (10)

Some other amazingly fast centuries in limited over cricket are in this blog post. Here is the breakdown of the previous fastest ODI century (36 balls) by Corey Anderson in this match:

1 | . 4 1 | . 1 | 6 1 . 2 1 | 4 6 1 | 6 6 . 6 . 6 | 1 . . 6 | 6 6 6 6 1 | . 1 | 4 4 1 1 | 6 6 4 1 | 2 4 1 | 6 1 | 2 2 1

January 26, 2015

Affine Transformations of Cartesian Coordinates

Filed under: mathematics — ckrao @ 11:43 am

A very common exercise in high school mathematics is to plot transformations of some standard functions. For example, to plot y = 2\sin (5x + \frac{2\pi}{3}) - 1 we may start with a standard sine curve and apply the following transformations in turn:

  • squeeze it by a factor of 5 in the x-direction
  • shift it left by \frac{2\pi}{3}
  • stretch it by a factor of 2 in the y-direction
  • shift it down by 1

This leads to the plot shown.


For sine and cosine graphs an alternative is to plot successive peaks/troughs of the curve and interpolate accordingly. For example, to plot y = 2\sin (5x + \frac{2\pi}{3}) - 1 we may proceed as follows.

  • Since \sin(x) has a peak at \frac{\pi}{2}, solve 5x + \frac{2\pi}{3} = \frac{\pi}{2} to find x = -\frac{\pi}{30} as a point where there is a peak at y = 2\times 1 - 1 = 1. Hence plot the point (-\frac{\pi}{30},1).
  • Since the angular frequency is 5, the period is \frac{2\pi}{5} and we may plot successive peaks spaced \frac{2\pi}{5} apart from the point (-\frac{\pi}{30},1).
  • Troughs will be equally spaced halfway between the peaks at y = 2\times (-1) - 1 = -3 (at x = -\frac{\pi}{30} + \frac{\pi}{5} + k\frac{2\pi}{5}). Then join the dots with a sinusoidal curve.
  • Additionally x- and y- intercepts may be found by setting y = 0 and x = 0 respectively. We find that the x-intercepts are at x = \frac{2\pi k}{5} - \frac{\pi}{10}, \frac{2\pi k}{5} + \frac{\pi}{30}\ (k \in \mathbb{Z}) and y-intercept is y = 2\sin (\frac{2\pi}{3}) - 1 = \sqrt{3}-1.


The first approach is more generalisable to plotting other functions. Instead of thinking of the graph transforming, we also may consider it as a change of coordinates. For example, if we translate the parabola y = x^2 so that its turning point is at (2,1), this is equivalent to keeping the parabola fixed and shifting axes so that the new origin is at (-2,-1) with respect to the old coordinates. This is illustrated below where the black coordinates are modified to the red ones. The parabola has equation y = x^2 under the black coordinates and y - 1 = (x-2)^2 or y = (x-2)^2 + 1 under the red coordinates.


As another example suppose we take a unit circle and stretch it by a factor of 2 in the x direction and a factor of 3 in the y direction. This is the equivalent of changing scale so that the x-axis is squeezed by 2 and the y-axis is squeezed by 3.



Under this stretching of the circle or squeezing of axes, the unit circle equation x^2 + y^2 = 1 transforms to that of the ellipse \left(\frac{x}{2}\right)^2 + \left(\frac{y}{3}\right)^2 = 1.

More generally, by stretching a Cartesian graph f(x,y) = 0 by a in the x-direction and b in the y-direction, then shifting it along the vector (h,k), we obtain the equation

\displaystyle f\left(\frac{x-h}{a}, \frac{y-k}{b}\right) = 0.

This uses the fact that \frac{x-h}{a} and \frac{y-k}{b} are the inverses of ax+h and by+k respectively. Note that if |a| or |b| are less than 1, the stretch becomes a squeezing of the graph, while a < 0 or b < 0 correspond to a reflection in the x or y axes.

We can extend this idea to the rotation of a graph. Suppose for example we wish to rotate the hyperbola y = 1/x by 45 degrees anti-clockwise. This is equivalent to a rotation of the axes by 45 degrees clockwise and the matrix corresponding to this linear transform is

\displaystyle \left[ \begin{array} {c} x' \\ y' \end{array} \right] = \frac{1}{\sqrt{2}}\left[ \begin{array}{rr} 1 & 1\\ -1 & 1 \end{array} \right] \left[ \begin{array} {c} x \\ y \end{array} \right] = \left[ \begin{array} {c} \frac{x+y}{\sqrt{2}} \\ \frac{-x+y}{\sqrt{2}}\end{array} \right].

(Here the columns of the change of basis matrix correspond to where the basis vectors (1,0) and (0,1) map to under a 45 degree clockwise rotation.)

In other words we replace x' with (x+y)/\sqrt{2} and y' with (-x+y)/\sqrt{2} in the equation y' = 1/x' and obtain (-x+y)/\sqrt{2} = 1/( (x+y)/\sqrt{2}) or y^2 - x^2 = 2.


Here is the same transformation applied to the parabola y = x^2 to obtain \frac{-x+y}{\sqrt{2}} = \frac{(x+y)^2}{2} or x^2 + y^2 + 2xy + \sqrt{2}(x-y) = 0:


If a graph is affinely transformed (by an invertible map) so that (1,0) maps to (a,b) and (0,1) maps to (c,d) followed by a shift along the vector (h,k), then this is equivalent to the coordinates shifting by (-h,-k) and then transforming under the inverse mapping \displaystyle \left[ \begin{array}{cc} a & c\\ b & d\end{array} \right]^{-1} = \frac{1}{ad-bc} \left[ \begin{array}{cc} d & -c\\ -b & a\end{array} \right]:

\displaystyle \boxed{\begin{aligned} x' &= (x-h) \frac{d}{ad-bc} - (y-k) \frac{c}{ad-bd}\\ y' &= -(x-h) \frac{b}{ad-bc} + (y-k) \frac{a}{ad-bd}\end{aligned}}

Here are some special cases of this formula:

  • rotation of the graph by \theta anti-clockwise: \displaystyle x' = x\cos \theta + y \sin \theta, y' = - x \sin \theta + y\cos \theta (the example \theta = \pi/4 was done above)
  • reflection of the graph in y = x: x' = y, y' = x
  • reflection of the graph in y = mx where m = \tan \theta: verify that a = \cos 2\theta, b = \sin 2\theta, c = \sin 2\theta, d = -\cos 2\theta so \displaystyle x' = x \cos 2\theta + y \sin 2\theta, y' = x \sin 2\theta - y \cos 2\theta
  • reflection of the graph in y = mx + c where m = \tan \theta: this is equivalent to a reflection in the line y = mx followed by a shift along the vector (h,k) = (-c \sin 2\theta, c (1+\cos 2 \theta) ) so
    \displaystyle \begin{aligned} x' &= (x+c \sin 2\theta)\cos 2\theta + (y-c(1+\cos 2\theta))\sin 2\theta\\ &= x \cos 2\theta + (y-c)\sin 2\theta,\\ y' &= (x+c \sin 2\theta)\sin 2\theta - (y-c(1+\cos 2\theta))\cos 2\theta\\ &= x \sin 2\theta - (y-c) \cos 2\theta + c \end{aligned}
  • reflection of the graph in y = x + c (special instance of the previous case with \sin 2\theta = 1, \cos 2\theta = 0): x'= y - c, y' = x+c

December 15, 2014

Types of -saurs that are not dinosaurs

Filed under: nature — ckrao @ 12:06 pm

Below is a reference for myself of types of (mostly) prehistoric animals that are not dinosaurs but have names ending in -saur (sauria means lizard but most of these are not that closely related to lizards).

Group Prefix meaning When it lived Brief description
Aetosaur eagle late Triassic heavily armoured
Anteosaur Antaeus (son of Poseidon and Gaia) 272-260 Ma large Dinocephalians (therapsid)
Cotylosaur cup late Carboniferous-Permian basal reptile (also known as Captorhinids)
Ichthyosaur fish 245-90 Ma dolphin-like marine reptile
Ictidosaur ferret late Triassic – mid Jurassic mammal-like cynodonts, also known as tritheledontids
Mesosaur middle 299-280 Ma like a small aligator
Mosasaur Meuse River late Cretaceous marine reptile similar to monitor lizards
Nothosaur false/hybrid Triassic slender marine reptile
Pachypleurosaur thick-ribbed Triassic like an aquatic lizard
Pareiasaur shield 270-250 Ma large anapsid
Pelycosaur axe or bowl 320-251 Ma non-therapsid synapsids (e.g. Dimetrodon)
Phytosaur plant 228-200 Ma long-snouted archosauriforms
Plesiosaur close to/near 210-65 Ma marine reptile with broad flat body and short tail
Pliosaur closely 200-89 Ma short-necked plesiosaur
Poposaur discovered on Popo Agie River (ref) late Triassic carnivorous paracrocodylomorphs
Protorosaur early Permian-Triassic long-necked archosauromorphs
Pterosaur winged 228-65 Ma closest relatives to dinosauromorphs
Rhynchosaur beaked Triassic beaked archosauromorphs
Teleosaur end/last early Jurassic – early Cretaceous marine crocodyliforms
Thalattosaur ocean Triassic marine reptile with long flat tail
Trilophosaur three ridged late Triassic lizard-like archosauromorphs
Xenosaur strange present (Cenozoic) knob-scaled lizards

December 14, 2014

Basic combinatorics results

Filed under: mathematics — ckrao @ 8:11 pm

The following lists most of the introductory combinatorics formulas one might see in a first course expressed in terms of the number of arrangements of letters in which repetition or order matters.

number of letters alphabet size letters repeated? order matters? formula comments
k n yes yes n^k samples with replacement
k  n no yes \begin{aligned} & n(n-1)\ldots (n-k+1)\\ &= \frac{n!}{(n-k)!} = P(n,k) = (n)_k\end{aligned} samples without replacement (permutations)
n  n no  yes n! if letters in a line

(n-1)! if letters in a ring and rotations are considered equivalent

(n-1)!/2 if letters in a ring and rotations & reflections are considered equivalent

 k n no no \frac{n!}{k!(n-k)!} = \binom{n}{k} = C(n,k) binomial coefficient


n 2 yes: k of type 1, n-k of type 2 yes \binom{n}{k}
n m yes: k_1 of type i for i = 1,\ldots, m yes \frac{n!}{k_1! k_2! \ldots k_m!} = \frac{(k_1 + k_2 + \ldots + k_m)!}{k_1! k_2! \ldots k_m!} = \binom{n}{k_1, k_2, \ldots, k_m} multinomial coefficient (multiset permutations)

e.g. number of arrangements of “BANANA” is \frac{6!}{3!2!1!}

n k yes no \binom{n+k-1}{k-1} = \binom{n+k-1}{n} = \left(\!\!{n \choose k}\!\!\right) multiset coefficient (combinations with repetition):

number of non-negative integer solutions to n_1 + n_2 + \ldots + n_k = n

n 2 no two consecutive letters of type 1 yes F_{n+2} Fibonacci number where F_{n+2} = F_{n+1} + F_n and F_1 = F_2 = 1

e.g. number of sequences of 6 coin tosses with no two consecutive heads is F_8 = 21

Next Page »

The Rubric Theme. Blog at


Get every new post delivered to your Inbox.

%d bloggers like this: