0% found this document useful (0 votes)
28 views36 pages

2 RandomVariable

The document discusses the concept of random variables, including their types (discrete and continuous), and their associated probability functions such as Probability Mass Function (pmf) and Probability Density Function (pdf). It provides examples to illustrate how random variables can be defined and calculated, including their expectation and variance. Additionally, it highlights the importance of understanding probability distributions in quantifying uncertainty in various scenarios.

Uploaded by

Pranav Sinha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views36 pages

2 RandomVariable

The document discusses the concept of random variables, including their types (discrete and continuous), and their associated probability functions such as Probability Mass Function (pmf) and Probability Density Function (pdf). It provides examples to illustrate how random variables can be defined and calculated, including their expectation and variance. Additionally, it highlights the importance of understanding probability distributions in quantifying uncertainty in various scenarios.

Uploaded by

Pranav Sinha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Random Variable

• Concept of Random Variable


• Types of Random Variables
• Discrete
• Continuous
• Probability Mass Function (pmf) of a Discrete Random Variable
• Expectation and Variance of a Discrete Random Variable
• Probability Density Function (pdf) of a Continuous Random Variable
• Expectation and Variance of a Continuous Random Variable
• Cummulative Distribution Function

Gaurav Garg (IIM Lucknow)


Concept of Random Variable
• Suppose a person plays a game, where
• he wins Rs. 100 if he gets at least one head in two tosses of a fair coin, and
• he loses Rs. 200 otherwise.
• If the person keeps playing the game for a long-term, is he going to gain some
money?
• What is the long-term gain or loss to the person.

• The probability of getting at least one head in two tosses is P({HH, HT ,TH})=3/4.
• So, he has 75% chance of winning Rs. 100.
• He could lose Rs. 200 with 25% chance.

• Now how to incorporate this idea of his gain (or loss) along with the probability.

• In many situations, Probability fails to provide the quantitative measurement of the


uncertainty.
Gaurav Garg (IIM Lucknow)
• What is lacking in previous example, is some quantitative measurement of
his gain.
• We define as his gain or profit in the same game, then

• Now each of these outcomes is a part of the sample space.


• So, each of them has some specific probability to happen.
• We can write it more systematically as below:
•, or

• This variable is called random variable.

Gaurav Garg (IIM Lucknow)


• Variable changes its values depending on some other factor (unlike
constant).

• Random Variable changes its values depending on what we get as an


outcome of a random experiment.

• Thus, each value of a random variable is associated with a probability.

• In other words, random variable takes a value with some probability.

Gaurav Garg (IIM Lucknow)


• Mathematical Definition
• A random variable, is a function that assigns a numeric value to the outcomes of a
random experiment
• i.e., ,
• where is the sample space, is the real line .
• Example:
• Consider the random experiment of tossing two coins
• Sample space:
• is number of Heads appeared
• It is a random variable
• It can take any value out of 0, 1 and 2.

Gaurav Garg (IIM Lucknow)


• Example:
• Consider the random experiment of tossing a fair die.
• Sample space: S = {1, 2, 3, 4, 5, 6}
• P(getting 1) = 1/6, P(getting 2) = 1/6
• P(getting 3) = 1/6, P(getting 4) = 1/6
• P(getting 5) = 1/6, P(getting 6) = 1/6

• Let X be the value on the upper face of the die


• X could be 1, 2, 3, 4, 5 or 6 (X is a random variable)

• The event of “getting 1” is same as saying “X=1”


• So, P(getting 1) = P(X=1) = 1/6

• Similarly,
• P(X=2) =1/6, P(X=3) = 1/6, P(X=4) = 1/6, P(X=5) = 1/6, P(X=6) = 1/6

Gaurav Garg (IIM Lucknow)


• Example:
• Consider the random experiment of tossing a fair coin thrice.
• Sample space S={HHH, HHT, HTH, THH, HTT, THT, TTH, TTT}
• X: no. of heads appearing in three tosses
• X could be 0, 1, 2, or 3. (X is a random variable)

• P(X = 0) = P(TTT) = 1/8


• P(X=1) = P(HTT, THT, TTH) = 3/8
• P(X=2) = P(HHT, HTH, THH) = 3/8
• P(X=3) = P(HHH) = 1/8

