Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Random Variables
•A random variable is a numerical measure of the
outcome from a probability experiment, so its value is
determined by chance. Random variables are
denoted X, Y, Z etc.
•A discrete random variable is a random variable
that has either a finite number of possible values or
a countable number of possible values.
•A continuous random variable is a random
variable that has an infinite number of possible
values that is not countable.
Example
• Discrete random variable with a finite number of
values
Let X = number of TV sets sold at the store in one
day where x can take on 5 values (0, 1, 2, 3, 4)
• Discrete random variable with an infinite sequence
of values
Let X = number of customers arriving in one day
where x can take on the values 0, 1, 2, . . .
We can count the customers arriving, but there is no
finite upper limit on the number that might arrive.
• The waiting time of a customer in a queueContinuous.
• We use capital letter , like X, to denote the random
variable and use small letter to list the possible
values of the random variable.
• Example. A single die is cast, X represent the
number of pips showing on the die and the
possible values of X are x=1,2,3,4,5,6.
A probability distribution provides the possible
values of the random variable and their corresponding
probabilities. A probability distribution can be in the
form of a table, graph or mathematical formula.
The table below shows the probability distribution for
the random variable X, where X represents the
number of DVDs a person rents from a video store
during a single visit.
Probability Distributions for
Discrete Random Variables
(Probability Mass Function (PMF)).
• The probability distribution is defined by a
probability function, denoted by p(x), which
provides the probability for each value of the
random variable.
• The probability distribution for discrete random
variable is called Probability Mass Function
(PMF).
p x i P X x i
Properties for
Discrete Random Variables
• The properties for a discrete probability function
(PMF) are:
p( x) P( X x)
0 p( x) 1 x
p( x) 1
all x
• Cumulative Distribution Function (CDF)
F ( x) P( X x)
F (b) P ( X b)
b
p( x)
y
F () 0
F ( ) 1
Example
n
Using past data on TV sales (below left), a tabular
representation of the probability distribution for TV
sales (below right) was developed.
Units Sold
0
1
2
3
4
Number
of Days
80
50
40
10
20
200
X
0
1
2
3
4
p(x)
.40
.25
.20
.05
.10
1.00
• Graphical Representation of the Probability Distribution
.50
p(x)
.40
.30
.20
.10
0
1
2
3 4
Values of Random Variable X (TV sales)
Example
• Random Variable: Grades of the students
Student ID
1
2
3
4
5
6
7
8
9
10
Grade
3
2
3
1
2
3
1
3
2
2
Probability Mass Function
2
p 1 P X 1
0.2
10
PMF
4
p 2 P X 2
0.4
10
4
p 3 P X 3
0.4
10
Grade
Example
• Random Variable: Grades of the students
Student ID
1
2
3
4
5
6
7
8
9
10
Grade
3
2
3
1
2
3
1
3
2
2
Probability Mass Function
p x
i
CDF
p 1 p 2 p 3 1
i
Cumulative Distribution Function
p X x x
p X 2 x
i
i
x
2
p X 3 x
i
p (x i )
p (x i ) p 1 p 2 0.2 0.4 0.6
2
p (x i ) p 1 p 2 p 3 1
Grade
Example
• Toss a fair coin three times and
define X = number of heads.
x
HHH
1/8
3
HHT
1/8
2
HTH
1/8
2
THH
1/8
2
HTT
1/8
1
THT
1/8
1
TTH
1/8
1
TTT
1/8
0
P(X = 0) =
P(X = 1) =
P(X = 2) =
P(X = 3) =
1/8
3/8
3/8
1/8
X
0
1
2
3
p(x)
1/8
3/8
3/8
1/8
Probability
Histogram for x
Expected Value and Variance
• The expected value, or mean, of a random variable
is a measure of its central location.
– Expected value of a discrete random variable:
n
E X xi p xi
11
• The variance summarizes the variability in the
values of a random variable.
– Variance of a discrete random variable:
Var X
2
n
E X ( xi ) 2 . p xi
2
i 1
EX
2
EX
2
n
xi2 p xi 2
i 1
Expected Value and Variance
E (aX b) aE ( X ) b
Ex. Given that X is random variable whose mean = 4,
find the mean of 3X+5.
Solution. E(3X+5)= 3 E(X)+E(5)= 3x4+5=17
V (aX b) a 2V ( X )
Ex. Given that X is random variable whose variance = 2,
find the variance of 3X+5.
Solution. V(3X+5)= 9 V(X)= 9x2=18
Example
n
Using past data on TV sales (below left), a tabular
representation of the probability distribution for TV
sales (below right) was developed.
Units Sold
0
1
2
3
4
Number
of Days
80
50
40
10
20
200
X
0
1
2
3
4
Find the mean and variance.
p(x)
.40
.25
.20
.05
.10
1.00
Example:
• Variance and Standard Deviation of a Discrete Random Variable
x
p(x)
xp(x)
0
1
2
3
4
.40
.25
.20
.05
.10
.00
.25
.40
.15
.40
1.20
x 2p(x)
.00
.25
.80
.45
1.6
3.1
n
E X xi p xi 1.20
n
Var X x p xi
2
i 1
2
i
2
3.1 1.20 1.66
2
11
standard deviation is
1.66 =1.2884
Example
• Toss a fair coin 3 times and
record x the number of heads.
X
p(x)
xp(x)
(x-)2p(x)
0
1/8
0
(-1.5)2(1/8)
1
3/8
3/8
(-0.5)2(3/8)
2
3/8
6/8
(0.5)2(3/8)
3
1/8
3/8
(1.5)2(1/8)
12
xp( x) 1.5
8
( x ) p( x)
2
2
2 .28125 .09375 .09375 .28125 .75
.75 .688
Alternative Solution (Suggested):
x
p(x)
x.p(x)
x2p(x)
0
1/8
0
0
1
3/8
3/8
3/8
2
3/8
3/4
3/2
3
1/8
3/8
9/8
12
xp( x) 1.5
8
Var X x p xi xi p xi
i 1
i 1
3 1.52 0.75
n
2
n
2
i
2
.75 .688
Example
• The probability distribution for X the
number of heads in tossing 3 fair coins.
•
•
•
•
Shape?
Outliers?
Center?
Spread?
Symmetric;
mound-shaped
None
= 1.5
= .688
Some important Differentiation and Integration
Formulas
d
c.dx c.x
(c ) 0
dx
dx x
d
( x) 1
n 1
x
dx
n
x
dx
; n 1
d
n 1
( x n ) nx n 1
x
x
dx
e
dx
e
d
(e x ) e x
1 x
x
dx
a dx ln a a
d
( a x ) a x ln a
ln( x)dx x ln x x
dx
1
d
1
dx ln x
ln( x )
x
dx
x
Notes about Continuous RV
• A continuous random variable can assume any
value in an interval on the real line or in a collection
of intervals.
• It is not relevant to talk about the probability of the
random variable assuming a particular value.
• Instead, we talk about the probability of the
random variable assuming a value within a given
interval.
Probability Distributions for
Continuous Random Variables
(Probability Density Function (PDF)).
• The probability distribution is defined by a
probability function, denoted by f(x), which
provides the probability for each value of the
random variable.
• The probability distribution for continuous
random variable is called Probability
Density Function (PDF).
Properties for
Continuous Random Variables
The properties for a
continuous probability
function (PDF) are:
f x
0 f ( x) 1
f ( x) dx 1
f x
d
F x
dx
Cumulative Distribution Function
(CDF)
F x P X x
x
f ( x) dx
b
F x P(a x b) f ( x) dx
a
Example
– Let X be a random variable with range [0,2] and pdf
defined by f(x)=1/2 for all x between 0 and 2 and f(x)=0
for all other values of x. Note that since the integral of
zero is zero we get
2
1
f ( x)dx 1/ 2dx x 1 0 1
0
2 0
2
– That is, as with all continuous pdfs, the total area under
the curve is 1. We might use this random variable to
model the position at which a two-meter with length of
rope breaks when put under tension, assuming “every
point is equally likely”. Then the probability the break
occurs in the last half-meter of the rope is
P(3/ 2 X 2)
2
3/ 2
2
1
f ( x)dx 1/ 2dx x 1/ 4
3/ 2
2 3/ 2
2
Example
– Let Y be a random variable whose range is the
nonnegative and whose pdf is defined by
1
f y
e
750
y
750
The random variable Y might be a reasonable choice to model
the lifetime in hours of a standard light bulb with average life
750 hours. To find the probability a bulb lasts under 500 hours,
you calculate
P(0 Y 500)
500
0
1 x / 750
x / 750 500
2/3
e
dx e
e 1 0.487
0
750
Expected Value and Variance
• The expected value, or mean, of a random variable is a
measure of its central location.
– Expected value of a continuous random variable:
EX
x f x dx
• The variance summarizes the variability in the values of a
random variable.
– Variance of a discrete random variable:
Var X 2 E X E X 2 E X
2
2
2
2
x . f x dx x . f x dx 2
Discrete versus Continuous Random Variables
Discrete RV
Continuous RV
Infinite Sample Space
e.g. [0,1], [2.1, 5.3]
Finite Sample Space
e.g. {0, 1, 2, 3}
Probability Mass Function (PMF)
Probability Density Function (PDF)
f x
p( xi ) P( X xi )
1. 0 p( x) 1 x
2.
p ( x) 1
all x
Cumulative Distribution Function (CDF)
F ( x) P( X x)
b
p( x)
y
p X x
F x P X x
x
f ( x) dx
b
F x P(a x b) f ( x) dx
a
Example
We assume that with average waiting time of one customer is 2
minutes
1 x / 2
e , x0
f ( x) 2
0,
otherwise
PDF: f (time)
time
Example
• Probability that the customer waits exactly 3 minutes is:
1 3 x /2
P (x 3) P (3 x 3) 3 e dx 0
2
• Probability that the customer waits between 2 and 3
minutes is:
1 3 x /2
P (2 x 3) e dx 0.145
2 2
• The Probability that the customer waits less than 2
minutes
2
P(0 X 2) e
0
x/ 2
1
dx 1 e 0.632
Example
• Probability that the customer waits exactly 3 minutes is:
1 3 x /2
P (x 3) P (3 x 3) 3 e dx 0
2
• Probability that the customer waits between 2 and 3 minutes is:
1 3 x /2
P (2 x 3) e dx 0.145
2 2
P(2 X 3) F (3) F (2) (1 e(3 / 2) ) (1 e1 ) 0.145
CDF
• The Probability that the customer waits less than 2 minutes
P (0 X 2) F (2) F (0) F (2) 1 e 1 0.632
CDF
Expected Value and Variance
A continuous variable X has a probability density function
f ( x) cx ;0 x 1
2
where c is constant. Find (i) the value of c (ii)
(iii) P ( X .75) (iv) P (.25 X .75)
v) compute mean and variance of X.
P ( X .25)
Key Concepts
V. Discrete Random Variables and Probability
Distributions
1. Random variables, discrete and continuous
2. Properties of probability distributions
0 p( x) 1 and p( x) 1
3. Mean or expected value of a discrete random
variable: Mean : xp( x)
4. Variance and standard deviation of a discrete
random variable: Variance : 2 ( x )2 p( x)
Standard deviation : 2