# What is the probability of making a cake?

### The question:

We are given 6 different ingredients. 2 types of flours, 2 types of sugars, and 2 identical eggs.

$$F_1,F_2,S_1,S_2,E,E$$

We choose 3 items at random, we mix them, and throw them into the oven.

A) What is the size of the sample space of the question

B) What is the probability we make a cake (flour + sugar + egg)

### My attempt:

A) This would just be all permutations of possible choices, the size of the sample space would be 6 choose 3 (although I don't think this is correct because the eggs are identical)

How would I solve question B?

• You should use the term "permutations" to only refer to things which are very specifically permutations, bijective functions from a set to itself or equivalently strings of $n$ distinct characters where each character occurs exactly once. The term has been misused and has come to mean any string of characters of whatever length in some cases, but even in that case the order of the letters as they appear still matter. In your case the order does not. Call these instead "combinations" or "outcomes." – JMoravitz Jan 18 at 4:22

In an attempt to make the problem easier to calculate, we may choose to take one of the two identical eggs and mark it with a foodsafe marker of some sort. Now, the eggs are in fact distinguishable. In this way we would have $$\binom{6}{3}$$ outcomes in our sample space. We generally choose to do this because we have that each of these $$\binom{6}{3}=20$$ outcomes are equally likely to occur (given the most common interpretation of the problem).

If you insist that you want to look at the sample space as being where the eggs are treated as identical, you will have overcounted each outcome where exactly one egg appears twice each when we wanted to count them only once. There are $$\binom{4}{2}=6$$ such outcomes being overcounted. This drops our sample space down to size $$\binom{6}{3}-\binom{4}{2}=14$$. This is not a useful sample space for performing calculations with however since the outcomes are not equally likely to occur. It is far more likely to have an outcome of $$(F_1, S_1, E)$$ than $$(F_1, E, E)$$ (specifically it is twice as likely to occur).

Remember that if we want to use $$Pr(E) = \dfrac{|E|}{|S|}$$, we require that each outcome in the sample space be equally likely to occur. There are only two outcomes to playing the lottery, you either win or you lose. The probability of winning the lottery is nowhere close to $$\frac{1}{2}$$ however despite this.

Making the proposed simplification to the problem where we mark one of the eggs ahead of time, we count how many outcomes will actually result in one of each type of ingredient being used. There are $$2$$ ways to select which flour is used, $$2$$ ways to select the sugar, and $$2$$ ways to select the egg. Multiplying the number of options for each gives the total number of arrangements of one of each type as per the rule of product. This yields $$2\times 2\times 2=8$$ ways to select one from each ingredient type.

Dividing by the size of the sample space (remembering that this sample space was chosen specifically because it is an equiprobable sample space that fully describes the event we are interested in), gives us the probability:

$$\frac{8}{20}=0.4$$

• I understand everything in your post except There are (4 choose 2) such outcomes being over counted. How did you get that number? – AlanSTACK Jan 18 at 4:34
• @AlanSTACK Suppose you have exactly one egg in your selection. You still need $2$ more ingredients chosen to bring your total number of ingredients chosen up to $3$. There are $4$ non-egg ingredients left available to choose from of which you want to choose $2$ of them. There are $\binom{4}{2}$ (read aloud as "4 choose 2") number of ways to do so. Now, note that for each selection with exactly one egg where the eggs were considered identical corresponds to two different outcomes if the eggs were marked, once where $E$ was replaced by $E_1$ and again where $E$ was replaced by $E_2$. – JMoravitz Jan 18 at 4:36
• You have already answered my question, but out of curiosity. If the selection was $F_1, F_2, S, S, E, E$ (the different sugars were identical too). Would the sample space then be (6 choose 3) - (3 choose 2) - (3 choose 2)? – AlanSTACK Jan 18 at 4:41
• @AlanSTACK Hmm... For this, I'd probably brute force the count honestly. Some outcomes will have been overcounted four times: $(F_1, S, E)$ corresponds to each of $(F_1, S_1, E_1), (F_1, S_1, E_2),\dots (F_1, S_2, E_2)$, so I don't think it would be as easy as the expression you write. By my count I see $2+3+3+2=10$ outcomes there, not equal to the expression you wrote. – JMoravitz Jan 18 at 4:45

The probability you make a cake is equal to the number of three-ingredient combinations in the space that form a cake (flour + sugar + egg), divided by the total number of three-ingredient combinations in the space. The total number of three-ingredient combinations is 20 (= 6 choose 3), and because you have two possibilities for each of flour, sugar, and egg, the number of three-ingredient-combinations that make a cake is 2*2*2 = 8. So the probability of making a cake is 8 / 20, or 2/5 = 40%.

• I don't think my attempt is even correct. Since the eggs are identical. In addition, I don't really understand what you mean by the number of three-ingredient-combinations that make a cake is 2*2*2 = 8 Could you elaborate on that? – AlanSTACK Jan 18 at 4:18

Since this is a very practical problem, here's a more intuitive solution:

1. Pick the first ingredient. What is the chance it's a valid ingredient for making a cake? Actually, you can pick any ingredient here, so the probability is 6/6 = 100%.
2. Pick the second ingredient. You have five items left, of which only one would make baking a cake impossible (that is, selecting an identical ingredient to the first one). Therefore, the probability of a good pick is 4/5 = 80%.
3. Pick the third ingredient. If you have picked two different ingredients previously, let's call them A and B, you now have A, B, C and C left on the table. Only picking a C will get you a cake. Therefore the probability here is 2/4 = 50%.

You get the probability of making a valid cake by multiplying the individual probabilities in each step, so the result is 6/6 * 4/5 * 2/4 = 2/5 or 40%.

Regarding the sample space:

First think of in how many different ways can you make a valid cake? Each cake has one flour, one sugar and one egg. There are two different flours, two different sugars, and two eggs. Therefore you can make a cake in 2*2*2 = 8 different ways (since the eggs are actually identical, you end up with only four different kinds of cakes). When calculating the sample space you have to take into account the different ways of making a cake, not the number of diffrent cakes we get as a result.

As we already calculated the probability of making a valid cake to be 40%, we know that 8 combinations of ingredients equals 40%. There the number of all possible combinations is 8/0.4 = 20.

• Do you have an "intuitive solution" for part (A) as well? What is the size of the sample space of the question? – AlanSTACK Jan 19 at 3:00

I think the easiest way to solve this, as there's only 3 steps, is to create a probability tree with cake and no cake options at each branch. This would also chart the whole probability space, and would probably answer point A.

However, as that would involve firing up a paint program, I'll instead go through the tree verbally here.

$$P($$Cake$$|$$1st ingredient$$) = 1$$

No matter what ingredient we take, we can still bake a cake.

$$P($$Cake$$|$$2nd ingredient$$) = P($$Cake$$|$$1st$$) \cdot \frac{4}{5}$$

Of the 5 ingredients remaining, 1 is not ok – the one picked first – so that leaves us with 4 OK ingredients and one bad option.

$$P($$Cake$$|$$3rd ingredient$$) = P($$Cake$$|$$2nd$$) \cdot \frac{2}{4} = \frac{4}{5} \cdot \frac{1}{2} = \frac{2}{5} = 0.4$$

Of the 4 ingredients remaining, there is one item of ingredient 1 and one item of ingredient 2 remaining. That leaves us with 2 bad options and 2 items of ingredient 3.

I'm not too sure about what the sample space part A refers to. However here is a simple way to solve part B. The problem states that there are two identical eggs. So no consider that for each flour, you can pick two types of sugar but you can only pick 1 egg(you can choose either egg but they will be similar). So then each flour gives you 2 different results. Since there are a total of 2 different flours, you see that there are actually 4 different ways to bake a cake. This is just the number of ways to bake a cake. And that is simply the numerator for the probability calculation that has to be made. The denominator essentially asks how many different ways can you pick 3 items out of 6 different items(a simple combinatorics problem): $$\binom {6}{3} = 20$$ However, in this explanation, both eggs were combined as being one egg. So you have do divide by the number of ways that an egg can be chosen, which is basically $$2!= 2$$. So take $$20/2 = 10$$ as the total number of ways to pick 3 ingredients. An even more simplified approach is that instead of saying you can pick 6 ingredients, instead pick 5 ingredients(since the egg here is counted once). Then using combinatorics yet again, $$\binom {5}{3} = 10$$. This is the total number of unique ways to actually pick out the ingredients, since two identical items are being used.

Going back to the sample space problem, it is not quite clear at first. It might look as if it is a permutation. And yes it can be indeed a permutation. But the sample space of the question is not a permutation. The reasoning here is very simple, you pick 3 ingredients out of 6 ingredients. The order is not important here as {flour1, sugar1, egg1} is the same as {egg1, flour1, sugar1}. Thus not a permutation. In addition, because the eggs are identical, then {egg1, flour1, sugar1} = {egg2, flour1, sugar1}. So the cardinality of the sample of the question is 10: there are 10 unique possible ways to COMBINE 3 ingredients. You can either think of it as $$\binom {6}{3} = 20$$ and then divide by the total number of ways that you swap out egg1 for egg2: $$2! = 2$$. Or simply admit that you actually only really have 5 ingredients(because you really only do have 5). The reason that I find the sample space to be unclear is because you can pick the first ingredient 6 different ways, the second ingredient 5 different ways, and the third ingredient 4 different ways. If it was a combination problem you simply divide by the number of ways to shuffle those 3 ingredients once you pick them. The problem is that maybe you are not trying to bake a cake. So maybe you want to make some dough where you put a bit of the first flour in, then a bit of sugar, then you put the second type of flour(this might be a pie crust). Some people will bake flour and sugar and then after a few minutes of heating will add a second type of thinner or thicker flour to create a flaky texture so order is very important here.

• Only those outcomes which use exactly one egg are double counted. The outcomes with two eggs like $(F_1,E,E)$ or no eggs like $(F_1,F_2,S_1)$ are correctly counted only once. Exchanging $E_1$ for $E_2$ in these does not actually change the outcome. – JMoravitz Jan 18 at 18:03