Skip to content

Instantly share code, notes, and snippets.

@anadim
Created November 20, 2024 19:55
Show Gist options
  • Save anadim/1710c4ab6f6f200b118c8129429462cf to your computer and use it in GitHub Desktop.
Save anadim/1710c4ab6f6f200b118c8129429462cf to your computer and use it in GitHub Desktop.
So i'm trying to solve this probability problem. jen picks 4 distinct numbers from the set s = {1,2,3,...,9,10}. then, 4 numbers are randomly chosen from s. she wins a prize if at least two of her numbers match the randomly chosen numbers, and she wins the grand prize if all four of her numbers match the randomly chosen numbers. i need to find the probability of her winning the grand prize given that she won a prize, and then express it as m/n where m and n are relatively prime positive integers, and finally find m + n.
first, i need to understand the problem better. it seems like this is a conditional probability problem. specifically, i need to find p(grand prize | prize), which is the probability that she wins the grand prize given that she has won a prize.
recall that the formula for conditional probability is:
\[ p(a | b) = \frac{p(a \cap b)}{p(b)} \]
in this context:
- a is the event that she wins the grand prize.
- b is the event that she wins a prize.
since winning the grand prize automatically means she has won a prize (because having all four numbers match certainly means she has at least two matching), the intersection \( a \cap b \) is just a. therefore:
\[ p(a | b) = \frac{p(a)}{p(b)} \]
so, i need to calculate p(a) and p(b).
let's start by calculating p(a), the probability of winning the grand prize.
**calculating p(a):**
jen picks 4 distinct numbers from s, which has 10 numbers. the total number of ways to choose 4 numbers from 10 is:
\[ \binom{10}{4} \]
similarly, the lottery randomly chooses 4 numbers from the same set s, and for jen to win the grand prize, her 4 numbers must exactly match the lottery's 4 numbers. since all selections are equally likely, the probability p(a) is:
\[ p(a) = \frac{1}{\binom{10}{4}} \]
calculating \( \binom{10}{4} \):
\[ \binom{10}{4} = \frac{10!}{4! \cdot 6!} = 210 \]
therefore:
\[ p(a) = \frac{1}{210} \]
**calculating p(b):**
now, p(b) is the probability that at least two of jen's numbers match the lottery's numbers.
this can be a bit tricky because "at least two" includes the scenarios where she has exactly two, exactly three, or exactly four matches.
so, p(b) = p(exactly 2 matches) + p(exactly 3 matches) + p(exactly 4 matches)
we already have p(exactly 4 matches) = p(a) = 1/210.
now, let's calculate p(exactly 2 matches) and p(exactly 3 matches).
to find these probabilities, i'll need to consider the number of ways jen's numbers can match the lottery's numbers in exactly 2 or exactly 3 positions.
first, let's denote:
- jen's chosen numbers as j = {j1, j2, j3, j4}
- lottery's chosen numbers as l = {l1, l2, l3, l4}
we need to count the number of ways that exactly k of j's numbers are in l, for k = 2, 3, 4.
wait a minute, actually, since both jen and the lottery are choosing 4 distinct numbers from the same set s of 10 numbers, and the choices are independent, i need to consider the overlap between j and l.
but actually, since both are choosing 4 numbers from 10, and the lottery's selection is random, given j's selection, i can think of the lottery's selection as choosing 4 numbers from s, and i need to find the probability that the intersection of l and j has size at least 2.
alternatively, perhaps a better approach is to fix j's selection and then consider the lottery's selection.
but to make it simpler, perhaps it's better to think in terms of combinations.
let's consider that j has already chosen her 4 numbers, and now the lottery is choosing 4 numbers randomly from s.
the total number of possible lottery selections is \( \binom{10}{4} = 210 \).
now, the number of lottery selections that result in exactly k matches with j's numbers is \( \binom{4}{k} \times \binom{6}{4 - k} \), where:
- \( \binom{4}{k} \) is the number of ways to choose k numbers from j's 4 numbers.
- \( \binom{6}{4 - k} \) is the number of ways to choose the remaining 4 - k numbers from the 6 numbers not chosen by j.
wait, but actually, since the lottery is choosing 4 numbers from s, and j has already chosen her 4 numbers, the number of lottery selections with exactly k matches is indeed \( \binom{4}{k} \times \binom{6}{4 - k} \).
so, for k = 0 to 4, the number of lottery selections with exactly k matches is \( \binom{4}{k} \times \binom{6}{4 - k} \).
therefore, the probability p(b), which is the probability of at least 2 matches, is:
\[ p(b) = \frac{\binom{4}{2} \times \binom{6}{2} + \binom{4}{3} \times \binom{6}{1} + \binom{4}{4} \times \binom{6}{0}}{\binom{10}{4}} \]
let's compute each term:
first, \( \binom{4}{2} \times \binom{6}{2} \):
\[ \binom{4}{2} = 6 \]
\[ \binom{6}{2} = 15 \]
\[ 6 \times 15 = 90 \]
second, \( \binom{4}{3} \times \binom{6}{1} \):
\[ \binom{4}{3} = 4 \]
\[ \binom{6}{1} = 6 \]
\[ 4 \times 6 = 24 \]
third, \( \binom{4}{4} \times \binom{6}{0} \):
\[ \binom{4}{4} = 1 \]
\[ \binom{6}{0} = 1 \]
\[ 1 \times 1 = 1 \]
adding them up:
\[ 90 + 24 + 1 = 115 \]
therefore:
\[ p(b) = \frac{115}{210} \]
i can simplify this fraction:
\[ \frac{115}{210} = \frac{23 \times 5}{42 \times 5} = \frac{23}{42} \]
wait, is that correct? let me check:
actually, 115 divided by 5 is 23, and 210 divided by 5 is 42, so yes, \( \frac{115}{210} = \frac{23}{42} \).
so, p(b) = 23/42.
now, recall that p(a | b) = p(a) / p(b).
we have p(a) = 1/210 and p(b) = 23/42.
therefore:
\[ p(a | b) = \frac{1/210}{23/42} = \frac{1}{210} \times \frac{42}{23} = \frac{42}{210 \times 23} \]
simplify 42/210:
\[ \frac{42}{210} = \frac{1}{5} \]
so:
\[ p(a | b) = \frac{1}{5 \times 23} = \frac{1}{115} \]
wait a second, is that correct? let me double-check the calculation.
starting from:
\[ p(a | b) = \frac{1/210}{23/42} = \frac{1}{210} \times \frac{42}{23} \]
calculating 42/210:
\[ \frac{42}{210} = \frac{1}{5} \]
so:
\[ p(a | b) = \frac{1}{5} \times \frac{1}{23} = \frac{1}{115} \]
wait, that seems correct, but maybe i should express it differently to ensure i didn't make a mistake.
alternatively, perhaps i should think in terms of conditional probability more carefully.
given that jen has won a prize (i.e., at least two matches), what is the probability that she has exactly four matches?
alternatively, perhaps there's a better way to approach this problem.
let me think differently. maybe using the concept of hypergeometric distribution.
in the hypergeometric distribution, the probability of k successes (matches) in n draws is given by:
\[ p(k) = \frac{\binom{k}{k} \binom{n-k}{n-k}}{\binom{n}{n}} \]
where:
- n is the population size (here, n = 10)
- k is the number of success states in the population (here, k = jen's 4 numbers)
- n is the number of draws (here, n = 4)
- k is the number of observed successes (here, k = number of matches)
so, in this problem:
- population size n = 10
- number of success states k = 4 (jen's chosen numbers)
- number of draws n = 4
- number of observed successes k = 2, 3, or 4 for p(b), and k = 4 for p(a)
thus, p(b) is the sum of p(k=2), p(k=3), and p(k=4), and p(a) is p(k=4).
from the hypergeometric formula:
\[ p(k) = \frac{\binom{4}{k} \binom{6}{4 - k}}{\binom{10}{4}} \]
which matches what i did earlier.
so, p(b) = p(k=2) + p(k=3) + p(k=4) = 115/210 = 23/42
p(a) = p(k=4) = 1/210
therefore:
\[ p(a | b) = \frac{p(a)}{p(b)} = \frac{1/210}{23/42} = \frac{1}{210} \times \frac{42}{23} = \frac{42}{210 \times 23} = \frac{42}{4830} \]
simplify 42/4830:
divide numerator and denominator by 42:
\[ \frac{42 \div 42}{4830 \div 42} = \frac{1}{115} \]
so, p(a | b) = 1/115
now, the problem asks for m and n where p(a | b) = m/n with m and n being relatively prime positive integers.
here, m = 1 and n = 115, which are already relatively prime.
therefore, m + n = 1 + 115 = 116
but before finalizing, i should make sure there isn't a mistake in my calculations.
let me recap:
- total ways: \( \binom{10}{4} = 210 \)
- p(a) = 1/210
- p(b) = ( \( \binom{4}{2} \times \binom{6}{2} + \binom{4}{3} \times \binom{6}{1} + \binom{4}{4} \times \binom{6}{0} \) ) / 210 = 115/210 = 23/42
- p(a | b) = (1/210) / (23/42) = 1/115
yes, it all checks out.
**final answer**
\boxed{116}
Jen picks 4 distinct numbers from the set
s
=
{
1
,
2
,
3
,
,
9
,
10
}
s={1,2,3,…,9,10}. the lottery also randomly chooses 4 numbers from
s
s. she wins a prize if at least two of her numbers match the lottery's numbers, and she wins the grand prize if all four of her numbers match the lottery's numbers. we need to find the probability of her winning the grand prize given that she won a prize, and then express it as
m
n
n
m
where
m
m and
n
n are relatively prime positive integers, and finally find
m
+
n
m+n.
first, we calculate the probability of winning the grand prize
p
(
a
)
p(a):
p
(
a
)
=
1
(
10
4
)
=
1
210
p(a)=
(
4
10
)
1
=
210
1
next, we calculate the probability of winning a prize
p
(
b
)
p(b), which is the probability of having at least two matches. this includes the scenarios of having exactly 2, 3, or 4 matches:
p
(
b
)
=
(
4
2
)
(
6
2
)
+
(
4
3
)
(
6
1
)
+
(
4
4
)
(
6
0
)
(
10
4
)
p(b)=
(
4
10
)
(
2
4
)(
2
6
)+(
3
4
)(
1
6
)+(
4
4
)(
0
6
)
calculating each term:
(
4
2
)
(
6
2
)
=
6
×
15
=
90
(
2
4
)(
2
6
)=6×15=90
(
4
3
)
(
6
1
)
=
4
×
6
=
24
(
3
4
)(
1
6
)=4×6=24
(
4
4
)
(
6
0
)
=
1
×
1
=
1
(
4
4
)(
0
6
)=1×1=1
summing these:
90
+
24
+
1
=
115
90+24+1=115
thus:
p
(
b
)
=
115
210
=
23
42
p(b)=
210
115
=
42
23
now, we find the conditional probability
p
(
a
b
)
p(a∣b):
p
(
a
b
)
=
p
(
a
)
p
(
b
)
=
1
210
23
42
=
1
210
×
42
23
=
42
210
×
23
=
1
115
p(a∣b)=
p(b)
p(a)
=
42
23
210
1
=
210
1
×
23
42
=
210×23
42
=
115
1
since
1
115
115
1
is already in its simplest form,
m
=
1
m=1 and
n
=
115
n=115. therefore,
m
+
n
=
1
+
115
=
116
m+n=1+115=116.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment