Idea of Random Variable

Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

Idea of Random Variable

• Consider a random experiment of tossing a fair


coin twice.
• Suppose a person plays a game where
▪ he wins Rs. 100 if he gets at least one head in
two tosses, and
▪ he loses Rs. 200 otherwise.
• If the person keeps playing the game for a long
time, is he going to gain some money or loose?
• 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.
• But, at the same time, he could lose Rs. 200 with
25% chance.
• Now how to incorporate this idea of his gain (or
loss) along with the probability.
• We define X as his gain or profit in the same
game, then
▪ X takes the value 100 when he wins.
▪ X takes the value -200 when he looses.
• Now each of these outcomes is a part of the
sample space.
• So each of them has some specific probability to
happen.
• We write it more systematically as follows –

• Using the corresponding probabilities, we write


the same idea as

• Or
• This variable X is called random variable.
• Random Variable changes its value depending on
what we get as an outcome of a random
experiment.
• Each value of a random variable is associated with
a probability.
• A random variable is a rule for assigning numbers
to the possible outcomes of an experiment.
Symbolically they are denoted by capital letters
such as X, Y, or Z with or without subscripts and
the values taken by them are denoted by x, y, or z.
Mathematical Definition
• Experiment ----> Outcome ----> Numerical
Value
▪ A random variable, X, maps the experimental
outcome to a real number.
▪ A random variable, X, is a numerical measure of
the outcomes of an experiment
▪ A random variable is a function that assigns a
numeric value to the outcomes of a random
experiment
▪ i.e., X : S →R,
• where S is the sample space, R is the real line (-∞, ∞).
Example
• Consider the random experiment of tossing two
coins
✓Sample space: S = {HH, HT, TH, TT}
✓X is number of Heads appeared
✓X is a random variable
✓X can take any value out of 0,1 and 2.

➢P(X =0) = P{TT} = 1/4,


➢P(X =1) = P{HT, TH} = 2/4,
➢P(X =2) = P{HH} = 1/4.
Example
• Consider the random experiment of tossing a fair die.
✓ Sample space: S = {1, 2, 3, 4, 5, 6}
✓ Let X be the value on the upper face of the die
✓ X could be 1, 2, 3, 4, 5 or 6
✓ The event of “getting 1” is same as saying “X=1”

So,
➢ P(getting 1) = P(X=1) = 1/6
➢ 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
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 is a random variable.
✓X could be 0, 1, 2, or 3.

➢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
Same Example
• 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


▪ 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
• In general,
▪ P(X = x) is the probability that X takes on the value x
and
▪ P(X ≤ x) is the probability that X takes on a value that
is less than or equal to x
▪ As sum of all probabilities is 1 we have:
o P(X ≤ x) = 1 – P(X > x)
o P(X ≥ x) = 1 – P(X < x)
Example:
Consider the random experiment of drawing two cards at
random from a well shuffled pack of 52 cards.
The sample space: S =

X: number of Diamond Cards selected


• X is a random variable.
• Find the probability of the event that at most one diamond
card is selected. P(X ≤ 1) = 15/16
• Find the probability of the event that exactly one diamond
card is selected. P(X = 1) = 6/16
Some More Instances of Random Variable
• Number of defective ATMs in a city on a given
day.
• Number of employees absent on a day.
• Number of train accidents in a year on Indian
Railways due to collisions.
• Price of a stock.
• Monthly Earnings from Goods carried by
Indian Railways.
• Waiting time of a passenger for receiving
services in a computerized Booking Counter of
Indian Railways.
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 bulbs in a box, etc.
• Discrete random variables usually count the items.
• Range set 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 is usually a measurement.
• 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), (0, ∞) or (a, b).
Discrete random variable
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

• 0≤p(x)≤1 for all x.


• Together they sum up to 1.
Example:
• X is the number of heads appeared in two coins tossing
experiment.
• X is a discrete random variable having the probability distribution
probabilit y mass function of X is
1 / 4, if x = 0

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

0.6
Probabilities

0.5

0.4

0.3

0.2

0.1

0
x=0 x=1 x=2
• Example:
• In throwing a die, X is the value that appeared
• X is a discrete random variable having the probability distribution

probabilit y mass function of X is


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

0.2
Probabilities

0.15

0.1

0.05

0
x=1 x=2 x=3 x=4 x=5 x=6
• 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

• Probability mass function of X is written as


