You are currently browsing the tag archive for the ‘number theory’ tag.

Ramanujan’s Taxi Cabs and the Sum of 2 Cubes

The Indian mathematician Ramanujan (picture cite: Wikipedia) is renowned as one of great self-taught mathematical prodigies.  His correspondence with the renowned mathematician G. H Hardy led him to being invited to study in England, though whilst there he fell sick.  Visiting him in hospital, Hardy remarked that the taxi that had brought him to the hospital had a very “rather dull number” – number 1729.  Ramanujan remarked in reply, ” No Hardy, it’s a very interesting number!  It’s the smallest number expressible as the sum of 2 cubes in 2 different ways!”

Ramanujan was profoundly interested in number theory – the study of integers and patterns inherent within them.  The general problem referenced above is finding integer solutions to the below equation for given values of A:

In the case that A = 1729, we have 2 possible ways of finding distinct integer solutions:

The smallest number which can be formed through 3 distinct (positive) integer solutions to the equation is A = 87, 539, 319.

Although this began as a number theory problem it has close links with both graphs and group theory – and it is from these fields that mathematicians have gained a deeper understanding as to the nature of its solutions.  The modern field of elliptical curve cryptography is closely related to the ideas below and provides a very secure method of encrypting data.

We start by sketching the graph of:

For some given integer value of A. We will notice that the graph has a line of symmetry around y = x and also an asymptote at y = -x.  If we plot:

We can see that both our integer solutions to this problem (1,12) and (9,10) lie on the curve:

Group theory

Groups can be considered as sets which follow a set number of rules with regards to operations like multiplication, addition etc.  Establishing that a set is a group then allows certain properties to be inferred.  If we can establish the following rules hold then we can create an Abelian group.  If we start with a set A and and operation Θ.

1) Identity. For an element e in A, we have a Θ e = a for all a in A.

(for example 0 is the identity element for the addition operation for the set of integers numbers. a+0 = a for all a in the real numbers).

2) Closure.  For all elements a,b in A, a Θ b = c, where c is also in A.

(For example with the addition operation, the addition of 2 integers numbers is still an integer)

3) Associativity. For all elements a,b,c in A, (a Θ b) Θ c = a Θ (b Θ c)

(For example with the addition operation, (1+2) + 3 = 1 + (2+3) )

4) Inverse.  For each a in A there exists a b in A such that a Θ b = b Θ a = e.  Where e is the identity.

(For example with the addition operation, 4+-4 = -4+4 = 0.  0 is the identity element for addition)

5) Commutativity. For all elements a,b in A, a Θ b = b Θ a

(For example with the addition operation 1+2 = 2+1).

As we have seen, the set of integers under the operation addition forms an abelian group.

Establishing a group

So, let’s see if we can establish a Abelian group based around the rational coordinates on our graph.  We can demonstrate with the graph:

We then take 2 coordinate points with rational coordinates (i.e coordinates that can be written as a fraction of integers).  In this case A (1,12) and B (9,10).

We then draw the line through A and B.  This will intersect the graph in a 3rd point, C (except in a special case to be looked at in a minute).

We then reflect this new point C in the line y = x, giving us C’.

In this case C’ is the point  (46/3, -37/3)

We therefore define addition (our operation Θ) in this group as:

A + B = C’.

(1,12) + (9,10) = (46/3, -37/3).

We now need to deal with the special case when a line joining 2 points on the curve does not intersect the curve again.  This will happen whenever the gradient of this line is -1, which will make it parallel to the graph’s asymptote y = -x.

In this case we affix a special point at infinity to the Cartesian (x,y) plane.  We define this point as the point through which all lines with gradient -1 intersect.  Therefore in our expanded geometry, the line through AB will intersect the curve at this point at infinity. Let’s call our special point  Φ.  Now we have a new geometry,  the (x,y) plane affixed with Φ.

We can now create an Abelian group.  For any 2 rational points P(x,y), Q(x,y) we will have:

1) Identity.  P + Φ = Φ + P = P

2) Closure.  P + Q = R. (Where R(x,y) is also a rational point on the curve)

3) Associativity. (P+Q) + R = P+(Q+R)

4) Inverse.  P + (-P) = Φ

5) Commutativity.  P+Q = Q+P

Understanding the identity

Let’s see if we can understand some of these.  For the identity, if we have a point A on the line and the point at infinity then this will contain the line with gradient -1.  Therefore the line between the point at infinity and A will intersect the curve again at B.  Our new point, B’ will be created by reflecting this point in the line y = x.  This gets us back to point A.  Therefore P + Φ = P as required.

Understanding the inverse

With the inverse of our point P(x,y) given as -P = (-x,-y) we can see that this is the reflection in the line y = x.  We can see that we we join up the 2 points reflected in the line y = x we will have a line with slope -1, which will intersect with the curve at our point at infinity.  Therefore P + (-P) = Φ.

