0% found this document useful (0 votes)
3 views

Random Variable 2024 Note

A random variable is a real-valued function defined on a sample space, with examples including the number of heads in coin tosses. Random variables can be discrete, assuming countable values, or continuous, taking any value in an interval. The document also discusses probability distributions, expected values, variance, and cumulative distribution functions for random variables.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Random Variable 2024 Note

A random variable is a real-valued function defined on a sample space, with examples including the number of heads in coin tosses. Random variables can be discrete, assuming countable values, or continuous, taking any value in an interval. The document also discusses probability distributions, expected values, variance, and cumulative distribution functions for random variables.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

Random Variable

Definition
A random variable is a real valued function for which the
domain is a sample space.

Example
Define an experiment as tossing two coins and observing the
results. Let Y equal the number of heads obtained.
(1) Identify the sample points in S.
(2) Assign a value of Y to each sample point.
(3) Identify the sample points associated with each value of
the random variable Y.

1 / 66
Solution

(1) Let H and T represent head and tail respectively. Then


sample points in S are

E1 : HH, E2 : HT , E3 : TH and E4 : TT .

(2) Y = {0, 1, 2}
(3) {Y = 0} = {E4 }
{Y = 1} = {E2 , E3 }
{Y = 2} = {E1 }
Let y denote an observed value of the random variable Y .
Then P(Y = y) is the sum of the probability of the sample
points that are assigned to y.
▶ P(Y = 0) = P(E4 ) = 14
▶ P(Y = 1) = P(E2 ) + P(E3 ) = 1 1 1
4 + 4 = 2
▶ P(Y = 2) = P(E1 ) = 1
4
2 / 66
Discrete Random Variable

Definition
A random variable that assumes countable values is called a
discrete random variable.

Example
1. The number of vehicles owned by a family
2. The number of customers who visit a bank any given hour
3. The number of heads obtained in three tosses of a coin

3 / 66
Continuous Random Variable

Definition
A random variable that can assume any value contained in one
or more interval is called a continuous random variable.

Example
1. The time taken to travel from home to work
2. The time spent by a physician examining a patient
3. The time taken to serve a customer in a supermarket

4 / 66
Discrete and Continuous Random variables

5 / 66
Discrete and Continuous Random variables

Exercise
State whether each of the following random variables is
discrete or continuous:
a. The number of defective tires on a car
b. The body temperature of a hospital patient
c. The number of pages in a book
d. The number of draws (with replacement) from a deck of
cards until a heart is selected
e. The lifetime of a light bulb

6 / 66
We will use
▶ uppercase letters, such as Y to denote random variables
and
▶ lowercase letters, such as y , to denote particular values
that a random variable may assume.
Note: Y is a random variable, but the specific observed value,
y , is not random.

7 / 66
The probability Distribution for a Discrete Random
Variable
Definition
The probability distribution for a discrete random variable Y
can be represented by a formula, a table, or a graph, which
provides p(y) = P(Y = y ) for all y .

Example
Toss two fair coins. Consider the random variable Y =number of
heads which turn up. Then the probability distribution of Y is
given by the following table:

y p(y)
0 1/4
1 1/2
2 1/4

8 / 66
The probability distribution of a discrete random variable Y
must satisfy the following two conditions:
1. 0 ≤ p(y) ≤ 1 for all y
P
2. y p(y ) = 1

