Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been stuck on this problem: How many ways can you place n identical items in k spots(with k>2n-1) so that none of the items are next to another item (not all of the items need to be placed).

I tried using inclusion-exclusion on this but I couldn't figure out how to make it work.

Reading this again my wording was off - I've changed the problem phrasing so that it is clearer.

share|cite|improve this question
up vote 2 down vote accepted

Turn the problem around: imagine that the $n$ people are sitting in a row, and we’re to distribute $k-n$ seats in the row in such a way that there is at least one seat in each gap between two adjacent people. There are $n-1$ gaps between the people, and we can also put seats on the ends, so we’re distributing $k-n$ seats in $n+2$ slots with the restriction that the middle $n-1$ slots must each get at least one seat. Of course this means that $k-n$ must be at least $n-1$, so $k\ge 2n-1$.

Start by putting one seat in each of the $n-1$ gaps between people; that leaves us with $$k-n-(n-1)=k-2n+1$$ seats that can be freely distributed amongst the $n+1$ slots. This is a standard stars-and-bars problem, whose solution is


share|cite|improve this answer
I think "stars-and-bars" is a trick to translate a selection-allowing-repetition problem into a selection-without-repetition problem. Here your original problem is selection-without-repetition problem, which you first translate into selection-allowing-repetition problem, and then use "stars-and-bars" to translate it back to selection-without-repetition. It works, but it does not seem necessary. – Marc van Leeuwen Aug 28 '12 at 11:53
@Marc: I think that you make it sound a bit more involved than it really is: it’s just an easy reduction of the problem to a solved problem. – Brian M. Scott Aug 28 '12 at 18:34

Supposing you are only interested in the set of occupied seats, proceed as follows. Seat the $n$ people on an $n$-subset of the first $k-(n-1)$ seats without restriction, for $\binom{k-n+1}n$ possibilities. Now ask everyone to move ahead in the row as many places are there are people before them (the first person stays seated, the next moves one place, the next two places, etc.). Since the last person moves $n-1$ places, she won't fall off the end of the row, and nobody will end up next to another. The procedure is reversible from a seating arrangement without neigbours, so $\binom{k-n+1}n$ is the answer.

share|cite|improve this answer
I'm not sure about my answer...Can you explain me why my approach might be incorrect?Consider the side sits which are 2: We choose 2 from n people sitting at sides:nC(2) we have n-2 people remaining. We triple this remaining so we have 3(n-2) abstract people now because there are two invisible people sitting beside anyone ⇒ kC(3n−6) The final answer is: nC(2)×kC(3n−6) – Zeta.Investigator Aug 28 '12 at 9:10
@PooyaM: I tried to answer this at your answer, but it evaporated and turned up here. Your approach has multiple difficulties, to name a few: the exterior seats need no be occupied, two people may share an empty seat as neighbour, supposing $nC(m)$ means $\binom nm$, you first choose people (implying identity matters) then places (implying identity does not matter). – Marc van Leeuwen Aug 28 '12 at 9:18
van Leewen:I deleted my answer.thanks – Zeta.Investigator Aug 28 '12 at 9:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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