Gaurav Garg (IIM Lucknow)


• Consider the same example again.
• S = {HHH, HHT, HTH, THH, HTT, THT, TTH, TTT}
• X: no. of heads appearing in three tosses
• X belongs to {0, 1, 2, 3}

• Event of “getting at least one head” is same as “X ≥ 1”


• P(X ≥ 1) = P(HHH, HHT, HTH, THH, HTT, THT, TTH) = 7/8

• Similarly, we can write


• P(X ≤ 1) = P(HTT, THT, TTH, TTT) = 4/8
• P(X < 2) = P(HTT, THT, TTH, TTT) = 4/8
• P(X ≤ 2) = P(HHT, HTH, THH, HTT, THT, TTH, TTT)= 7/8

Gaurav Garg (IIM Lucknow)


• Example:
• Consider the random experiment of drawing two cards at random from a well
shuffled pack of 52 cards with replacement.
• The sample space:
• S={ CC, CD, CH, CS,
DC, DD, DH, DS,
HC, HD, HH, HS,
SC, SD, SH, SS }
• X: number of Diamond Cards selected
• X is a random variable.

• X ≤ 1 is the event that at most one diamond is selected

• P(X ≤ 1) = 15/16

Gaurav Garg (IIM Lucknow)


• Example:
• Metro trains run every half hour between 7:00 AM to 7:00 PM on a certain line .
• A man enters the station at a random time during this period.

• Let X be the random variable which denotes the waiting time in minutes.
• X can take any value between 0 and 30.
• Sample space: S = [0,30)

• The event that “he has to wait for at most 10 minutes” is same as “X ≤ 10”
• P(X ≤ 10) = (10 – 0)/ (30 – 0) = 1/3

Gaurav Garg (IIM Lucknow)


Types of Random Variables
• Random Variables are of two types:
• Discrete Random Variable
• Continuous Random Variable

• Discrete Random Variable takes only a countable (finite or countably infinite)


number of values.
• no. of accounts opened, no. of cars sold, Friday night attendance at a cinema, no. of
defective items in a box, etc.
• Discrete random variables usually counts the items or individuals.
• Range set (the collection of all possible values of X) of a discrete random variable is countable.

• Continuous Random Variable takes on any values within an interval.


• weight of fertilizer packed in a bag, amount of sugar in an orange, time required to run a
mile, price of a stock, etc.
• Continuous random variable usually measures the characteristics.
• It can take an uncountably infinite number of values.
• Range set of a continuous random variable is an interval.
• It can be of types (-∞, ∞), (-∞, 0),Gaurav
(0, ∞)Garg (IIM Lucknow)
or (a, b).
More Examples
Random Variable Values Type
Flip a coin three times; {0, 1, 2, 3} Range Set is Finite
X = the total number of heads. Discrete Random Variable

Select a mutual fund; {2, 3, 4, ...} Range Set is Countably Infinite


X = the number of companies in the Discrete Random Variable
fund portfolio.
Measure the length of an object; Any positive Range Set is Uncountable
X = its length in centimeters. number Continuous Random Variable

Throw two dice over and over until { 1, 2, 3, 4, ...} Range Set is Countably Infinite
you roll a double six; Discrete Random Variable
X = the number of throws.
Take a true-false test with 100 {0, 1, 2, 3, Range Set is Finite
questions; X = no. of questions 4, ..., 100} Discrete Random Variable
answered correctly.
Invest $10,000 in stocks; {$0, $1, $2, $3, Range Set is Countably Infinite
X = the value, to the nearest $1, of …} Discrete Random Variable
your investment after an year.
Select a group of 50 people at Any positive Range Set is Uncountable
random; number Continuous Random Variable
X = exact average height (in m) of the
group.

Gaurav Garg (IIM Lucknow)


Probability Distribution of a Discrete Random Variable
• Also called as Probability Mass Function (pmf).
• It is a mutually exclusive listing of all possible values of the discrete
random variable along with corresponding probabilities.

All possible values of random variable X

Corresponding probabilities

• p1, p2, p3,…. are non-negative.


• Together they sum up to 1.

Gaurav Garg (IIM Lucknow)


