Quote:
Originally Posted by Raziel26
Tennis question that I'm stuck on ...
A couple of years ago I developed for fun (and because it's easy) a small library in R that allows to calculate the probability of winning a tennis match from any given score, assuming that the probabilities pA and pB of the two players winning a point on their own serve are fixed (player A has pA to win a point on their serve and 1-pB to win the point while B serving). The founding block of the library is the probability of winning from a deuce score. As you showed, this is:
P(D) = P(A wins from Deuce on their serve) = pA^2/(pA^2 + (1-pA)^2)
Next, to get the chance of holding a serve you just need the binomial distribution and its cumulative. They are implemented through dbinom and pbinom in R and defined as such:
b(k,n,p) = C(n,k) p^k * (1-p)^(n-k)
B(k,n,p) = \sum_{i=k}^{n} C(n,i) p^i * (1-p)^(n-i)
and represent the probability of winning exactly k points out of n (b function) and at least k points (B function) respectively.
You can now imagine to play 6 points for each service game. Player A wins the game if they win at least 4 points or if they win exactly 3 points and then goes on to win from deuce. In formula:
P(A wins a game while serving) = B(4,6,pA) + b(3,6,pA)*P(D)
Using the same logic as above, you can calculate the probability of winning the game from any score (for instance if the score is 15-0, you imagine to play other 5 points; A needs to win at least 3 of them or just 2 and then win from deuce).
You can do the same for the chance of B holding.
The probability of winning a set is slightly more difficult because you have to take into account that the probabilities of Player A winning a game (PGA, PGB) depend on who's serving. You imagine to play the first 10 games, 5 on each serve. Player A wins the set if:
- holds once and breaks 5 times;
- holds twice and breaks at least 4 times;
- ....
- holds always (5 times) and breaks at least once.
You can calcualate the above using the b and B functions easily. Player A can win also if after the first 10 games the score is 5-5 and wins the next two games or if wins just one of them and wins the tiebreaker.
To calculate the probability of winning a tiebreaker, you proceed as above and see what happens after 12 points.
Hope to have given you some hints to approach the general problem.