Thank you to all of you for coming along. Now as Tom mentioned, I’m researcher at the London School of Hygiene and Tropical Medicine where I specialise in mathematical models of infectious disease. So on the face of it, my job couldn’t be further really from the world of casinos and playing cards and plastic chips. But really science and gambling have incredibly intertwined relationship, a really longstanding history. And that’s what I want to talk about this evening. And seeing as I’m talking about gambling, I thought I would start with an example of how not to gamble. So this is a story– story from a few years ago. And as you can probably notice, there’s two large flaws with this lady’s strategy. The first is it’s completely illegal.

And the second is it clearly doesn’t work. And the reason I wanted to show you this is I think when we talk about people taming chance and beating the system, typically these are two themes that crop up quite a lot. You either have them doing something a bit dodgy. Or you have them presenting a system which clearly isn’t going to do something very successful. And what I want to do this evening is take a look at a third approach. Take a look at some of the ways in which mathematicians or scientists have taken on games of chance and used their techniques to get an edge over the house. I also want to look at how the ideas have flowed the other way, how actually games and gambling have inspired many ideas which are now fundamental to modern maths and science. And really lotteries, I think, are a good place to start, because for me, it was a story about lotteries that first got me interested in the mathematics of betting. As I’m sure any of you who’ve played the lottery or have thought about playing lottery will know it’s incredibly difficult to win. But actually, even the way we measure how difficult it is to win is a fairly recent development. Although maths is– has been around for millennia. The idea of how we quantify luck, how we quantify random events, is a relatively recent one. It was one that was developed in the 16th century. And it was actually in Veneto, Italy. There was a Italian called Gerolamo Cardano. He was a physician. As a doctor, he was the first to describe the clinical symptoms of typhoid. He was also a gambler. And as a gambler, he was the first to describe such games mathematically. And he actually outlined what’s known as a sample space. So this is the– all of the combinations of events that could occur. And obviously, if you’re only interested in one of those, that gives you a sense of how difficult it is to win. Now for the UK National Lottery as it stands, you have to pick six numbers from a possible set of 59. So this results in just over 45 million possible combinations of you– of numbers you could pick if you bought a card. Clearly this makes life very difficult for you to win the jackpot. But there is a way that you can guarantee you will win the lottery this weekend. And that is quite simply to buy up every single combination of numbers. Now that might sound a little bit absurd. But let’s just run with it for a moment. As I said, there’s 45 million combinations of tickets for the UK lottery. So if you were to buy up every single possible combination and line them up end-to-end, it would actually stretch from London to Dubai. What’s more, each ticket cost 2 pounds. So if you really want to win the jackpot this weekend, it’s going to cost about 90 million pounds to achieve. Clearly that’s not a feasible strategy. But not all lotteries are the same. In the 1990s, for example, the Irish National Lottery had a much smaller sample space– a much smaller possible combination of numbers that could come up. In fact, there were about 1.94 million combinations. Each ticket costs 50p. So as a result, it would cost you less than a million pounds to buy up every single combination.

