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?


Solution 1:

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.

Solution 2:

Preliminary

  • The subsets of a set $A=A$'s power set $=\mathcal{P}\left(A\right)$.
  • The size of a set $A=A$'s cardinality $=card\left(A\right)$.
  • Let your options be represented by the set $X = \left\{P,C,M,I\right\}$.

This table describes what to do for any basic combinatorics/permutations q...

$$ \begin{array}{l} \begin{array}{c|c} \hskip36.5pt & \hskip42.5pt\style{font-family:inherit}{\text{Ordering}} \end{array} \\[-7pt]\hline\hskip-5.5pt \begin{array}{c|c|c} \style{font-family:inherit}{\text{Repetition}} & \style{font-family:inherit}{\text{w/}} & \style{font-family:inherit}{\text{w/o}} \\\hline \style{font-family:inherit}{\text{w/}} & P_r^n=n^r & C_r^n=\left(\!\left(\begin{smallmatrix} n \\ r \end{smallmatrix}\right)\!\right)=\left(\begin{smallmatrix} n+r-1 \\ r \end{smallmatrix}\right) \\[0pt]\hline \style{font-family:inherit}{\text{w/o}} & nPr=\frac{n!}{(n-r)!} & nCr=\left(\begin{smallmatrix} n \\ r \end{smallmatrix}\right)=\frac{n!}{r!(n-r)!} \end{array}\hskip-5.5pt \end{array} $$

Remark

I will provide my own answer; but first, I will assign some notation to the already accepted answer (which correctly stated that the q could be thought of as the # sequences "(a,b,c,d)" s.t. a,b,c,d $=$ Y/N, i.e., w/ repetition & w/ ordering, subtracted by 1)...

  • $\mathcal{P}\left(X\right) = \left\{\left\{\right\},\left\{P\right\},\left\{C\right\},\left\{M\right\},\left\{I\right\},\left\{P,C\right\},\left\{P,M\right\},\left\{P,I\right\},\left\{C,M\right\},\left\{C,I\right\},\left\{I,M\right\}\left\{P,C,M\right\},\left\{P,C,I\right\},\left\{P,M,I\right\},\left\{C,M,I\right\},\left\{P,C,M,I\right\}\right\}\hskip-2pt\style{font-family:inherit}{\text{.}}$
  • # Combinations w/ empty set $= card\left(\mathcal{P}\left(X\right)\right) = 16$.
  • # Combinations w/o empty set = $card\left(\mathcal{P}\left(X\right)\right) - 1 = 15$.

Answer

Let's consider the q in its intuitive (some would say "raw") form, i.e., 1 about finding the # combinations of options from $X$ w/o repetition or ordering. The table says to use the Binomial Coefficient ($nCr$) but we will have to use it 4 times & + up the results to account for your 4 differently sized subsets...

$$\style{font-family:inherit}{\text{# Combinations}} = 4C1 + 4C2 + 4C3 + 4C4 = \left(\begin{smallmatrix} 4 \\ 1 \end{smallmatrix}\right) + \left(\begin{smallmatrix} 4 \\ 2 \end{smallmatrix}\right) + \left(\begin{smallmatrix} 4 \\ 3 \end{smallmatrix}\right) + \left(\begin{smallmatrix} 4 \\ 4 \end{smallmatrix}\right) = 15$$