Skip to content

Commit

Permalink
added 2014 fall exam solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnLu2004 committed Jul 17, 2024
1 parent 743ee40 commit 31c2f96
Show file tree
Hide file tree
Showing 22 changed files with 345 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/1/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
First, we choose the odd digit from $ \{ 1,3,5,7,9 \} $: $5 \text{ ways} $ \\
Then, we choose which position to place the odd digit: $ \binom{13}{1} \text{ ways} $ \\
Finally, we choose which of the following 5 event digits for the remaining 12 digits: $ 5^{12} \text{ ways} $ \\
$ 5 \cdot \binom{13}{1} \cdot 5^{12} $ \\
$ 13 \cdot 5^{13} $
23 changes: 23 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/10/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Let's calculate $f(1)$ first \\
$f(1) = f(0) + 8 \cdot 1 - 2 $ \\
$f(1) = -17 + 8 - 2 $ \\
$f(1) = -11 $
\begin{enumerate}
\item $ f(n) = 3n^{2} - n - 17 $ \\
$ f(1) = 3 \cdot 1^2 - 1 - 17 $ \\
$ f(1) = 3 - 1 - 17 $ \\
$ f(1) = -15 $
\item $ f(n) = 3n^{2} + n - 17 $ \\
$ f(1) = 3 \cdot 1^2 + 1 - 17 $ \\
$ f(1) = 3 + 1 - 17 $ \\
$ f(1) = -13 $
\item $ f(n) = 4n^{2} - 2n - 17 $ \\
$ f(1) = 4 \cdot 1^2 - 2 - 17 $ \\
$ f(1) = 4 - 2 - 17 $ \\
$ f(1) = -15 $
\item $ f(n) = 4n^{2} + 2n - 17 $ \\
$ f(1) = 4 \cdot 1^2 + 2 - 17 $ \\
$ f(1) = 4 + 2 - 17 $ \\
$ f(1) = -11 $
\end{enumerate}
The correct answer is $ f(n) = 4n^{2} + 2n - 17 $ because it is the only one that gives the correct value for $ f(1) $
34 changes: 34 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/11/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
We can draw a tree to represent the recursive calls
\begin{forest}
[FIB$20$
[FIB$19$
[FIB$18$
[FIB$17$
[FIB$16$
]
[FIB$15$
]
]
[FIB$16$
]
]
[FIB$17$
[FIB$16$
]
[FIB$15$
]
]
]
[FIB$18$
[FIB$17$
[FIB$16$
]
[FIB$15$
]
]
[FIB$16$
]
]
]
\end{forest} \\
There are 3=5 calls to $FIB(16)$
17 changes: 17 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/12/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
\begin{enumerate}
\item Let A = Event that both balls are blue \\
A occurs when we choose 2 of the 5 blue balls \\
$ |A| = \binom{5}{2} $
\item Let B = Event that both balls are red \\
B occurs when we choose 2 of the 4 red balls \\
$ |B| = \binom{4}{2} $
\item Let C = Event that both balls are green \\
C occurs when we choose 2 of the 6 green balls \\
$ |C| = \binom{6}{2} $
\item Let S = All possible outcomes \\
S occurs when we choose 2 of the 15 balls \\
$ |S| = \binom{15}{2} $
\end{enumerate}
$ |A \cup B \cup C| = |A| + |B| + |C| $ \\
$ |A \cup B \cup C| = \binom{5}{2} + \binom{4}{2} + \binom{6}{2} $ \\
$ \Pr(A \cup B \cup C) = \frac{\binom{5}{2} + \binom{4}{2} + \binom{6}{2}}{\binom{15}{2}} $
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/13/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Let A = Event that Annie, Boris, and Charlie have the same birthday \\
Annie has a birthday on any of the 365 days: 365 \\
Boris would only then have a birthday on the same day as Annie: 1 \\
Charlie would only then have a birthday on the same day as Annie and Boris: 1 \\
$ |A| = 365 \cdot 1 \cdot 1 $ \\
Let S = All possible outcomes \\
$ |S| = 365^3 $ \\
$ \Pr(A) = \frac{365}{365^3} $ \\
$ \Pr(A) = \frac{1}{365^2} $
11 changes: 11 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/14/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Let's go through each option and explain
\begin{enumerate}
\item $1 - (1/2)^{7}$ \\
This is just the complement rule, which usually works but they're subtracting the probability that we get 6 tails followed by a head \\
It might've worked if they were subtracting the probability that we get 7 tails followed by a head from the whole set of possibilities
\item $\sum_{k=0}^{7} (1/2)^{k}$ \\
This one is wrong because it starts at $ { \left( \frac{1}{2} \right)}^0 $ but it doesn't take into account the fact that we have to flip a head to stop, which has a probability of $ \frac{1}{2} $
\item $\sum_{k=0}^{7} (1/2)^{k+1}$ \\
This one is beautiful \\
It says, probability of flipping a heads right away, probability of flipping a tails folloewd by a heads, probability of flipping 2 tails followed by a heads, and so on until 7 tails followed by a heads
\end{enumerate}
12 changes: 12 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/15/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
\begin{enumerate}
\item Let A = Event that both balls are red \\
A occurs when we choose 2 of the 4 red balls \\
$ |A| = \binom{4}{2} $
\item Let B = Event that both balls have the same color \\
B occurs when we choose 2 of the 5 blue balls or 2 of the 4 red balls \\
$ |B| = \binom{5}{2} + \binom{4}{2} $
\item Let $A \cap B$ = Event that both balls are red and both balls have the same color \\
$ |A \cap B| = \binom{4}{2} $
\end{enumerate}
$ \Pr(A|B) = \frac{|A \cap B|}{|B|} $ \\
$ \Pr(A|B) = \frac{\binom{4}{2}}{\binom{5}{2} + \binom{4}{2}} $
12 changes: 12 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/16/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
\begin{enumerate}
\item Let A = Event that $x$ is even \\
A occurs when we choose an even number from the set ${2, 4, 6, 8, 10}$ \\
$ |A| = 5 $
\item Let B = Event that $x$ is divisible by 3 \\
B occurs when we choose a number from the set ${3, 6, 9}$ \\
$ |B| = 3 $
\item Let $A \cap B$ = Event that $x$ is even and divisible by 3 \\
$ |A \cap B| = 1 $
\end{enumerate}
$ \Pr(A|B) = \frac{|A \cap B|}{|B|} $ \\
$ \Pr(A|B) = \frac{1}{3} $
17 changes: 17 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/17/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
\begin{enumerate}
\item Let S = All possible outcomes \\
$ |S| = 10 $
\item A occurs when we choose an even number from the set ${2, 4, 6, 8, 10}$ \\
$ |A| = 5 $ \\
$\Pr(A) = \frac{5}{10} = \frac{1}{2} $
\item B occurs when we choose a number from the set ${1, 2, 3, 4, 5}$ \\
$ |B| = 5 $ \\
$\Pr(B) = \frac{5}{10} = \frac{1}{2} $
\item $A \cap B$ occurs when we choose an even number from the set ${2, 4}$ \\
$ |A \cap B| = 2 $ \\
$\Pr(A \cap B) = \frac{2}{10} = \frac{1}{5} $
\end{enumerate}
$ \Pr(A \cap B) = \Pr(A) \cdot \Pr(B) $ \\
$ \frac{1}{5} = \frac{1}{2} \cdot \frac{1}{2} $ \\
$ \frac{1}{5} = \frac{1}{4} $ \\
Because the equation is false, these events are not independent.
17 changes: 17 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/18/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
\begin{enumerate}
\item Let S = All possible outcomes \\
$ |S| = 10 $
\item A occurs when we choose an even number from the set ${2, 4, 6, 8, 10}$ \\
$ |A| = 5 $ \\
$\Pr(A) = \frac{5}{10} = \frac{1}{2} $
\item B occurs when we choose a number from the set ${1, 2, 3, 4, 5, 6}$ \\
$ |B| = 6 $ \\
$\Pr(B) = \frac{6}{10} = \frac{3}{5} $
\item $A \cap B$ occurs when we choose an even number from the set ${2, 4, 6}$ \\
$ |A \cap B| = 3 $ \\
$\Pr(A \cap B) = \frac{3}{10} $
\end{enumerate}
$ \Pr(A \cap B) = \Pr(A) \cdot \Pr(B) $ \\
$ \frac{3}{10} = \frac{1}{2} \cdot \frac{3}{5} $ \\
$ \frac{3}{10} = \frac{3}{10} $ \\
Because the equation is true, these events are independent.
16 changes: 16 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/19/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
We need to determine if events $ A $ and $ B $ are independent.
\begin{enumerate}
\item $ \Pr(A) = \frac{1}{2} $
\item If they have at least 3 kids and the third child is a boy, let's calculate what's needed to get there \\
Boy, Girl, Boy: $ \frac{1}{2} \cdot \frac{1}{2} \cdot \frac{1}{2} = \frac{1}{8} $ \\
Girl, Boy, Boy: $ \frac{1}{2} \cdot \frac{1}{2} \cdot \frac{1}{2} = \frac{1}{8} $ \\
$ \Pr(B) = \frac{1}{8} + \frac{1}{8} = \frac{1}{4} $
\item $ \Pr(A \cap B) $ now \\
If the second child is a boy and we want them to keep pumping out babies, then the first two children must be of different genders \\
That leaves us with Girl, Boy, Boy: $ \frac{1}{2} \cdot \frac{1}{2} \cdot \frac{1}{2} = \frac{1}{8} $ \\
$ \Pr(A \cap B) = \frac{1}{8} $
\end{enumerate}
Now, let's check if $ \Pr(A) \cdot \Pr(B) = \Pr(A \cap B) $ \\
$ \frac{1}{2} \cdot \frac{1}{4} = \frac{1}{8} $ \\
$ \frac{1}{8} = \frac{1}{8} $ \\
The events $ A $ and $ B $ are independent. Thus, the statement is true.
17 changes: 17 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/2/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
\begin{enumerate}
\item A = Event that the password contains 0 event digits \\
Since every digit is odd, each of the 13 digits must be chosen from the set \{1,3,5,7,9\} \\
$ |A| = 5^{13} $
\item B = Event that the password contains 1 event digit \\
Since 1 of the digits is even, there are 13 positions to place the single even digit: $ \binom{13}{1} $ \\
Since the 1 even digit can be chosen from the set \{0,2,4,6,8\}, there are 5 choices for the even digit: $ 5 $ \\
The remaining 12 digits must be chosen from the set \{1,3,5,7,9\}, so there are $ 5^{12} $ ways to choose the remaining digits \\
$ |B| = \binom{13}{1} \cdot 5 \cdot 5^{12} $
\item C = Event that the password contains 2 event digits \\
Since 2 of the digits are even, there are $ \binom{13}{2} $ ways to choose the 2 positions for the even digits \\
Since the 2 even digits can be chosen from the set \{0,2,4,6,8\}, each digit has 5 choices: $ 5^2 $ \\
The remaining 11 digits must be chosen from the set \{1,3,5,7,9\}, so there are $ 5^{11} $ ways to choose the remaining digits \\
$ |C| = \binom{13}{2} \cdot 5^2 \cdot 5^{11} $
\end{enumerate}
$ |A| + |B| + |C| = 5^{13} + \binom{13}{1} \cdot 5 \cdot 5^{12} + \binom{13}{2} \cdot 5^2 \cdot 5^{11} $ \\
$ |A| + |B| + |C| = 5^{13} + 13 \cdot 5^{13} + \binom{13}{2} \cdot 5^{13} $
48 changes: 48 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/21/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
\subsection\*{Step-by-Step Solution}

