Until September last year, I had never really gambled. I’d been to the dog tracks a few times when I lived in Manchester and once went to Aintree to watch the Grand National. Some of my friends would bet on the football, and I could see how it could add an extra dimension to watching the game. But I’d never got over the entry barrier posed by opening up an account and feeding in my credit card details.

That was all about to change. I had spent the summer working on “Soccermatics”, my book about maths and football, and decided to set myself one final challenge before I sent my draft to the publishers. I was going to take everything I had learnt about the mathematics of football and apply it to a real-life situation. I was determined to use maths to beat the bookies.

So, during the first half of the 2015-16 Premier League season I developed a set of models that tried to predict the outcome of games more accurately than the bookmakers’ odds did. I tested the models, refined them, and before too long I started to make money. From a starting capital of £400, I made £108.33 by the end of November: a return of 27% over two months.

Gambling is not about picking winners. The trick is to know your probabilities better than the bookies

Before I reveal the secrets of my betting model, we need to take a step back and get some of the basics straight. To the uninitiated, the world of online betting can be somewhat overwhelming. There are a huge number of bookmakers, all offering free starting bonuses and a whole range of products, from straightforward bets to more complicated ones such as Asian handicaps (where the weaker team is assigned extra goals at the start of the match), over/under corner markets (where the stake is multiplied by the number of corners over – or under – a target set by the bookmakers) and Scorecasts (that offer very long odds on the first or last goal scorer and the match result). But don’t worry about them: for the purposes of clarity, I decided to stick to the traditional win/draw/lose bets.

Now, it might be tempting to set up an account with one of the gambling sites from TV adverts or a company you’re familiar with from the high street. But a single account is not a good idea. Most bookmakers calculate odds to guarantee a 5% profit on every bet you place. This means that if you were to place £100 on win, draw and lose in the same match, your £100 would become £95. Unless you are a lot smarter than the bookmakers, your money will soon be gone.

By having multiple bookmakers you can reduce the bookmaker’s advantage. Each bookmaker offers slightly different odds. If you take the best available odds then the bookmaker’s margin drops to around 1.5%. For some big matches it can be even lower. This means that you only need to be about 2% better than the bookmaker in order to start to make a reliable long-term profit.

The second rule of gambling is to make sure you understand the relationship between odds and probabilities. Most of us know that odds of 5/7 for a Manchester United win means that if you bet £7 you win £5 if the result goes Manchester United’s way (the bookmaker would give you £12: £5, plus your original stake). But it is also important to realise that odds of 5/7 mean that the bookmakers think that the probability of Manchester United winning is less than 7/(5+7) or 58.3% – the number of likely winning outcomes divided by the total number of outcomes, that is. So if you think United have, say, a 60% chance, then 5/7 is a good bet.

You need to do the odds-to-probability calculation every single time you place a bet. Before you part with your money, assign probabilities to each potential outcome and compare these with the odds. Only bet if the probability you assign to an outcome is higher than the bookmakers’ implied probability. For many people this is a very difficult idea to get their head around. Gambling is not about “picking winners”. Successful gamblers back just as many, if not more, losers than winners. The trick is to know your probabilities better than the bookies.

The first model I devised, back in September 2015, was based on an expert’s predictions. In earlier seasons, NBC journalist Joe Prince-Wright had been particularly successful in predicting the Premier League end-of-season table. So I took his weekly “Premier League picks” and used them to decide which team to back. Prince-Wright’s predictions are fun, but quickly lost money, and I had to drop him from my modelling. In general, media experts provide entertaining predictions, but don’t outperform the bookies.

The second model I tried was based on the Euro Club index, which assigns points based on the result of matches between teams. Every time a team wins a match it gains index points and when it loses, the team loses index points. This is similar to the Elo rating that is used in chess and other sports. The Euro Club index does give reasonable predictions of match outcomes, but it didn’t beat the odds. Once the bookmaker’s margin is taken in to account, betting on the index lost money at a steady rate.

Many big matches ended in draws; backing them was the main source of my profits

The third model was based on a concept called expected goals. In this model, each shot a team makes is assigned a value based on historical data of shots taken in similar situations. For example, a shot from inside the box typically has a 12% probability of going in, so it contributes 0.12 to a team’s expected goals total. Shots from outside the box have only a 3% chance of going in and contribute 0.03. Summing up all expected goals scored and conceded by a team gives a good overall estimate of the quality of a team’s attack and defence that can then be used to simulate future matches. My model based on expected goals resulted in some spectacular gains early on in the season. It predicted the decline of Chelsea, but it overrated Arsenal and Liverpool. While the expected goals model didn’t lose money, it made such wild predictions that it couldn’t be relied on for a steady return.

As the season progressed it became clear that a fourth and final model, which I called the odds bias model was the most reliable. Many betting markets exhibit a phenomenon known as “long-shot bias”, where the odds are better for favourites than for “long shots”. The bias can be explained by punters being attracted by the potential of big profits offered by large odds, and undervaluing the smaller gains to be had by betting on the favourite (and bookmakers adjusting their odds accordingly).

I found a long-shot bias in earlier Premier League seasons. For example, in 2014-15, putting money on Chelsea, Arsenal and Manchester City against teams lower in the table would have given a small but reliable week-on-week pay-off. Big teams win slightly more often than predicted by the bookmakers’ odds. This bias disappeared during the 2015-16 season, with big teams performing worse than expected, and with “long shots” Leicester City defying the odds. Not only did some bookmakers initially offer Leicester at 5,000 to 1 to win the league, but they were also undervalued in almost every match they played.

