# Find the probability of solutions of an equation.

Let $x+y+z=20$. What is the probability that all the solutions are distinct? (No two variables have the same value). Assuming that the solutions are only positive integers or zero.
I have tried- $n(S)=\frac{22!}{2!20!}$
EDIT:$n(S)=231$. Now suppose we choose any two variables $x,y,z$, which can be done in ${3 \choose 2}$ ways. Now no. of ways of getting the same value in the two chosen variables-$10$. Now ${3 \choose 2}*10=30$. So probability will be: $1-\frac{30}{231}=\frac{67}{77}$. So where did I commit the mistake?
Edit: Sorry, the question says that solution can be zero too.

• What solutions have you found so far? – Nescrio Apr 24 '15 at 8:16
• Let me update the question. – Aditya Agarwal Apr 24 '15 at 8:18
• You may find non-distinct solutions and then subtract. The $x,y,z$ can't be equal all together, $3x\neq 20$, so you need just a case $(x=y)\neq z$ (up to permutations of $x,y,z$). – Alexey Burdin Apr 24 '15 at 8:29
• But how do I count it and then I'll have to double it for $x\neq y=z.$ – Aditya Agarwal Apr 24 '15 at 8:42
• If we are using positive integer solutions, presumably equally likely, the denominator is $\binom{19}{2}$. – André Nicolas Apr 24 '15 at 8:42

The number of partitions of $17$ into up to three parts is $33$ (see for example A001399),

so the number of partitions of $20$ into exactly three positive parts is $33$,

so the number of partitions of $23$ into exactly three distinct positive parts is $33$,

so the number of partitions of $20$ into exactly three distinct non-negative positive parts is $33$,

so the number of compositions of $20$ into exactly three distinct non-negative positive parts is $3!\times 33 = 198$,

so the probability all three non-negative parts are distinct is $\dfrac{198}{22\ \choose 2}=\dfrac67$.

The simple form of this result suggests there may be an alternative approach.

• What do you mean by partitions? – Aditya Agarwal Apr 24 '15 at 9:42
• I calculated like this- $n(S)=231$. Now suppose we choose any two variables $x,y,z$, which can be done in ${3 \choose 2}$ ways. Now no. of ways of getting the same value in the two chosen variables-$10$. Now ${3 \choose 2}*10=30$. So probability will be: $1-\frac{30}{231}=\frac{67}{77}$. So where did I commit the mistake? – Aditya Agarwal Apr 24 '15 at 9:50
• Wikipedia on partitions – Henry Apr 24 '15 at 11:04
• In your calculation, the pairs can individually take the values $0,1,\ldots,9,10$ i.e. $11$ possibilities, not $10$. Multiply that by ${3 \choose 2}$ and subtract the result from from $231$ to get $198$. – Henry Apr 24 '15 at 11:07
• Ok so 10 was the mistake – Aditya Agarwal Apr 24 '15 at 13:40

You have three distinct boxes, and want to count ways to put 20 indistinct balls into them. The total count of solutions is, as you have calculated:

$$\frac{22!}{2!20!} = 231$$

Now, to generate forbidden solutions you can choose 2 boxes, then put the same number of balls $n$ into each of them, and the remainder into the other. Since the number $n$ can vary from zero to ten, the ways to do this are:

$$\frac{3!}{2!1!}\times\sum_{n=0}^{10} 1 = 33$$

Noting that there's no way to fill three boxes all with the same number of balls (20 is not so divisible), we are done.

Assuming that each solution has equal probability of occurring, therefore the probability that no two terms in the solution are the same, is:

$$1-\frac{33}{231}=\frac{6}{7}$$

• Can you please elaborate more. (Fill up the spaces). – Aditya Agarwal Apr 24 '15 at 9:36