You are on page 1of 13

Random Variable and its Notation

A variable that associates a number X(u) with the


outcome u of a random experiment is called a random
variable.
Probability and X :Ω → R
HCMC University of Technology Statistics u → X(u)
Dung Nguyen
Uppercase letters (X, Y, Z): Random variables.
Random Variables and Random Lowercase letters (x, y, z): Measured values of
random variables (after the experiment is
Vectors
conducted). Eg. x = 70 milliamperes.

Dung Nguyen Probability and Statistics2 / 29

Discrete Random Variables Continuous Random Variables

A discrete random variable is a random variable with A continuous random variable is a random variable
a finite or countably infinite range. Its values are with an interval (either finite or infinite) of real
obtained by counting. numbers for its range. Its values are obtained by
Number of scratches on a surface. measuring.
Number of defective parts among 100 tested. Electrical current and voltage.
Number of transmitted bits received in error. Physical measurements, e.g., length, weight,
Number of common stock shares traded per day. time, temperature, pressure.

Dung Nguyen Probability and Statistics3 / 29 Dung Nguyen Probability and Statistics4 / 29
Density function Discrete random variables Density function Discrete random variables

Discrete Distribution Example 1 - Digital Channel

There is a chance that a bit transmitted through


The probability mass function of X is defined by a digital transmission channel is received in
fX (u) = P(X = u) error.
X:the number of bits received in error in 4 bits
transmitted.

0.6
P(X = 0) = 0.6561
P(X = 1) = 0.2916 0.4
P(X = 2) = 0.0486
X P(X = 3) = 0.0036 0.2
For any event A: P(X ∈ A) = f(u). P(X = 4) = 0.0001
u∈A Total 1.0000 0
0 2 4

Dung Nguyen Probability and Statistics5 / 29 Dung Nguyen Probability and Statistics6 / 29

Density function Discrete random variables Density function Discrete random variables

Example 2 - Wafer Contamination


X: the number of wafers that need to be analyzed to
detect a large particle of contamination. Assume
that the probability that a wafer contains a large
particle is 0.01, and that the wafers are Proposition (Characteristic properties)
independent. A discrete function f is a probability mass function
Ω = {p, ap, aap, aaap, . . .}. ·10−2 iff
The range of X: 1 1 f(u) ≥ 0 for all u.
{1, 2, 3, 4, . . .}.
X
2 f(u) = 1.
u
0.99
Probability Distribution
P(X = 1) = 0.01 0.01
P(X = 2) = (0.99)(0.01) 0.0099 0.98
P(X = 3) = (0.99)2 (0.01) 0.0098
P(X = 4) = (0.99)3 (0.01) 0.0097
··· ··· ··· 0.97
Total 1
Dung Nguyen Probability
1 2
and Statistics7 / 29
3 4 Dung Nguyen Probability and Statistics8 / 29
Density function Discrete random variables Density function Continuous random variables

Example Continuous Distribution


3 Uniform distribution: Ω = {1, 2, 3, · · · , n}
1 A random variable X is continuous if ∃f ≥ 0 such that
f(k) = P(X = k) = for any [a, b]
n Z b
each outcome has equal probability P(a < X < b) = f(u)du
a

λk
4 Is f(k) = P(X = k) = k! e−λ (k = 0, 1, 2 . . . ) a probability
mass function?

5 Suppose that a random variable X has a discrete