9 / 66
Probability distribution for Discrete Random variables
Example
Let X be the number of courses for which a randomly selected
student at a certain university is registered. The probability
distribution of X appears in the following table:
X 1 2 3 4 5 6 7
P(X ) 0.02 0.03 0.09 0.25 0.40 0.16 0.05
a. What is P(X = 4) ?
b. What is P(X ≤ 4)?
c. What is the probability that the selected student is taking at
most five courses?
d. What is the probability that the selected student is taking
more than five courses?
e. What is the probability that the selected student is taking at
least five courses?
f. Calculate P(3 ≤ X ≤ 6) and P(3 < X < 6). Explain why
these two probabilities are different.
10 / 66
Exercise
Let Y denote the number of broken eggs in a randomly
selected carton of ten eggs. Suppose that the probability
distribution of Y is as follows:
Y 0 1 2 3 4
p(Y ) 0.65 0.20 0.10 0.04 ?
a. Only Y values of 0, 1, 2, 3, and 4 have positive
probabilities. What is p(4) ?
b. How would you interpret p(1) = 0.20 ?
c. Calculate P(Y ≤ 2), the probability that the carton contains
at most two broken eggs, and interpret this probability.
d. Calculate P(Y < 2), the probability that the carton
contains fewer than two broken eggs. Why smaller than
the probability in Part (c)?
e. What is the probability that the carton contains exactly 8
unbroken eggs?
f. What is the probability that at least 8 eggs are unbroken?
11 / 66
The Expected Value of a Random Variable

Definition
Let Y be a discrete random variable with the probability function
p(y). Then the expected value of Y , E[Y ], is defined to be
X
E[Y ] = yp(y).
y

12 / 66
Example
Let Y be a discrete random variable with probability function in
the following table.

y p(y)
0 1/4
1 1/2
2 1/4

Find the expected value of Y .

13 / 66
Example

y p(y)
0 0.20
1 0.15
2 0.25
3 0.35
4 0.05

Find the expected value of Y .

14 / 66
Example
A drug is used to maintain a steady heart rate in patients who
have suffered a mild heart attack. Let X denote the number of
heartbeats per minutes obtained per patient. Consider the
hypothetical probability distribution given in the following table:

x 40 60 68 70 72 80 100
P(X=x) 0.01 0.04 0.05 0.80 0.05 0.04 0.01

What is the average heart rate obtained by all patients


receiving this drug. That is, what is E[X ]?

15 / 66
Example
A gambler wins Rs. 100 with probability 0.1 and Rs. 50 with
probability 0.1, and loses Rs. 20 with probability 0.8. What is
his expected win?

16 / 66
The Expected value of a Function of a Random
Variable

Let Y be a discrete random variable with probability function


p(y) and g(y) be a real valued function of Y . Then the expected
value of g(Y ) is given by
X
E[g(Y )] = g(y )p(y)
y

17 / 66
Example
Monthly sales of a certain product, recorded to the nearest
thousand, are believed to follow the probability distribution
given in the following table.

Number of Items y p(y)


5,000 0.2
6,000 0.3
7,000 0.2
8,000 0.2
9,000 0.1
1.00

Suppose that the company has a fixed monthly production cost


Rs. 8,000 and that each item brings Rs.2. Find the expected
monthly profit from product sales.

18 / 66
Variance

Definition
The variance of a random variable Y is defined to be expected
value of (Y − µ)2 . That is

Var (Y ) = E[(Y − µ)2 ]

where µ = E[Y ].
The standard deviation of Y is the positive square root of
Var (Y ).
If σ 2 = Var (Y ) then the standard deviation
p
σ = + Var (Y )

19 / 66
Example
The probability distribution for a random variable Y is given in
the following table:

y p(y)
0 1/8
1 1/4
2 3/8
3 1/4

Find the mean, variance and standard deviation of Y .

20 / 66
Theorem
Let Y be a discrete random variable with probability function
p(y).
(1) If c be a constant then

E[c] = c

.
(2) If g(Y ) be a function of Y and let c be a constant, then

E[cg(Y )] = cE[g(Y )]

(3) If g1 (Y ), g2 (Y ), · · · , gk (Y ) be a k functions of Y , then

E[g1 (Y ) + g2 (Y ) + · · · + gk (Y )] = E[g1 (Y )] + E[g2 (Y )] + · · ·


· · · + E[gk (Y )].

21 / 66
Proof:
(1)
X
E[c] = cp(y)
y
X
= c p(y )
y
X
= c (∵ p(y) = 1)
y

(2)
X
E[cg(Y )] = cg(y )p(y )
y
X
= c g(y)p(y)
y
= cE[g(Y )].