Through our graphical understanding the commutativity rule also follows immediately, It doesn’t matter which of the 2 points come first when we draw a line that connects them, therefore P+Q = Q+P.

Understanding associativity and closure

Neither associativity nor closure are obvious from our graph.  We could check individual points to show that (P+Q) + R = P+(Q+R), but it would be harder to explain why this always held.  Equally whilst it’s clear that P+Q will always create a point on the curve it’s not obvious that this will be a rational point.

In fact we do have both associativity and closure for our group as we have the following algebraic definition for our addition operation:

For a given point:

On a given curve of the form:

The addition of 2 points is given by:

In the case of our curve:

If we take P = (1,12).  P + P will be given by:

We can check this result graphically.  If P and Q are the same point, then the line that passes through both P and Q has to be the tangent to the curve at that point.  Therefore we would have:

Here the tangent at A does indeed meet the curve again – at point C, which does reflect in y = x to give us the coordinates above.

We could also find this intersection point algebraically.  If we differentiate the original curve to find the gradient when x = 1 we can find the equation of the tangent when x=1 and then substitute this back into the equation of the curve to find the intersection point.  This would give us:

We would then reverse the x and y coordinates to reflect in the line y = x.  This also gives us the same coordinates.

More generally if we have the 2 rational coordinates on the curve:

We have the algebraic formula for addition as:

 

If P = (1,12) and Q = (9,10), P + Q would give (after much tedious substitution!):

This agrees with the coordinates we found earlier using the much easier geometrical approach. As we can see from this formula, both coordinate points will always be rational – as they will be composed of combinations of our original rational coordinates.  For any given curve there will be a generator set of coordinates through which we can generate all other rational coordinates on the curve through our addition operation.

So, we seem to have come a long way from our original goal – finding integer solutions to an algebraic equation. Instead  we seem to have got sidetracked into studying graphs and establishing groups.  However by reinterpreting this problem as one in group theory then this then opens up many new mathematical techniques to help us understand the solutions to this problem.

A fuller introduction to this topic is the very readable, “Taxicabs and the Sum of Two Cubes” by Joseph Silverman (from which the 2 general equations were taken) .

Project Euler: Coding to Solve Maths Problems

Project Euler, named after one of the greatest mathematicians of all time, has been designed to bring together the twin disciplines of mathematics and coding.  Computers are now become ever more integral in the field of mathematics – and now creative coding can be a method of solving mathematics problems just as much as creative mathematics has always been.

The first problem on the Project Euler Page is as follows:

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

This is a reasonably straight forward maths problem which we can solve using the summation of arithmetic sequences (I’ll solve it below!) but more interestingly is how a computer code can be written to solve this same problem.  Given that I am something of a coding novice, I went to the Project Nayuki website which has an archive of solutions.  Here is a slightly modified version of the solution given on Project Nayki, designed to run in JAVA:

 

The original file can be copied from here, I then pasted this into an online JAVA site jdoodle. The only modification necessary was to replace:

public final class p001 implements EulerSolution with public class p001

Then after hitting execute you get the following result:

i.e the solution is returned as 233,168. Amazing!

But before we get carried away, let’s check the answer using some more old fashioned maths. We can break down the question into simply trying to find the sum of multiples of 3 under 1000, the sum of the multiples of 5 under 1000 and then subtracting the multiples of 15 under 1000 (as these will have been double counted). i.e:

(3 + 6 + 9 + … 999)  +  (5 + 10 + 15 + … 995)  – (15 + 30 + 45 + …990)

This gives:

S_333 = 333/2 (2(3)+ 332(3)) = 166,833
+
S_199 = 199/2 (2(5) + 198(5)) = 99, 500

S_66 = 66/2 (2(15) +65(15) = 33, 165.

166,833 + 99, 500 – 33, 165 = 233, 168 as required.

Now that we have seen that this works we can modify the original code.  For example if we replace:

if (i % 3 == 0 || i % 3 == 0)
with
if (i % 5 == 0 || i % 7 == 0)

This will find the sum of all the multiples of 5 or 7 below 1000.  Which returns the answer 156,361.

Replacing the same line with:

if (i % 5 == 0 || i % 7 == 0 || i % 3 == 0)

will find the sum of all the multiples of 3 or 5 or 7 below 1000, which returns the answer 271,066.  To find this using the previous method we would have to do:

Sum of 3s + Sum of 5s – Sum of 15s + Sum of 7s – Sum of 21s – Sum 35s – Sum of 105s. Which starts to show why using a computer makes life easier.

This would be a nice addition to any investigation on Number Theory – or indeed a good project for anyone interested in Computer Science as a possible future career.

Website Stats

  • 6,667,152 views

Recent Posts

Follow IB Maths Resources from British International School Phuket on WordPress.com