Probability Question

geonerd

New member
Joined
Feb 11, 2021
Messages
4
There are 24 students in a class. 4 are in school, 20 are virtual. The teacher makes 6 breakout rooms (groups) of 4. What is the probability that 3 students in school end up in the same room?
 
There are 24 students in a class. 4 are in school, 20 are virtual. The teacher makes 6 breakout rooms (groups) of 4. What is the probability that 3 students in school end up in the same room?

Before I try to solve this, we need to be sure whether this means EXACTLY 3 in the same room, or AT LEAST 3 in the same room. If all four in-school students are in the same room, do we count that?

Once that's decided, we can keep things simple by realizing that it doesn't matter where the virtual students are; they can be rearranged at will without affecting the event we are asking about. So think of it this way: Four objects are each randomly placed in one of 6 boxes. What is the probability that [exactly/at least] 3 of them are in the same box?

(The fact that there are 4 in school, and 4 per room, keeps the problem from being as hard as it might have been!)

I will not be giving you a solution, but helping you find one on your own. So be sure to tell us what you have tried, and also how much you have learned about this subject, so we know what methods to suggest.

Be sure to read this if you haven't yet:
 
The problem means exactly 3.

This is what I have done so far: There are 4 ways to make groups of the 4 kids in school, where 3 will be in each group

And then there are 20 students at home, so each of these students could possibly be "paired" with a group from the people at school, since each room needs 4. That gets 80 possibilities (4*20)

Then, for the denominator, the total combinations of students is (24 C 4)*(20 C 4) *...(4 C 4)

Therefore, the answer is 80/3.46670573E15

Before that, there was another way I tried to do the problem, but the answer didn't seem to fit:
I used the same logic to come up with a numerator of 80.

Then did 24 C 4 to find number of possible groups of 4, which is 10626

So I got 80/10626 which simplifies to 40/5313

However, I'm not sure if I did either right

Also, just to clear up any possible confusion, this isn't a school assignment or homework, it's just something that actually happened (!) in one of my classes. I'm always curious about probability, but wasn't exactly sure how to figure it out! Other information: I am taking 10th grade PreCalc right now but have some experience with combinatorics and probability.
 
Last edited:
Also, just to clear up any possible confusion, this isn't a school assignment or homework, it's just something that actually happened (!) in one of my classes. I'm always curious about probability, but wasn't exactly sure how to figure it out! Other information: I am taking 10th grade PreCalc right now but have some experience with combinatorics and probability.
Thanks for the background information; that's important to know.

But when a question about probability is inspired by what actually happens, generally it's that "this or more" happened that is surprising, so I would make it "at least". I'll look at both.

Since this isn't for school, I'll just try to solve the problem (both ways), and then make comments on your work by comparison.

