Discrete Probability Basics#
Introduction#
Here we will introduce the basics of probability that many people cover in the undergrad studies at a university. The goal is to provide a set of the most important concepts and notions that are necessary for understanding any more advanced concepts in probability.
Probability of an Event#
In probability you will frequently hear a word event, which can be basically anything, here are some examples of events:
On a single coin flip heads (\(H\)) appears
Number 6 appeared in three consecutive 6-sided-die throws
A train arrived before the 12:00h, which was the scheduled arrival time
Price of the stock \(S\) in one year time is be above 120 EUR
…
This list is infinite, but I think it is important to have in mind what an occurrence of an event means. Given certain assumptions, we could calculate the probability of each of these events. A probability (often denoted by \(\mathbb{P}\) or \(p\)) is a number in interval \([0,1]\) that is assigned to an event (\(E\)). Special cases include:
\(\mathbb{P}(E)=0 \longrightarrow \) the event \(E\) is impossible
\(\mathbb{P}(E)=1 \longrightarrow \) the event \(E\) is surely happening
Let us have a look at the example of a 6-sided fair die. A die show any number from one to six, all with equal probability \(p\). In the case of a fair die, the probability is $\(p=\frac{1}{6}\)$
Now we need a way to represent the outcome of a die throw. In order to do that we will introduce a concept of a random variable. Random variable is a way of assigning a value (most often it is an actual number) to an outcome of an experiment. A very simple random variable is exactly the outcome of a die throw, where we will assign the value of \(1\) if number one appears on the die, number \(2\) if the number two appears on the die, and so on.
Note
My goal here is not to present these concepts in a mathematically rigorous way, but I still think that for you to be able to read other materials in the books or in the internet, it would be nice to show at least one or two examples of what it would look like to write down a die thrown outcome as a random variable.
Let us denote with \(\omega_i\) an event of a number \(i\) appearing on the die, that is:
Then a random variable \(X\) that represents the outcome of our die will simply be \(X(\omega_i)=i\), that is:
We can also imagine a random variable \(Y\) that represents the squared outcome of our die throw, that is:
Or even a random variable \(Z\) that takes the value of \(1\) if the the number on the die is even, and \(0\) if the number is odd:
Now that we have a good understanding of what an event \(\omega\) is, what a random variable is, let us present a compact way to write down random variables (discrete random variables like the ones above):
where the first row shows all the values that a random variable can take, and the second row shows the probabilities of \(X\) taking that value, i.e. \(\mathbb{P}(\omega_i)\). For the case of \(Y\) from above, that would be:
and for \(Z\):
where \(0.5\) comes from the fact that any of the events \(\omega_1, \omega_3, \omega_5\) can happen in order for \(Z\) to take value of 0, the same goes for the even numbers.
Expectation and Variance#
Now that we have described the concept of a random variable, it is time for us to show what does it mean to take the expectation or the variance of a random variable. An expectation (or expected value) of a discrete random variable is defined as follows:
So in other words, the expectation is the weighted sum of all possible outcomes of a random variable, weighted by the probability of those outcomes happening. Let us try to take the expectation of a random variable \(X\) from above:
Expected value is a very important concept in probability and probably the concept that (alongside variance) you will use the most. But what is variance? Variance of a random variable appears as a needed concept when you ask yourself “How far away do I expect the random variable to be from its expected value?”. If we want to write that mathematically (assuming we want the average of the square of the distance from the expected value) we would get:
Where many times the last expression is very handy and could make your calculations quicker. Let us calculate the variance of our random variable \(X\):
Since we have already calculated the expectation (\(\mathbb{E}(X)\)) we only have to calculate the \(\mathbb{E}(X^2)\), and now we will show how simple that actually is. If we square a random variable, this means that we are squaring each outcome of that random variable, i.e.
So the expected value of \(X^2\) will be:
And finally the variance is:
Examples with Expected Value#
Let us now imagine that we throw a die 5 times in a row and we are interested in the sum of our throws. We want to calculate the expected value and the variance of that sum. We will denote the outcome of the \(i\)-th throw with \(X_i\). All throws are independent (we will talk more about independence in the next chapters) and they have the same distribution (IID - independent identically distributed). The distribution of each throw is:
We define \(Y\) as the sum of our throws:
We are interested in the expected value of such sum.
Note
It can easily be shown that the expectation of the sum of random variables is always equal to the sum of the expectations of random variables that are included in the sum:
This holds even if the random variables are not independent.
With this in our toolbox we can easily calculate the expected value of \(Y\):
With variance the story is slightly different and it matters if the random variables are independent or not.
Note
The full formula of the variance of the sum of random variable is as follows:
Note that the variance of the sum will be equal to the sum of variance if the random variables are uncorrelated, which is different from independence.
Important
Independence is a stronger condition:
In our case, however, the \(X_i\) are independent and we can easily calculate the variance of \(Y\):