# No of ways in which seven man can leave a lift.

Seven people enter a lift.the lift stops at three unspecified floors.at each of the three floors,no one enters the lift,but at least one person leaves the lift.after the three floor stops the lift is empty.in how many ways can this happen?

My attempt---

I tried to use the principle of inclusion and exclusion. I took P1 to be the property in which Ist person was left in the lift and P2 to be the property in which 2nd person was left in the lift and so on.Note P5,P6 and P7 are not possible. Therefore $n(1)=3^67$ $n(2)=C^7_23^5$ $n(3)=C^7_33^4$ $n(4)=C^7_43^3$

So number of ways=$$3^7-n(1)+n(2)-n(3)+n(4)$$ But that gave me a wrong answer. I couldn't understand where I went wrong.please help me. Thanks.

• Not really following. Are the people distinguishable, or is a "way this can happen" just something like $(5,1,1)$ meaning that $5$ get off at the first stop, then one each on the next two? – lulu Oct 8 '16 at 23:20
• @lulu yes the people are distinguishable. – Navin Oct 8 '16 at 23:33
• So then, this is the number of surjective maps from the set of seven elements to the set with three elements. That kind of thing has a well studied theory, which you can read about here for instance. – lulu Oct 8 '16 at 23:37
• here is another good source. This problem is the same as yours, but with $5$ people in the elevator...they work the inclusion-exclusion approach explicitly. – lulu Oct 8 '16 at 23:40
• @lulu I got it.Thanks for your looking at this problem as a kind of finding out number of surjective functions which is somewhat easier. – Navin Oct 9 '16 at 9:08

Each of the seven people on the lift has three choices for which floor to leave the lift, so there are $3^7$ ways the people could depart the lift. From these, we must exclude those cases in which there is not at least one person leaving the lift on each floor.
There are $\binom{3}{1}$ ways to select a floor on which nobody departs the lift and $2^7$ ways for the seven people to depart the lift on the remaining floors. However, if we subtract this number from $3^7$, we will have subtracted the number of ways in which all the people depart the lift on the same floor twice, one for each of the two ways we could have picked the excluded floor. There are $\binom{3}{2}$ ways to select the two floors on which nobody departs the lift and one choice for all the people to depart the lift on the remaining floor.
By the Inclusion-Exclusion Principle, the number of ways that seven people can leave the lift on three floors so that at least one person departs the lift on each floor is $$3^7 - \binom{3}{1}2^7 + \binom{3}{2}1^7$$