3 / 4 if X = 100
p ( x) = 
1 / 4 if X = − 200
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
Exercise
After watching a number of children playing games at a
video arcade, a statistics practitioner estimated the following
probability distribution of X, the number of games per visit.

X 1 2 3 4 5 6 7
p(X) .05 .15 .15 .25 .20 .10 .10

a. What is the probability that a child will play more than


four games?
b. What is the probability that a child will play at least two
games?

Sol: a) .40 b).95


Ex.1 Determine whether the following is a valid probability
distribution
X 0 1 2 3
p(x) .1 .3 .4 .1

Ex.2 The random variable X has the following prob. distribution


X -3 2 6 8
p(x) .2 .3 .4 .1

Find the following probabilities


a) P(X>0)
b) P(X≥1)
c) P(X≥2)
d) P(2≤X≤5)
Sol: a).8 b).8 c).8 d).3
Expectation of a Discrete Random Variable
• “some sort of average” of all the values that the random
variable takes.

• Acts as the center of its distribution.

• Concept analogous to the physical concept of the center


of gravity of a distribution of mass.

• The expected value of a discrete random variable X is a


weighted average of the possible values that the random
variable can take. Here probability values act as weight.
• The mean of a random variable provides the long-run
average of the variable, or the expected average
outcome over many observations

• X is a discrete random variable having the pmf p(x)


• Expectation or Expected value or mean of X is given by

• Recall the first example where X is the random variable


denoting the gain

3 / 4 if x = 100
• pmf of X is p ( x) = 
1 / 4 if x = − 200
Expected gain of the person is
E(X) = (100)(3/4) + (-200)(1/4) = 25 Rupees

Laws of Expected Value


In general, if a and b are constants; and X and Y are
random variables, then we have

• E(a) = a

• E(aX) = aE(X)

• E(ax + bY) = aE(X) + bE(Y)

• E(X+a)=E(X)+a
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:The number of pizzas delivered to university students
each month is a random variable with following probability
distribution.
X 0 1 2 3
P(x) .1 .3 .4 .2
Determine the mean number of pizzas delivered to students each
Month
Ans: 1.7
Variance of a Discrete Random Variable
• The idea of center is not enough to summarize a
probability distribution.
• We need some idea of variability also.
• Variance of a random variable X is defined as

Var( X ) =  2
X 
= E ( X − E( X ))
2

( ) − E( X )
=E X 2 2

• It is the expected squared deviation of possible


values of X from its mean.
E ( X 2 ) =  x 2 p( x) and E ( X ) =  x p( x),
x x

• where p(x) is the pmf of X.


• Note that Variance is always non-negative.
• Standard Deviation of X = σx = √[Var (X)]
Laws of Variance
If a and b are constants, X and Y are random variables,
then we have
▪ Var(a) = V(a)=0,
▪ Var(aX) = a2Var(X),
▪ Var(X+a)=Var(X),
▪ Var(aX + bY) = a2Var(X) + b2Var(Y) + 2ab σXY
▪ σXY is the covariance between X and Y.
(will be discussed 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: The number of pizzas delivered to university students
each month is a random variable with following probability
distribution.
X 0 1 2 3
P(x) .1 .3 .4 .2
Determine the variance of the number of pizzas delivered
Ans: .81
EXERCISE
The monthly sales at a computer store have a mean of $25,000
and a standard deviation of $4,000. Profits are calculated by
multiplying sales by 30% and subtracting fixed costs of $6,000.
Find the mean and standard deviation of monthly profits
Solution
Relationship between profit and sales:
Profit=.30(Sales)-6,000
Expected or Mean profit is
E(Profit)=E[.30(Sales)-6,000]
E(Profit)=.30E(Sales)-6,000=.30(25,000)-6,000=1,500
The Variance is
V(Profit)=V[.30(Sales)-6,000]=(.3)2 V(Sales)=.09(4,000)2
=1,440,000
Thus, standard deviation of monthly profits is
σProfit = √1,440,000 = $1,200
Exercise

You have a choice of receiving $500 in cash or receiving a


gold coin that has a face value of $100. However, the actual
value of the gold coin depends on its gold content. You are
told that the coin has a 40% probability of being worth $400,
a 30% probability of being worth $900, and a 30% probability
of being worth its face value. Basing your decision on
expected value, should you choose the coin?
Practice questions:

3.1, 3.2, 3.4, 3.5, 3.9, 3.10, 3.11, 3.12, 3.16, 3.21, 3.31

Solved Examples: 3.1, 3.2, 3.3

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy