You are on page 1of 28

Random Variables and their Distributions

• Random Variable: Describes the outcomes of a random experiment or process by


assigning some numbers to them i.e. outcomes → numbers (a function which maps
outcomes to numbers X: O → N)

Ex: A random variable X for flipping a fair coin


0, 𝑖𝑓 ℎ𝑒𝑎𝑑 𝑜𝑐𝑐𝑢𝑟𝑠
𝑋= ቊ ,
1, 𝑖𝑓 𝑡𝑎𝑖𝑙 𝑜𝑐𝑐𝑢𝑟𝑠

Y = a random variable such that sum of rolling a


pair of fair dice is 9 etc.
• Types of Random Variables Discrete random
variable
Random
Variable
Continuous
random variable

• Discrete Random Variable: Random variables whose range is finite or countably


infinite. (Counting based)
Ex: Both variables X, Y in previous slide
Z = Year that a random student in this class was born,
W = Number of boys born yesterday in universe etc.
• Continuous Random Variable: random variables can take on values on a
continuous scale. (Measuring based)
Ex: X = Mass of a random animal selected at Delhi zoo,
Y = Exact winning time for men’s 100m race in Olympics.
Example 1: Two balls are selected at random from a box containing five brown balls
and three green balls. List the elements of the sample space, the corresponding
probabilities, and the corresponding values w of the random variable W, where W is the
number of brown balls selected.

Solution: B- brown, G- green, then sample space


S = {BB,BG,GB,GG}
corresponding prob. for BB : (5/8).(4/7) = 5/14
corresponding prob. for BG : (5/8).(3/7) = 15/56
corresponding prob. for GB : (3/8).(5/7) = 15/56
corresponding prob. for GG : (3/8).(2/7) = 3/28

Now, One can ask, what is the probability of the event that the random variable W will
take on the value 2?
P(W=w) = P(W=2) = 5/14.
Similarly, P(W=1) = (15/56) + (15/56) = 30/56 or 15/28.
Example 2: A balanced coin is tossed three times. Then define a random variable X
containing the total number of heads.
Elements of S Probability x
Solution: H-head, T-tail, then Sample space
HHH 1/8 3
S = {HHH,HHT,HTH,HTT,THH,THT,TTH,TTT} HHT 1/8 2
HTH 1/8 2
As each outcome of S is equal probable , HTT 1/8 1
so probability of each outcome is: ½. ½ . ½ = 1/8. THH 1/8 2
THT 1/8 1
TTH 1/8 1
TTT 1/8 0

One can ask, what is the probability of getting exactly 2 heads?


i.e. P(X=2) = (1/8)+(1/8)+(1/8) = 3/8.
• Probability Distribution:
(In the previous two examples, we have probability associated with the values of a
random variable as shown in tables. We can have a function to express these
probabilities, called probability distribution)

✓ Any probability distribution should have the following two properties:


Example 3: Find a formula (function) for the probability distribution of the total
number of heads obtained in three tosses of a balanced coin.

Solution: X = random variable indicating total no. of Elements Probability x


heads, i.e. X = {0,1,2,3} of S
Now, we can find, HHH 1/8 3
f(0) = P(X=0) = 1/8 HHT 1/8 2
f(1) = P(X=1) = (1/8) + (1/8) + (1/8) = 3/8 HTH 1/8 2
f(2) = P(X=2) = (1/8) + (1/8) + (1/8) = 3/8 HTT 1/8 1
f(3) = P(X=3) = 1/8 THH 1/8 2
THT 1/8 1
Now, probability distribution for X can be written as: TTH 1/8 1
3
TTT 1/8 0
𝑥
f(x) = P(X=x) = for x=0,1,2,3
8
x+2
Example 4: Check whether the function given by 𝑓 𝑥 = , for x = 1, 2, 3, 4, 5
25
can serve as the probability distribution of a discrete random variable.
Solution: A probability distribution f(x) should follow two properties i.e.
(i) f(x) ≥ 0 and (ii) ෍ 𝑓 𝑥 = 1
𝑥

