ML Interview Q Series: Calculating M&M Color Probabilities Using Basic Probability Rules
Browse all the Probability Interview Questions here.
Question
M&M sweets are of varying colours and the different colours occur in different proportions. The table below gives the probability that a randomly chosen M&M has each colour, but the value for tan candies is missing.
a) What value must the missing probability be?
b) You draw an M&M at random from a packet. What is the probability of each of the following events?
i) You get a brown one or a red one.
ii) You don’t get a yellow one.
iii) You don’t get either an orange one or a tan one.
iv) You get one that is brown or red or yellow or green or orange or tan.
Short Compact solution
a) All probabilities must sum to 1. Hence, the tan probability is 1 - 0.3 - 0.2 - 0.2 - 0.1 - 0.1 = 0.1.
b)
i) 0.3 + 0.2 = 0.5
ii) 1 - 0.2 = 0.8
iii) 1 - (0.1 + 0.1) = 0.8
iv) 1 (since all possible colours are included)
Comprehensive Explanation
To find the missing probability for the tan colour, we use the fundamental principle that the probabilities of all mutually exclusive events covering the entire sample space must add up to 1. In this context, each colour category (brown, red, yellow, green, orange, tan) is one of the mutually exclusive events.
Given the probabilities for brown, red, yellow, green, and orange, we can solve for p(tan). So:
p(brown) = 0.3
p(red) = 0.2
p(yellow)= 0.2
p(green) = 0.1
p(orange)= 0.1
p(tan) = ?
Summing the known probabilities: 0.3 + 0.2 + 0.2 + 0.1 + 0.1 = 0.9. Therefore, p(tan) must be 1 - 0.9 = 0.1.
Once we know p(tan), we can answer the subsequent probability questions:
Probability of getting a brown or red M&M: Since these events (brown vs. red) cannot overlap for a single draw, their union probability is just their sum: 0.3 + 0.2 = 0.5.
Probability of not getting a yellow M&M: The complement of “getting a yellow” is 1 - p(yellow) = 1 - 0.2 = 0.8.
Probability of not getting either orange or tan: The event “not orange or tan” is the complement of “(orange or tan).” We add p(orange) and p(tan) because they are disjoint color events, then subtract that sum from 1: 1 - (0.1 + 0.1) = 0.8.
Probability of getting a brown or red or yellow or green or orange or tan: This covers all known colors in the scenario, so effectively it must be 1.
By carefully considering these color categories as mutually exclusive events, all probabilities become straightforward sums or complements of the relevant color probabilities.
Follow-up Question 1
What if we were to check the probability of getting exactly two M&Ms of different colors in two independent draws?
To address this scenario, you would need to understand that each draw is an independent event. The probability of picking a specific colour in the first draw does not affect the probability in the second draw (assuming a large supply of M&Ms such that proportions do not change).
Probability of a specific colour in the first draw: p(colour1).
Probability of a different specific colour in the second draw: p(colour2).
For exactly two different colours in two draws, you would sum over all valid colour pairs:
Sum over all pairs (c1, c2) of p(c1) * p(c2), where c1 != c2. In text form, that is: sum over c1 != c2 of p(c1) * p(c2).
Follow-up Question 2
Are these probabilities stable over time, or can they change depending on the batch of M&Ms?
In real-world settings, manufacturers may alter the color proportions without announcement. So while the basic principle of summing probabilities to 1 remains, the exact numerical values for each colour could change from batch to batch if the ratio of the colours in the packets is adjusted. In practice, if you had a new distribution, you would recalculate p(tan) (or any colour) by subtracting all known probabilities from 1.
Follow-up Question 3
What if a question uses the word “or” but the events can overlap, such as “brown or tan or red in the same single draw,” yet the events are not guaranteed mutually exclusive?
In the case of M&M colours, each candy can only have one colour, so it’s always mutually exclusive. But in general, if we deal with events that can overlap, we must use: p(A or B) = p(A) + p(B) - p(A and B).
If A and B are mutually exclusive, p(A and B) = 0, so the formula simplifies to p(A) + p(B). Always verify whether the events can overlap before using any direct summation.
Follow-up Question 4
Why is the event “brown or red or yellow or green or orange or tan” equal to a probability of 1?
This is because these six colours exhaust all possibilities for the M&M in this scenario. Any single M&M drawn must fall into exactly one of these categories. Hence the union of all categories that cover the entire outcome space has probability 1 by definition.
Follow-up Question 5
If we took multiple samples, how can we estimate these probabilities from data?
In an applied machine learning setting or a data analytics scenario, you might count the occurrences of each colour over many independent samples and then estimate:
p̂(color) = (Number of candies of that color observed) / (Total number of candies sampled).
These estimated probabilities should sum close to 1 in large samples, assuming no systematic bias in how samples are collected.
By leveraging these principles of probability—particularly the use of complements, sums of mutually exclusive events, and the union formula—one can handle a wide variety of questions and checks, whether in interview scenarios or real-life analytics.