You are on page 1of 7

Faculty of Information Science & Technology

(FIST)

PSM 0325
Introduction to Probability and Statistics

Foundation in Life Science


Foundation in Information Technology

ONLINE NOTES

Topic 3
Random Variables

FIST, MULTIMEDIA UNIVERSITY (436821-T)


MELAKA CAMPUS, JALAN AYER KEROH LAMA, 75450 MELAKA, MALAYSIA.
URL: http://fist2.mmu.edu.my
PSM0325 Introduction to Probability and Statistics Topic 3

TOPIC 3
RANDOM VARIABLES

Reference:
Introduction to Probability and Statistics, Assliza Salim. et al.,Pearson. 2011

Objectives:
1. To understand the concept of discrete and continuous random variables.
2. To find the probability, mean and variance of random variable X.
3. To construct cumulative distribution.

Contents:
1. Introduction
2. Random Variables and Probability Functions
3. Expected Value and Variance
4. Continuous Random Variables

3.1 INTRODUCTION

This chapter forms a bridge between the study of probability and the application of
probability theory to the field of statistics. One such topic is the values (or costs)
which are sometimes associated with the outcomes of experiments. A common
problem in such situations, a problem which occurs frequently in decision making, is
to find an average value to associate with an experiment. To solve such problems we
use the concepts of random variable, mean, and standard deviation. The normal
random variable, which occurs in many statistical applications, will be introduced and
studied, as will the binomial random variable. We conclude the chapter by studying
the close relationship between the normal random variable and the binomial random
variable.

3.2 RANDOM VARIABLES AND PROBABILITY FUNCTIONS

In many situations that involve uncertainty we are interested in a numerical quantity


whose value depends on the outcome of an experiment. For instance, gamblers are
interested in the amount of money won or lost on each play a game; business
managers are interested in day-to-day demand for products; and students are
interested in semester-to-semester grade point averages. Each of these quantities
(winnings, demands, grade point averages) is a number, and in general it is known in
advance what the number will be. We will use probability to help us understand such
situations.

For a given sample space S of some experiment, a random variable is a function that
assigns a number to each outcome in S. It is a function from S to the set of real numbers
.

__________________________________________________________________________________
1/ 6
PSM0325 Introduction to Probability and Statistics Topic 3

Random variables are usually denoted by uppercase letters, such as X and Y .


X : S 
The values of the random variables X will be denoted by the lowercase letters x 1, x2,…,xk.

Example 1
Consider the experiment of flipping a coin three times.
There are 8 possible outcomes of the experiment;
The sample space S = {HHH , HHT ,HTH , HTT ,THH ,TTT ,THT ,TTH }.

If X : S is the random variable that denotes the number of tails that appear in three flips
of a fair coin, what are the possible values of X?
Let Y be the random variable that denotes the number of heads that appear in three flips of a
fair coin.

Random Variable X Y
Value of Random Variable 0, 1, 2, 3 0, 1, 2, 3

There are two types of random variable:


1) discrete random variable
2) continuous random variable

Discrete Random Variable - a random variable that assumes countable values.


- eg: number of cars, number of shoe pairs etc.

Continuous Random Variable - a random variable that can assume any value
contained in one or more intervals.
- eg: the height of student, the time taken to
complete the examination.

A general definition follows:

A random variable on a sample space S is an assignment of real numbers to


the elements of S, exactly one number assigned to each outcome.

In mathematical terms a random variable on S is a real valued function with domain


S.

Random variables are usually represented by uppercase letters such as X and Y. The
values of the random variables X will be denoted by the lowercase letters x 1, x2, …,
xk. Following convention, we will list these values in increasing order: x 1 < x2 < …<
xk. Also, in most problems we will specify a random variable by using table in which
each row corresponds to a single value of the random variable.

__________________________________________________________________________________
2/ 6
PSM0325 Introduction to Probability and Statistics Topic 3

The probability density function, or simply density function, of a random


variable X assigns probabilities pi to values xi of X, where pi is the probability
of the event Ei on which the random variable X takes the value xi, i = 1, 2, …,
k.

Two characteristics of a probability distribution (in table form):


1. The probability assigned to each value of a random variable x lies in
range 0 to 1, that is, 0  P( X  x )  1 for each value x.

2. The sum of the probabilities assigned to all possible values of x is equal to


1, that is,  P( X  x )  1 .

We note that since the events Ei are always a partition of the sample space S,
p1 + p2 + … + pk = 1

Example 2
Consider a game in which you roll two fair dice, and you note the sum of the numbers
on top. You win $3 if the sum is 7 and $4 if the sum is 11.You will lose $1 if the sum
is anything other than 7 or 11. Let X be the random variable which assigns to each
play of the game the amount you win or lose. Find the probability density function of
this random variable. Hence, construct the probability distribution table.

Solution:
The random variable X takes the values (in dollars) -1, 3, and 4, and so we set x 1 = -1,
x2 = 3, x3 = 4. The associated events E1, E2, and E3 are defined by

E1 = {outcomes such that the sum is 2, 3, 4, 5, 6, 8, 9, 10, or 12}


E2 = {outcomes such that the sum is 7}
E3 = {outcomes such that the sum is 11}

The probabilities of these events are obtained by using the methods of Chapter 3. The
dice are fair, so all 36 outcomes are equally likely. Also, n(E 1) = 28, n(E2) = 6, and
n(E3) = 2. Thus, we have

Pr[E1] = 28/36 = 7/9 Pr[E2] = 6/36 = 1/6 Pr[E3] = 2/36 = 1/18

The random variable X and its density function are shown in Table 5.3. Note that p 1 +
p2 + p3 = 7/9 + 1/6 + 1/18 = 1

