To win a tennis match you have to play better than your opponent. But how much better? Is it enough to win 5% more points than your opponent to be sure of the match? You can try to find this out with a simulation of tennis matches. This page contains a PHP script that can run simulations of tennis matches with two players of different strength.

First you will need to tell the script the strength of the two players. We define the strength of the two players by giving them each a number. The sum of these numbers is 1. If the strength of player A is 0.516 then the strength of player B will be 0.484.

This means that on average, player A will win 516 points of every 1000 points that are played between them. Player B wins on average 484 points.

Or you could calculate the relative strength of the two players. In the above example, player A will score on average 100*(516/485)-100 = 6.6% more points than player B. So if B scores 100 points, you can expect A to score about 106 or 107 points.

If both players are exactly equal in strength they each have strength 0.5 and on average they will score the same numbers of points.

Apart from setting the relative strength of the players you can also decide if the simulated matches are played as "best of 3" (this means you need to win 2 sets to win the match) or "best of 5" (win 3 sets to be the winner). And of course you have to tell the script how many matches you want it to simulate.

Go ahead and simulate some tennis matches. Fill the form and click the "play it" button. The script will generate all matches and show some statistics of the simulation. If you want you can select to see the results of all individual matches.

How the script works? For every ball played it generates a random number between 0 and 1. The point is won by player A if the random number is lower than his strength. Otherwise the point is for player B.

What did I learn from this? If I win just 60% of my matches against a certain opponent, I don't really feel much stronger. But if I win 90% of all encounters, I would really consider myself the better player. So running the simulation (best of 3) I found out that I need a strength of about 0.545 to win about 90% of all my matches.

That means that I need to score on average 100*(545/455)-100 = 19.8% more points than Federer.