As I suggested, I'd ignore the 20 and focus on the 4. I'm going to treat the groups and students both as distinguishable, but ignore order of placement in each group, though it might be done in other ways. Suppose we have 4 in-person students, A, B, C, and D, and 6 groups to put them in, 1, 2, 3, 4, 5, 6. Each of the 4 can be in any of the 6 (since the group size doesn't restrict us), so the total number of ways to assign them is 6^4 = 1296. That's our denominator. Now, in how many of these have three in the same group? There are 4 ways to choose which 3 are together, 6 ways to choose the group they are in, and 5 ways to choose the group with the other one, for a total of 4*6*5 = 120 possible assignments. Therefore, the probability of exactly 3 being in a group is 120/1296 = 0.0926, or 9.26%. That's not too rare.

If, as I said, we want at least 3 in the same group, the numerator is increased by the number of ways to put all 4 in one group, which is 6 (groups for them to be in). So the 30 increases to 36, and the probability of something at least this surprising becomes 36/1296 = 1/36 = 0.0278, just a bit more.

How about your work?
This is what I have done so far: There are 4 ways to make groups of the 4 kids in school, where 3 will be in each group

And then there are 20 students at home, so each of these students could possibly be "paired" with a group from the people at school, since each room needs 4. That gets 80 possibilities (4*20)

Then, for the denominator, the total combinations of students is (24 C 4)*(20 C 4) *...(4 C 4)

Therefore, the answer is 80/3.46670573E15
This is far too small; that's because your numerator and denominator don't match. Your 4 ways are just ways to choose which 3 will be in the same group, not ways to place them; then multiplying by 20 just counts the ways to choose who will be with the 3. So you are counting only ways to assign that one group, and ignoring where everyone else goes. But in you denominator, you are counting ways to assign all 24 students to 6 distinct groups. The latter is good; but your numerator has to count the same sort of thing, and it doesn't.

Before that, there was another way I tried to do the problem, but the answer didn't seem to fit:
I used the same logic to come up with a numerator of 80.

Then did 24 C 4 to find number of possible groups of 4, which is 10626

So I got 80/10626 which simplifies to 40/5313
This denominator only counts different ways to make one group; at least this matches the numerator, more or less, so your answer here may be closer to what I got. Evaluating it, 40/5313 = 0.0075 = 0.75%. I'm not surprised it's too small, because you didn't really count everything.

Now, what happens if I expand my reasoning to include all the students, not just the 4?

As you found, there are (24 C 4)*(20 C 4)*(16 C 4)*(12 C 4)*(8 C 4)*(4 C 4) = 3.2467*10^15 ways to assign each student to a group.

How many ways are there to assign 3 in-person students to some group, 1 to another, and then fill in the rest? We have 4 ways to choose the 3, 6 ways to choose the group with 3, then 5 ways to choose the group with 1, then 20 ways to fill in the group with 3, then 19C3 ways to fill in the group with 1, then (16 C 4)*(12 C 4)*(8 C 4)*(4 C 4) ways to fill in the other 4 groups. This makes it 4*6*5*20*(19 C 3)*(16 C 4)*(12 C 4)*(8 C 4)*(4 C 4) = 1.4666*10^14. That's our numerator. The last 4 factors will cancel, so the probability is [4*6*5*20*(19 C 3)]/[(24 C 4)*(20 C 4)] = 2,325,600/51,482,970 =0.04517.

That's about half what I said before, so at least one of the two is wrong. I don't have time to pursue that, so I'll let someone else have the honor of finding my error. (As I've often said, I don't trust my work on this sort of problem until I get the same answer two different ways!)
 
I wrote a Monte Carlo simulation to estimate the probability of getting exactly three together in one group. During several runs I got the following results:- 0.092516; 0.092053; 0.092637; 0.092677 which strongly agrees with @Dr.Peterson 's first solution. Therefore his second solution probably contains the error (unless I made a mistake in my code).

Python:
from random import randint

max=1000000 # number of times to run the simulation
match=0
for i in range(max):
   
    g=[0, 0, 0, 0, 0, 0] # six groups, each with zero people in them

    # For each of the 4 students in school, assign them to one of the six groups
    for j in range(4):
        r=randint(0,5) # pick a random group
        g[r] = g[r]+1  # increase the count in that group

    # Has any group got exactly 3?
    for j in g:
        if j==3:
            match+=1
            break

print(match/max)
 
I wrote a Monte Carlo simulation to estimate the probability of getting exactly three together in one group. During several runs I got the following results:- 0.092516; 0.092053; 0.092637; 0.092677 which strongly agrees with @Dr.Peterson 's first solution. Therefore his second solution probably contains the error (unless I made a mistake in my code).

Python:
from random import randint

max=1000000 # number of times to run the simulation
match=0
for i in range(max):
  
    g=[0, 0, 0, 0, 0, 0] # six groups, each with zero people in them

    # For each of the 4 students in school, assign them to one of the six groups
    for j in range(4):
        r=randint(0,5) # pick a random group
        g[r] = g[r]+1  # increase the count in that group

    # Has any group got exactly 3?
    for j in g:
        if j==3:
            match+=1
            break

print(match/max)

Is it possible to run a simulation not just with sorting the 4 students into the rooms, but all 24 students, and see what the probability of 3 being together is?
 
Is it possible to run a simulation not just with sorting the 4 students into the rooms, but all 24 students, and see what the probability of 3 being together is?

Interesting. Doing this gives answers close to @Dr.Peterson 's second solution:- 0.045091; 0.045357

Python:
import random

studentsAtHome = [0] * 20
studentsAtSch = [1] * 4

# "chunks" function obtained from https://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks
def chunks(lst, n):
    """Yield successive n-sized chunks from lst."""
    for i in range(0, len(lst), n):
        yield lst[i:i + n]

students=studentsAtHome + studentsAtSch
max=1000000
match=0
for i in range(max):
    # print()
    random.shuffle(students)
    
    groups=list(chunks(students, 4))
    for gr in groups:
        sch=0
        for s in gr:
            if s==1: sch+=1
            
        # print(gr, "num in school: ", sch)
        if sch==3:
            match+=1
            break
    
print()
print(match/max)
Uncomment the print commands, and set "max" variable to "1" to better see how it works
 
That's so interesting! @Dr.Peterson, do you have any ideas? Maybe all the students have to be included to find the probability.

Does anyone have any idea if there is a potential mistake with the 1st solution, where the other students are not counted? Or maybe there is one with the 2nd?

Anyways, thanks for running the simulations @Cubist
 
First, I fully agree with Dr. Peterson that when dealing the a priori probability of actual events, what is usually of interest is answers of “at least.”

Assuming that students 1 through 4 are in school and that the groups are labeled A through F and that assignment is random and so independent, there 6^4 = 1296 ways to assign the in-school students to groups, each equally probable.

No students in the same group. 6 ways to assign student 1, 5 for student 2, 4 for student 3, 3 for student 4.
Total = 6 * 5 * 4 * 3 = 360 ways.

4 students in the same group. 6 possible groups.
Total = 6.

3 students in the same group. 4 ways to pick 3 students out of 4. 6 ways to assign tripleton to a group. 5 ways to assign singleton to a remaining group.
Total = 4 * 6 * 5 = 120.

2 students in the same group. This one is tricky. First once we pick one pair, we have determined the other pair. Number of ways to form a pair from 4 is 6. (Students 1 and 2, or 1 and 3, or 1 and 4, or 2 and 3, or 2 and 4, or 3 and 4.)

We could have a pair in one group and the other pair split. In that case, we have 6 ways to assign one pair together, and 5 * 4 ways to split the other pair. That gives 120 ways.

Alternatively, we could have a pair in one group and a pair in another group. If group A has a pair, there are 5 ways to pick the other group with a pair. If group A has no students and group B has a pair, then there are 4 ways to pick the other group with a pair. If group A and B have no students and Group C has a pair, there are 3 ways to pick the other group with a pair. In short, we have
5 + 4 + 3 + 2 + 1 = 15 ways.

Thus the total is 6(120 + 15) = 810.

Check, not proof.

[MATH]360 + 6 + 120 + 810 = 1296 = 6^4. \ \checkmark[/MATH]
In short,

[MATH]\text {probability that each student is in a different group} = \dfrac{360}{1296} \approx 27.78\%[/MATH]
[MATH]\text {probability that only 2 students are in the same group} = \dfrac{6 * 120}{1296 }\approx 55.56\%[/MATH]
[MATH]\text {probability that 2 students are in one group and 2 in another} = \dfrac{6 * 15}{1296} \approx 6.94\%[/MATH]
[MATH]\text {probability that 3 students are in the same group} = \dfrac{120}{1296} \approx 9.26\%[/MATH]
[MATH]\text {probability that 4 students are in the same group} = \dfrac{6}{1296} \approx 0.46\%[/MATH]
There probably is a formula for this kind of question, but I do not know it.

The probability of at least three students in the same group is close to 10%.
 
It took me long enough to realize this: My first method, ignoring the virtual students, did not count equally likely outcomes, because for different arrangements of the school students (none together, one pair, two pairs, ...), there will be different numbers of ways to assign virtual students.

So it looks like the lower probability, 4.5%, is the right one.

I'll reiterate:
(As I've often said, I don't trust my work on this sort of problem until I get the same answer two different ways!)
It's very easy to fool yourself. Even now, I find it hard to disbelieve my shortcut.
 
I find this problem particularly non-intuitive.

After much thinking I too am inclined to agree with the lower result of 4.5% because my post #7 simulation seems to reflect the actual problem more closely then my post #5. I guess the following two scenarios are quite different:-

1) assign the 4 "in school" students to the 6 groups at random (and then the "out of school" students are assigned to the remaining places)