• Example:
• X is the number of heads appearing in two fair coin-tossing experiments.
• X is a discrete random variable having the probability distribution:
probability mass function of X is
1 / 4, if x  0

p ( x) 2 / 4, if x  1
1 / 4, if x  2

0.6

0.5

0.4

0.3

0.2

0.1

0
x=0 x=1 x=2

Gaurav Garg (IIM Lucknow)


• Example:
• In throwing a die, X is the values appeared
• X is a discrete random variable having the probability distribution

probability mass function of X is


p ( x) 1 / 6, if x 1,2,3,4,5,6.

0.18
0.16
Probabilities

0.14
0.12
0.1
0.08
0.06
0.04
0.02
0
x=1 x=2 x=3 x=4 x=5 x=6
Gaurav Garg (IIM Lucknow)
• Recall the first example where X is the random variable denoting the gain
and is given by

• In tabular format, the probability distribution of X is given by

3 / 4 if x  100
• Probability mass function of X is written as p ( x) 
1 / 4 if x   200

Gaurav Garg (IIM Lucknow)


• Sometimes, the pmf can be expressed as a mathematical function.
• Example
• denotes the number of tosses needed to get the first tail.

• is a discrete random variable with probability distribution:

probability mass function of X is


 1/ 2 if x 1
1 / 2 2 if x 2

• pmf can also be written as p ( x ) 
 
1 / 2 3
if x 3
• Clearly,   

Gaurav Garg (IIM Lucknow)


• Example:
• Consider the previous example again.
• The discrete random variable has the pmf:

• The probability of getting a tail in less than 3 tosses is given by

Gaurav Garg (IIM Lucknow)


• Example:
• Suppose an individual purchases two electronic components
• Each of which may either be defective or acceptable.
• Sample space: S = {DD, DA, AD, AA}
• Given that P(DD) = 0.09, P(DA) = 0.21, P(AD) = 0.21, P(AA) = 0.49.
• X: number of acceptable components.
• Obtain the probability distribution of X.
• What is the probability of getting at least one acceptable components?

• Ans: 0.91

Gaurav Garg (IIM Lucknow)


Expectation of a Discrete Random Variable
• is a discrete random variable having the pmf
• Expectation or Expected value or mean of is given by

• Example:
• Recall the first example where is the random variable denoting the gain
• pmf of is
• Expected gain of the person is
• Rupees

Gaurav Garg (IIM Lucknow)


• Expectation of a random variable can be interpreted as “some sort of
average” of all the values that the random variable takes.
• So, expected value of a random variable is the center of its distribution.
• The concept of expectation is analogous to the physical concept of the
center of gravity of a distribution of mass.
• If and are constants, and are random variables, then we have

• For any function ,

Gaurav Garg (IIM Lucknow)


• Example
• Suppose X is a discrete random variable having following probability distribution
• x: -2 -1 0 1
• p(x): 0.4 k 0.2 0.3
• Find E(X).
• Ans: -0.6

• Example
• A shipment of 6 television sets contains 2 defective sets.
• A hotel makes a random purchase of 3 of the sets.
• If X is the no. of defective sets purchased by the hotel.
• How many defective sets are expected?
• Ans: 1

Gaurav Garg (IIM Lucknow)


• Example
• Consider the random experiment of tossing a fair coin repeatedly till we get the
first tail.
• What is the expected number of tosses needed to get the first tail.
• Random variable X is the number of tosses needed to get the first tail.
• pmf of X is given as

• We have to find E(X)

• Ans: 2

Gaurav Garg (IIM Lucknow)


Variance of a Discrete Random Variable
• Standard deviation is a universally accepted measure of dispersion.
• It is obtained as a positive square root of variance.
• Variance of a random variable is defined as

• where for a discrete random variable with pmf ,

• Note that Variance is always non-negative.


• If and are constants, and are random variables, then we have

• is the covariance between and It would be(IIMdiscussed


Gaurav Garg Lucknow) later.
• Example
• Suppose X is a discrete random variable having following probability distribution
• x: -2 -1 0 1
• p(x): 0.4 k 0.2 0.3
• Find Var(X).
• Ans: 1.64

• Example
• A shipment of 6 television sets contains 2 defective sets.
• A hotel makes a random purchase of 3 of the sets.
• If X is the no. of defective sets purchased by the hotel.
• Find Var(X).
• Ans: 2/5