22 / 66
(3) We will demonstrate the proof only for the case k = 2, but
analogous steps will hold for any finite k.
X
E[g1 (Y ) + g2 (Y )] = (g1 (y) + g2 (y ))p(y)
y
X X
= g1 (y )p(y ) + g2 (y)p(y)
y y
= E[g1 (Y )] + E[g2 (Y )].

23 / 66
Theorem
Let Y be a discrete random variable with probability function
p(y) then

Var (Y ) = σ 2 = E[(Y − µ)2 ] = E[Y 2 ] − µ2

Proof:

σ 2 = E[(Y − µ)2 ]
= E[Y 2 − 2µY + µ2 ]
= E[Y 2 ] − E[2µY ] + E[µ2 ]
= E[Y 2 ] − E[2µY ] + Eµ2 ∵ µ is a constant
2 2 2
= E[Y ] − 2µ + µ
= E[Y 2 ] − µ2

24 / 66
Example

y p(y)
0 1/8
1 1/4
2 3/8
3 1/4

Find the variance of Y .

25 / 66
Example
The manager of an industrial plant is planning to buy a new
machine of either type A or type B. If t denotes the number of
hours of daily operation, the number of daily repairs Y1 required
to maintain a machine of type A is a random variable with mean
and variance both to 0.10t. The number of daily repairs Y2 for a
machine of type B is a random variable with mean and variance
both equal to 0.12t. The daily cost of operating A is
CA (t) = 10t + 30Y12 ; for B it is CB (t) = 8t + 30Y22 . Assume that
the repairs take negligible time and that each night the
machines are tuned so that they operate essentially like new
machines at the start of the next day. Which machine minimizes
the expected daily cost if a workday consists of (a) 10 hours
and (b) 20 hours?.

26 / 66
Solution
The expected daily cost for A is

E[CA (t)] = E[10t + 30Y12 ]


= 10t + 30E[Y12 ]
= 10t + 30{Var (Y1 ) + (E[Y1 ])2 }
= 10t + 30{0.1t + (0.1t)2 }
= 13t + 0.3t 2 .

E[CB (t)] = E[8t + 30Y22 ]


= 8t + 30E[Y22 ]
= 8t + 30{Var (Y2 ) + (E[Y2 ])2 }
= 8t + 30{0.12t + (0.12t)2 }
= 11.6t + 0.432t 2 .

27 / 66
Solution (Continue..)
(a) When t = 10, E[CA (10)] = 160 and
E[CB (10)] = 159.2
Machine B is better than Machine A.
(b) When t = 20, E[CA (20)] = 380 and
E[CB (20)] = 404.8
Machine A is better than Machine B.
▶ In conclusion, machines of type B are more economical for
short time periods and long time periods machines of type
A are more economical.

28 / 66
Cumulative Distribution Function

Definition
The cumulative distribution function F (y) of a discrete random
variable Y with probability function P(y) is

F (y ) = P(Y ≤ y) for − ∞ < y < ∞.

29 / 66
Example
Let Y be a discrete random variable with the following
probability distribution:
y 0 1 2 3
P(Y=y) 1/27 6/27 12/27 8/27

Find the cumulative distribution of Y .

30 / 66
Example
Suppose that Y has a binomial distribution with n = 2 and
p = 1/2. Find F (y).

31 / 66
Solution
The probability function for Y is given by
   y  2−y
2 1 1
p(y ) = , y = 0, 1, 2.
y 2 2

The probabilities are

p(0) = 1/4, p(1) = 1/2 and p(2) = 1/4.


What is F (−2) = P(Y ≤ −2)?
F (−2) = 0.
∴ F (y) = 0 for all y < 0.
What is F (1.5) ?

F (1.5) = P(Y ≤ 1.5) = P(Y = 0) + P(Y = 1)


= 1/4 + 1/2
= 3/4.
32 / 66
The graph of the F (y) is given in the following Figure.

The cumulative function stayed flat between the possible values


of Y and increased in steps at each of the possible values of Y .
Functions that behave in such a manner are called step
functions.
Distribution functions for discrete random variables are always
step functions because the cumulative distribution function
increases only at a countable number of points.