2) draw students randomly from a bag without replacement (initially containing all 24 students) and assign them to groups in the order they are drawn.
 
OK. I was wrong to accept the premise that the virtual students could be ignored.

First, select randomly 12 students for assignment to groups A, B, and C. There are five possibilities: 0 in-school students are included, 1 is included, 2, 3, or 4. In the first two cases, it is possible but not certain that exactly one of group D, E, or F has at least 3 in-school students. In the third case, the probability that any group has at least 3 is zero. In the fourth and fifth cases, it is possible but not certain that exactly one of group A, B, or C has at least 3 in-school students. It is impossible for more than one group to contain at least 3 in-school students because there are only four such students.

The probability of a case is [MATH]\dbinom{4}{x} * \dbinom{20}{12 - x} \div \dbinom{24}{12}[/MATH]
[MATH]\dbinom{4}{x} * \dfrac{20}{(12 - x)! * (8 + x)!} * \dfrac{12! * 12!}{24!} =[/MATH]
[MATH]\dbinom{4}{x} * \dfrac{12! * 12!}{(12 - x)! * (8 + x)!} * \dfrac{1}{255024} \ \because \ \dfrac{20!}{24!} = \dfrac{1}{255024}.[/MATH]
[MATH]P(0) = 1 * 12 * 11 * 10 * 9 * \dfrac{1}{255024} = \dfrac{11880}{255024} \approx 4.66%[/MATH]
[MATH]P(1) = 4 * 12 * 12 * 11 * 10 * \dfrac{1}{255024} = \dfrac{63360}{255024} \approx 24.84%[/MATH]
[MATH]P(2) = 6 * 12 * 11 * 12 * 11* \dfrac{1}{255024} = \dfrac{104544}{255024} \approx 40.99%[/MATH]
[MATH]P(3) = 4 * 12 * 11 * 10 * 12 * \dfrac{1}{255024} = \dfrac{63360}{255024} \approx 24.84%[/MATH]
[MATH]P(4) = 1 * 12 * 11 * 10 * 9 * \dfrac{}{255024} = \dfrac{11880}{255024} \approx 4.66%[/MATH]
We have two reasons to have confidence in that result. It is symmetric. The probability that the first twelve selected will have x in-school students is exactly equal to the probability that the second twelve will have x in-school students. And

