# Combinatorics choosing members for a class.

The question goes as follows:

We have two classes of students, Class A and Class B and $n$ students to sort into either class. We randomly choose a number $x$ between $1$ and $n-1$ to give us the class size. $x$ is then the size of Class A. From this we pick the students for the class A with each set of students chosen being equally likely. Then the remaining students ($n-x$) make up Class B. Consider a particular student, student $1$. What is the probability of the class containing student $1$ to have a size $m$ for $m$ from $(1.\;.\;.\;n-1)$

This is my working so far. I believe we need to use Baye's conditional formula to work out the probability of the size of the class given that student $1$ is in said class. Hence $$P(\text{size of class}|\text{Student}\; 1 )=\frac{P(\text{Student}\; 1|\text{size of class})\cdot P(\text{size of class})}{P(\text{Student}\; 1)}$$ Now $$P(\text{Student}\; 1|\text{size of class})=\frac{n-1\choose m-1}{n\choose m}$$

And $P(\text{size of class})=\frac{1}{n-1}$. However I'm having trouble seeing where $P(\text{Student}\; 1)$ comes from. Any pointers?

HINT: There are $2^{n-1}-1$ possible classes that contain Student $1$. (Why?) For a given $m$, how many of them have $m$ members?

• For any given $m$, the number of possible combinations of the class is $n\choose m$. I'm not sure how to look at this for the class containing student 1. I'm definitely missing something.... – JJabrams Dec 3 '15 at 14:26
• @JJabrams: To form a class of $m$ students that includes Student $1$, you have to pick $m-1$ other students. In how many different ways can you do this? – Brian M. Scott Dec 3 '15 at 14:27
• Choosing $m-1$ students from $n-1$ right? Is this not using $n-1\choose m-1$? Sorry I'm not grasping this – JJabrams Dec 3 '15 at 14:30
• @JJabrams: Yes, that’s correct. That’s the number of $m$-person classes that contain Student $1$. There are $2^{n-1}-1$ possible $m$-person classes altogether. Therefore . . . ? – Brian M. Scott Dec 3 '15 at 14:35
• Ok yeah I understand you divide them. How did you get that there is $2^{n-1}-1$ possible size $m$ classes? – JJabrams Dec 3 '15 at 14:40

You can clarify things a bit by writing out your events in greater detail. The event "size of class = n" is actually "size of class we observe = n", and the event "Student 1" is actually "Student 1 is in the class we observe". So when you're looking for $P(\text{Student 1})$, what you're looking for is the probability that Student 1 is in the class you're observing, before knowing how large the class is.

There are two ways of thinking about how you calculate this value, and both will take you to the same answer.

### First Way

The first way to calculate this probability is as the expected value of $P(\text{Student 1})$ for unknown class size. That is, $$P(\text{Student 1}) = \sum P(\text{Student 1} \mid \text{class size}) \cdot P(\text{class size})$$ where the sum is taken over all possible values of class size.

### Second Way

The second way is to recall that what Bayes' Theorem gives you is a probability. Therefore, $P(\text{class size = x} \mid \text{Student 1})$ must sum to $1$ if you sum over all values $x$ of class size. Since the denominator $P(\text{Student 1})$ doesn't depend on class size, we can write \begin{align*}1 = \sum P( \text{class size}\mid \text{Student 1} ) & = \sum \frac{P(\text{Student 1} \mid \text{class size}) \cdot P(\text{class size})}{P(\text{Student 1})} \\ & = \frac{\sum P(\text{Student 1} \mid \text{class size}) \cdot P(\text{class size})}{P(\text{Student 1})}\end{align*} and therefore $$P(\text{Student 1}) = \sum P(\text{Student 1} \mid \text{class size}) \cdot P(\text{class size}).$$

• Thanks! Is my general approach right? I wasn't sure about using Baye's as it doesn't specifically mention conditional probability – JJabrams Dec 3 '15 at 14:18
• Yes, your general approach to use Bayes' Theorem is correct. – Empiromancer Dec 3 '15 at 14:29