Professional Documents
Culture Documents
2
Example
A coin is thrown twice. The sample space is S = {(H, H); (H, T ); (T, H); (T, T )}
We may want to consider how many times it was a Tail. Let’s assign a number X to each
event. Then the number X will be the number of Tails.
Complete the following:
8
>
> (H, H) 7! . . .
>
<(H, T ) 7! . . .
X:
>
> (T, H) 7! . . .
>
:
(T, T ) 7! . . .
8
>
> (H, H) 7! . . .
>
<(H, T ) 7! . . .
Y :
>
> (T, H) 7! . . .
>
:
(T, T ) 7! . . .
X can take the values 0,1 or 2 and Y the values 0 or 1. We use the notation [X = 2] for
the event that Tails appears twice. Similarly, [X > 1] is the event that Tails appears at
least once, and [X 2 {0, 2}] is the event that there are an even number of Tails.
13
2.1. DEFINITIONS CHAPTER 2. DISCRETE RV
2.1 Definitions
X:S !R
where the domain S is the sample space and R is the codomain of the function, the
set of real numbers that may possibly come out.
The set of values taken on by X, i.e. the set of values that actually come out is called
the range of the function and is denoted by ⌦X . In other words,
⌦X = {X(x) | x 2 S}
Remarks
Random variable (functions) are often called X (upper case X) so the values it
takes would be X(x). So a random variable is neither a variable nor random (it is
a function about random events) but it uses capital X which must not be confused
with a variable x.
Let S be the sample space associated with a random event and X be a discrete random
variable. If for each value of X we associate the corresponding probability, then we obtain
the probability density function of the random variable X.
A. Lemmon 14 Ma1
CHAPTER 2. DISCRETE RV 2.1. DEFINITIONS
Example
Let’s take our first example, where the number X represents the number of Tails. We
have:
S = {(H, H); (H, T ); (T, H); (T, T )}: it’s the domain of X;
⌦X = {0; 1; 2}: it’s the range of X, a subset of R.
1
P (X = 0) =
4
1
P (X = 1) =
2
1
P (X = 2) =
4
Remark
We will call pi the probability P (X = xi ), for each xi 2 ⌦X . Then, if ⌦X has n elements,
we have
X n
pi = 1
i=1
We can display this information in a table called the probability distribution table:
3
X
xi 0 1 2
i=1
1 2 1
pi 1
4 4 4
1 3
P (X 6 xi ) 1
4 4
The graph of a probability density function can be represented by a bar graph. On the
horizontal axis are the values of xi 2 ⌦X and on the vertical axis are the corresponding
probabilities (0 6 pi 6 1).
1 pi
0.75
0.5
0.25
0 1 2 xi
A. Lemmon 15 Ma1
2.2. EXPECTED VALUE CHAPTER 2. DISCRETE RV
The expected value is sometimes also called the expectation, the average or the mean
value.
Examples
Let’s consider two dice, a fair one and a loaded one. Each dice is thrown once. Let X
and Y be the random variables indicating the number shown by the fair and loaded dice
respectively. Calculate their respective expectations knowing that we have the following
distributions:
6
X
xi 1 2 3 4 5 6
i=1
1 1 1 1 1 1
pi 1
6 6 6 6 6 6
1 2 3 4 5 6 21
xi · pi = 3.5
6 6 6 6 6 6 6
1 1 1 1 1 1 21
E(X) = 1 · +2· +3· +4· +5· +6· = = 3.5
6 6 6 6 6 6 6
A. Lemmon 16 Ma1
CHAPTER 2. DISCRETE RV 2.2. EXPECTED VALUE
6
X
yi 1 2 3 4 5 6
i=i
2 2 3 3 4 4
pi 1
18 18 18 18 18 18
2 4 9 12 20 24 71
yi · pi ⇡ 3.94
18 18 18 18 18 18 18
1 1 1 1 2 2 71
E(Y ) = 1 · +2· +3· +4· +5· +6· = ⇡ 3.94
9 9 6 6 9 9 18
Remark
If all the probabilities are equal, then the expected value
x1 + x2 + · · · + xn
E(x) =
n
is called the arithmetic mean, or simply the mean of x1 , x2 , . . . , xn . Such distribution is
called a uniform distribution.
Properties
Remarks
A. Lemmon 17 Ma1
2.3. VARIANCE CHAPTER 2. DISCRETE RV
Examples
6
X
xi 1 2 3 4 5 6
i=1
1 1 1 1 1 1
pi 1
6 6 6 6 6 6
1 2 3 4 5 6 21
xi · pi = 3.5
6 6 6 6 6 6 6
6
X
y1 1 2 3 4 5 6
i=1
5 4 1 1 4 5
pi 1
20 20 20 20 20 20
5 8 3 4 20 30 70
yi · pi = 3.5
20 20 20 20 20 20 20
A. Lemmon 18 Ma1
CHAPTER 2. DISCRETE RV 2.3. VARIANCE
6
X
zi 1 2 3 4 5 6
i=1
1 4 5 5 4 1
pi 1
20 20 20 20 20 20
1 8 15 20 20 6 70
z i · pi = 3.5
20 20 20 20 20 20 20
Note that all three random variables have the same expected value, but you can see that
the distributions are quite di↵erent. Variable Z is the one most centered around the
expected value. Indeed:
1 1 2
P (3 6 X 6 4) = P (X = 3) + P (X = 4) = + = = 33.3%
| {z } | {z } 6 6 6
=p3 =p4
1 1 2
P (3 6 Y 6 4) = P (Y = 3) + P (Y = 4) = + = = 10%
| {z } | {z } 20 20 20
=p3 =p4
5 5 10
P (3 6 Z 6 4) = P (Z = 3) + P (Z = 4) = + = = 50%
| {z } | {z } 20 20 20
=p3 =p4
Intuitively, the mean (absolute) deviation is the expected value of the di↵erence between
the variable’s mean (µ = E(X)) and the variable’s realization, that is, the average of the
di↵erence between the variable’s mean and each possible value, weighted according to the
probability that the value will occur. This translates to
n
X
|xi µ| · pi
i=1
Concretely, this formula is not practical. This is why people introduced the variance,
which is the expected value of the squared di↵erence between the variable’s realization
and the variable’s mean, and managed to get the standard deviation by taking the
square root of the variance. Mean deviation and standard deviation do not give exactly
the same result, but are close. The standard deviation is more a↵ected by larger values
and is more commonly used, thanks to the variance theorem. Larger variance reflects a
greater spread in the probability distribution.
A. Lemmon 19 Ma1
2.3. VARIANCE CHAPTER 2. DISCRETE RV
Definition 17 (Variance)
Let X be a discrete random variable, where ⌦X = {x1 , x2 , . . . , xn }, and let µ = E(X).
Then the variance V (X) is given by
n
X
V (X) = (xi µ)2 · pi = E[(X µ)2 ]
i=1
That is, the variance is the expected value of the squared di↵erence between the vari-
able’s realization and the variable’s mean (expected value).
Example
We roll a dice once. Let X be the random variable indicating the number obtained, as
1
summarized in the previous example. Then P (X = xi ) = and µ = 3.5. Applying the
6
definition of the variance, we obtain
1 1 1
V (X) = (1 3.5)2 · + (2 3.5)2 · + (3 3.5)2 ·
6 6 6
1 1 1
+ (4 3.5)2 · + (5 3.5)2 · + (6 3.5)2 ·
6 6 6
1
= [( 2.5)2 + ( 1.5)2 + ( 0.5)2 + 0.52 + 1.52 + 2.52 ] ·
6
35 1
= ·
2 6
35
=
12
Hence, the standard deviation is
r
35 ⇠
(X) = = 1.7
12
The variance doesn’t have the same unit as the random variable X (because of the square),
but the standard deviation does. Here, the standard deviation tells us that when we roll
a dice, we are, in some sort of average, 1.7 away from the expected value being 3.5.
(Remember that the variance is more a↵ected by larger values, this is why we don’t get
1.5 as expected by the mean deviation).
Theorem 12 (Variance)
Let X be a discrete random variable, where ⌦X = {x1 , x2 , . . . , xn }, and let µ = E(X).
Then the variance
n
X
V (X) = x2i · pi µ2 = E(X 2 ) [E(X)]2
i=1
A. Lemmon 20 Ma1
CHAPTER 2. DISCRETE RV 2.3. VARIANCE
Example
Let’s calculate the variance and the standard deviation for the random variable X given
above:
6
X
xi 1 2 3 4 5 6
i=1
1 1 1 1 1 1
pi 1
6 6 6 6 6 6
1 2 3 4 5 6 21 7
xi · pi =
6 6 6 6 6 6 6 2
1 1 1 1 1 1 91
x2i · pi 12 · 22 · 32 · 42 · 52 · 62 ·
6 6 6 6 6 6 6
✓ ◆2
2 91 2 7 35
V (X) = E(X ) [E(X)] = =
6 2 12
and r
35 ⇠
(X) = = 1.7
12
Example
Calculate the variance and the standard deviation for the random variable Z given above.
Remark
The unit of the standard deviation is equal to the unit of its random variable, whereas
the unit of the variance is the squared of the the unit of its random variable. Hence the
standard deviation is more meaningful.
Properties
(1) V (X + k) = V (X), 8k 2 R
(2) V (k · X) = k 2 · V (X), 8k 2 R
Remark
The last two properties are equivalent to V (a · X + b) = a2 · V (X)
A. Lemmon 21 Ma1
2.4. BINOMIAL DISTRIBUTION CHAPTER 2. DISCRETE RV
Example
A coin is tossed ten times. What is the probability of obtaining exactly seven tails?
where
n = number of trials
Remarks
n ✓ ◆
X n
(1) · pk · q n k
= (p + q)n = 1n = 1 since q = 1 p
k
k=0
A. Lemmon 22 Ma1
CHAPTER 2. DISCRETE RV 2.4. BINOMIAL DISTRIBUTION
Example
Let X be the random variable counting how many times we obtain 6 dots when rolling a
fair dice 6 times. How many time would we expect to obtain 6 dots?
Applying the definition of the expected value, we have:
✓ ◆ ✓ ◆0 ✓ ◆ 6
6 1 5
P (X = 0) = · ·
0 6 6
✓ ◆ ✓ ◆1 ✓ ◆ 5
6 1 5
P (X = 1) = · ·
1 6 6
✓ ◆ ✓ ◆2 ✓ ◆ 4
6 1 1
P (X = 2) = · ·
2 6 6
✓ ◆ ✓ ◆3 ✓ ◆ 3
6 1 5
P (X = 3) = · ·
3 6 6
✓ ◆ ✓ ◆4 ✓ ◆ 2
6 1 5
P (X = 4) = · ·
4 6 6
✓ ◆ ✓ ◆5 ✓ ◆ 1
6 1 5
P (X = 5) = · ·
5 6 6
✓ ◆ ✓ ◆6 ✓ ◆ 0
6 1 5
P (X = 6) = · ·
6 6 6
E(X) = 1 (surprised?)
(1) E(X) = np
A. Lemmon 23 Ma1
2.4. BINOMIAL DISTRIBUTION CHAPTER 2. DISCRETE RV
A. Lemmon 24 Ma1