> For the complete documentation index, see [llms.txt](https://justinthezhu.gitbook.io/stat110/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://justinthezhu.gitbook.io/stat110/section-3/questions.md).

# Questions

## Calvin and Hobbes

Calvin and Hobbes play a match consisting of a series of games, where Calvin has probability $$p$$ of winning each game (independently). They play with a "win by two" rule: the first player to win two games more than his opponent wins the match. Find the probability that Calvin wins the match (in terms of $$p$$) in two different ways:

{% tabs %}
{% tab title="Q" %}
Find the probability that Calvin wins the match (in terms of $$p$$) by conditioning, using the **Law of Total Probability**.
{% endtab %}

{% tab title="A" %}
Let $$C$$ be the event that Calvin wins the match. Consider the first two games. There are 4 possible outcomes, 3 of which result in Calvin not losing immediately. Therefore, we condition on each of these possibilities: Let $$WW$$ represent Calvin winning both games, and $$WL$$, $$LW$$ represent a win then a loss or a loss then a win respectively. Using LOTP, we get:

$$
\begin{aligned}
P(C) &= P(C | WW) P(WW) + P(C | WL) P (WL) + P(C | LW) P(LW) \\
&= p^2 + 2pq \cdot P(C) \\
&\Downarrow \\
P(C) &= \frac{p^2}{1 - 2pq} \\
&=  \boxed{\frac{p^2}{p^2 + q^2}}\end{aligned}
$$
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Q" %}
Find the probability that Calvin wins the match (in terms of $$p$$) by interpreting the problem as a **gambler's ruin problem**.
{% endtab %}

{% tab title="A" %}
We can interpret this problem as a Gambler's Ruin where each player starts out with $2. Calvin wins if he gets to $4. Therefore, we have $$N = 4$$ and $$i = 2$$, so the probability of Calvin winning is:

$$
\frac{1 - \frac{q}{p}^2}{1 - \frac{q}{p}^4} = \frac{p^2(p^2 - q^2)}{p^4 - q^4} =\boxed{ \frac{p^2}{p^2 + q^2}}
$$

which is indeed the same answer as before.
{% endtab %}
{% endtabs %}

## Symmetry

For the following 2 questions, think about how symmetry may be used to avoid unnecessary calculations.

{% tabs %}
{% tab title="Q" %}
Suppose $$X$$ and $$Y$$ are i.i.d. $$Bin(n, p)$$. What is $$P(X < Y)$$?
{% endtab %}

{% tab title="A" %}
First, we note that $$P(X < Y) = P(Y < X)$$ by symmetry, and that $$P(X < Y) + P(X = Y) + P(Y < X) = 1$$. Hence,

$$
\begin{aligned}
P(X < Y) &= \frac{1}{2}\left({1 - P(X = Y)}\right) \\
&= \frac{1}{2}\left({1 - \sum\_{k=0}^n P(X = Y | X = k)P(X = k)}\right) \\
&= \frac{1}{2}\left({1 - \sum\_{k=0}^n P(Y = k)P(X = k)}\right) \\
&= \frac{1}{2}\left({1 - \sum\_{k=0}^n\left({\binom{n}{k}p^k(1 - p)^{n - k}}\right)^2}\right)
\end{aligned}
$$
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Q" %}
Can you construct two random variables X and Y both distributed ($$3, \frac{1}{2}$$) such that $$P(X=Y)=0$$?
{% endtab %}

{% tab title="A" %}
Yes, let $$Y = 3 - X$$. Then, there is no way that $$X$$ and $$Y$$ take on the same value because their sum would have to be 3.
{% endtab %}
{% endtabs %}

## Counting Cards

In the game Texas Hold'em, players combine two of their cards that are hidden to everyone else with five community cards to make the best possible five-card hand. The game is played with a standard deck of 52 cards. A flush is where all 5 cards belong to the same suit.

{% tabs %}
{% tab title="Q" %}
Suppose you are holding 2 spades in your hand, and there are 2 spades showing among the three community cards. What is the probability that you hit the flush?
{% endtab %}

{% tab title="A" %}
Since we currently see 4 spades, there are 9 other spades that can be used. Of the 52 cards in the deck, we know what 5 of them are, so we have 47 card values that remain to be seen. To find this probability, we can use the Hyper-Geometric distribution, specifically of $$HGeom(9, 38, 2)$$, since there are 9 desirable cards, 38 undesirable cards, and 2 cards that are being drawn. Now, we are interested in the probability that we observe either one or two spades in the two cards we draw. Or $$P(X = 1) + P(X=2)$$, where $$X$$ is distributed as above.

$$
\frac{{9 \choose 1}{38 \choose 1}}{{47 \choose 2}} + \frac{{9 \choose 2}}{{47 \choose 2}} = 0.3497
$$
{% endtab %}
{% endtabs %}
