Worked solutions - Quiz 1¶
This page contains sketch notes to some of the quiz questions from Quiz 1. It is not comprehensive. We have tried to include most of the questions where it may not be obvious how to get to the correct answer.
Question 15¶
\[\begin{split}
\begin{align*}
ln\left( \prod_{i=1}^n p^{x_i} (1-p)^{y_i} \right)
&= ln\left( (p^{x_1} (1-p)^{y_1}) \times (p^{x_2} (1-p)^{y_2}) \times ... \times (p^{x_n} (1-p)^{y_n}) \right) \\
&= ln(p^{x_1} (1-p)^{y_1}) + ln(p^{x_2} (1-p)^{y_2}) + ... + ln(p^{x_n} (1-p)^{y_n}) \\
& = \sum_{i=}^n ln( p^{x_i} (1-p)^{y_i})
\end{align*}
\end{split}\]
We have
\[\begin{split}
\begin{align*}
ln(p^{x_1} (1-p)^{y_1}) & = ln(p^{x_1}) + ln(1-p)^{y_1}) \\
& = x_1 ln(p) + y_1 ln(1-p)
\end{align*}
\end{split}\]
Doing that to each term gives
\[\begin{split}
\begin{align*}
ln\left( \prod_{i=1}^n p^{x_i} (1-p)^{y_i} \right) & = \sum_{i=}^n \left( x_i ln(p) + y_i ln(1-p) \right) \\
& = \sum_{i=}^n x_i ln(p) + \sum_{i=}^n y_i ln(1-p) \\
\end{align*}
\end{split}\]
where we can split the summation into the two separate terms. Then,
\[\begin{split}
\begin{align*}
ln\left(\prod_{i=1}^n p^{x_i} (1-p)^{y_i} \right) & = \sum_{i=}^n x_i ln(p) + \sum_{i=}^n y_i ln(1-p) \\
& = (x_1 ln(p) + x_2 ln(p) + ... + x_n ln(p)) + (y_1 ln(1-p) + y_2 ln(1-p) + ... + y_n ln(1-p)) \\
& = ln(p) (x_1 + x_2 + ... + x_n) + ln(1-p) (y_1 + y_2 + ... + y_n) \\
& = ln(p) \sum_{x=1}^n x_i + ln(1-p) \sum_{i=1}^n y_i
\end{align*}
\end{split}\]