# Thread: n people standing in a line

1. ## n people standing in a line

Here is the question:
If Sam and Peter are among n men who are arranged at random in a line, what is the probability that exactly k men stand between them?

My solution:
1. Group Sam and Peter and the k men together and count them as one person.
2. So in effect, we have (n-k-2+1) number of people.
3. Simplify that and we get n-k-1
4. There are (n-k-1)! ways of arranging them.
5. There are then 2 more ways of arranging Sam and Peter by switching them around.
6. Finally, there are k! ways of arranging the k people between Sam and Peter
7. There are n! ways of arranging everyone without any restrictions.
8. Therefore the solution is:
(n-k-1)! * 2 * k! / n!

However, the book solution is 2*(n-k-1)/n*(n-1)

I checked by plugging some numbers and my answer is different from the book. Can someone explain what I'm missing?

Thanks

2. First of all what happens if n=2 or n=3?
Can k=0?
If n>2 can k=0,1,2,…(n-2)?

Say that n=10 and k=4. The number of ways that k can stand between the two is C(8,4)[2(4!)](5!).

I think you must deal with several cases for n & k.

3. Thank you Plato =D.
So I was missing the C(n-2, k).

I was trying to figure out why the combination part is needed and here is what I came up with. For those of you who were wondering the same, hopefully this is correct and clears things up. (If it's wrong, please correct me. Thanks)

Throughout my thought process, I've ignored the fact that the k people between Sam and Peter can be any k members of the remaining n-2 people. Therefore, there are C(n-2, k) many ways of selecting those k people.