# The probability of winning the match with a certain probability of winning points

I hope there are sports fans among the readers. If you play badminton or table tennis, then you may have wondered: what is the probability of winning a game with a certain probability of winning a point? Suppose you lose your opponent with a score of about 11: 7. It would seem that only 4 points of difference, but it does not manage to win the game. Unlucky? I propose to solve this problem and get an answer to this question.

Having an indirect relation to financial mathematics, I know that it is for financial mathematics that such a task will seem particularly simple. Possible methods of solving it are very similar to the methods of calculating the price of an option. But there are some nuances in this task that are somewhat atypical for finance. Let's consider the solutions.

For a start, I commissioned my 15-year-old son to solve this problem by numerical methods, who is a little involved in programming in Python (the keyword “a little”). I suggested that he try the binary tree method (in financial risk, the analyst is usually called the binomial method or lattice) and Monte Carlo. Son surprisingly quickly coped with Monte Carlo, writing a fairly compact code. If anyone does not know, the idea of ​​Monte Carlo is to make a large number of random stuffings by simulating the problem and finding the answer. Suppose you are the first player. In this case, we have the probability of winning a point (7 / (11 + 7)) ~ = 0.39. We start the game by generating a random number X in the range [0., 1.]. If X <0.39, then you win the point. We bring the party to the end and note who won. To achieve acceptable accuracy, we perform this procedure a large number of times. In finance, the range from 100K to 1M is usually used, this ensures the accuracy of 8 significant digits. My son counted up to 10K, it was instantly and unequivocally ensured sufficient accuracy. For which, however, we did not pursue, because for simplicity, we decided to ignore the goat's battle. That is, a score of 11:10 was considered a victory. Half a page of code is easily enough to solve this problem. Try it and you will like it. Half a page of code is easily enough to solve this problem. Try it and you will like it. Half a page of code is easily enough to solve this problem. Try it and you will like it.

I was not satisfied with the simplicity of the solution with the help of Monte Carlo and decided to load my son with the binary tree method. He had long discarded and complained about the complexity. I had to help him a little with materiel.

Binary tree is built as follows. We start with the score 0: 0. If the first point is won by the first player, go up one cell to the right and if the second one wins down and to the right. Movement to the right is a movement on points from the beginning of the game to the end. To play up to 3 full tree is shown below. The tops of the intermediate results are highlighted in blue, the first player wins the match in yellow, and the second player wins in green. We start with the score 0: 0, the probability of which is 100%. Each transition to the right has its own probability. We denote the probability of winning points by the first player - p1, and the second - p2. Naturally, the sum of p1 + p2 = 1. Go through the tree from the beginning to the end and calculate the probability of getting into a given cell. For the uppermost and lower cells, transition is possible only from one cell of the previous level. For example, a score of 3: 0 is possible only after 2: 0. Entry into the remaining cells occurs from two adjacent left. For example, a 1: 1 score is possible after 1: 0 with a subsequent scoring by the second player, or at 0: 1 with a winning by the first player. Vertices are highlighted in blue, the hit to which comes from one previous peak, yellow from two. The selected cells mark the end of the game, that is, the victory of one of the players. When counting them, only one previous vertex is also used, since the other is the end of the game after which the transition is not carried out.

The problem of the son was in the representation of such a tree by means of the language. The graph suggested itself, but in Python it’s somehow difficult, or he doesn’t know. I myself am almost not familiar with this language. I had to move this structure into an array, slightly twisting it as follows. Then it remains to go in a double cycle left to the right and from top to bottom, counting the likelihood of the cells and taking into account the boundary conditions. They are cast in if / if / else. Well, it remains to sum up the probabilities of winning cells for one of the players (it is possible for the second to check that their sum is equal to 1).

Well, finally, the third method. Any final score of the party (for example 11: 7) implies a certain number of options. Statistics say that this is the number of combinations from 7 to 17. The value is 17! / ((17-7)! 7!). 17 is the total number of points scored on this score minus one, since the last point is always winning for the winner, that is, 7 lost cannot be in this place. Possible variants of winning accounts are as follows (I ignore the goat fight) - 11: 0, 11: 1, ..., 11: 10.

That is, you can go through all the outcomes of a winning account for a player by summing up the number of options in each of them multiplied by the probability of a given outcome. The table contains the results of calculations for the probability of winning a point of 39%. power1 is the degree to which the probability of winning a point is raised to a winner, power2 to a loser. All the above methods work reliably and give the same results.
In conclusion, I will give a graph of the probability of winning a match in table tennis (up to 11) and badminton (up to 21) depending on the average probability of winning a point. The blue line represents table tennis, the orange line represents badminton. As can be seen from the graph, in order to have at least some chances (~ 3%) to win the game of table tennis, it is required to win at least 30% of points. Already at 25% the odds go below 1%.
In badminton requirements are even tougher. There it will take more than 35% to hope for winning the game with a probability of about 3%.

In a natural way, the probability of winning a match (from several games) drops even more if you score less than 50% for each point.

Valuable advice suggests itself - in order to win matches, you have to work on winning each point.