CSC 208-01 (Fall 2023)

Lab: Working with Expectation

Problem: Expectations

So far, we have calculated the probability of an event occurring. Suppose that we assign numeric values to each possible event, e.g., an amount of money won if you have a certain hand. We can then use these probabilities to compute the average value of an experiment, called its expected value or expectation.

To formalize this notion, we can create a function \(f : \mathcal{P}(\Omega) \rightarrow \mathbb{R}\) be an interpretation function that takes an event as input and then produces its numeric “value” as output. If \(p : \mathcal{P}(\Omega) \rightarrow \mathbb{R}\) is the probability of an event occurring, then the expected value of the experiment is given by:

\[ \sum_{E \in \mathcal{P}(Q)} f(E) \cdot p(E). \]

In other words, the expectation is the weighted average of all the possible events of the experiment.

  1. Suppose that we draw a poker hand at random and receive the following pay-out depending on the outcome:

    • $1 if we draw a pair.
    • $10 if we draw a full house.
    • $100 if we draw a flush.

    If none of these occurrences happen, we lose $3 dollars. Compute the expectation of this game.

  2. Now consider our Dungeons and Dragon example again. To hit a monster in combat, the player must first roll \(1d20\) to determine if they hit the monster. They hit the monster if the roll equals to or exceeds the monster’s armor class. If they do hit the monster, they roll a certain number of additional dice to determine the amount of damage dealt to the monster.

    Let’s say for the purposes of the problem that the player is equipped with two daggers so they roll \(2d4\) damage if they hit and the monster in question has an armor class of 12. What is the expected amount of damage dealt to the monster by the player in a single attack?