1. **Possible Outcomes and Corresponding Values:**
There are four possible outcomes when flipping two fair coins:
\begin{itemize}
\item First coin is heads (H), second coin is heads (H): $(H, H)$
\item First coin is heads (H), second coin is tails (T): $(H, T)$
\item First coin is tails (T), second coin is heads (H): $(T, H)$
\item First coin is tails (T), second coin is tails (T): $(T, T)$
\end{itemize}

2. **Winning Amount for Each Outcome:**
For each outcome, we determine the amount $ X $ that you win:
\begin{itemize}
\item $(H, H)$: The first coin is heads, so we don't lose. The second coin is heads, so we win 1 dollar. Thus, $ X = 1 $.
\item $(H, T)$: The first coin is heads, so we don't lose. The second coin is tails, so we don't win. Thus, $ X = 0 $.
\item $(T, H)$: The first coin is tails, so we lose (i.e., we win $-1$ dollars). The second coin is heads, so we win 1 dollar, but since the first coin being tails means we lose, this overrides the second coin's result. Thus, $ X = -1 $.
\item $(T, T)$: The first coin is tails, so we lose (i.e., we win $-1$ dollars). The second coin is tails, so we don't win. Thus, $ X = -1 $.
\end{itemize}

3. **Calculate the Expected Value $ E(X) $:**
The expected value $ E(X) $ is calculated using the formula:
\[
E(X) = \sum\_{i} P(X = x_i) \cdot x_i
\]
Each of the four outcomes has a probability of $ \frac{1}{4} $, as the coins are fair and independent.
Therefore, we have:
\begin{itemize}
\item $ P(X = 1) = \frac{1}{4} $ (from the $(H, H)$ outcome)
\item $ P(X = 0) = \frac{1}{4} $ (from the $(H, T)$ outcome)
\item $ P(X = -1) = \frac{1}{2} $ (from the $(T, H)$ and $(T, T)$ outcomes combined)
\end{itemize}