And actually a syndicate headed up by an accountant got thinking about this. And clearly most weeks, this is a pretty poor investment, because the jackpot would be maybe a few hundred thousand. And if you’re spending almost a million to win a few hundred thousand, doesn’t take much to spot that’s a pretty bad investment. But if a rollover were to come around, maybe this could be plausible. And actually rather than stretching it to Dubai, if you lined up all of these tickets and the combinations end-to-end, it would actually stretch from London to Plymouth. So you’ve got something that’s a bit more doable. And what they started to do is collect together these tickets and fill each one out by hand to get every single one of these combinations. And then they waited. They waited for about six months until the May Bank Holiday in 1992 when the rollover hit 2.2 million. And they put their plan into action. They took all these tickets they’d filled out, started taking them to shops, and buying them up. And in many cases this raised some attention. So shops that would usually sale maybe a thousand tickets in a week were suddenly selling 15,000. The Lottery perhaps expectantly, frowned upon this a little bit and tried to stop them. And as a result, when the lottery draw came around, they’d only bought 80% of the possible combinations of tickets. So there’s still an element of luck as to whether they’d win the jackpot. Fortunately for them, that jackpot’s winning set of numbers was within the combinations that they bought up. So they won that week. Unfortunately, there were two other winners that week. So they had to split the jackpot. But when you added up all those lower tier prizes that they match five numbers, four numbers as well, they walked away with a profit of 300,000 pounds. Now for me, years ago when I heard the story, that was just a fantastic illustration of how you can take a pretty simple mathematical insight, a good dose of audacity and hard work, and convert it into something that’s profitable. And this isn’t the only instance that people have targeted these kind of games. For the UK lottery, the draw is random. So really the only way you can guarantee a win is to use this brute force approach by simply buying up all of the combinations. But not all lotteries are the same. Take scratchcards, for example. On the face of it, scratchcards are completely random. If you think about it, they can’t be completely random. Because if you’re producing scratchcards, and you just randomly generate which cards are going to be winners, there’s a chance that by sheer chance you will produce too many winning cards. If you’re a company making scratchcards, you want some way of controlling and limiting which prizes go out. As statisticians will call it, you need controlled randomness. You want the prizes to be fairly uniformly, evenly distributed amongst the occasions. But you don’t want the generation to be completely random. And actually in 2003, a statistician called Mohan Srivastava was thinking about scratchcards. He’d been given some as a joke present and was wondering on this idea of controlled randomness. And he realised there must be some way for the lottery to identify which cards were winners without having to scratch them off. On each card there were a series of digits. And some of these would appear two times, three times. But some numbers and symbols only appeared once on the card. And actually if these unique numbers appeared in a row, that card was always a winner. And he went and bought more cards and tested out his strategy. And every single time, the cards that had these numbers in a row were guaranteed winners. Now what would you do in this situation? You’ve essentially cracked scratchcards. You’ve got a system which can identify the winning ones and the not winning ones just by looking at them. Would you go out and buy tonnes? What would you do? Well, think back to that slide that I showed you at the start. Winning scratchcards are remarkably rare. And actually what Mohan did, rather than just going on a huge scratchcard buying spree, was work out how long it would take him to buy up enough cards and guarantee himself a winner. And he was a statistician working on geological problems earning pretty decent money. And he realised that actually, although he had a winning lottery strategy, it was better off just to stick in his existing job. So what he did was he rang up the lottery and told them that there was a hidden code on their scratchcards, and he had deciphered it, and he knew how to win. The lottery, of course, didn’t take him seriously. So what he did was actually collected the scratchcards. And he identified some winning ones, some losing ones, divided them into two piles and posted them by courier to lottery. That evening he got a phone call from lottery saying, we need to have a chat. And really the story is representative of a lot of areas of gambling. Often it’s not professional gamblers who come up with these strategies that beat the system. And often people who beat the system, don’t become professional gamblers. For a lot of these people, gambling is almost a playground for ideas. It’s a way of testing out problem solving and skills that actually would apply to many other industries. People who have tried these problems are moving into academia, into finance, into business. And as I mentioned with Cardano, this isn’t a new phenomenon. Really throughout history, many of the great thinkers and mathematicians have used gambling as a way of refining their ideas. In around 1900, a French mathematician called Henri Poincare was particularly interested in gambling. Now Poincare was one of the– what’s know as the last universalists. As a mathematician, he was one of the last people to specialise in almost every area of the subject as existed at the time. It hadn’t expanded to the point where it was as large as it is today. And one of the things he was interested in was predictability. And to him, unexpected events, unexpected outcomes were the result of ignorance. He thought if something is unexpected, it’s because we’re ignorant of the causes. And he classed these problems by what he called the three levels of ignorance. The top level was a situation where we know what the rules are, we have the information, we just have to do some basic calculations. So if you’ve got, say, a school physics exam, you know what the physical laws are. You’re given the information. So in theory, you should be able to get the right answer. If your answer is surprising, then you’ve done something wrong in the working. But it’s not a kind of difficult level of ignorance to escape, in theory. The second level of ignorance according to Poincare was one where you know what the rules are, but you lack the information necessary to carry out the calculations accurately. And he used roulette as an example. So a roulette table, you start a ball spinning round and round. And he observed a very small change in the initial speed of the ball could have a very dramatic effect on where it ends up, because it’s going to be circling this table over time. And nowadays mathematicians refer to this as sensitive dependence on initial conditions. And popularly it’s known as the butterfly effect. There’s a talk in the ’70s where a physicist pointed out that a butterfly flapping its wings in Brazil could cause or perhaps prevent a tornado in Texas. These very small changes, which Poincare first observed, could have a very large effect later on. And then we’ll say that the results is random. It’s down to chance. But really, it’s a problem of information. Then comes the third degree of ignorance. And this is where we don’t know the rules. Or perhaps they’re so complex, we’ll never be able to untangle them. And in this situation, all we can do is watch. Watch over time and try and gain some understanding of what we’re observing. And it’s really this level of ignorance when gamblers started targeting roulette that they focused on. They didn’t try and untangle all of these physical laws. They just said, well, let’s just watch a load of roulette spins at a table and see if there’s a bias. See if there’s something odd going on with this table. But this raises the question of what do we actually mean by odd. What do we mean by biassed? And while Poincare was thinking about roulette in France, on the other side of the channel, a mathematician called Karl Pearson was also thinking about roulette. And Pearson was fascinated by random events. As he said, we can’t have any true sense of what nature does. We can only observe and try and make inferences on those observations