distribution with the following p.d.f.
(
cu, u = 1, · · · , 5
f(u) =
0, otherwise
Determine the value of the constant c.
Dung Nguyen Probability and Statistics9 / 29 Dung Nguyen Probability and Statistics10 / 29

Density function Continuous random variables Density function Continuous random variables

Example 6 - Current

Let X denote the current measured in a thin copper


wire in milliamperes(mA). Assume that the range of X
is 4.9 ≤x≤ 5.1 and f(x) = 5. What is the probability
Proposition (Characteristic properties) that a current is
If f is a (probability) density function then

a between 4.95mA and 5.1mA?
1 f(u) ≥ 0
Z ∞
b less than 5mA?
2 f(u)du = 1
−∞
Solution
Z 5.1 Z 5.1
P(4.95 < X < 5.1) = f(x)dx = 5dx = 0.75
4.95 4.95
Z 5 Z 5
P(X < 5) = f(x)dx = 5dx = 0.5
4.9 4.9

Dung Nguyen Probability and Statistics11 / 29 Dung Nguyen Probability and Statistics12 / 29
Density function Continuous random variables Cumulative Distribution Function

Example Example 11 - Digital channel


7 Uniform distribution on [a, b] Consider the probability distribution for the digital
(
1 channel example.
, u ∈ [a, b]
f(u) = b−a x P(X = x)
0, u 6∈ [a, b] 0 0.6561
1 0.2916
2 0.0486
8 Suppose that the p.d.f. of X is as 3 0.0036
(
cu, 0 < u < 4 4 0.0001
f(u) = 1.0000
0, otherwise
Find the probability of three or fewer bits in error.
Find c. Then determine P(1 ≤ X ≤ 2) and P(X > 2).
The event (X ≤ 3) is the total of the events:
9 Suppose that X is a continuous random variable (X = 0), (X = 1), (X = 2), and (X = 3).
whose probability density function is given by From the table:
( P(X ≤ 3) = P(X = 0) + P(X = 1) + P(X = 2) + P(X = 3) = 0.9999
c(4u − 2u2 ), 0 < u < 2
f(u) =
0,
Dung Nguyen
otherwise
Probability and Statistics13 / 29 Dung Nguyen Probability and Statistics14 / 29

Find c and P(X > 1).


10 The amount of time in hours that a computer
functions before
Cumulative Distribution breaking down is a continuous
Function Cumulative Distribution Function

random variable
Cumulative with probability
Distribution density function
Function Example 12 - Defective parts
(
λe −u/100 , u≥0
f(u) = A day’s production of 850 parts contains 50 defective
F(u) = P(X ≤ u) 0, otherwise parts. Two parts are selected at random without
X
Compute = thef(k) probability
(discretethat a computer will
distribution) replacement. Let the random variable X equal the
functionk≤u number of defective parts in the sample. Find the

a between Z u 50 and 150 hours before breaking down? cumulative distribution function of X. The

b for=fewerf(t)dt than 100 hours?
(continuous distribution) probability mass function is calculated as follows:
−∞
800 799
P(X = 0)= · = 0.886
850 849
800 50
P(X = 1)= 2 · · = 0.111
850 849
50 49
P(X = 2)= · = 0.003
850 849

P(X = 0) = 0.886, P(X = 1) = 0.111, P(X = 2) = 0.003.


F(0) = P(X ≤ 0) = 0.886 1
F(1) = P(X ≤ 1) = 0.997
Dung Nguyen Probability and Statistics15 / 29 Dung Nguyen Probability and Statistics16 / 29
F(2) = P(X ≤ 2) = 1.000. 0.8
Cumulative Distribution Function Cumulative Distribution Function

Example 13 - Electric Current Properties


5
Consider the current Proposition (Characteristic properties)
4
measured in a thin 1 F(u) is nondecreasing
copper wire in mil- 3
2
2 F(−∞) = 0 and F(∞) = 1
liamperes(mA). Recall
that the range of X is 1
3 F is right continuous: limu→a+ F(u) = F(a)
4.9 ≤ x ≤ 5.1 and f(x) = 5.
4.7 4.8 4.9 5 5.1 5.2 5.3 Example (14)
Which of the six functions shown are valid CDFs?
The cdf
1
 0.8
0,
 x < 4.9 0.6
F(x) = 5(x − 4.9), 4.9 ≤ x ≤ 5.10.4
.

5.1 ≤ x

1, 0.2

4.7 4.8 4.9 5 5.1 5.2 5.3


Dung Nguyen Probability and Statistics17 / 29 Dung Nguyen Probability and Statistics18 / 29

Cumulative Distribution Function Cumulative Distribution Function

Other properties Example


Proposition (F =⇒ Probability) 15 Let X have the CDF
1 P(X < u) = F(u− ) and P(X = u) = F(u) − F(u− ). F(u)
2 Probability of random variable occurring within 1
an interval
P(a < X ≤ b) = F(b) − F(a)
0.5
Proposition (F =⇒ f)
1 If X has a discrete distribution then
u
f(u) = F(u) − F(u− )
−2 −1
2 If X has a continuous distribution, then F is
continuous at every u and F 0 (u) = f(u), i.e.
a Determine all values of u such that P(X = u) > 0.

b Find P(X ≤ 0)
f(u) = F 0 (u)
c Find P(X < 0).

Dung Nguyen Probability and Statistics19 / 29 Dung Nguyen Probability and Statistics20 / 29
Cumulative Distribution Function Expectation

Example Example 17 - Introduction to expectation


16 Let X have the CDF Random numbers
2 9 4 3 3 10 5 7 6 6
f(u)
10 6 5 6 5 7 1 3 9 1
1 The average value
1
0.75 x= (2 + 9 + 4 + 3 + 3 + 10 + 5 + 7 + 6 + 6p x = 5.4
20
0.5 + 10 + 6 + 5 + 6 + 5 + 7 + 1 + 3 + 9 +41)
0.25 1
= (1 · 2 + 2 · 1 + 3 · 3 + 4 · 1 + 5 · 3
u 20 3
5 10 15 20 + 6 · 4 + 7 · 2 + 8 · 0 + 9 · 2 + 10 · 2)
2 1 3 1 2
3
Find the numerical values of the following =1· +2· +3· +4· +5·
quantities 20 20 20 20 20
4 2 0 2 1 2

a P(X ≤ 1) +6· +7· +8· +9· + 10 ·

b P(X ≤ 10) 20 20 20 20 20 x

c P(X ≥ 10) = 1 · f(1) + 2 · f(2) + 3 · f(3) + · · · + 10 · f(10)
1 2 3 4 5 6 7 8 9 10

d P(X = 10) = 5.4.

e P(|X − 5| ≤ 0.1).
Dung Nguyen Probability and Statistics21 / 29 Dung Nguyen Probability and Statistics22 / 29

Expectation Expectation

Example 18 - Introduction to expectation Expectation


Definition
The expected value (mean) of a random variable X is
Play a game X
E(X) = uf(u) (discrete)
u −1 1
P(X = u) 23 13 Zu ∞
E(X) = uf(u)du (continuous).
−∞
Then
(−1) · 2 + (1) · 1 Other names: Expected value, Mean, Mean value,
E(X) =
3 Average value.
2 1 1
= (−1) · + (1) · (= − ) Proposition (Properties)
3 3 3
= (−1)f(−1) + (1)f(1). Expectation is linear:
E(aX + b) = a E(X) + b
and
E(X + Y) = E(X) + E(Y)

Dung Nguyen Probability and Statistics23 / 29 Dung Nguyen Probability and Statistics24 / 29
Expectation Expectation

Example The second moment of random variables


19 A roulette wheel has the numbers 1 through 36, as
well as 0 and 00. If you bet $1 that an odd
number comes up, you win or lose $1 according to
whether that event occurs. If X denotes your net
gain, find E(X). The expected value of a random variable X 2 is
X
E(X 2 ) = u2 f(u) (discrete)
Zu ∞
E(X 2 ) = u2 f(u)du (continuous).
−∞

20 A school class of 120 students is driven in 3


buses to a symphonic performance. There are 36
students in one Dung
of Nguyen
the buses,
Probability40 in another,
and Statistics25 / 29 and Dung Nguyen Probability and Statistics26 / 29

44 in the third bus. When the buses arrive, one


of the 120 students is randomly chosen. Let X
denoteExpectation
the number of students on the bus of that Expectation

randomly chosen student, and find E(X).


Example Expectation of function of a random
22 A roulette wheel has the numbers 1 through 36, as variable
21 well as 0 when
Find E[X] and 00. If you bet
the density $1 that
function of an odd
X is
number comes up, you (win or lose $1 according to
whether that event 2u, 0 ≤ u ≤ 1
f(u) =occurs. If X denotes your net
gain, find E(X 2 ). 0, otherwise
Proposition
In general, for any function g(u):
X
23 Let X denote a random variable that takes on any E g(X) = g(u)f(u) (discrete)
of the values -1, 0, and 1 with respective
Zu ∞
probabilities
E g(X) = g(u)f(u)du (continuous).
P(X = −1) = 0.2, P(X = 0) = 0.5, P(X = 1) = 0.3 −∞

Compute E(X 2 ).

24 Let X be the current measured in mA. The PDF is


f(x) = 0.05 for 0 ≤ x ≤ 20. What is the expected
value of power when the resistance
Dung Nguyen is 100
Probability and Statistics27 / 29 ohms? Dung Nguyen Probability and Statistics28 / 29

Use the result that power in watts P = 10−6 RI 2 ,


Expectation Expectation

Example 25 - Digital Channel Example 26 - Expected cost


There is a chance that a bit transmitted through a
digital transmission channel is received in error. X The time, in hours, it takes to locate and repair an
is the number of bits received in error of the next 4 electrical breakdown in a certain factory is a random
transmitted. The probabilities are variable X whose density function is given by
(
P(X = 0) = 0.6561, P(X = 2) = 0.0486, P(X = 4) = 0.0001, 1, if 0 < u < 1
f(u) =
P(X = 1) = 0.2916, P(X = 3) = 0.0036, 0, otherwise.
What is the expected value of the cube of the number If the cost involved in a breakdown of duration X is
of bits in error? X 3 , what is the expected cost of such a breakdown?
Solution
Solution
Put g(u) = u3 .
4 4 Put h(u) = u3 . Then
X X
3 3 1 1
u4 1 1
Z Z
E(X ) = E(g(X)) = g(u)f(u) = u f(u) 3 3 3
E(X ) = E(h(X)) = u f(u)du = u du = = .
u=0 u=0 4 0 4
0 0
3 3 3 3 3
= 0 (0.6561) + 1 (0.2916) + 2 (0.0486) + 3 (0.036) + 4 (0.0001)
= 1.6588.
Dung Nguyen Probability and Statistics29 / 29 Dung Nguyen Probability and Statistics30 / 29

Expectation Variance and Standard Deviation

Example Example 30 - Pass or First-Class


27 Suppose X is a random variable taking values in Honours?
{−2, −1, 0, 1, 2, 3, 4, 5}, each with probability 1/8. p p
Let Y = X 2 . Find E[Y]. x = 6.5 x = 6.5
0.25

28 Find E[eX ] when the density function of X is


(
1, 0 ≤ u ≤ 1
f(u) =
0, otherwise
0.125
29 Linda is a sales associate at a large auto
dealership. At her commission rate of 25% of
gross profit on each vehicle she sells, Linda
expects to earn $350 for each car sold and $400 x x
for each truck or SUV sold. Linda motivates 5 6 7 8 3 4 5 6 7 8 9 10
herself by using probability estimates of her
(a) Class 1 (b) Class 2
sales. She estimates her car sales in one day as
follows Dung Nguyen Probability and Statistics31 / 29 Dung Nguyen Probability and Statistics32 / 29
Car sales 0 1 2 3
Variance and Standard Deviation Variance and Standard Deviation

Example 31 - Stock Price Changes Deviations


1+2+5+8
Consider the prices A and B of two stocks at a time Observations: 1,2,5,8 =⇒ M = = 4.
one month in the future. Assume that 4
A has the uniform distribution on the interval 1 − 4 = −3 5−4=1
[25, 35]
B has the uniform distribution on the interval 1 2 4 5
[15, 45].
1/10 2 − 4 = −2 8−4=4
The distribu-
A tions: the Sum of squares: (1 − 4)2 + (2 − 4)2 + (5 − 4)2 + (8 − 4)2 .
B mean = 30 but Average sum of squares:
different. (1 − 4)2 + (2 − 4)2 + (5 − 4)2 + (8 − 4)2
. Sample variance:
4
1/30 A will surely (1 − 4)2 + (2 − 4)2 + (5 − 4)2 + (8 − 4)2
.
be worth at 4−1
least 25 while x1 + x2 + · · · + xn
P(B < 25) = 1/3. Observations: x1 , x2 , . . . , xn =⇒ x = .
15 25 35 45 n
Dung Nguyen Probability and Statistics33 / 29 Dung Nguyen Probability and Statistics34 / 29

2(x1 − x)2 + (x2 − x)2 + · · · + (xn − x)2


s = .
n−1
Variance and Standard Deviation Variance and Standard Deviation

Variance and Standard Deviation Properties


The variance of an r.v. X is
V(X) = E(X − µ)2 .
Variance measures dispersion around the mean. 1 Computational formula
X is discrete
X
V(X) = E(X 2 ) − (E X)2
V(X) = (u − µ)2 f(u). 2 Variance and standard deviation are not linear
u
V(aX + b) = a2 V(X) and SD(aX + b) = a SD(X)
X is continuous
3 If X and X are independent then
Z ∞
2
V(X) = (u − µ) f(u)du. V(X + Y) = V(X) + V(Y)
−∞

The standard deviation is


p
SD(X) = Var(X).

Dung Nguyen Probability and Statistics35 / 29 Dung Nguyen Probability and Statistics36 / 29
Variance and Standard Deviation Variance and Standard Deviation

Example 32 - Digital Channel Example 33 - Electric Current


There is a chance that a bit transmitted through a For the copper wire current measurement, the PDF is
digital transmission channel is received in error. X f(u) = 0.05 for 0 ≤ u ≤ 20. Find the mean and variance.
is the number of bits received in error of the next 4
transmitted. The probabilities are Solution
P(X = 0) = 0.6561, P(X = 2) = 0.0486, P(X = 4) = 0.0001, Z ∞ Z 20
0.05u2 20
P(X = 1) = 0.2916, P(X = 3) = 0.0036 E(X) = uf(u)du = u × (0.05)du = = 10
−∞ 0 2 0
Calculate the mean and variance. Z ∞ Z 20
V(X) = (u − 10)2 f(u)du = (u − 10)2 (0.05)du
x f(x) xf(x) (x − 0.4)2 (x − 0.4)2 f(x) x 2 f(x) −∞ 0

0 0.6561 0.0000 0.160 0.1050 0.0000 0.05(u − 10)3 20 100


= = .
1 0.2916 0.2916 0.360 0.1050 0.2916 3 0 3
2 0.0486 0.0972 2.560 0.1244 0.1944 Z ∞ Z 20
2 2 0.05u3 20 400
3 0.0036 0.0108 6.760 0.0243 0.0324 E(X ) = u f(u)du = u2 × (0.05)du = =
−∞ 0 3 0 3
4 0.0001 0.0004 12.960 0.0013 0.0016
400 100
Total 0.4000 0.3600 0.5200 V(X) = E(X 2 ) − E(X)2 = − 102 = .
3 3
Dung Nguyen Probability and Statistics37 / 29 Dung Nguyen Probability and Statistics38 / 29

Variance and Standard Deviation Variance and Standard Deviation

Example 34 - Comparison Example

X1
0.15 X2 35 Suppose that X can take each of the five values
X3 −2, 0, 1, 3, 4 with equal probability. Determine the
X4 variance and standard deviation of X and
Y = 4X − 7.
0.10

36 Suppose X has the following pdf, where c is a


0.05 constant to be determined
(
c(1 − u2 ), −1 ≤ u ≤ 1
f(u) =
0, otherwise
0 Compute E(X), V(X).
−20 −10 0 10 20 30 40 50
E(X1 ) = E(X2 ) < E(X3 ) = E(X4 ).
V(X1 ) = E(X3 ) < E(X2 ) = E(X4 ).
Dung Nguyen Probability and Statistics39 / 29 Dung Nguyen Probability and Statistics40 / 29
Joint Distributions Joint Distributions

Joint Probability Mass Function

In many random experiments, more than one quantity is


measured, meaning that there is more than one random The joint probability mass function of the discrete
variable. random variables X and Y denoted as fXY (u, v) satisfies
Example (Cell phone flash unit) fXY (u, v) = P(X = u, Y = v).
A flash unit is chosen randomly from a production
line; its recharge time X (seconds) and flash
intensity Y (watt-seconds) are measured. Proposition (Characteristic properties)
1 fXY (u, v) ≥ 0 for all u, v.
To make probability statements about several random XX
variables, we need their joint probability 2 fXY (u, v) = 1
u v
distribution.

Dung Nguyen Probability and Statistics41 / 29 Dung Nguyen Probability and Statistics42 / 29

Joint Distributions Joint Distributions

Example 37 - Signal Strength Joint Probability Density Function


A mobile web site is accessed from a smart phone; X
is the signal strength, in number of bars, and Y is
response time, to the nearest second. The joint probability density function for the
y = Response time x = Number of Bars continuous random variables X and Y, denotes as
(nearest second) of Signal Strength fXY (u, v), satisfies the following properties
ZZ
1 2 3 Total P((X, Y) ∈ A) = fXY (u, v)dudv.
1 0.01 0.02 0.25 0.28 A
2 0.02 0.03 0.20 0.25
3 0.02 0.10 0.05 0.17
Proposition (Characteristic properties)
4 0.15 0.10 0.05 0.30
Total 0.20 0.25 0.55 1.00
1 fXY (u, v) ≥ 0.
Z ∞Z ∞
2 fXY (u, v)dudv = 1.
Determine −∞ −∞

a P(X < 3, Y ≤ 2).

b P(X < 3|Y ≤ 2).

c P(Y ≤ 2|X < 3).
Dung Nguyen Probability and Statistics43 / 29 Dung Nguyen Probability and Statistics44 / 29
Joint Distributions Joint Distributions

Example 38 - Server Access Time Marginal Probability Distributions


Let the random variable X denote the time until a
(discrete)
computer server connects to your machine (in Since X is a random variable, it also has its own
milliseconds), and let Y denote the time until the probability distribution, ignoring the value of Y,
server authorizes you as a valid user (in called its marginal probability distribution.
milliseconds). X and Y measure the wait from a The marginal probability distribution for X
common starting point (u < v). The joint probability
fX (u) = P(X = u)
density function for X and Y is X
= P(X = u, Y = v)
fXY (u, v) = k e−0.001u−0.002v ,
v
for 0 < u < v < ∞. X
= fXY (u, v)

a Identify k. v
X

b Calculate P(X ≤ 1000, Y ≤ 2000). fX (u) = fXY (u, v).
v
Solution The marginal probability distribution for Y
k = 6 × 10−6 , P(X ≤ 1000, Y ≤ 2000) = 0.915
X
fY (v) = fXY (u, v).
u
Dung Nguyen Probability and Statistics45 / 29 Dung Nguyen Probability and Statistics46 / 29

Joint Distributions Joint Distributions

Example 39 - Signal Strength Marginal Probability Distributions


(continuous)
A mobile web site is accessed from a smart phone; X
is the signal strength, in number of bars, and Y is
If the joint probability density function of random
response time, to the nearest second.
variables X and Y is fXY (u, v), then
y = Response time x = Number of Bars
(nearest second) of Signal Strength The marginal probability density functions of X:
1 2 3 Marginal fY (y) Z ∞
1 0.01 0.02 0.25 0.28 fX (u) = fXY (u, v)dv,
−∞
2 0.02 0.03 0.20 0.25 The marginal probability density functions of Y:
3 0.02 0.10 0.05 0.17 Z ∞
4 0.15 0.10 0.05 0.30 fY (v) = fXY (u, v)du.
−∞
Marginal fX (x) 0.20 0.25 0.55 1.00

Dung Nguyen Probability and Statistics47 / 29 Dung Nguyen Probability and Statistics48 / 29
Joint Distributions

Example 40 - Signal Strength

A mobile web site is accessed from a smart phone; X


is the signal strength, in number of bars, and Y is
response time, to the nearest second.
y = Response time x = Number of Bars
(nearest second) of Signal Strength
1 2 3 Marginal fY (y)
1 0.01 0.02 0.25 0.28
2 0.02 0.03 0.20 0.25
3 0.02 0.10 0.05 0.17
4 0.15 0.10 0.05 0.30
Marginal fX (x) 0.20 0.25 0.55 1.00

Compute the mean and the variance of X and Y.

Dung Nguyen Probability and Statistics49 / 29

You might also like