Clearly, f(1) = 3/25, f(2) = 4/25, f(3) = 5/25, f(4) = 6/25, and f(5) = 7/25, all are ≥ 0,
and f(1)+f(2)+f(3)+f(4)+f(5) = (3/25)+(4/25)+(5/25)+(6/25)+(7/25) = 1.
• Probability Distribution (Graphically) :
1) Probability Histogram - “Spreading” the values of the given discrete random
variable over a continuous scale.
(The height of each rectangle equals the probability that X takes on the value that
corresponds to the midpoint of its base.)
2) Bar Chart – On discrete scale.
(The height of each rectangle, or bar, equals the probability of the corresponding
value of the random variable)
Example 5: Probability distribution of the total number of heads obtained in four tosses
of a balanced coin is given in the table. Draw probability histogram and bar chart for
the same.
Representing 0 with the interval from
Solution: −0.5 to 0.5, 1 with the interval from 0.5
to 1.5, . . ., and 4 with the interval from Discrete scale
3.5 to 4.5

Unit Width
Probability Histogram Bar Chart
• Distribution Function or Cumulative Distribution Function (CDF):
(Sometimes it is desirable to know the probability that the value of a random variable
is less than or equal to some real number x i.e. P(X ≤ x) )

✓ CDF should have the following two properties:


Example 6: Find the distribution function of the total number of heads obtained in three
tosses of a balanced coin.
Elements Probability x
Solution: From example 3, we have distribution function of S
values as f(0) = 1/8, f(1) = 3/8, f(2) = 3/8, and f(3) = 1/8. HHH 1/8 3
For CDF, HHT 1/8 2
F(0) = f(0) = 1/8 HTH 1/8 2
F(1) = f(0)+f(1) = 4/8 or 1/2 HTT 1/8 1
F(2) = f(0)+f(1)+f(2) = 7/8 THH 1/8 2
F(3) = f(0) +f(1)+f(2)+f(3) = 1 THT 1/8 1
CDF is given as: TTH 1/8 1
0 𝑓𝑜𝑟 𝑥 < 0 TTT 1/8 0
1
𝑓𝑜𝑟 0 ≤ 𝑥 < 1
8
1 • If one ask, what is the probability of getting at most 2
𝐹 𝑥 = 𝑓𝑜𝑟 1 ≤ 𝑥 < 2 heads?
2
7
8
𝑓𝑜𝑟 2 ≤ 𝑥 < 3 Then, P(X≤ 2) = f(0)+f(1)+f(2) = (1/8)+(3/8)+(3/8) = 7/8
1 𝑓𝑜𝑟 𝑥 ≥ 3
Graph of CDF of previous example:

Graph of CDF
1
looks like a Step
7/8 function.

1/2

1/8

0 1 2 3

Note that at all points of discontinuity the cumulative distribution function takes on the
greater of the two values, as indicated by the dotted lines in the above figure.
• From Distribution Function (CDF) to Probability Distribution:
(Given a CDF of a random variable X, we can always find the corresponding probability
distribution for X)

(small “f” indicating probability distribution and capital “F” indicating CDF)
Example 7: Find probability distribution for random variable X whose distribution
function is:
Solution: Given random variable can take values 0,1,2,3,4.
Now, probability at x=0 is: f(0) = F(0) = 1/16
probability at x=1 is: f(1) = F(1) – F(0) = (5/16) – (1/16) = 4/16
probability at x=2 is: f(2) = F(2) – F(1) = (11/16) – (5/16) = 6/16
probability at x=3 is: f(3) = F(3) – F(2) = (15/16) – (11/16) = 4/16
probability at x=4 is: f(4) = F(4) – F(3) = 1 – (15/16) = 1/16.

Probability distribution is:


4
𝑥
𝑓 𝑥 = for x = 0,1,2,3,4
16

