This is like asking "what's the probability of matching exactly 1 number in a Pick 3 straight play?" but I have modified it to fewer numbers to explain the situation a little better for those who may not be familiar with that.

When we pick 3 numbers from 1-4 (order matters), we have the following 24 possible outcomes:

123 124 132 134 142 143 213 214 231 234 241 243 ... and so on

So if we pick the number 123, we have the following 9 numbers that will result in a match where exactly 1 of my number matches:

If the first number matches: 1xx -> 132 134 142

If the second number matches: x2x -> 321 324 421

If the third number matches: xx3 -> 213 243 412

I am trying to approach this by counting all possible outcomes where the first number matches and then subtracting the ones where the middle number is my picked number and then subtracting the numbers where the third number is my picked number.

So, we will have: 123 124 132 134 142 143 - 123 124 - 123 143 = 132 134 142. This process will repeat for each spot and so we will have a total of 3*3 = 9

But If we go about counting them and not know which ones are being removed again, we would get 6 - 2 - 2 = 2 and not 3.

How would we know how many to add back to get the answer to be 3? Or is there any other way to go about this?


I would think that you should use the inclusion / exclusion principle here.

It states that:

size of (A union B) = size of (A) + size of (B) - size of (A intersection B).

In your case, we take A to be the number where the second number matches. You have 1 for the first position, 2 for the second position, and then 2 choices for the third problem, so the size of A is 2.

Similarly, take B to the number where the third number matches. You have 1 for the first position, 3 for the third position, and then 2 choices for the second position, so the size of B is 2.

However, as you say, you can't just get the answer you want, which is size of A union B, by subtracting off the size of A and the size of B, because then you've subtracted off one possibility (123) twice since it is in both A and B. Because you've subtracted off the size of the intersection of A and B twice, you have to add it back on.

In this case, we can easily see that the intersection is the number where the second position and the third positions match, and the only possible option here is 123, so the size of the intersection is 1.

So the answer becomes: 6 - 2 - 2 + 1 = 3, as you expect.

You can keep applying the principle of inclusion / exclusion to higher valued problems, for example, say, if you have a list of four numbers.


Picking $3$ from $[4]$ without replacement and arranging them in order is the same as ranking all $4$. By symmetry we may assume that the first ranking is $(1,2,3,4)$, and that for the second ranking $\sigma=(\sigma_1,\sigma_2,\sigma_3,\sigma_4)$ all $24$ possible rankings are equiprobable. We want to know the probability $p$ that $\sigma$ has exactly one fixed point at one of the positions $1$, $2$, or $3$. These three events are mutually exclusive, and equiprobable.

The probability for $\sigma_1=1$ is ${1\over4}$. Conditioned on $\sigma_1=1$ we don't want a fixed point at either $2$ or $3$. The conditional probability $P_c\bigl[\sigma_2\ne2\wedge\sigma_3\ne3]$ for this to happen can be rewritten as $$P_c\bigl[\sigma_2\ne2\wedge\sigma_3\ne3]=1-P_c\bigl[\sigma_2=2\vee\sigma_3=3 \bigr]\ .\tag{1}$$ For the last term we use inclusion/exclusion, and get $$\eqalign{P_c\bigl[\sigma_2=2\vee\sigma_3=3]&=P_c\bigl[\sigma_2=2]+P_c\bigl[\sigma_3=3\bigr]-P_c\bigl[\sigma_2=2\wedge\sigma_3=3\bigr]\cr &={1\over3}+{1\over3}-{1\over6}={1\over2}\ .\cr}\tag{2}$$ E.g., conditioned on $\sigma_1=1$ the probability of $\sigma_2=2$ is ${1\over3}$. We now plug $(2)$ into $(1)$ and then finally obtain $$p=3\cdot{1\over4}\cdot\left(1-{1\over2}\right)={3\over8}\ .$$

  • $\begingroup$ thanks Christian, although the number 3/8 seems to be correct, I don't fully understand it the process.. could you please point me to some resources that will explain this in more detail? $\endgroup$ – K Vij Aug 6 '18 at 19:43
  • $\begingroup$ I have slightly edited my answer. There are no resources, theorems, or special notions needed to understand it. $\endgroup$ – Christian Blatter Aug 7 '18 at 8:23
  • $\begingroup$ Ahh, I see, so it's basically counting the possibilities manually and then adding and subtracting them. I am wondering if there is a general formula that can be applied to any situation with any numbers... e.g. matching exactly 2 if 3 numbers are picked from 0..9 ? Is there a general formula that can take these as parameters n, r, k etc and give you the result? $\endgroup$ – K Vij Aug 8 '18 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.