Recently, I’ve been to Las Vegas, and you can’t miss out on all the gambling in the casinos. It’s part of the culture. Here, we’ll see with basic probability, how to create a simple slot machine and see if us, the gambler, can make some money.
Probability Basics
Let’s start by defining some basic ideas of probability that we’ll use later on. I’ll try to keep the ideas simple.
outcome - A possible result of an experiment.
event - It is the set of outcomes in an experiment.
For future reference, we will use the symbol $\Omega$ to represent all possible outcomes.
The Probability of an Event $E$ is
$$ \frac{\text{\# of outcomes in E}}{\text{\# of all possible outcomes}} $$
A textbook example would be flipping a coin twice and seeing the probability of the event of getting exactly one head. We can represent an outcome as XY where X is the outcome of the first flip and Y is the outcome of the second flip. All possible outcomes are $HH,HT,TH,TT$. The outcomes where there is exactly one head are $HT,TH$. Therefore, the probability of getting exactly one head is $\frac{2}{4}$ or $\frac{1}{2}$.
The Probability of an Event can also be written out as the sum of the probabilities of its outcomes or $\sum_{y\in\Omega}P\left[y\right]$. $\Omega$ always occurs in an experiment since it has all outcomes so $\mathbb{P}\left[\Omega\right]=1$.
A random variable can be thought of as associating an outcome to a Real number relating to some event $E$. Looking at the coin flip example, we can create a random variable for the number of heads from two coin flips. The random variable would associate the following events. $$HH\to 2, TH\to 1, HT\to 1, TT\to 0$$ Associating outcomes with numbers is nice since then we can apply mathematical ideas to them now.
The expected value of a random variable is a weighted sum of all outcomes. In terms of lottery winnings, it can be seen as the expected profit or loss. To find an expected value, we get an outcome and multiply its probability and associated value in the random variable and, sum it with all the other outcomes. Formally, the expected value of a random variable $X$ is written as $$\mathbb{E}\left[ X\right]=\sum_{y\in\Omega}\mathbb{P}\left[ y\right] X\left(y\right)$$
Expected value and Probability form the foundations of casinos, poker, and all other forms of betting and gambling. In our case, we’ll create a hypothetical slot machine to show how House always wins.
Finding the Golden Equation
Let’s focus on the classic slot machine, where when we pay a basic fee, we get a chance to win big if we get the same icon in a row. Let’s say there are n icons. Let’s see what our expected winnings from the slot machine should be. $$ \mathbb{E}\left[\text{net profit}\right] = \sum_{y\in\Omega}\mathbb{P}\left[y\right]\cdot \left(\text{net profit in outcome y}\right) $$ Remember that to get an expected value, we will multiply an outcome’s probability by its associated value. For each money won in outcome y, we subtract an additional b since that is our entry to play. Here, we’re gonna do a bit of math to come to a nice-looking equation. \begin{align} & \sum_{y\in\Omega}\mathbb{P}\left[y\right]\cdot \left(k_y - b\right) \\ & = \sum_{y\in\Omega}\mathbb{P}\left[y\right]k_y - \mathbb{P}\left[y\right]b\\ & = \sum_{y\in\Omega}\mathbb{P}\left[y\right]k_y - \sum_{y\in\Omega}\mathbb{P}\left[y\right]b\\ & = \sum_{y\in\Omega}\mathbb{P}\left[y\right]k_y - b\sum_{y\in\Omega}\mathbb{P}\left[y\right]\\ & = \sum_{y\in\Omega}\mathbb{P}\left[y\right]k_y - b\mathbb{P}\left[\Omega\right]\\ & = \sum_{y\in\Omega}\mathbb{P}\left[y\right]k_y - b\\ & = \sum_{y\in\Omega}\left(\frac{1}{n}\right)^3k_y - b\\ & = \left(\frac{1}{n}\right)^3\sum_{y\in\Omega}k_y - b \\ & = \left(\frac{1}{n}\right)^3K-b \\ & = \frac{K}{n^3} - b \end{align}
The K represents the sum of all possible profit. We want positive net cash, so we’ll set the equatioin greater than 0, and find K relative to b.
$$ K > bn^3 $$
Creating the Slot Machine
From my trip to Vegas, one simple slot machine had 5 options per slot: 7, 77, 777, Jackpot, JackpotJackpot. Slots like these usually cost a dollar to play. In this example, the summed possible winnings has to be greater than 125. When designing a slot machine, it’s nice to have a few big winnings to give the possibility of a big score. $$7\to 10, 77\to 15, 777\to 30, Jackpot\to 15, JackpotJackpot\to 50$$ E.g. if we get 3 sevens in a row, we will win 10 dollars minus the initial bet.
For each winning, we seem to have a decent profit for only losing 1 dollar, especially the 50 dollar win seems appealing to the naive gambler, but K is only 120, which is less than 125. Therefore, the expected net loss in the long term will be 5 dollars.
We can appeal to the mind of the gambler of the Big Score by giving larger option sizes but allowing possible profit to reach in the thousands. Imagine, there were 20 options but you had the chance to win 5k, and you only had to bet 1 dollar? What is interesting to note is that you don’t need just three in a row. We can have different combinations be winning. The slot machine could have a reward for most combinations and the casino can still ensure they win.
Play around with the equation and see what kind of basic games you can create for yourself to win yourself some dough. Most importantly, I hope you see how Vegas can ensure that they’ll secure a profit out of you with some basic probability and dreams of winning it big.