In the 2015-16 season, underdogs Leicester defeated odds of 5,000-1 to win the Premier League

While the usual long-shot bias didn’t make money last season, I found an additional bias that was immune to the peculiarities of Leicester’s amazing run, the frailties of Manchester City’s defence and the unreliability of Arsenal’s strikers. Punters don’t like backing draws in big matches. When Manchester United host Manchester City or Arsenal visit Liverpool, these matches see two very well matched teams play each other. But punters like to see a win in one direction or the other and the bookmakers increase the odds for a draw. This is a consistent bias over a number of Premier League seasons, and the 2015-16 season was no exception. Many “big game” matches ended in draws and backing these draws was the main source of my profits.

When I finished writing “Soccermatics”, in December 2015, my “odds bias” model had doubled the starting capital invested in it. I’d placed enough bets to demonstrate that these profits were statistically significant and that I hadn’t just been lucky. After that, my betting became more sporadic. I placed a few bets when I had time, but I often forgot. Feeding odds in to my laptop on a Friday night before the weekend’s games was not really a top priority. There is more to life than gambling.

It is, however, possible for me to assess how I would have done if I had continued to bet. The website www.football-data.co.uk collates closing odds and results for the UK leagues. It turns out that my model continued to hold its own throughout the season. The rate of return for the odds bias model over the 2015-16 Premier League season was more than 200%. Not bad at all in the current economic climate.

There is a caveat to all of my modelling work, a small detail that I haven’t yet revealed. It is this. What I haven’t mentioned is that I had a fifth model. It was called “ask my wife”. Lovisa Sumpter is a very talented individual. She is an associate professor of mathematics education in Sweden, where we live, and a qualified yoga instructor. She also has a much better record than her husband in football betting. When she was still a student, Lovisa correctly predicted the outcome of every one of the 13 matches in the Swedish Stryktipset. The chance of getting these right by picking randomly is 1 in 3 to the power of 13 (or 1/1,594,323). Although the pay-out for her winning week was relatively small, she remains proud of being one of the few people in Sweden to “get 13 right”.

What I haven’t mentioned is that I had a fifth model. It was called “ask my wife”

Given her record, I asked Lovisa if she would try her luck as a benchmark model. She would represent the typical punter. I have to admit, I expected her to lose. She was using a single bookmaker who had a 6% advantage per bet over her, while I had my system with multiple bookmakers. She claimed to be “studying the form”, which involved trying to see a pattern in the win/draw/lose results for the various teams. But I couldn’t see any logic in what she was doing.

How wrong I was. At the end of our experiment Lovisa had won £17. A tidy little profit on the £100 investment. In fact, given that Lovisa cashed in her winnings after only four weeks, the rate of return on her investment was higher than mine.

I have to say, and this is still a matter of some controversy in our household, that Lovisa’s winnings were not statistically significant evidence to back up her “studying the form” method. She didn’t place enough bets each week to pass a statistical test. But I do have to give her credit, and not just for the sake of harmony at home: she got the result and made some money.

What I learnt from my gambling experiment is that betting using mathematics is hard work. It took me a fair bit of time to develop the model of the Premier League. And the results aren’t directly transferable from one market to another. For the English Premier League, the bias against draws between well-matched teams might be explained by the media hype building up to these games. The newspapers carry stories strongly contrasting the two teams, and punters are tempted to opt for one side or the other, neglecting the correct probability of a draw. The same isn’t true for other leagues. When I tested my model on the Championship and lower leagues, without placing bets, I found that draws between well-matched teams were not undervalued on betting sites.

To be sure of a reliable profit over various markets, new models need to be developed for each of them. This is a full-time job. So even if you have the prerequisite mathematical skills, I wouldn’t recommend becoming a professional gambler. There are many other jobs in mathematics and statistics that provide a much more stable income than gambling and require a much smaller starting capital.

All that said, I couldn’t resist the temptation to look at Euro 2016, which starts in France on June 10th. International tournaments are very different from national leagues, because they attract a much wider range of betting fans. In order to get some idea of what happens to the odds at these big tournaments, I looked at the odds at the previous two World Cups: the men’s world cup in Brazil in 2014 and the women’s world cup in Canada in 2015.

The small number of matches played at international tournaments means that we can’t draw strong statistical conclusions, but I have found a small bias in the odds from previous World Cups. In matches where a slightly favoured team (with odds between 3/5 and 3/2) plays a less favoured team (with odds between 3/2 and 7/2) then the underdog wins more often than predicted by the odds. This is very different from the long-shot bias found in the Premier League. Why do the favourites tend to be overvalued in international tournaments? One answer is that these tournaments attract a lot of punters who don’t usually bet on football, and it is plausible that name recognition drives their decisions. Their money goes on the well-known footballing nations, so yours should go on their slightly lesser-known opponents. However, extreme long shots, like Iceland, are still not worth the risk.

Backing Wales at 5/2 to beat Russia in the group stage is one example of a bet suggested by my model. If you would rather back England, then you should wait to see if they get through the group stages (where they are favourites). Then £10 on England against Spain or Germany in the knockout stage should be worth the risk. It might finally be England’s turn to beat the odds.