# User manual | Part-IV Two-dimensional continuous distributions ```Probability Theory with Simulations
Part-IV
Two-dimensional continuous distributions
Andras Vetier
2013 09 11
Contents
1
Two-dimensional random variables and distributions
2
2
Uniform distribution on a two-dimensional set
6
3
*** Beta distributions in two-dimensions
7
4
Projections and conditional distributions
10
5
Normal distributions in two-dimensions
16
6
Independence of random variables
19
7
Generating a two-dimensional random variable
19
8
Properties of the expected value, variance and standard deviation
20
9
Transformation from plane to line
23
10 *** Transformation from plane to plane
24
11 *** Sums of random variables. Convolution
27
12 Limit theorems to normal distributions
30
1
1
Two-dimensional random variables and distributions
In this chapter, we start to work with two-dimensional continuous random variables
and distributions. When two random variables, say X and Y are considered, then we
may put them together to get a pair of random numbers, that is, a random point (X, Y )
in the two-dimensional space. Some examples:
1. Let us choose a Hungarian man, and let
X = his height
Y = his weight
Then (X, Y ) = (height,weight) is a two-dimensional random variable.
2. Let us generate three independent random numbers, and let
X = the smallest of them
Y = the largest of them
Then (X, Y ) = (smallest,biggest) is a two-dimensional random variable.
Density function. Two-dimensional continuous random variables are described mainly
by their density function f (x, y), which integrated on a set A gives the probability of
the event that the value of (X, Y ) is in the set A:
ZZ
P(A) = P ((X, Y ) ∈ A) =
f (x, y) dx dy
A
The characteristic properties of two-dimensional density functions are:
f (x, y) ≥ 0
ZZ
f (x, y) dx dy = 1
R2
These two properties are characteristic for two-dimensional density functions, because,
on one side, they are true for two-dimensional density functions of any continuous
random variables, and on the other side, if a function f (x, y) is given which has these
two properties, then it is possible to define a two-dimensional random variable (X, Y )
so that its density function is the given function f (x, y).
The density function as a constant of approximate proportionality. If A is a small
set around a point (x, y), then
ZZ
P ((X, Y ) ∈ A) =
f (x, y) dx dy ≈ f (x, y) × area of A
A
2
and
f (x, y) ≈
P ((X, Y ) ∈ A)
area of A
We emphasize that the value f (x, y) of the density function does not represent any
probability value. If (x, y) is a fixed point, then f (x, y) may be interpreted as a constant
of approximate proportionality: if A is a small set around a point (x, y), then the
probability that the point (X, Y ) is in A is approximately equal to f (x, y) × area of A:
P ((X, Y ) ∈ A) ≈ f (x, y) × area of A
Approximating the density function. If A is a small rectangle with sides of lengths
∆x and ∆y, then we get that
f (x, y) ≈
P (x < X < x + ∆x and y < Y < y + ∆y)
∆x ∆y
This formula is useful to determine the density function in some problems.
Conditional probability. If A and B are subsets of the plane, then both (X, Y ) ∈ A
and (X, Y ) ∈ B defines an event. The conditional probability of the event (X, Y ) ∈ B
on condition that the event (X, Y ) ∈ A occurs is denoted by P ((X, Y ) ∈ B|(X, Y ) ∈ A)
or P(B|A) for short. This conditional probability can be be calculated obviously as tho
ratio of two integrals:
RR
f (x, y) dx dy
A∩B
RR
P(B|A) =
f (x, y) dx dy
A
If B ⊆ A, then A ∩ B = B, and we get that
RR
f (x, y) dx dy
B
P(B|A) = RR
f (x, y) dx dy
A
Conditional density function. If A is a subset of the plane, which has a positive
probability, and we know that the condition (X, Y ) ∈ A is fulfilled, then the density
function of (X, Y ) under this condition is, obviously
f (x, y|A) =
f (x, y)
f (x, y)
= RR
P(A)
f (x, y) dx dy
if (x, y) ∈ A
A
Multiplication rule for independent random variables. If X and Y are independent,
and their density functions are f1 (x) and f2 (y) respectively, then the density function
f (x, y) of (X, Y ) is the direct product of the density functions f1 (x) and f2 (y):
f (x, y) = f1 (x) f2 (y)
3
Proof.
f (x, y) ≈
P (x < X < x + ∆x and y < Y < y + ∆y)
≈
∆x ∆y
P (x < X < x + ∆x) P (y < Y < y + ∆y)
≈
∆x
∆y
f1 (x) f2 (y)
General multiplication rule. If the density function of X is f1 (x) and the density
function of Y under the condition that X = x is f2|1 (y|x), then the density function of
(X, Y ) is
f (x, y) = f1 (x) f2|1 (y|x)
Similarly:
f (x, y) = f2 (y) f1|2 (x|y)
Proof. We give the proof of the first formula:
f (x, y) ≈
P (x < X < x + ∆x and y < Y < y + ∆y)
=
∆x ∆y
P (x < X < x + ∆x) P (y < Y < y + ∆y | x < X < x + ∆x)
≈
∆x
∆y
P (x < X < x + ∆x) P (y < Y < y + ∆y | X ≈ x)
≈
∆x
∆y
f1 (x) f2|1 (y|x)
Distribution function. The distribution function of a two-dimensional random variable is defined by
F (x, y) = P(X < x, Y < y)
The distribution function can be calculated from the density function by integration:
Z x Z y
F (x, y) =
f (x, y) dx dy
−∞
−∞
The density function can be calculated from the distribution function by differentiation:
f (x, y) =
∂ 2 F (x, y)
∂x ∂y
4
The probability of a rectangle can be calculated from the distribution function like this:
P (x1 < X < x2 and y1 < Y < y2 ) =
= P (X < x2 and Y < y2 ) − P (X < x1 and Y < y2 )−
−P (X < x2 and Y < y1 ) + P (X < x1 and Y < y1 ) =
= F (x2 , y2 ) − F (x1 , y2 ) − F (x2 , y1 ) + F (x1 , y1 )
Expected value of a function of (X, Y ). If we make N experiments for a twodimensional random variable (X, Y ), and we substitute the experimental results
(X1 , Y1 ), (X2 , Y2 ), . . . , (XN , YN )
into the function y = t(x, y), and we consider the values
t(X1 , Y1 ), t(X2 , Y2 ), . . . , t(XN , YN )
then their average is close to the expected value of t(X, Y ):
t(X1 , Y1 ) + t(X2 , Y2 ) + . . . + t(XN , YN )
≈ E (t(X, Y ))
N
where E (t(X, Y )) is the expected value of t(X, Y ), which is calculated by a double
integral:
ZZ
E (t(X, Y )) =
t(x, y)f (x, y) dx dy
R2
Expected value of the product. As an example, and because of its importance, we
mention here that the expected value of the product XY of the random variables X
and Y is calculated by a double integral:
ZZ
E (XY ) =
x y f (x, y) dx dy
R2
which means that if N is large, then
X1 Y1 + X2 Y2 + . . . + XN YN
≈ E (XY ) =
N
ZZ
x y f (x, y) dx dy
R2
Covariance and covariance matrix. The notion of the covariance is an auxiliary
notion in two-dimensions. For a two-dimensional data-set, it is
(X1 − X)(Y2 − Y ) + (X2 − X)(Y2 − Y ) + . . . + (XN − X)(YN − Y )
=
N
5
X1 Y2 + X2 Y2 + . . . + XN YN
−X Y
N
For a two-dimensional random variable and distribution the covariance COV(X, Y ) is
defined by
COV(X, Y ) = E ((X − E(X))(Y − E(Y ))) = E(XY ) − E(X)E(Y ) =
ZZ
ZZ
(x − µ1 ) (y − µ2 ) f (x, y) dx dy =
x y f (x, y) dx dy − µ1 µ2
R2
R2
The covariance and the variances of the coordinates can be arranged into a matrix. This
matrix is called the covariance matrix:
2
σ1
c
C=
c
σ22
This matrix can be considered as a two-dimensional generalization or the notion of the
variance.
Correlation coefficient. The notion of the correlation coefficient plays an important
role in describing the relation between the coordinates of a two-dimensional data-set
of random variable. Its definition is:
CORR(X, Y ) =
COV(X, Y )
σ1 σ2
Its value is always between −1 and 1: −1 ≤ r ≤ 1. If r > 0, then larger x-coordinates
mostly imply larger y-coordinates, if r < 0, then larger x-coordinates mostly imply
smaller y-coordinates. In the first case, we say that the coordinates have a positive correlation, in the second case, we say that the coordinates have a negative correlation.
If |r| is close to 1, then the coordinates are in a strong correlation, if |r| is close to 0,
then the coordinates are in a loose correlation.
Using a calculator. More sophisticated calculators have a key to determine the covariance and the correlation coefficient of a two-dimensional data-set, as well.
2
Uniform distribution on a two-dimensional set
If S is a set in the two-dimensional plane, and S has a finite area, then we may consider
the density function equal to the reciprocal of the area of S inside S, and equal to 0
otherwise:
f (x, y) =
1
area of S
if (x, y) ∈ S
6
The distribution associated to this density function is called uniform distribution on
the set S. Since the integral of a constant on a set A is equal to the area of A multiplied
by that constant, we get that
ZZ
ZZ
1
area of A
P(A) =
f (x, y) dx dy =
dx dy =
area of S
area of S
A
A
for any subset A of S. Thus, uniform distribution on S means that, for any subset A of
S, the probability of A is proportional to the area of A.
The reader probably remembers that in Chapter 6 of Part I, under the title "Geometrical problems, uniform distributions", we worked with uniform distributions. Now it
should become clear that the uniform distribution on the set S is a special continuous
distribution whose density function is equal to a constant on the set S.
3
*** Beta distributions in two-dimensions
Assume that n people arrive between noon and 1pm independently of each other according to uniform distribution, and let X be the ith, and let Y be the jth arrival time.
This real-life problem can be simulated like this: we generate n uniformly distributed
independent random points between 0 and 1, and X = ith smallest, and Y = jth smallest among them. We calculate here the density function of the two-dimensional random
variable (X, Y ). Let 0 < x < y < 1, let [x1 , x2 ] be a small interval around x, and let
[y1 , y2 ] be a small interval around y. We assume that x2 < y1 . By the meaning of the
density function:
f (x, y) ≈
P(X ∈ ∆x, Y ∈ ∆y)
(x2 − x1 ) (y2 − y1 )
The event X ∈ ∆x , Y ∈ ∆y, which stands in the numerator, means that the ith
smallest point is in [x1 , x2 ), and the jth smallest point is in [y1 , y2 ), which means that
there is
there is
there are
there are
there are
at least one
at least one
i−1
j−i−1
n−j
point X
point Y
points
points
points
in
in
in
in
in
[x1 , x2 ),
[y1 , y2 ),
[0, X),
[X, Y ),
[Y, 1].
This, with a very good approximation, means that
there are
there is
there are
there is
there are
i−1
1
j−i−1
1
n−j
points
point
points
point
points
in
in
in
in
in
[0, x1 ),
[x1 , x2 ),
[x2 , y1 ),
[y1 , y2 ),
[y2 , 1].
7
and
and
and
and
and
and
and
and
Using the formula of the poly-hyper-geometrical distribution, we get that the probability of the event X ∈ ∆x, Y ∈ ∆y is approximately equal to
n!
xi−1 (x2 −x1 )1 (y1 −x2 )j−i−1 (y2 −y1 )1 (1−y2 )n−j
(i − 1)! 1! (j − i − 1)! 1! (n − j)! 1
Since 1! = 1, we may omit some unnecessary factors and exponents, and the formula
simplifies to
n!
xi−1 (x2 − x1 ) (y − x)j−i−1 (y2 − y1 ) (1 − y)n−j
(i − 1)! (j − i − 1)! (n − j)!
Dividing by (x2 − x1 ) (y2 − y1 ), we get that the density function, for 0 < x < y < 1,
is
f (x, y) =
n!
xi−1 (y − x)j−i−1 (1 − y)n−j
(i − 1)! (j − i − 1)! (n − j)!
Special cases:
1. Three independent random numbers (uniformly distributed between 0 and 1)
are generated.
(a) X = the smallest, Y = the biggest of them.
Replacing n = 3, i = 1, j = 3, we get:
f (x, y) = 6(y − x) if 0 < x < y < 1
(b) X = the smallest, Y = the second smallest of them.
Replacing n = 3, i = 1, j = 2, we get:
f (x, y) = 6(1 − y) if 0 < x < y < 1
(c) X = the second smallest, Y = the biggest of them.
Replacing n = 3, i = 2, j = 3, we get:
f (x, y) = 6x if 0 < x < y < 1
2. Four independent random numbers (uniformly distributed between 0 and 1)
are generated.
(a) X = the smallest, Y = the biggest of them.
Replacing n = 4, i = 1, j = 4, we get:
f (x, y) = 12 (y − x)2 if 0 < x < y < 1
(b) X = the smallest, Y = the second smallest of them.
Replacing n = 4, i = 1, j = 2, we get:
f (x, y) = 12(1 − y)2 if 0 < x < y < 1
8
(c) X = the second smallest, Y = the third smallest of them.
f (x, y) = 24x(1 − y)x if 0 < x < y < 1
3. Ten independent random numbers (uniformly distributed between 0 and 1) are
generated.
X = the 3rd smallest, Y = the 7th smallest of them.
Replacing n = 10, i = 3, j = 7, we get:
f (x, y) =
10!
x2 (y − x)3 (1 − y)3 if 0 < x < y < 1
2! 3! 3!
More general two-dimensional beta distributions. If the people arrive between A
and B instead of 0 and 1, that is, the n independent, uniformly distributed random
numbers are generated between A and B, and
X = the ith smallest of them
Y = the jth smallest of them
of them, then for A < x < B, the density function of (X, Y ) is
f (x, y) =
1
n!
2
(B − A) (i − 1)! (j − i − 1)! (n − j)!
x−A
B−A
i−1 y−x
B−A
j−i−1 B−y
B−A
n−j
Files to study two-dimensional beta point-clouds:
Demonstration file: Two-dimensional beta point-cloud related to size 2 and ranks 1
and 2
ef-200-69-00
Demonstration file: Two-dimensional beta point-cloud related to size 3 and ranks 1
and 2
ef-200-70-00
Demonstration file: Two-dimensional beta point-cloud related to size 3 and ranks 1
and 3
ef-200-71-00
Demonstration file: Two-dimensional beta point-cloud related to size 3 and ranks 2
and 3
ef-200-72-00
Demonstration file: Two-dimensional beta point-cloud related to size 5 and ranks k1
and k2
ef-200-73-00
9
Demonstration file: Two-dimensional beta point-cloud related to size 10 and ranks k1
and k2
ef-200-74-00
File to study two-dimensional point-clouds for arrival times:
Demonstration file: Two-dimensional gamma distribution
ef-200-68-00
4
Projections and conditional distributions
Projections. If the density function of the two-dimensional random variable (X, Y ) is
f(x,y), then the density function f1 (x) of the random variable X can be calculated by
integration:
Z ∞
f1 (x) =
f (x, y) dy
−∞
Sketch of proof. The interval [x, x + ∆x] on the horizontal line defines a vertical strip
in the plane:
S[x,x+∆x] = {(x, y) : x ∈ [x, x + ∆x]}
so that the event X ∈ [x, x + ∆x] is equivalent to (X, Y ) ∈ S[x,x+∆x] . Using this fact
we get that
P (X, Y ) ∈ S[x,x+∆x]
P (X ∈ [x, x + ∆x])
=
=
f1 (x) ≈
∆x
∆x
!
x+∆x
RR
R
R∞
f (x, y) dx dy
f (x, y) dy dx
Z∞
S[x,x+∆x]
x
−∞
=
≈
f (x, y) dy
∆x
∆x
−∞
Similarly, the density function f2 (x) of the random variable Y is
Z ∞
f2 (y) =
f (x, y) dx
−∞
Conditional distributions. If a two-dimensional random variable (X, Y ) is considered, and somehow the actual value x of X is known, but the value of Y is unknown,
then we may need to know the conditional distribution of Y under the condition that
X = x. The conditional density function can be calculated by division:
f2|1 (y|x) =
f (x, y)
f1 (x)
10
Similarly, the conditional density function of X under the condition that Y = y is
f1|2 (x|y) =
f (x, y)
f2 (y)
Sketch of proof. We give the proof of the first formula.
f2|1 (y|x) ≈
1
P (Y ∈ [y, y + ∆y] | X = x) ≈
∆y
1
P (Y ∈ [y, y + ∆y] | X ∈ [x, x + ∆x]) =
∆y
1 P (X ∈ [x, x + ∆x] and Y ∈ [y, y + ∆y])
=
∆y
P (X ∈ [x, x + ∆x])
1
∆y
P(X∈[x,x+∆x] and Y ∈[y,y+∆y])
∆x
P(X∈[x,x+∆x])
∆x
P(X∈[x,x+∆x] and Y ∈[y,y+∆y])
∆x ∆y
P(X∈[x,x+∆x])
∆x
≈
=
f (x, y)
f1 (x)
Product rules. It often happens that the density function of (X, Y ) is calculated from
one of the product rules:
f (x, y) = f1 (x) f2|1 (y|x)
f (x, y) = f2 (y) f1|2 (x|y)
Conditional distribution function. The distribution function of the conditional distribution is calculated from the conditional density function by integration:
Z y
F2|1 (y|x) =
f2|1 (y|x) dy = P (Y < y | X = x)
∞
Similarly,
Z
x
f1|2 (x|y) dx = P (X < x | Y = y)
F1|2 (x|y) =
∞
On the contrary, the conditional density function is a partial derivative of the conditional distribution function:
f2|1 (y|x) =
∂F2|1 (y|x)
∂y
11
Similarly,
f1|2 (x|y) =
∂F1|2 (x|y)
∂x
Conditional probability. The conditional probability of an interval for Y , under the
condition that X = x, can be calculated from the conditional density by integration:
Z y2
f2|1 (y|x) dy
P( y1 < Y < y2 | X = x ) =
y1
Similarly, the conditional probability of an interval for X, under the condition that
Y = y, can be calculated from the other conditional density by integration:
Z x2
P( x1 < X < x2 | Y = y ) =
f1|2 (x|y) dx
x1
The conditional probability of an interval for Y , under the condition that X = x, can
be calculated from the conditional distribution function as a difference:
P( y1 < Y < y2 | X = x ) = F2|1 (y2 |x) − F2|1 (y1 |x)
Similarly, the conditional probability of an interval for X, under the condition that Y =
y, can be calculated from the other conditional distribution function as a difference:
P( x1 < X < x2 | Y = y ) = F1|2 (x1 |y) − F1|2 (x1 |y)
Remark. Notice that in the conditional probability
P( y1 < Y < y2 | X = x )
the probability of the condition is zero:
P(X = x ) = 0
Thus, the definition
P(B|A) =
P(A ∩ B)
P(A)
would not be applicable to define P( y1 < Y < y2 | X = x ).
Conditional median. Solving the equation
F2|1 (y|x) =
1
2
for y, that is, expressing y in terms of x, we get the conditional median of Y on condition that X = x.
12
Similarly, solving the equation
F1|2 (x|y) =
1
2
for x, that is, expressing x in terms of y, we get the conditional median of X on
condition that Y = y.
Conditional expected value. The conditional expected value is the expected value of
the conditional distribution:
Z ∞
E(Y |X = x) = µ2|1 (|x) =
y f2|1 (y|x) dy
−∞
Z
∞
E(X|Y = y) = µ1|2 (|y) =
x f1|2 (x|y) dx
−∞
Conditional variance. The variance of the conditional distribution is the conditional
variance:
2
VAR(Y |X = x) = σ2|1
(|x) =
Z ∞
Z
2
y − µ2|1 (|x) f2|1 (y|x) dy =
−∞
∞
y 2 f2|1 (y|x) dy − µ2|1 (|x)
2
x2 f1|2 (x|y) dx − µ1|2 (|y)
2
−∞
2
VAR(X|Y = y) = σ1|2
(|y) =
Z ∞
Z
2
x − µ1|2 (|y) f1|2 (x|y) dx =
−∞
∞
−∞
Conditional standard deviation. The standard deviation of the conditional distribution is the conditional standard deviation:
SD(Y |X = x) = σ2|1 (|x) =
sZ
sZ
∞
2
y − µ2|1 (|x) f2|1 (y|x) dy =
−∞
∞
y 2 f2|1 (y|x) dy − µ2|1 (|x)
2
−∞
SD(X|Y = y) = σ1|2 (|y) =
sZ
sZ
∞
2
x − µ1|2 (|y) f1|2 (x|y) dx =
−∞
∞
x2 f1|2 (x|y) dx − µ1|2 (|y)
2
−∞
Remark. The notion of the conditional variance and the conditional standard deviation
can obviously be introduced and calculated for discrete distributions as well: in the
above formulas, instead of integration summation is taken.
13
Example. We choose a random number between 0 and 1 according to uniform distribution, let it be X. If X = x, then we choose another random number between 0 and
x according to uniform distribution, let it be Y . We shall calculate now all the density
functions. By the definition of X and Y , we may write:
f (x) = 1
if 0 < x < 1
1
x
By the product rule:
if 0 < y < x < 1
f2|1 (y|x) =
f (x, y) = f1 (x) f2|1 (y|x) = 1
By the integration rule:
Z ∞
Z
f2 (y) =
f (x, y) dx =
−∞
1
1
=
x
x
y
y
if 0 < y < x < 1
1
dx = − ln(y)
x
if 0 < y < 1
By the division rule:
f1|2 (x|y) =
1
f (x, y)
1
x
=
=−
f2 (y)
− ln(y)
x ln(y)
if 0 < y < x < 1
The conditional distribution function is
Z x
F1|2 (x|y) =
f1|2 (x|y) dx =
∞
Z
y
x
1
−
x ln(y)
1
dx =
− ln(y)
Z
x
y
ln(x)
1
(ln(x) − ln(y)) = 1 −
− ln(y)
ln(y)
1
dx =
x
if 0 < y < 1
The conditional median is the solution for x of the equation
F1|2 (x|y) = 1 −
ln(x)
1
=
ln(y)
2
that is
ln(x)
1
=
ln(y)
2
1
ln(y)
2
√
ln(x) = ln( y)
√
x= y
ln(x) =
14
The conditional expected value is
Z
∞
E(X|Y = y) = µ1|2 (|y) =
x f1|2 (x|y) dx =
−∞
1
Z 1 1
1
dx =
−
dx =
x ln(y)
ln(y)
y
y
y−1
1
(1 − y) =
if 0 < y < 1
−
ln(y)
ln(y)
Z
x
−
Files to visualize projections and conditional distributions:
Demonstration file: X = RND1 , Y = X RND2 , projections and conditional distributions
ef-200-79-00
Demonstration file: Two-dim beta distributions, n = 10 , projections and conditional
distributions
ef-200-80-00
Demonstration file: Two-dim beta distributions, n ≤ 10 , projections and conditional
distributions
ef-200-81-00
Files to study construction of a two-dimensional continuous distribution using conditional distributions:
Demonstration file: Conditional distributions, uniform on parallelogram
ef-200-84-00
Demonstration file: Conditional distributions, (RND1 , RND1 RND2 )
ef-200-85-00
Demonstration file: Conditional distributions, uniform on triangle
ef-200-86-00
Demonstration file: Conditional distributions, Bergengoc bulbs
ef-200-87-00
Demonstration file: Conditional distributions, standard normal
ef-200-88-00
Demonstration file: Conditional distributions, normal
ef-200-89-00
15
5
Normal distributions in two-dimensions
Standard normal distribution. The two-dimensional standard normal distribution is
defined on the whole plane by its density function:
f (x, y) =
1 − 12 (x2 +y2 )
e
2π
Since the value of the density function depends on x and y only through x2 + y 2 ,
the distribution is circular symmetrical. Actually, the surface defined by the density
function resembles a hat or a bell.
It is easy to check that the projections of the standard normal distribution onto both
axes are one-dimensional standard normal distributions.
The conditional distributions both on the vertical and the horizontal lines are onedimensional standard normal distributions, as well.
General two-dimensional normal distributions. General two-dimensional normal
distributions are defined by their density function:
2
f (x, y) =
1
√
2πσ1 σ2 1 − r2
e
− 21
y−µ2
1
+(
( x−µ
σ1 )
σ2 )
2
1−r 2
−2r
x−µ1 y−µ2
σ1
σ2
where the parameters µ1 , µ2 are real numbers, σ1 , σ2 are positive numbers, and r is
a number between −1 and 1, equality permitted. The surface defined by the density
function resembles a hat which is compressed in one direction so that looking at it from
above it has an elliptical shape.
It can be shown that the level curves of the density function are ellipses, whose
center is at the point (µ1 , µ2 ), the directions of the axes are determined by the directions
of the eigen-vectors of the covariance matrix, and the sizes of the axes are proportional
to the square roots of the eigen-values.
Projections. It is easy to check that the projections of a two-dimensional normal distribution onto both axes are normal distributions. The projection onto the horizontal axis
is a normal distribution with parameters µ1 and σ1 . The projection onto the vertical
axis is a normal distribution with parameters µ2 and σ2 . The density function of the
projection onto the horizontal axis is:
2
(x−µ1 )
−
1
2
2σ1
f1 (x) = √
e
2πσ1
The density function of the projection onto the vertical axis is:
(y−µ2 )
−
1
2
2σ2
f2 (y) = √
e
2πσ2
2
16
Correlation coefficient . The value of the correlation coefficient can be calculated according to its definition. It turns out that its value is equal to the value of the parameter
r.
Conditional distributions. The conditional distributions are normal distributions. The
conditional density function along the vertical line, when X = x, is:
f2|1 (y|x) √
1
√
e
2πσ2 1 − r2
− 12
σ
y− µ2 +r 2 (x−µ1
√σ1
σ2 1−r 2
(
)
!2
The conditional density function along the horizontal line, when Y = y, is:
f1|2 (x|y) √
1
√
2πσ1 1 − r2
e
− 12
σ
x− µ1 +r 1 (y−µ2
√σ2
σ1 1−r 2
(
)
!2
Conditional median and expected value. Both conditional medians and expected
values depend on the condition linearly. Namely, the conditional median and expected
value of Y , when X = x, is:
µ2 + r
σ2
(x − µ1 )
σ1
The straight line defined by this formula is the so called first regression line.
Similarly, the conditional median and expected value of X, when Y = y, is:
µ1 + r
σ1
(y − µ2 )
σ2
The straight line defined by this formula is the so called second regression line. The
regression lines mark the place of the conditional medians and expected values.
Conditional standard deviation. Both conditional standard deviations do not depend
on the condition, they are a constants. Namely, the conditional standard deviation of
Y , when X = x, is:
p
σ2 1 − r 2
If we move the first regression line up and down by an amount equal to the value of
the conditional standard deviation we get the so called conditional standard deviation
lines associated to the first regression line.
Similarly, the conditional standard deviation of X, when Y = y, is:
p
σ1 1 − r 2
17
If we move the second regression line to the right and to the left by an amount equal to
the value of the conditional standard deviation we get the so called conditional standard deviation lines associated to the second regression line.
Standard deviation rectangle. In order to get a better view of a normal distribution,
let us consider the rectangle defined by the direct product of the intervals
(µ1 − σ1 ; µ1 + σ1 ) and (µ2 − σ2 ; µ2 + σ2 )
We may take also the rectangles defined by the direct product of the intervals
(µ1 − sσ1 ; µ1 + sσ1 ) and (µ2 − sσ2 ; µ2 + sσ2 )
where s is a positive number. This rectangle may be called the standard deviation
rectangle of size s. Let us put a scale from −1 to 1 on each of the sides of the standard
deviation rectangle so that the −1 is at the left end, and the is 1 at the right end on
the horizontal sides, and the −1 is at the lower end, and the is 1 at the upper end on
the vertical sides. The points on the sides which correspond to r, the value of the
correlation coefficient, play an interesting role, since the following facts are true:
1. The sides of the standard deviation rectangles are tangents to the ellipses which
arise as level curves, and the common points of the ellipses and the standard
deviation rectangles correspond to r, the value of the correlation coefficient, on
the scales on the sides of the standard deviation rectangles.
2. The regression lines intersect the standard deviation rectangles at points which
correspond to r on the scales on the sides of the standard deviation rectangles.
3. If we draw the standard deviation rectangle of size 1, and consider the ellipse
which arises as a level curve, touching the standard deviation rectangle at the
point having a position r on the on the scales on the sides of the standard deviation rectangle, then we may draw the tangent lines to the ellipse, parallel to
the regression lines. These lines that we get are the standard deviation lines
associated to the regression lines.
Files to study the height and weight of men as a two-dimensional normal random variable:
Demonstration file: Height and weight
ef-200-65-00
Demonstration file: Height and weight, ellipse, eigen-vectors (projections and conditional distributions are also studied)
ef-200-82-00
Demonstration file: Two-dim normal distributions normal distributions, projections
and conditional distributions
ef-200-83-00
18
File to study voltages as a two-dimensional normal random variable:
Demonstration file: Measuring voltage
ef-200-66-00
6
Independence of random variables
The discrete random variables X and Y are independent, if any (and then all) of the
following relations hold:
p2|1 (y|x) = p2 (y)
for all x and y
p1|2 (x|y) = p1 (x)
for all x and y
p(x, y) = p1 (x)p2 (y)
for all x and y
The continuous random variables X and Y are independent, if any (and then all) of
the following relations hold:
f2|1 (y|x) = f2 (y)
for all x and y
f1|2 (x|y) = f1 (x)
for all x and y
f (x, y) = f1 (x)f2 (y)
for all x and y
If some random variables are not independent, then we call them dependent.
File to study the notion of dependence and independence:
Demonstration file: Lengths dependent or independent
ef-200-91-00
7
Generating a two-dimensional random variable
It is important that for a given two-dimensional distribution that a two-dimensional
random variable can be generated by a calculator or a computer so that its distribution
is the given two-dimensional continuous distribution. If the distribution is continuous,
then the method described below defines such a two-dimensional random variable.
(The discrete case is left for the reader as an exercise.)
In order to find the desired distribution in the continuous case, let the distribution function of its projection onto the horizontal axis be denoted by F1 (x). Let F −1 (u) be
its inverse. (If F1 (x) not strictly increasing on the the whole real-line, but only on
an interval (A, B), then F −1 (u) should be the inverse of restriction of F (x) onto that
19
interval.) The way how we technically find a formula for F1−1 (u) is that we solve the
equation
u = F1 (x)
for x, that is, we express x from the equation in terms of u:
x = F1−1 (u)
In a similar way, let the distribution function of the conditional distributions on the
−1
vertical axes be denoted by F2|1 (y|x), and their inverse be denoted by F2|1
(v|x). The
−1
way how we find technically a formula for F2|1 (v|x) is that we solve the equation
v = F2|1 (y|x)
for y, that is, we express y from the equation in terms of v:
−1
y = F2|1
(v|x)
In this calculation x plays the role of a parameter.
Now we define the random value X by
X = F1−1 (RND1 )
It is easy to be convinced that the distribution function of the random variable X is the
function F1 (x). Then we define the random variable Y by
−1
Y = F2|1
(RND2 |X)
It is easy to be convinced that the conditional distribution function of the random variable Y on condition that X = x is the function F2|1 (y|x). The two facts that
1. the distribution function of the random variable X is the function F1 (x)
2. the conditional distribution function of the random variable Y on condition that
X = x is the function F2|1 (y|x)
mean that the random variable (X, Y ) has the given two-dimensional continuous distribution.
8
Properties of the expected value, variance and standard deviation
In this section, we present the most important properties of the expected value, variance
and standard deviation. In the formulas bellow X, Y , X1 , X2 , . . ., Xn represent
random variables, and a, b, c, n, a1 , a2 , . . ., an , represent constants.
20
1. Addition rule for the expected value:
(a) For two terms:
E(X + Y ) = E(X) + E(Y )
(b) For more terms:
E(X1 + X2 + . . . + Xn ) = E(X1 ) + E(X2 ) + . . . + E(Xn )
2. Expected value of constant times a random variable:
E(cX) = cE(X)
3. Linearity of the expected value:
(a) For two terms:
E(a X + b Y ) = a E(X) + b E(Y )
(b) For more terms:
E(a1 X1 + a2 X2 + . . . + an Xn ) =
a1 E(X1 ) + a2 E(X2 ) + . . . + an E(Xn )
4. Expected value of the sum with identical expected values:
If X1 , X2 , . . . , Xn have an identical expected value µ, then
E(X1 + X2 + . . . + Xn ) = nµ
5. Expected value of the average with identical expected values:
If X1 , X2 , . . . , Xn have an identical expected value µ, then
X1 + X2 + . . . + Xn
E
=µ
n
6. Expected value of the product for independent random variables:
If X and Y are independent, then
E(XY ) = E(X)E(Y )
7. Variance of a sum:
VAR(X + Y ) = VAR(X) + VAR(Y ) + 2COV(X, Y )
where COV(X, Y ) is the covariance between X and Y (see the definition of the
covariance later).
21
8. Variance of the sum of independent random variables:
If X and Y are independent, then
VAR(X + Y ) = VAR(X) + VAR(Y )
9. Variance of constant times a random variable:
VAR(cX) = c2 VAR(X)
10. Variance of the sum of independent random variables:
If X1 , X2 , . . . , Xn are independent and have a common variance σ 2 , then
VAR(X1 + X2 + . . . + Xn ) = n σ 2
11. Variance of the average of independent random variables:
If X1 , X2 , . . . , Xn are independent and have a common variance σ 2 , then
VAR
X1 + X2 + . . . + Xn
n
=
σ2
n
12. Standard deviation of constant times a random variable:
SD(cX) = |c| SD(X)
13. Square root law for the standard deviation of the sum:
If X1 , X2 , . . . , Xn are independent and have a common standard deviation σ,
then
√
SD(X1 + X2 + . . . + Xn ) = n σ
14. Square root law for the standard deviation of the average:
If X1 , X2 , . . . , Xn are independent and have a common standard deviation σ,
then
X1 + X2 + . . . + Xn
σ
SD
=√
n
n
File to study the "average"-property of the standard deviation:
Demonstration file: Standard deviation of the average
ef-200-61-00
Demonstration file: Standard deviation of the average
ef-200-61-01
22
9
Transformation from plane to line
When the two-dimensional random continuous variable (X, Y ) has a density function
f (x, y), and z = t(x, y) is a given function, then the distribution function R(z) of the
random variable Z = t(X, Y ) is
ZZ
R(z) =
f (x, y) dx dy
Az
where the set Az is the inverse image of the interval (−∞, z) at the transformation
z = t(x, y):
Az = {(x, y) : t(x, y) < z)}
Sketch of proof. The event Z < z is equivalent to the event (X, Y ) ∈ Az , so
ZZ
R(z) = P(Z < z) = P( (X, Y ) ∈ Az ) =
f (x, y) dx dy
Az
Taking the derivative with respect to z on both sides, we get the density function:
r(z) = R0 (z)
Files to study transformations from plane to line:
Demonstration file: Transformation from square to line by product
ef-300-02-00
Demonstration file: Transformation from square to line by ratio
ef-300-03-00
Demonstration file: Transformation from plane into chi distribution
ef-300-04-00
Demonstration file: Transformation from plane into chi-square distribution
ef-300-05-00
Projections from plane onto the axes. If t(x, y) = x, then the transformation means
the projection onto the x-axis. Recall that the density function f1 (x) can be calculated
from f(x,y) by integration with respect to y:
Z ∞
f1 (x) =
f (x, y) dy
−∞
23
Similarly, if t(x, y) = y, then the transformation means the projection onto the y-axis.
The density function f2 (x) can be calculated from f(x,y) by integration with respect to
x:
Z ∞
f2 (y) =
f (x, y) dx
−∞
Files to study projections from plane to axes:
Demonstration file: Projection from triangle onto axes: (max(RND1 , RND2 ); min(RND1 , RND2 ))
ef-300-06-00
Demonstration file: Projection from triangle onto axes: (RND1 ; RND1 RND2 )
ef-300-07-00
Demonstration file: Projection from sail onto axes: (RND1 RND2 ; RND1 /RND2 )
ef-300-08-00
p
√
Demonstration file: Projection from sale onto axes: ( RND1 RND2 ; RND1 /RND2 )
ef-300-09-00
10
*** Transformation from plane to plane
General case. Assume that a the density function of a distribution on the plane is
f (x, y). Consider a one-to-one smooth transformation t from the (x, y)-plane onto the
(u, v)-plane given by a pair of functions:
u = u(x, y)
v = v(x, y)
Let the inverse of the transformation be given by the pair of functions
x = x(u, v)
y = y(u, v)
The Jacobian matrix of the inverse transformation plays an important role in the formula we will state. This is why we remind the reader that the Jacobian matrix of the
inverse transformation is a two by two matrix consisting of partial derivatives:

∂(x, y) 
=
∂(u, v)
∂x(u,v)
∂u
∂x(u,v)
∂v
∂y(u,v)
∂u
∂y(u,v)
∂v


24
As the (x, y)-plane is transformed into the (u, v)-plane, the distribution on the (x, y)plane is also transformed into a distribution on the (u, v)-plane. Let the density function of the arising distribution on the (u, v)-plane denoted by s(u, v). Then the value
of the new density function is equal to the value of the old density function multiplied
by the absolute value of the determinant of the Jacobian matrix of the inverse transformation:
∂(x, y) s(u, v) = f (x(u, v), y(u, v)) det
∂(u, v) Sketch of proof. Let us consider a small rectangle B at the point (u, v). Its inverse
image on the (x, y) plane is approximately a small parallelogram-like set A at the point
(x, y) so that the ratio of their areas is approximately equal to the absolute value of the
Jacobian matrix of the inverse transformation:
area of A ∂(x, y) ≈ det
area of B
∂(u, v) Using this fact we get that
∂(x, y) P ((U, V ) ∈ B)
P ((X, Y ) ∈ A) area of A
s(u, v) ≈
=
≈ f (x, y) det
area of B
area of A
area of B
∂(u, v) Files to study a transformation from plane to plane:
Demonstration file: Transformation from square onto a "sail"
ef-300-09-50
Special case: Multiplying by a matrix. Let us consider the special case, when the
transformation is a linear transformation
u = a11 x + a12 y
v = a21 x + a22 y
that is
u
v
=
a11
a21
a12
a22
x
y
Introducing the matrix notations
u
u=
v
a11 a12
A=
a21 a22
x
x=
y
25
the linear transformation can be written briefly as
u = Ax
Then the inverse transformation is
x = A−1 u
where A−1 is the inverse of A and the Jacobian matrix of the inverse transformation is
the inverse matrix A−1 itself.
So the new density function s(u) expressed in terms of the old density f (x) looks
like this:
s(u) = f (A−1 u) det A−1 Special case: Multiplying by a matrix and adding a vector. Let us consider the
special case, when the transformation is a linear transformation
u = a11 x + a12 y + b1
v = a21 x + a22 y + b2
Introducing the notation
b1
b=
b2
the linear transformation can be written briefly as
u = Ax + b
Then the inverse transformation is
x = A−1 (u − b)
So the new density function s(u) expressed in terms of the old density f (x) looks like
as this:
s(u) = f ( A−1 (u − b) ) det A−1 Linear transformation of two-dimensional normal distributions. If a two-dimensional
normal distribution is transformed by a linear transformation
u=Ax + b
then the new distribution is a normal distribution, too. If the expected value of the old
distribution is mold , then the expected value of the new distribution is
mnew = A mold + b
26
If the covariance matrix of the old distribution is Cold , then the covariance matrix of
the new distribution is
Cnew = A Cold AT
Demonstration file: Linear transformation of the standard normal point-cloud
ef-300-10-00
Demonstration file: Linear transformation of normal distributions
ef-300-11-00
11
*** Sums of random variables. Convolution
Discrete random variables, general case. Assume that the two-dimensional random
variable (X, Y ) has a distribution p(x, y). Let Z denote the sum of X and Y , that is,
Z = X + Y . Then the distribution r(z) of the sum is:
X
X
X
r(z) =
p(x, y) =
p(x, z − x) =
p(z − y, y)
(x,y): x+y=z
x
y
Notice that
- in the first summation, for a given value of z, the summation takes place for all
possible values of (x, y) for which x + y = z,
- in the second summation, for a given value of z, the summation takes place for all
possible values of x.
- in the third summation, for a given value of z, the summation takes place for all
possible values of y.
Remark. If p(x, y) is zero outside a region S, then, in the first summation, for a given
value of z, the summation can be restricted to the set {(x, y) : (x, y) ∈ S}:
X
p(x, y)
r(z) =
(x,y)∈S: x+y=z
In the second summation it can be restricted to the set Az = {x : (x, z − x) ∈ S}:
X
r(z) =
p(x, z − x)
x∈Az
In the third summation it can be restricted to the set Bz = {y : (z − y, y) ∈ S}:
X
r(z) =
p(z − y, y)
y∈Bz
27
Discrete, independent random variables. Assume now that the discrete random variables X and Y are independent. Since p(x, y) = p1 (x)p2 (y), the above formulas
reduce to:
X
X
X
r(z) =
p1 (x) p2 (y) =
p1 (x) p2 (z − x) =
p1 (z − y) p2 (y)
x
(x,y): x+y=z
y
We recognize that r(z) is the convolution of the distributions p1 (x) and p2 (y).
Example 1. Convolving binomial distributions. If we convolve a binomial distribution with parameters n1 and p with a binomial distribution with parameters n2 and p
(the parameter p is the same for both distributions), then we get a binomial distribution
with parameters n1 + n2 and p.
Example 2. Convolving Poisson distributions. If we convolve a Poisson distribution
with parameter λ1 with a Poisson distribution with parameter λ2 , then we get a Poisson
distribution with parameters λ1 + λ2 .
Example 3. Convolving geometrical distributions. If we convolve a geometrical
distribution with parameter p with a geometrical distribution with parameter p (the
parameter p is the same for both distributions), then we get a second order negative
binomial distribution with parameter p.
Example 4. Convolving negative binomial distributions. If we convolve a negative
binomial distribution with parameters r1 and p with a negative binomial distribution
with parameters r2 and p (the parameter p is the same for both distributions), then we
get a negative binomial distribution with parameters r1 + r2 and p.
Files to study how the distribution of the sum can be calculated:
Demonstration file: Summation of independent random variables, fair dice
ef-300-12-00
Demonstration file: Summation of independent random variables, unfair dice
ef-300-13-00
Continuous random variables, general case. Assume that the two-dimensional random variable (X, Y ) has a density function f (x, y). Let us consider the sum of X and
Y : Z = X + Y . Then the density function r(z) of the sum is:
Z ∞
Z ∞
r(z) =
f (x, z − x) dx =
f (z − y, y) dy
−∞
−∞
Sketch of proof. We shall perform the transformation in two steps. First we transform the distribution onto the (u, v)-plane by the linear transformation given by the
equations
u
v
=
=
x
+
y
y
28
and then we project onto the horizontal axis. Since the first coordinate of the above
transformation is u = x + y, after the projection, we get what we need. The inverse
transformation is
x
y
=
=
u
−
The Jacobian matrix is
 ∂x ∂x 

∂u
∂v
∂y
∂u
∂y
∂v
v
v

1
−1
=


1
so the Jacobian determinant is equal to 1. Thus
s(u, v) = f ( u − v , v )
1 = f ( u − v ,v )
Now projecting onto the horizontal axis, the value of the density function at u turns out
to be
Z ∞
Z ∞
s(u, v) dv =
f ( u − v , v ) dv
−∞
−∞
Replacing formally the letter u by the letter z, and the integration variable v by y, we
get that the value of the density function at z is
Z ∞
r(z) =
f ( z − y , y ) dy
−∞
Remark. If f (x, y) is zero outside a region S, then, for a given z value, the interval
(−∞, ∞) in the first integral can be replaced by the set Az = {x : (x, z − x) ∈ S}:
Z
r(z) =
f (x, z − x) dx
Az
Similarly, the interval (−∞, ∞) in the second integral can be replaced by the set Bz =
{y : (z − y, y) ∈ S}:
Z
r(z) =
f (z − y, y) dy
Bz
Continuous, independent random variables. Assume now that the continuous random variables X and Y are independent. Since f (x, y) = f1 (x)f2 (y), the above
formulas reduce to:
Z ∞
Z ∞
r(z) =
f1 (x) f2 (z − x) dx =
f1 (z − y) f2 (y) dy
−∞
−∞
We recognize that r(z) is the convolution of the density functions f1 (x) and f2 (y).
29
Example 1. Convolving exponential distributions. If we convolve an exponential
distribution with parameter λ with an exponential distribution with parameter λ (the
parameter λ is the same for both distributions), then we get a second order gamma
distribution with parameter λ.
Example 2. Convolving gamma distributions. If we convolve a gamma distribution
with parameters n1 and λ with a gamma distribution with parameters n2 and λ (the
parameter λ is the same for both distributions), then we get a gamma distribution with
parameters n1 + n2 and λ.
Example 3. Convolving normal distributions. If we convolve a normal distribution
with parameters µ1 and σ1 with a normal distribution with parameters µ2 and σ2 (the
parameter p is the same for
p both distributions), then we get a normal distribution with
parameters µ1 + µ2 and σ12 + σ22 .
12
Limit theorems to normal distributions
Moivre-Laplace theorem. If, for a fixed p value, we consider a binomial distribution
with parameters n and p so that n is large, then the binomial distribution can be well
approximated by a normal distribution. The parameters, that is, the expected value and
the standard deviation of the normal distribution should be taken to be equal to the
expected
value and the standard deviation of the binomial distribution, that is, np and
p
np(1 − p).
If we standardize the binomial distribution, then the arising standardized binomial distribution will be close to the standard normal distribution.
Here is a file to study binomial approximation of normal distribution:
Demonstration file: Binomial approximation of normal distribution
ef-300-14-00
Central limit theorem. If we add many independent random variables, then the distribution of the sum can be calculated from the distributions of the random variables by
convolution. It can be shown that, under very general conditions (which we do not give
here), the distribution of the sum will approximate a normal distribution. The parameters, that is, the expected value and the standard deviation of the normal distribution
should be taken to be equal to the expected value and the standard deviation of the sum.
If we standardize the sum, the arising standardized value will be distributed approximately according to the standard normal distribution.
Central limit theorem in two-dimensions. If we add many independent two-dimensional
random variables (random vectors), then the distribution of the sum, under very general
30
conditions (which we do not give here), the distribution of the sum will approximate a
two-dimensional normal distribution.
Files to study how convolutions approximate normal distributions:
Demonstration file: Convolution with uniform distribution
ef-300-15-00
Demonstration file: Convolution with asymmetrical distribution
ef-300-16-00
Demonstration file: Convolution with U-shaped distribution
ef-300-17-00
Demonstration file: Convolution with randomly chosen distribution
ef-300-18-00
File to study how gamma distributions approximate normal distributions:
Demonstration file: Gamma distribution approximates normal distribution
ef-300-19-00
Files to study the two-dimensional central limit theorem:
Demonstration file: Two-dimensional central-limit theorem, rectangle
ef-300-20-00
Demonstration file: Two-dimensional central-limit theorem, parallelogram
ef-300-21-00
Demonstration file: Two-dimensional central-limit theorem, curve
ef-300-22-00
31
```