4. **Substitute the Values into the Expected Value Formula:**
\[
E(X) = 1 \cdot \frac{1}{4} + 0 \cdot \frac{1}{4} + (-1) \cdot \frac{1}{2}
\]
\[
E(X) = \frac{1}{4} + 0 - \frac{1}{2}
\]
\[
E(X) = \frac{1}{4} - \frac{2}{4}
\]
\[
E(X) = -\frac{1}{4}
\]

Therefore, the expected value of $ X $ is $ \boxed{-\frac{1}{4}} $.
28 changes: 28 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/22/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
\subsection\*{Step-by-Step Solution}

1. **Probability of Getting $ HTH $:**
The probability of getting a head followed by a tail followed by a head in three consecutive flips is:
\[
P(HTH) = P(H) \times P(T) \times P(H) = \left(\frac{1}{2}\right) \times \left(\frac{1}{2}\right) \times \left(\frac{1}{2}\right) = \frac{1}{8}
\]
2. **Number of Possible $ HTH $ in 6 Flips:**
Since we are looking for consecutive $ HTH $ patterns, we need to consider overlapping patterns in the sequence.
In a sequence of 6 coin flips, the positions where a $ HTH $ can start are:
\begin{itemize}
\item 1st position: $ \{1, 2, 3\} $
\item 2nd position: $ \{2, 3, 4\} $
\item 3rd position: $ \{3, 4, 5\} $
\item 4th position: $ \{4, 5, 6\} $
\end{itemize}
Therefore, there are 4 possible positions for a $ HTH $ to occur.
3. **Expected Value Contribution from Each Position:**
For each position, the expected value contribution is:
\[
E(\text{one } HTH) = P(HTH) \times \text{payout} = \frac{1}{8} \times 5 = \frac{5}{8}
\]
4. **Total Expected Value $ E(X) $:**
Since there are 4 possible positions, the total expected value is the sum of the contributions from each position:
\[
E(X) = 4 \times \frac{5}{8} = \frac{20}{8} = \frac{5}{2}
\]
Therefore, the expected value of $ X $ is $ \boxed{\frac{5}{2}} $.
6 changes: 6 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/23/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
So um, this algorithm pretty much counts the number of attempts we make until we get $HHH$ or $TTT$ \\
We have a $ \frac{1}{8} $ chance of flipping an $HHH$ \\
We have a $ \frac{1}{8} $ chance of flipping an $TTT$ \\
This gives us a $ \frac{1}{4} $ chance of flipping either $HHH$ or $TTT$ \\
By the geometric distribution, the expected value of the number of attempts until we get a success is $ \frac{1}{p} $ \\
Therefore, the expected value of $X$ is $ \frac{1}{\frac{1}{4}} = 4 $
12 changes: 12 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/24/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
\begin{enumerate}
\item Let A be the event that we flip a head \\
$ \Pr(A) = \frac{1}{2} $
\item Let B be the event that we flip a tail \\
$ \Pr(B) = \frac{1}{2} $
\end{enumerate}
$ \mathbb{E}(X) = 2 \cdot \mathbb{E}(\text{number of heads}) - 3 \cdot \mathbb{E}(\text{number of tails}) $ \\
$ \mathbb{E}(X) = 2 \cdot \sum*{i=0}^{n} \Pr(A) - 3 \cdot \sum*{i=0}^{n} \Pr(B) $ \\
$ \mathbb{E}(X) = 2 \cdot n \cdot \frac{1}{2} - 3 \cdot n \cdot \frac{1}{2} $ \\
$ \mathbb{E}(X) = n - \frac{3}{2}n $ \\
$ \mathbb{E}(X) = \frac{2n}{2} - \frac{3n}{2} $ \\
$ \mathbb{E}(X) = \frac{-n}{2} $
19 changes: 19 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/4/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
\begin{enumerate}
\item A = Event that the bitstring starts with 010 \\
Since the bitstring starts with 010, the first 3 digits must be 010 \\
The remaining 10 digits can be chosen from the set \{0,1\}, so there are $ 2^{10} $ ways to choose the remaining digits \\
$ |A| = 2^{10} $
\item B = Event that the bitstring ends with 11 \\
Since the bitstring ends with 11, the last 2 digits must be 11 \\
The remaining 11 digits can be chosen from the set \{0,1\}, so there are $ 2^{11} $ ways to choose the remaining digits \\
$ |B| = 2^{11} $
\item $ A \cap B $ = Event that the bitstring starts with 010 and ends with 11 \\
Since the bitstring starts with 010 and ends with 11, the first 3 digits must be 010 and the last 2 digits must be 11 \\
The remaining 8 digits can be chosen from the set \{0,1\}, so there are $ 2^8 $ ways to choose the remaining digits \\
$ |A \cap B| = 2^8 $
\end{enumerate}
$ |A \cup B| = |A| + |B| - |A \cap B| $ \\
$ |A \cup B| = 2^{10} + 2^{11} - 2^8 $ \\
$ |A \cup B| = 1 \cdot 2^{10} + 2 \cdot 2^{10} - 2^8$ \\
$ |A \cup B| = (1+2) \cdot 2^{10} - 2^8 $ \\
$ |A \cup B| = 3 \cdot 2^{10} - 2^8 $
6 changes: 6 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/5/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Let's write out all recursive cases for $S_n$
\begin{enumerate}
\item $0, S_{n-1} $
\item $1, 0, S_{n-2} $
\end{enumerate}
$S*n = S*{n-1} + S\_{n-2} $
10 changes: 10 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/6/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
A = Like 8:30am classes \\
$ |A| = 40 $ \\
B = Like COMP 2804 \\
$ |B| = 30 $ \\
$ |\overline{A \cup B}| = 50 $ \\
$ |A \cup B| = 100-50 $ \\
$ |A \cup B| = 50 $ \\
$ |A \cap B| = |A| + |B| - |A \cup B| $ \\
$ |A \cap B| = 40 + 30 - 50 $ \\
$ |A \cap B| = 20 $
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/7/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
A = Event that we pick 7 blue balls \\
First, we choose 7 of the m blue balls: $ \binom{m}{7} $ \\
The first ball has 7 choices, the second ball has 6 choices, the third ball has 5 choices, and so on until the seventh ball has 1 choice: $ 7! $ \\
$ |A| = \binom{m}{7} \cdot 7! $ \\
B = Event that we pick 7 red balls \\
First, we choose 7 of the n red balls: $ \binom{n}{7} $ \\
The first ball has 7 choices, the second ball has 6 choices, the third ball has 5 choices, and so on until the seventh ball has 1 choice: $ 7! $ \\
$ |B| = \binom{n}{7} \cdot 7! $ \\
$ |A| + |B| = \binom{m}{7} \cdot 7! + \binom{n}{7} \cdot 7! $
9 changes: 9 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/8/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
\begin{enumerate}
\item A 3
\item B 2
\item C 5
\end{enumerate}
$ \binom{10}{3} \cdot \binom{7}{2} \cdot \binom{5}{5} $ \\
$ \frac{10!}{3!7!} \cdot \frac{7!}{2!5!} \cdot \frac{5!}{5!0!} $ \\
$ \frac{10!}{3!1} \cdot \frac{1}{2!5!} \cdot \frac{1}{1 \cdot 1} $ \\
$ \frac{10!}{3!2!5!} $
8 changes: 8 additions & 0 deletions src/content/questions/comp2804/exam-fall-2014/9/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
We can solve this using stars and bars approach\\
There are 13 stars and 2 extra positions to place the bars/dividers between rows of stars
\begin{enumerate}
\item The number of stars to the left of the first bar is $x_1$
\item The number of stars between the first and second bars is $x_2$
\item The number of stars to the right of the second bar is $x_3$
\end{enumerate}
As a result, we pick 2 positions out of 13 and 2 positions to place the bars: $ \binom{15}{2} $

0 comments on commit 31c2f96

Please sign in to comment.