# What are the total number of ways in which $n$ distinct objects can be put into two different boxes so that no box remains empty?

I have came across this problem which is my textbook.According to the book the answer is: $2^n - 2$. But i don't understand how they got to that answer. Can someone help me out?

• You can't put them all into box 1, and you can't put them all into box 2. Otherwise whichever box you choose to put object 1, object 2, ..., object $n$ will be OK. Commented Jun 15, 2017 at 20:15
• @LordSharktheUnknown ?? Commented Jun 15, 2017 at 20:23

There are $2^n$ different subsets that can be taken from a set of $n$ objects. Pick any subset and put it in the first box. Then put the rest in the other box. That makes $2^n$ ways to put $n$ object in $2$ boxes. But you have the restriction that neither box can be empty. So you can't choose the empty set for box 1. And you can't put the whole set of $n$ objects in box 1, because that leaves box 2 empty. So there are $2^n-2$ ways that meet your criteria.