[MATH]\dfrac{11880 + 63360 + 104544 + 63360 + 11880}{255024} = \dfrac{255024}{255024} = 1.[/MATH]
If we have have 3 or 4 in-school students among the twelve selected, what is the probability that one group of four will have at least 3. There are three cases. If there are exactly three, then one group must have three and both other groups zero. If there are exactly four, then one group may have all four and both other groups zero or one group may have three, one group may have one, and the remaining group zero.

The probability that group A will have 3 in-school students given that there are exactly 3 in-school students in the first twelve selected is:

[MATH]\dbinom{3}{3} * \dbinom{9}{1} \div \dbinom{12}{4} = 9 * \dfrac{4! * 8!}{12!} = \dfrac{9 * 4 * 3 * 2}{12 * 11 * 10 * 9} = \dfrac{216}{11880}.[/MATH]
The probability that group A will have 3 in-school students given that there are exactly 4 in-school students in the first twelve selected is:

[MATH]\dbinom{4}{3} * \dbinom{8}{1} \div \dbinom{12}{4} = 4 * 8 * \dfrac{4! * 8!}{12!} = \dfrac{4 * 8 * 4 * 3 * 2}{12 * 11 * 10 * 9} = \dfrac{768}{11880}.[/MATH]
The probability that group A will have 4 in-school students given that there are exactly 4 in-school students in the first twelve selected is:

[MATH]\dbinom{4}{4} * \dbinom{8}{0} \div \dbinom{12}{4} = 1 * 1 * \dfrac{4! * 8!}{12!} = \dfrac{4 * 3 * 2}{12 * 11 * 10 * 9} = \dfrac{24}{11880}.[/MATH]
Therefore the probability that group A will have exactly 3 in-school students is

[MATH]\dfrac{216}{11880} * \dfrac{63360}{255024} + \dfrac{768}{11880} * \dfrac{11880}{255024} = \dfrac{1152 + 768}{255024} = \dfrac{1920}{255024} \approx 0.75\%.[/MATH]
And the probability that group A will have exactly 4 in-school students is

[MATH]\dfrac{24}{11880} * \dfrac{11880}{255024} = \dfrac{24}{255024} \approx 0.01\%[/MATH]
Now following Dr. Peterson's advice, let's try it a different way.

Probability that group A will have exactly 3 students.

[MATH]\dbinom{4}{3} * \dbinom{20}{1} \div \dbinom{24}{4} = 4 * 20 * \dfrac{4!}{24 * 23 * 22 * 21} = \dfrac{1920}{255024}. \ \checkmark[/MATH]
Probability that group A will have exactly 4 students.

[MATH]\dbinom{4}{4} * \dbinom{20}{0} \div \dbinom{24}{4} = 1 * 1 * \dfrac{4!}{24 * 23 * 22 * 21} = \dfrac{24}{255024}. \ \checkmark[/MATH]
But of course any group is equally likely for that to happen.

Probability of a group with exactly 3 in-school students

[MATH]6 * \dfrac{1920}{255024} \approx 4.52\%.[/MATH]
Probability of a group with exactly 4 in-school students

[MATH]6 * \dfrac{24}{255024} \approx \ 0.06%.[/MATH]
Probability of a group with at least 3 [MATH]\approx 4.58\%[/MATH]
 
Top