# A multinomial problem has been solved programmatically, could someone please give a hint about how to solved it mathematically?

This post gives an example of Multinomial Distribution.

Two chess players have the probability Player A would win is 0.40, Player B would win is 0.35, game would end in a draw is 0.25.

The multinomial distribution can be used to answer questions such as: “If these two chess players played 12 games, what is the probability that Player A would win 7 games, Player B would win 2 games, the remaining 3 games would be drawn?”

That post has solved the problem programmatically in R.

dmultinom(x=c(7,2,3), prob = c(0.4,0.35,0.25))
##  0.02483712


Could someone please give a hint about how to solved the problem mathematically?

someone gave a formula for this

$$n = \frac{12!}{7! \times 2! \times 3!}$$

the denominator represents all the possible unique ways to get the combination of (Player A wins 7 games, Player B wins 2 games, 3 drawn)

what does the $$12!$$ part represent?

the corresponding R code is

(factorial(x = 12) / (factorial(x = 7) * factorial(x = 2) * factorial(x = 3))) * (0.4 ^ 7) * (0.35 ^ 2) * (0.25 ^ 3)


and got

#>  0.02483712


the result is equal to the first one, but why? where does this code from?

• If you really want to understand the meanings of the factorials, like $12!,$ then see my explanation at stats.stackexchange.com/a/415878/919. BTW, that R code is useful for textbook exercises but fails (due to underflow or overflow) on real problems where the numbers might be a little larger. Use logarithms and log factorials (lfactorial) instead. – whuber Oct 15 '19 at 13:10
• en.wikipedia.org/wiki/Multinomial_distribution think about these games as making 12 rolls of 3-sided dice and apply formula ------------------------------ if you would want me to add more just add comment – quester Oct 15 '19 at 18:56

What we need to solve this question are two things
1) How likely is one pattern where player A wins 7 games, Player B two games, and 3 draws. For example AAAAAAABBDDD This is $$p = 0.4^7*0.35^2*0.25^3 = 3.136^{-6}$$

2) The number of patterns with 7 wins for A two wins for B and 3 draws.
This is a permutation of multisets (see Wikipedia) $$n!/k_1!k_2!...k_m!$$
$$n$$ = number of elements and n! is the number of possible sequences of n different objects
$$k_1 ... k_m$$= Number of similar elements of each group, By dividing we correct for the n! for the fact that we do not have n different objects but instead some groups

For your chess problem n = 12 as it is the number of games,
k1 = 7 (wins for A),
k2= 2 (wins for B) and
k3= 3 (draws)