33 / 66
Properties of a Cumulative Distribution Function

If F (y) is a distribution function, then


1.
F (−∞) ≡ limy→−∞ F (y ) = 0.
2.
F (∞) ≡ limy→∞ F (y) = 1.
3. F (y ) is a non-decreasing function of y. (If y1 and y2 are
any values such that y1 < y2 , then F (y1 ) ≤ F (y2 ) ).

34 / 66
Cumulative Distribution Function

Theorem
If the all possible values for the random variable X is given by
Rx = {x1 < x2 < x3 < · · · < xn }, then

p(x1 ) = F (x1 )
p(x2 ) = F (x2 ) − F (x1 )
p(x3 ) = F (x3 ) − F (x2 )
. = .
. = .
p(xn ) = F (xn ) − F (xn−1 ).

35 / 66
Cumulative Distribution Function

Example
Find the probability function of the random variable X whose
cumulative distribution function is


 0 if x < −1
0.25 if −1 ≤ x < 1



F (x) = 0.5 if 1 ≤ x < 3
0.75 if 3 ≤ x < 5




1 if x ≥ 5.

Also, find (a) P(X ≤ 3), (b) P(X = 3), and (c)P(X < 3).

36 / 66
Distribution Functions of Continuous Random
variables
A random variable X is said to be continuous if its space is
either and interval or a union of intervals. The following
definition formally defines a continuous random variable.
Definition
a random variable X is said to be a continuous random variable
if there exists a continuous function f : R  [0, ∞) such that for
every set of real number A
Z
P(X ∈ A) = f (x)dx.
A

Definition
The function f is called the probability density function of the
continuous random variable X .

37 / 66
It can be easily shown that for every probability density function
f, Z ∞
f (x)dx = 1.
−∞

38 / 66
Example
Is the real valued function f : R  R defined by

2x −2

if 1<x <2
f (x) =
0 otherwise

a probability density function for some random variable X ?

39 / 66
Example
Is the real valued function f : R  R defined by

1 + |x| if −1 < x < 1
f (x) =
0 otherwise

a probability density function for some random variable X ?

40 / 66
Example
For what value of the constant c, the real valued function
f : R  R given by
c
f (x) = , −∞ < x < ∞,
1 + (x − θ)2

where θis a real parameter, is a probability density function for


random variable X ?

41 / 66
Example
For what value of the constant c, the real valued function
f : R  R given by

c if a≤x ≤b
f (x) =
0 otherwise

where a, b are real constant, is a probability density function for


random variable X?

42 / 66
Definition
Let f (x) be the probability density function of a continuous
random variable X . The cumulative distribution function F (x) of
X is defined as
Z x
F (x) = P(X ≤ x) = f (t)dt.
−∞

43 / 66
Theorem
If F (x) is the cumulative distribution function of a continuous
random variable X , the probability density function f (x) of X is
the derivative of F (x), that is

d
F (x) = f (x).
dx

44 / 66
Example
What is the cumulative distribution function of the Cauchy
random variable with parameter θ?

Example
What is the probability density function of the random varaible
whose cdf is
1
F (x) = , −∞ < x < ∞?
1 + e−x

45 / 66
Theorem
Let X be a continuous random variable whose cdf is F (x).
Then followings are true:
(a) P(X < x) = F (x),
(b) P(X > x) = 1 − F (x),
(c) P(X = 0) = 0, and
(d) P(a < X < b) = F (b) − F (a).

46 / 66
Example
Suppose that

 0 for y < 0
F (y ) = y for 0 ≤ y ≤ 1
1 for y > 1.

Find the probability density function for Y , and graph it.

Solution
 d(0)
 dy = 0 for y < 0
d 
d(y)
f (y) = F (y ) = dy = 1 for 0 < y < 1
dy  d(1)
= 0 for y > 1.

dy

f (y) is undefined at y = 0 and y = 1.

47 / 66
48 / 66
49 / 66
Example
Let Y be a continuous random variable with probability density
function given by

3y 2 0 ≤ y ≤ 1