(Which is nothing, but the probability distribution of the total number of heads obtained
in four tosses of a balanced coin)
***********************************************************************
Exercise 1: For each of the following, determine whether the given function can serve as the
probability distribution of a random variable with the given range:
(a) f (x) = (x−2)/5 for x = 1, 2, 3, 4, 5;
(b) f (x) = 𝑥 2 /30 for x = 0, 1, 2, 3, 4;
(c) f (x) = 1/5 for x = 0, 1, 2, 3, 4, 5.
Exercise 2: Find the probability distribution for a random variable X of getting a sum of rolling a
pair of fair dice. Also, what is the probability of getting the sum at most 7 i.e. P(X≤7)?
Exercise 3: For each of the following, determine c so that the function can serve as the probability
distribution of a random variable with the given range:
(a) f (x) = cx for x = 1, 2, 3, 4, 5;
(b) f (x) = c 𝑥5 for x = 0, 1, 2, 3, 4, 5;
1 𝑥
(c) f (x) = c for x = 1, 2, 3, . . . .
4
Exercise 4: For each of the following, determine whether the given values can serve as the values of
a distribution function of a random variable with the range x = 1, 2, 3, and 4:
(a) F(1) = 0.3, F(2) = 0.5, F(3) = 0.8, and F(4) = 1.2;
(b) F(1) = 0.5, F(2) = 0.4, F(3) = 0.7, and F(4) = 1.0;
(c) F(1) = 0.25, F(2) = 0.61, F(3) = 0.83, and F(4) = 1.0.
Exercise 5: If X has the distribution function

Then, find
(a) P(2<X ≤ 6);
(b) P(X = 4);
(c) the probability distribution of X.

Exercise 6: Find the distribution function (CDF) of the random variable that has the probability
distribution :
𝑥
𝑓 𝑥 = for x = 1,2,3,4,5
15

*******************************************************************************
• Continuous Random Variable Case:
➢ For continuous random variables, rather than having probability distribution
function as was the case with discrete random variable, we use probability density
function (PDF).
➢ Probability density functions are continuous curves rather than discrete
histograms.
➢ In PDF, the probability that the corresponding random variable X will take a
particular value (i.e., P(X=x)) is always 0. (that means the probability of having
exactly 1.2 L of water in a bottle is 0.)
➢ The area under the PDF curve gives the probabilities associated with an interval
from a to b.

a b
• Probability Density Function (PDF)

Note that f (c), the value of the probability density of X at c, does not give P(X = c) as in
the discrete case. In connection with continuous random variables, probabilities are always
associated with intervals and P(X = c) = 0 for any real constant c.
• Properties of Probability Density Function (PDF):
✓ Does not matter whether we include the endpoints of the interval from a to b;

✓ A PDF should always have the following two properties:


−3𝑥
Example 8: If X has the probability density 𝑓 𝑥 = ቊ 𝑘. 𝑒 𝑓𝑜𝑟 𝑥 > 0
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
Then, find 𝑘 and 𝑃(0.5 ≤ 𝑋 ≤ 1).
Solution:

If 𝑓 𝑥 is a probability density function, then it should satisfy ‫׬‬−∞ 𝑓 𝑥 𝑑𝑥 = 1
i.e.

it follows that k=3

Now, for probability

𝑃 0.5 ≤ 𝑋 ≤ 1 =
Example 9: The probability density of the continuous random variable X is given by
1
𝑓𝑜𝑟 2 < 𝑥 < 7
𝑓 𝑥 = ൝5
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
(a) Draw its graph and verify that the total area under the curve (above the x-axis) is
equal to 1.
(b) Find 𝑃(3 < 𝑋 < 5)
Solution:
(a) Total area under the curve is:
7 71 1 7 1
= ‫׬‬2 𝑓 𝑥 𝑑𝑥 = ‫׬‬2 5 𝑑𝑥 = [𝑥]2 = 7−2 =1
5 5

(b) Now, for probability,


𝑏
𝑃 𝑎 ≤ 𝑋 ≤ 𝑏 = න 𝑓 𝑥 𝑑𝑥
𝑎
51 1 1 2
Thus, 𝑃 3 < 𝑋 < 5 = 𝑃 3 ≤ 𝑋 ≤ 5 = ‫׬‬3 5 𝑑𝑥 = [𝑥]53 = 5−3 =
5 5 5
Example 10: The density of the continuous random variable X is given by
6𝑥 1 − 𝑥 𝑓𝑜𝑟 0 < 𝑥 < 1
𝑓 𝑥 = ቊ , then, Find P(X < ¼) and P(X > ½)
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
Solution:
(a) Probability 𝑃(𝑋 < 1Τ4),
𝑏
𝑃 𝑎 ≤ 𝑋 ≤ 𝑏 = න 𝑓 𝑥 𝑑𝑥
𝑎
1
Thus, 𝑃 𝑋 < 1/4 = 𝑃 0 ≤ 𝑋 ≤ 1/4 = ‫׬‬0 6𝑥 1 − 𝑥 𝑑𝑥
4
1 1
= 6 ‫׬‬0 𝑥 𝑑𝑥 − ‫׬‬0 𝑥 2 𝑑𝑥
4 4

