3.
One-dimensional random variables
3.1 Definitions of Random Variables
Definition 3.1: Let S be a sample space of an experiment and X is a real valued function defined
over the sample space S, then X is called a random variable.
A random variable is a function defined on a sample space S and taking values in the real line ,
and denoted by capital letters, such as X, Y, Z. Thus, the value of the random variable X at the
sample point s is X(s).
The difference between a random variable and a function is that, the domain of a random
variables a sample space S, unlike the usual concept of a function, whose domain is a subset of
or of a Euclidean space of higher dimension. The usage of the term “random variable”
employed here rather than that of a function may be explained by the fact that a random variable
is associated with the outcomes of a random experiment. Of course, on the same sample space,
one may define many distinct random variables.
Example 1: Assume tossing of three distinct coins once, so that the sample space is S = {HHH,
HHT, HTH, THH, HTT, THT, TTH, TTT}. Then, the random variable X can be defined as
X(s), X(s) = the number of heads (H’s) in S.
Example 2: In rolling two distinct dice once. The sample space S is S = {(1, 1), (1, 2), . . . , (2,
1), . . . , (6, 1), (6, 2), . .. , (6, 6)}, a random variable X of interest may be defined by X(s)
= sum of the numbers in the pair S.
Example 3: Recording the lifetime of an electronic device, or of an electrical appliance. Here S
is the interval (0, T) or for some justifiable reasons, S = (0, ∞), a random variable X of
interest is X(s) = s, s ∈ S.
Example 4: Measuring the dosage of a certain medication administered to a patient, until a
positive reaction is observed. Here S = (0, D) for some suitable D. X(s) = s, s ∈ S, or X(s)=
the number of days the patient get sick.
In the examples discussed above we saw random variables with different values. Hence, random
variables can be categorized in to two broad categories such as discrete and co ntinuous random
variables.
1
3.2 Discrete Random Variables
Definition 3.2:
A random variable X is called discrete (or of the discrete type), if X takes on a finite or countably
infinite number of values; that is, either finitely many values such as x1 , . . . , xn , or countably
infinite many values such as x0 , x1 , x2 , . . . .
Example 5: In the examples 1 and 2 above, the random variables defined are discrete random
variables.
Example 6:
Experime nt Random Variable (X) Variable values
Children of one gender in a family Number of girls 0, 1, 2, …
Answer 23 questions of an exam Number of correct 0, 1, 2, ..., 23
Count cars at toll between 11:00 am &1:00 pm Number of cars arriving 0, 1, 2, ..., n
Probability Distribution of Discrete Random Variables
Definition 3.3:If X is a discrete random variable, the function given by p(x) = P(X = x) for each
x within the range of X is called the probability distribution or probability mass function of X.
Remark
The probability distribution (mass) function p(x), of a discrete random variable X, satisfy the
following two condition
1. 0≤ p(x) ≤1
2. p( x) 1. The summation is taken over all possible values of x.
x
Example 7:Find the probability distribution of the number of heads obtained in two tosses of
balanced coin.
Answer:
x 0 1 2
p(x) 1 1 1
4 2 4
Example 8: Check whether the function given by for x = 1, 2, 3, 4, 5 is a probability
mass function or not.
2
3.3 Continuous Random Variables
Definition 3.4:A random variable X is called continuous (or of the continuous type) if X takes
all values in a proper interval I ⊆ .
Or we can describe continuous random variables as follows:
Take whole or fractional number.
Obtained by measuring.
Take infinite number of values in an interval.
Too many to list like discrete variable
Example 9: In Examples 3 and 4 above, the random variables defined are continuous random
variables.
Example 10: The following examples are continuous random variables.
Experime nt Random Variable X Variable values
Weigh 100 People Weight 45.1, 78, ...
Measure Part Life Hours 900, 875.9, …
Measure Time Between Arrivals Inter-Arrival time 0, 1.3, 2.78, ...
Probability Density Function of Continuous Random Variables
Definition 3.5:
A function with values f(x), defined over the set of all real numbers, is called a probability
density function (pdf) of the continuous random variable X if and only if
P (a ≤ x ≤ b) = for any real constant a ≤ b.
Remarks
The probability density function f (x) of the continuous random variable X, has the following
properties:
1. f(x) ≥ 0 for all x, or for −∞ <x < ∞
2. f ( x) dx 1
If X is a continuous random variable and a and b are real constants with a ≤ b, then
1. P (a ≤ x ≤ b) = P (a < x ≤ b) = P (a ≤ x < b) = P (a < x < b)
2. P( X a) P( X a); and P( X b) P( X b)
3
Example 11: Suppose that the random variable X is continuous with probability density function
2 x, o x 1,
f x
0, otherwise
a) Check that f (x) is a pdf
b) Find P X 0.5 ;
c) Evaluate P X 1 given that 1 X 2
2 3 3
Solution: a) Obviously, for o < X< 1, f(x) >0, and
1
f ( x)dx f ( x)dx , since f(x) is zero in the other two intervals: , 0 1, .
0
1 1
2 xdx x 2 1
0 0
Hence, f (x) is the probability density function of some random variable X.
0.5 0.5
b) P X 0.5 f ( x)dx 2 xdx x
2 0.5
0.25.
0
0 0
c) Let A X 1 , B 1 X 2 , sothat A B 1 X 1 .
2 3 3 3 2
1/ 2
Then, P X 1 1 X 2 P( A / B) P( A B) , where P( A B) 5
2 xdx 36 ,
2 3 3 P( B) 1/ 3
2/3
1
and P( B)
1/ 3
2 xdx 3 .
5 / 36 5 5
P( A / B) 3 .
1/ 3 36 12
x, 0 x 1
Example 12: Let X be a continuous random variable with pdf , f ( x) 2 x, 1 x 2
0,
elsewhere
a) Check that f (x) defines a pdf;
b) Find P(0.8<X<1.2)
Solution:
1 2
1 2
x2 x2
a) f ( x)dx xdx (2 x)dx 2 x 1 (4 2) 2 1 1 .
0 1
2 0 2 1 2 2
And since f ( x) 0 for all x, the function is the pdf of X.
4
1.2 1 1.2
b) P(0.8 X 1.2)
0.8
f ( x)dx xdx (2 x)dx
0.8 1
1 1.2
x2 x2 1
2 x 0.32 (2.4 0.72) (2 0.5) 0.36.
2 0.8
2 1 2
Example 13: Suppose the probability density function, f(x), of a random variable X is given by
(a) Find the constant c
(b) Compute P(1 < x < 2)?
3 3
Solution: a) P(0 X 3) f ( x)dx cx
2
dx =1
0 0
3
x3
=c =1 , =1 , c= 1/9
3 0.
2
2 2
x3
b) P(1 < x < 2) = P(1 X 2) f ( x)dx cx 2 dx = c =1/27( 8-1)=7/27
1 1
31
Example 14: The probability density function of a continuous random variable X is given as:
kx , 0 x5
f ( x) k (10 x) , 5 x 10
0
, otherwise
a) Find k;
b) Find P(X> 5)
c) P(2.5<X<7.5)
3.4 Cumulative distribution function and its properties
Definition 3.6: Distribution Functions for Random Variables
The cumulative distribution function, or the distribution function, for a random variable X is a
function defined by: , where x is any real number, i.e., - ∞ < x < ∞. Thus, the
distribution function specifies, for all real values x, the probability that the random variable is
less than or equal to x.
5
Properties of distribution functions, F(x)
1. 0 ≤ F(x) ≤ 1 for all x in R
2. F(x) is non-decreasing [i.e., F(x) ≤ F(y) if x ≤ y].
3. F(x) is continuous from the right [i.e., lim F ( x h) F ( x) for all x]
h 0
4. lim F ( x ) 0 and lim F (x ) 1
x x
Distribution Functions for Discrete Random Variables
Definition 3.7:If X is a discrete random variable, the function given by:
F ( x) P ( X x) p (t ) For all x in and t ∈X, where p(t) is the value of probability
t x
distribution or p.m.f of X at t, is called the distribution function, or the cumulative distribution
function of X.
If X takes on only a finite number of values x1 , x2 , . . . ,xn , then the cumulative distribution
function is given by:
0, x x1
p( x ) , x1 x x2
1
p ( x ) p ( x2 ) ,
x 2 x x3
F ( x) 1
.
.
p( x1 ) p ( x2 ) ... p ( xn ) 1, x xn
Example 15: A fair coin is tossed twice. Let X = number of heads obtained. Find the cumulative
distribution function of X.
Solution: The cumulative distribution function is
0, x0
1
4 0 x 1
F ( x)
3 4 1 x 2
1 x2
Definition 3.8: Distribution Functions of Continuous Random Variables
6
If X is a continuous random variable and the value of its probability density is f (t), then function
x
given by F ( x) P ( X x)
f (t ) dt
is called the distribution function, or the cumulative
distribution of the continuous random variable X.
Note that if f (x) and F(x) are the values of the probability density and the distribution function
of X at x, then P (a ≤ x ≤ b) = F(b) - F(a)
For any real constant a and b with a ≤ b, and
Where the derivative exist.
Example 16:If X has a pdf of f ( x) 3x 2 , for 0 <x <1, find
a) Cumulative distributi on function
b) c if P( X c) 0.036
c) b if P( X b) P( X b)
Solutions:
x
3 x
x
x3
a) F ( x) P ( X x)
f (t ) dt 3t 2 dt t
0 0
The cumulative distribution function is
0, x0
F ( x) x 3 , 0 x 1
1 , x 1
1
x 3 1 c 3 0.036
1
b) P ( X c ) c
3 x 2 dx
c
Hence, c = 0.4
b 1
3x
b 1
c ) P ( X b ) P ( X b) 3x 2 dx 2
dx x 3 x 3
0 b 0 b
1
1 3
Therefore, b
2
7
4. Functions of random variables
Introduction
In standard statistical methods, the result of statistical hypothesis testing, estimation, or even
statistical graphics does not involve a single random variable but, rather, functions of one or
more random variables. As a result, statistical inference requires the distributions of these
functions. In many situations in statistics, we may be interested (it is necessary) to derive the
probability distribution of a function of one or more random variables. For instance, a probability
model of today’s weather, let the random variable X be the temperature in degrees Celsius, and
consider the transformation Y = 1.8X + 32, which gives the temperature in degrees Fahrenheit.
In this example, Y is a linear function of X, of the form Y = g(X) = a X + b, or the use of
averages of random variables is common. In addition, sums and more general linear
combinations are important. We are often interested in the distribution of sums of squares of
random variables, particularly in the use of analysis of variance techniques. In the following
sections the probability distribution (pmf and pdf) of a function of one random variable will be
discussed.
4.1. Equivalent Events
Let X be a random variable defined on a sample space, S, and let Y be a function of X. then Y is
also a random variable. Define Rx and Ry called the range space of X and Y can take. Let C Ry
and B Rx defined as: B ={X ∈ Rx : Y(X)∈ C} then the event B and C are called equivalent
events. Or if B and C are two events defined on different sample spaces, saying they are
equivalent means that one occurs if and only if the other one occurs.
Definition 4.1:
Let E be an experiment and S be its sample space. Let X be a random variable defined on S and
let Rx be its range space. Let B be an event with respected to Rx, that is, B ⊆ Rx, suppose that A
is defined as A ={s ɛ S: X(s) ɛ B}, and we say A and B are equivalent events.
Example 1: In tossing two coins the sample space S = {HH, HT, TH, TT}. Let the random
variable X = Number of heads, Rx = {0, 1, 2}. Let B ⊆ Rx and B = {1}. Moreover X (HT)
= X (TH) = 1. If A = {HT, TH} then A and B are equivalent events.
Example 2:Let X is a discrete random variable on scores of a die and Y = X2 , then Y is a
discrete random variable as X is discrete. Therefore, the range sample space of X is Rx =
{1, 2, 3, 4, 5, 6,} and the range sample space of Y is Ry = {1, 4, 9, 16, 25, 36}. Now,
{Y =4} is equivalent to {X=2}
8
{Y < 9} is equivalent to {X <3}
{Y 25} is equivalent to {X 5} etc.
Example 3: Let X be a continuous random variable taking value in [0, 2] and Y = X2 + 1. Now,
{Y =3} is equivalent to {X = }
{Y > 4} is equivalent to {X > }
{4 < Y 5} is equivalent to { <X 2} etc.
Definition 4.2:
Let B be an event in the range space Rx of the random variable X, we define P(B) as P(B) = P(A)
where A = {s ɛ S: X(s) ɛ B}.From this definition, we saw that if two events are equivalent then
their probabilities are equal.
Definition 4.3:
Let X be a random variable defined on the sample space S, let Rx be the range space of Xand let
H be the real valued function and consider the random variable H(x) = Y with range space Ry,
for any event C ⊆Ry, we define P(C) as P(C) = P({x ɛ Rx: H(x) ɛ C}). This means the
probability of an event associated with the sample space Y is defined as the probability of
equivalent event in the range space of X.
4.2. Functions of discrete random variables
If X is a discrete or continuous random variable and Y is a function of X, then it follows
immediately that Y is also discrete or continuous.
Theorem 4.1:
Suppose that X is a discrete random variable with probability distribution p(x).Let Y = g(X)
define a one-to-one transformation between the values of X and Y so that the equation y = g(x)
can be uniquely solved for x in terms of y, say x = w(y). Then the probability distribution of Y is
p(y) = p[w(y)].
Example 4: Let X be a random variable with probability distribution p(x) = , x= 1, 2, 3, .
then find the probability distribution of the random variable Y = X2 .
Solution: Since the values of X are all positive, the transformation defines a one-to-one
correspondence between the x and y values, y = x 2 and x = . Hence p (y) =p( )
= , y= 1, 4, 9, . . . ,
9
Example 5: If X is the number of heads obtained in four tosses of a balanced coin, find the
probability distribution of H(X) .
Solution: The sample space S = {HHHH, HHHT, HHTH, HTHH, THHH, HHTT, HTHT,
HTTH, TTHH, THTH, THHT, HTTT, TTTH, TTHT, THTT, TTTT}
x 0 1 2 3 4
p(x) 1/16 4/16 6/16 4/16 1/16
Then, using the relation y = 1/ (1 + x) to substitute values of Y for values of X, we find
the probability distribution of Y
y 1 1/2 1/3 1/4 1/5
p(y) 1/16 4/16 6/16 4/16 1/16
Example 6: Let X be random variable which assumes -1, 0 and 1 with probability values 1/3, ½
and 1/6 respectively. Let H(x) = 3x + 1 then what is the respective possible values of
H(x)?
Solution: the possible values of H(X) = -2, 1 and 4 with probability 1/3, ½ and 1/6 respectively.
4.3. Functions of continuous random variables
A straight forward method of obtaining the probability density function of continuous random
variables consists of first finding its distribution function and then the probability density by
differentiation. Thus, if X is a continuous random variable with probability density f(x), then the
probability density of Y = H(X) is obtained by first determining an expression for the probability
F(y) = P(Y ≤ y) = P (H(X) ≤ y) and then differentiating
Finally determine the values of y where .
To find the probability distribution of the random variable Y = u(X) when X is a continuous
random variable and the transformation is one-to-one, we shall need the following definition.
Theorem 4.2:
Suppose that X is a continuous random variable with probability distribution f(x). Let Y = g(X)
define a one-to-one correspondence between the values of X and Y so that the equation y = g(x)
can be uniquely solved for x in terms of y, say x = w(y). Then the probability distribution of Y is
f(y) = f[w(y)]|J|, where J = w’(y) and is called the Jacobian of the transformation.
10
Example 7: Let X be a continuous random variable with probability distribution
Find the probability distribution of the random variable Y = 2X − 3.
Solution: The inverse solution of y = 2x − 3 yields x = (y + 3)/2, from which we obtain
J = w’(y) = dx/dy= 1/2. Therefore, using theorem 4.2, we find the density function of Y
to be f(y) = = , −1 < y <7, and 0, elsewhere.
Exercise
1. Suppose that the discrete random variable X assumes the values 1, 2 and 3 with equal probability.
What is the range space of Y if Y = 2X + 3?
2. Suppose that the discrete random variable X assumes the values -1, 0 and 1 with the
probabilities of 1/3, 1/2, and 1/6 respectively. Find the probability mass function of Y = X2 .
3. Suppose X has a pdf of f(x) = 1, 0 < x < 1, then what is the pdf of Y if Y =X2 ?
4. Let X has a pdf of f(x) = ½, -1 < x < 1, then: find the pdf of Y if
(a) Y = X2 (b) Y = 2x +1 and hence find P( Y< 2).
5. If the probability density of X is given by
Find the probability density of .
6. Let X is a continuous random variable with p.d.f.
If Y= H(x)= 2x +1
(a) Determine the range space of Y.
(b) Suppose event C is defined as C = {y ≥ 5}, determine the event B = {x ɛ Rx: H(x) ɛ C}
(c) Determine P(Y ≥ 5)
7. Let a random variable X has pdf given by .
Let be random variable defined on X. then find the p.d.f of Y.
11