f (y ) =
0 elsewhere.

Find F (y). Graph both f (y) and F (y ).

50 / 66
Solution

51 / 66
52 / 66
Theorem
If the random variable Y has density function f (y ) and a ≤ b,
then the probability that Y falls in the interval [a,b] is
Z b
P(a ≤ Y ≤ b) = f (y)dy .
a

If Y is a continuous random variable and a and b ae constants


such that a < b, then P(Y = a) = 0 and P(Y = b) = 0 and

P(a < Y < b) = P(a ≤ Y < b) = P(a < Y ≤ b)


= P(a ≤ Y ≤ b)
Z b
= f (y)dy.
a

53 / 66
54 / 66
Example
Given f (y) = cy 2 , 0 ≤ y ≤ 2 and f (y ) = 0 elsewhere, find value
of c for which f (y ) is a density function.

Solution

Z ∞
F (∞) = f (y)dy = 1
−∞
Z 2
= cy 2 dy
0
2
cy 3
=
3
 0
8
= c.
3

Thus 83 c = 1


⇒ c = 38 .
55 / 66
Example
Find P(1 ≤ Y ≤ 2) for the above example. Also find
P(1 < Y < 2).

56 / 66
Percentiles for Continuous Random Variables

Definition
Let p be a real number between 0 and 1. A 100pth percentile of
the distribution of a random variable X is any real number q
satisfying

P(X ≤ q) ≤ p and P(X > q) ≤ 1 − p.

57 / 66
Percentiles for Continuous Random Variables

Example
If the random variable X has the density function
 x−2
e for x <2
f (x) =
0 otherwise

then what is the 75th percentile of X ?

58 / 66
Percentiles for Continuous Random Variables

Definition
The 25th and 75th percentiles of any distribution are called the
first and third quartiles, respectively.

Definition
The 50th percentile of any distribution is called the median of
the distribution.

59 / 66
Mode of a Distribution

Definition
A mode of the distribution of a continuous random variable X is
the value of x where the probability density function f (x) attains
a relative maximum.
A mode of a random variable X is one of its most probable
values.

60 / 66
Expected Value for Continuous Random variables

Definition
The expected value of a continuous random variable Y is
Z ∞
E[Y ] = yf (y)dy .
−∞

Provided that the integral exists.

Theorem
Let g(Y ) be a function of Y ; then the expected value of g(Y ) is
given by Z∞
E[g(Y )] = g(y )f (y)dy.
−∞

Provided that the integral exists.

61 / 66
Theorem
Let c be a constant and let g(Y ), g1 (Y ), g2 (Y ), · · · , gk (Y ) be
functions of a continuous random variable Y . Then the
following results hold.
1.
E[c] = c
2.
E[cg(Y )] = cE[g(Y )]
3.

E[g1 (Y )+g2 (Y )+· · ·+gk (Y )] = E[g1 (Y )]+E[g2 (Y )]+· · ·+E[gk (Y )].

62 / 66
Exercise
If Y is a continuous random variable with density function f (y ),
show that
σ 2 = Var (Y ) = E(Y 2 ) − [E(Y )]2 .

63 / 66
Exercise
If Y is a continuous random variable with mean µ and variance
σ 2 and a and b are constants, show that the following:
a E(aY + b) = aE(Y ) + b = aµ + b.
b Var (aY + b) = a2 Var (Y ) = a2 σ 2 .

64 / 66
Example
Let Y have the density function given by
 3 2
8y for 0 ≤ y ≤ 2
f (y ) =
0 elsewhere,

Find µ = E[Y ] and σ 2 = Var (Y ).

65 / 66
Exercise
Weekly CPU time used by an accounting firm has probability
density function (measured in hours) given by

(3/64)y 2 (4 − y ), for 0 ≤ y ≤ 4

f (y ) =
0 elsewhere,

a Find the expected value and variance of weekly CPU time.


b The CPU time costs the firm $200 per hour. Find the
expected value of the weekly cost for CPU time.
c Would you expect the weekly cost to exceed $600 very
often? why?

66 / 66

You might also like