1 1
𝑥2 4 𝑥3 4 1 1 5
=6 − =6 − =
2 0 3 0 32 192 32
(b) Probability 𝑃(𝑋 > 1Τ2),
1 1
𝑃 𝑋 > 1/2 = 𝑃 1/2 ≤ 𝑋 ≤ 1 = ‫׬‬1 6𝑥 1 − 𝑥 𝑑𝑥 =
2 2
• Distribution Function or Cumulative Distribution Function (CDF):
(Case of Continuous Random Variable)

✓ CDF should have the following two properties:

▪ The properties of distribution functions given in Theorem 2 (Discrete case) hold


also for the continuous case; that is, F(−∞) = 0, F(∞) = 1, and F(a) ≤ F(b) when
a<b.
Example 11: Find the distribution function of continuous random variable X having
−3x
probability density function f x = ቊ k. e for x > 0
0 elsewhere
Solution: For x > 0,

0 𝑓𝑜𝑟 𝑥 ≤ 0
and F(x) = 0 for x ≤ 0, Therefore, 𝐹 𝑥 = ቊ
1 − 𝑒 −3𝑥 𝑓𝑜𝑟 𝑥 > 0
• Computing probabilities from Distribution function F(x):

P(a ≤ X ≤ b) = F(b) − F(a)

Now, 𝑃(0.5 ≤ 𝑋 ≤ 1) = F(1) − F(0.5) = (1 − 𝑒 −3 ) − (1 − 𝑒 −1.5 ) = −𝑒 −3 + 𝑒 −1.5


(value is same as was in previous example)
• Relation between Density Function f(x) and Distribution Function F(x):
(Case of Continuous Random Variable)

Note: By using this relation, we can always find f(x) whenever F(x) is given.

Example 12: Find a probability density function i.e. f(x) for a continuous random
variable whose distribution function (CDF) is given by
Solution:
Since the given density function is differentiable everywhere except at x = 0 and x =1,
we differentiate for x<0, 0<x<1, and x>1, getting 0, 1, and 0. Therefore, according to
theorem, density function is

***********************************************************************
Exercise 7: The probability density of the continuous random variable X is given by
1
𝑓𝑜𝑟 2 < 𝑥 < 7
𝑓 𝑥 = ൝5
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
(a) Draw its graph and verify that the total area under the curve (above the x-axis) is equal to 1.
(b) Find P(3<X <5).
Exercise 8: The density of the continuous random variable X is given by
6𝑥 1 − 𝑥 𝑓𝑜𝑟 0 < 𝑥 < 1
𝑓 𝑥 = ቊ , then, Find P(X < ¼) and P(X > ½).
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
Exercise 9: The p.d.f. of the random variable X is given by
𝑐
𝑓𝑜𝑟 0 < 𝑥 < 4
𝑓 𝑥 = ൝ 𝑥
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
(a) Find the value of c.
(b) Find P(X < ¼) and P(X >1).
Exercise 10: Find the distribution function of the random variable X whose probability density is
𝑥 𝑓𝑜𝑟 0 < 𝑥 < 1
given by 𝑓 𝑥 = ቐ2 − 𝑥 𝑓𝑜𝑟 1 ≤ 𝑥 < 2
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
Exercise 11: The distribution function of the random variable X is given by
1 − 1 + 𝑥 𝑒 −𝑥 𝑓𝑜𝑟 𝑥 > 0
𝑓 𝑥 = ቊ . Then, find P(X ≤ 2), P(1 < X < 3) and P(X > 4).
0 𝑓𝑜𝑟 𝑥 ≤ 0

******************************************************************************

You might also like