Sunday, 8 July 2018

The Big Internet MathOff

The Big Internet MathOff is now taking place.  Sixteen mathematicians are competing in a knock-out tournament to present the most interesting piece of mathematics.  With the final two matches of the first round now taking place, there has already been a wealth of fascinating mathematics presented.  Christian Lawson-Perfect deserves huge thanks for creating this wonderful showcase of exciting maths.

But not only are the contestants' pitches fascinating.   There is also interesting maths involved in the background.

First, Each match runs for 48 hours.  As a contestant, my most pressing question today is whether I will win my first round match against Jo Morgan, in which case I will need to work urgently on my pitch for round 2.  So the question is, how soon can I extrapolate from the early votes to be reasonably sure of the outcome?

I am sure that this has been studied in the context of political elections.  But this is harder because the electorate is everybody with access to the internet - several hundred million people (though not all will actually vote). 

Now, when I first looked at the score ten minutes after the match started, I was leading by 2 votes to 1, but I think that was a bit too early to be confident of the result.  As I write this, four hours into the match, Jo is leading by 58 votes to 29, and my share of the vote has consistently been around 30% for some time.  Although time differences may mean that America has yet to vote, my intuition is that I can safely abandon my pitch for round 2 and turn to other things like writing blog posts.

I've already had to find my answer to my second problem.  Each contestant has to provide a different piece of fun mathematics for each round so we all had to submit four topics before the tournament started.  It's unlikely that each set of four topics were all equally good. So what order do you choose for your topics?  Do you save your best one for the final?  In that case, you might not get to the final and your best idea is wasted.  Or do you use your best ideas in the early rounds, to improve your chances of progress, but risk putting your weakest idea forward in the final?

There may be a similarity with World Cup penalty shoot-outs.  With five penalties to take, it's clear that a team should select their best five penalty takers.  But in which order should they take the penalties?  One suggestion is that you should save your best penalty-takers for the end, when the pressure will be greatest.  But that could mean that your team has lost 5-3 and your best taker hasn't taken one of the penalties.  The great Ally McCoist, commenting on last night's shoot-out between Russia and Croatia, argued for putting your best takers first, guaranteeing that at least they will take penalties.  I'm not convinced that's a sound argument, though if you score your early penalties then the pressure on your opponents will increase.

So what did I do for the MathOff? Did I save my best idea for the final, or bring it out for the first round?  Well, there is a further complication.  I have no idea how to judge which of my topics would win most votes in an internet poll. Ranking them in order would have been pure guesswork.  So, shamefully, I didn't use any game theory or simulation to decide the order of my pitches - I just entered them in the order in which I thought of them.  Which may be as good a strategy as any!

Sunday, 20 May 2018

Mathematical discoveries

I was lucky enough to attend a meeting organised by the British Society for the History of Mathematics on "The History of Cryptography and Coding".  It was a quite exceptional meeting - six excellent talks.  As one of the other audience members said, I learned something from every talk, and a lot from several talks.  (Anyone who goes to these events will know that this isn't always the case.)

The final talk, by Clifford Cocks on the discoveries of the public key cryptography, was fascinating in many respects.  (Cocks was one of the people at GCHQ who discovered both the Diffie-Hellman key exchange method and the Rivest-Shamir-Adleman (RSA) algorithm before those after whom the ideas are named, but this wasn't known until GCHQ made it public over 25 years after the event.)  Cocks told us about the (different) reasons why the British and American discoverers were looking for these methods.  I was particularly struck by his insights into the creative processes that led to the discoveries.

In 1970 James Ellis at GCHQ had the idea of public-key cryptography.  Many people at GCHQ tried to find a way to implement it, without success.  Cocks suggested that this was because of "tunnel vision" - because Ellis's paper suggested using look-up tables, everyone was focused on that idea. Cocks had just arrived at GCHQ from university, and his mentor mentioned Ellis's problem to him, but described it in general terms without mentioning look-up tables.  Without having been led in a wrong direction, Cocks quickly came up with the idea of using factorisation, and the problem was solved.  (When Cocks told his colleague and housemate Malcolm Williamson about his paper, Williamson overnight worked up the idea of using the discrete logarithm problem, anticipating Diffie and Hellman.)

Cocks also told us about how Diffie was working on these discoveries having left his academic job, supporting himself on his savings - something which I don't recall knowing.

Then Cocks told us about Rivest, Shamir and Adleman's discovery of RSA.  They had tried about 30 ideas, none of which worked.  Then after a Passover meal at which alcohol flowed freely, Rivest had the big idea, wrote it down, and checked the next morning to see if it still worked.

I think these stories shed some light on mathematical creativity.  It needs hard work, of course, but it also needs flexibility.  Cocks (by his modest account) had the advantage over his colleagues that his mind wasn't conditioned by an unproductive idea.  Rivest's solution came after a break from thinking about it.  Of course, there are many other examples - PoincarĂ©'s inspiration as he was getting on a bus is the standard one - but it is always interesting to hear how great mathematical discoveries came about, and to hear this story from Cocks himself was a wonderful privilege.

Sunday, 28 January 2018

London buses, and the use of the mean as an estimate

A couple of weeks ago, I got onto my morning bus, climbed the stairs, holding on as the bus lurched forward, and sat down, to hear for the first time the new announcement "Please hold on: the bus is about to move", introduced by TfL (Transport for London).  Over the next few days this announcement was widely ridiculed. It was broadcast after every stop, but often - in my experience almost always - AFTER the bus had started moving, and sometimes when it was slowing down for the next stop, making the announcement appear ridiculous.  Occasionally, at busy stops like the railway station, it was broadcast while large numbers of people were still waiting to board, presumably causing consternation to prospective passengers who took it seriously.  And on one occasion, while the bus was stationary, I heard "The bus is about to move" followed immediately by the announcement "The driver has been instructed to wait here for a few minutes", flatly contradicting the previous words.

What was happening? TfL explained that they were piloting the announcement for four weeks, to try to reduce the number of injuries sustained by passengers on moving buses - apparently of the order of 5000 each year.  The timing of the announcement was based on the average time buses spent at each stop - I suspect by "average" they meant the mean.

The intention is laudable.  But the problem with using a mean in situations like this is that it doesn't really tell you how long a particular bus will wait at a given stop.  My bus home probably spends longer stopped at the railway station than at all the other stops put together.  Just as most people earn less than the mean national salary, which is heavily influenced by the very small number of people earning millions each year, so I imagine most of the time a bus spends less time at a stop than the mean.  So a system based on the mean time spent at a stop will result in the announcement usually being played after the us has left the stop, leading to ridicule.

Now, TfL are pretty good at maths - their planning of the transport around London during the 2012 Olympics was a very successful example of operational research in action.  So did they really get this wrong?  After all, one would think that a few tests would have shown the problem.  

Certainly one result of the announcements was  a great deal of publicity, which perhaps has made people more aware of the need for care when standing and moving on a bus. The announcements themselves may have a short-term effect, but in fact one very quickly ceases to notice them (or at least I have found that they very rarely impinged on my attention, after the first few instances on the first day).  But perhaps the press coverage, and people talking about the announcements, had more impact than the announcements themselves.

But if the announcements are to continue, how can TfL avoid the absurdity of an announcement that the bus is about to move being broadcast after it has moved?  The solution TfL have adopted (as well as apparently changing the timing) is simple.  The wording of the announcement is now "Please hold on while the bus is moving".  The timing no longer offers the possibility of absurdity.  The solution to this problem was not mathematical modelling, but thoughtful use of language.