How to find all possible combinations of a set of options?

If you are given these options for dinner:

• Pie
• Cake
• Muffin
• Ice Cream

And you can have any of these options as you like and you can't have more than one of the same item. Then what are all the possible combinations?

For example you can have:

Pie
Pie, Cake
Pie, Cake, Muffin
Pie, Cake, Muffin, Ice Cream
Pie, Ice Cream
Cake, Muffin

etc...


Is there a way to find all possible combinations?

-
Do you want to list all of the combinations, or do you simply want to know how many there are? –  Brian M. Scott May 5 '12 at 9:11
@Brian M. Scott I would like to know the list of all possible combinations not just the number. –  Sam May 5 '12 at 9:13

A set of $4$ elements has $2^4$ subsets. These include the empty set, in which case you eat nothing. So the answer is $16$ if eating nothing is an option, or $15$ if eating nothing is not an option. The wording of the problem does not make it clear whether you can choose the empty set of foods.

The numbers are small enough that you could actually enumerate all the possibilities. You were well under way. To be sure of not missing any, you might proceed systematically. For brevity call the foods A, B, C, D.

We can have

i) nothing;

ii) A or B or C or D;

iii) AB or AC or AD or BC or BD or CD;

iv) BCD or ACD or ABD or ABC;

v) ABCD.

Count: we get $16$.

To see the "formula" $2^4$, imagine you are in a cafeteria line and the A's, B's, C's, and D's are lined up in that order. You look at the A's and say yes or no. Then you do the same with the B's, the C's, the D's. The number of possible choices is the number of strings of length $4$ made up of the letters Y (for Yes) and/or N (for No). There are $2^4$ such strings. The option NNNN corresponds to going hungry.

-
Eating nothing is not an option. Could you please provide a list of the 15 possible combinations? –  Sam May 5 '12 at 9:15
I had already edited to provide a list. If the number of options is say $10$ instead of $4$, then counting would still be easy ($2^{10}$, or $2^{10}-1$ if you do not allow the empty cafeteria tray). But making a complete list would be unpleasant, since $2^{10}=1024$. –  André Nicolas May 5 '12 at 9:23

Here you can input your options and get all possible combinations: mathisfun.com

-
This applet lists the $k$-element subsets of a set. So, in order to get all subsets, one would need to run the program for $k=1,2,\ldots,n$. –  Douglas S. Stones Oct 15 '12 at 12:24