Event E1 E2 E3
Value of X -1 3 4
Probability 7/9 1/6 1/18

__________________________________________________________________________________
3/ 6
PSM0325 Introduction to Probability and Statistics Topic 3

3.3 EXPECTED VALUES AND VARIANCE OF RANDOM


VARIABLES

Expected value of a Random Variable:


Let X be a discrete random variable with the set of possible values D and probability
distribution function p(x).

Let X be a random variable with values x1, x2, …, xk. Also, let p1 = Pr[X = xi]
for i = 1, 2, …, k. The expected value of X, E[X], is defined to be

E[X] = x1p1 + x2p2 + … + xkpk


(5.1)

The expected value of X also called the mean of X.

The probabilities pi are given by the probability density function for the random
variable X. Thus a necessary step in determining the expected value of X is to find
the density function of X.

Example 3:
The sale table for compact discs at Tone Down Sounds has 3 premium labels and 5
discount specials. On sale each premium label disc sells for $10 and each discount special
sells for $6. Two discs are selected at random. A random variable X is defined to be the
total cost of the discs selected. Find the expected value of the random variable X.

Solution:
In this first example, however, we apply the formula directly to emphasize the meaning
of each term in the formula. We first determine the values assumed by X. If 2 discount
specials are selected, then the cost in dollars is $12; if 1 discount special is selected along
with 1 premium label, then the cost is $16; and is 2 premium labels are selected, then the
cost is $20. Thus we set x1 = 12, x2 = 16, and x3 = 20. We determine the density function
of X to be
C(5,2 ) (5  4 ) / (1  2 ) 20
p1  Pr[ X  x1 ]   
C(8,2 ) (8  7 ) / (1  2 ) 56
C(5,1)C( 31, ) (5 / 1)( 3 / 1) 30
p 2  Pr[ X  x 2 ]   
C(8,2 ) (8  7 ) / (1  2) 56
C(3, 2) (3  2) / (1  2) 6
p3  Pr[ X  x 3 ]   
C(8,2) (8  7) / (1  2) 56

Applying the definition of expected value, we have


E[X] = x1p1 + x2p2 + x3p3 = 12(20/56) + 16(30/56) + 20(6/56)
= 840/56 = 15

In terms of the original setting, the expected value of the cost of the discs selected is
$15.

__________________________________________________________________________________
4/ 6
PSM0325 Introduction to Probability and Statistics Topic 3

Example 4:
A friend invites you to play the following game: 2 coins are to be selected at random
from 6 coins: 2 nickels, 3 dimes, and 1 quarter. If the sum of the values of the coins is
10, 20, or 30 cents, your friend pays you 25 cents. Otherwise you must pay your
friend the value of the coins. What is your expected gain per play of the game?

Solution:
Let N, D, and Q denote nickel, dime, and quarter, respectively. Since the order in
which the coins are drawn is unimportant, the sample space of the experiment can be
represented as {DQ, DN, DD, NQ, NN}. The gain to you is -35 cents for DQ, -15
cents for DN, and +25 cents for the other three outcomes. Let X denote the random
variable which assigns to each outcome its value to you in cents.

E[X] = -(105/15) - (90/15) + (150/15) = -(45/15) = -3

You should expect to lose 3 cents to your friend on each play game.

The expected value (or mean) of a random variable X is a number which gives a
precise meaning to the vague concept of the "average size of X". (There are other
numbers which one might associate with an average size, such as the median and the
mode, but we do not consider them in this book). In addition to such an average, it is
frequently helpful to know how the values of X are distributed about the mean, that
is, how the values are "spread out".

Variance of a Random Variable:

Let X be a random variable which takes the values x 1, x2, …, xn with


probabilities p1, p2, …, pn, respectively. Let  = E[X] denote the mean of X.
The variance of X, Var[X], is the number

Var[X] = (x1 - )2p1 + (x2 - )2p2 +…+ (xn - )2pn


(3.3)

The standard deviation of X is the number

  Var[X] (3.4)

Equation (5.4) simply says that once we have the variance of X we obtain the
standard deviation by taking the positive square root of the variance.

__________________________________________________________________________________
5/ 6
PSM0325 Introduction to Probability and Statistics Topic 3

3.4 Probability Distribution Function Of Continuous Random


Variables
The function f(x) is a probability distribution function for the continuous random variable
X, defined over the set of real numbers  , if
1. f ( x)  0 for all x   .
2.  f ( x ) dx  1
b
3. P(a  x  b)  a f ( x)dx

A continuous random variable has a probability of zero of assuming exactly any of its
values. P( X  a)  0

Note that when X is continuous


P ( a  x  b)  P ( a  x  b)  P ( a  x  b)  P ( a  x  b)
because, its relate to the same area under the probability density function.

Cumulative distribution function


The cumulative distribution function F(x) of a continuous random variable X with
probability distribution function f(x) is
F ( x)  P( X  x )   f (t )dt for    x  

Expected value of X
Let X be a random variable with probability distribution function f(x). The mean or
expected value of X is
  E ( X )   xf ( x )dx
if X is continuous random variable.

Variance of X
Let X be a random variable with probability distribution function f(x) and mean,  . The
variance of X is
 2  E ( X   ) 2   ( x   ) 2 f ( x)dx
 E ( X 2 )  ( E ( X )) 2 [Shortcut formula]
where
E ( X )   xf ( x )dx
E ( X 2 )   x 2 f ( x )dx

if X is a continuous random variable.

-----------------------------------------End of Topic 3------------------------------------------------

__________________________________________________________________________________
6/ 6

You might also like