Gaurav Garg (IIM Lucknow)


Joint Probability Distribution of two Discrete Random Variables
• Joint probability distribution or joint probability mass function of two
discrete random variables X and Y is
• for all possible values
• It can be written in a tabular form as below:
Possible values of Y
X Y b1 b2 ……… bm Total
Possible values of X
a1 p11 p12 ……… p1m p1.
a2 p21 p22 ……… p2m p2.
. . . . . .
. . . . . . Marginal pmf of X

an pn1 pn2 ……… pnm pn. Marginal pmf of Y

Total p.1 p.2 ……… p.m 1

pij  P ( X ai and Y b j ), i 1,2,  , n; j 1,2,  , m.


Gaurav Garg (IIM Lucknow)
Example:
• A fair coin is tossed once.
• Let X denote the number of heads.
• Y denote the number of tails.
• Find the joint probability mass function of X and Y.

• Ans Y
X 0 1 Total
0 0 1/2 1/2
1 1/2 0 1/2
Total 1/2 1/2 1

Gaurav Garg (IIM Lucknow)


• Example:
• A fair coin is tossed three times independently.
• X: no. of heads on the first toss;
• Y: total no. of heads.
• Find the joint pmf of X and Y.

• Ans Y
X 0 1 2 3 Total
0 1/8 2/8 1/8 0 4/8
1 0 1/8 2/8 1/8 4/8
Total 1/8 3/8 3/8 1/8 1

Gaurav Garg (IIM Lucknow)


Covariance between two Discrete Random Variables
• Covariance is a measure of relationship between two variables.
• For two random variables and , it is given by

• For discrete random variables and with joint pmf


• Example:
• A fair coin is tossed three times independently.
• Let X denote the no. of heads on the first toss;
• Y denote the total no. of heads.
• Obtain covariance between X and Y.
• Example:
• A fair coin is tossed once.
• Let X denote the number of head.
• Y denote the number of tail.
• Obtain covariance between X and Y.
Gaurav Garg (IIM Lucknow)
• Example:
• Using the given probability distribution of random variables and ,
compute

P(XiYi) X Y
0.2 -100 50
0.4 50 30
0.3 200 20
0.1 300 20

Gaurav Garg (IIM Lucknow)


Independence of two Discrete Random Variables
• Two discrete random variables and are said to be independent of each
other when

• for all possible values

• or,

• When X and Y are independent, then covariance between them is zero.

Gaurav Garg (IIM Lucknow)


Probability Distribution of a Continuous Random Variable
• A continuous random variable
• Has its range set is an interval on real line, e.g. etc.
• Takes uncountably many (infinite) values.
• Can not have countable (finite or infinite) possible values
• Can not have a pmf to give its probabilities.

• The probability distribution of a continuous random variable is described


by probability density function (pdf), which is given as

•,

• provided

Gaurav Garg (IIM Lucknow)


• Consider a continuous random variable having pdf
• Probability that takes the values on an interval is given by

• Example:
• Let is a random variable with pdf
• Show that is a valid pdf.
• Find and
• Example:
• Let is a random variable with pdf
• Show that is a valid pdf.
• Find and

Gaurav Garg (IIM Lucknow)


Expectation of a Continuous Random Variable
• If is a continuous random variable with pdf ,
• Then the Expectation of is given by

• For any function ,

• Example:
• If is a continuous random variable with pdf
• .

• Find .

• 3/4
• 1
Gaurav Garg (IIM Lucknow)
Variance of a Continuous Random Variable
• Variance of a random variable is defined as

• where for a continuous random variable with pdf ,

• Example:
• If is a continuous random variable with pdf
•.

• Find .

• 3/80
• 1/3
Gaurav Garg (IIM Lucknow)
Cumulative Distribution Function (cdf)
• Also called a Distribution Function.
• For a random variable , the cdf is defined as

• Clearly, it is a non-decreasing function.


• When X is a discrete random variable with pmf p(x), then

• When X is a continuous random variable with pdf f(x), then

• When X is continuous random variable, then


• cdf is also useful in obtaining various probabilities

Gaurav Garg (IIM Lucknow)

You might also like