MAT 326 Chapter 7 Fall 2024
MAT 326 Chapter 7 Fall 2024
In chapters 5 and 6 we explained how each time when we are doing a random operation,
then we can introduce one random variable X discrete or continuous”, we also talked
about f(x).(the probability distribution “density” function of X. Sometimes we may need
to introduce two or more random variables. In this chapter we shall deal with random
operations for which we need two random variables, say X, Y, in this case we shall need
to talk about f (x, y) the joint probability distribution (density) function of X and Y. We
shall assume that either both X, and Y are continuous or both are discrete
C X=0 , Y=0
Marginal Probability
X
0 1 2 for Y
1 2 1 4
0
9 9 9 9
2 2 4
Y 1 0
9 9 9
1 1
2 0 0
9 9
Marginal Probability 4 4 1
1
for X 9 9 9
Remark: The joint probability distribution f (x, y) can be used to find the marginal
probability distribution functions of X and Y.
We have f 1 ( x )=∑ f (x , y)
¿x
And f 2 ( y ) =∑ f ( x , y )
¿y
f ( x ) = P (X=x) = ∑ f (x , y) and
1 f ( y ) = = P (Y=y) = ∑ f (x , y)
2
¿y ¿x
Examples 2: Suppose that X and Y are two discrete random variables with
x. y
f (x, y) = for x= 0, 1, 2 and y= 1, 2, 3
18
xy 6 x x
So f 1 ( x )=¿ ∑ f ( x , y )=∑ = = for x= 0,1,2
y y 18 18 3
xy y
And f 2 ( y ) =∑ f ( x , y ) =∑ = for y=1,2,3
x x 18 6
Page 3 of 9
x+ y
Example 3: f (x, y) = for x= 0, 1, 2 and y= 1, 2, 3
27
x+ 2 y+ 1
So f 1 ( x )= for x = 0.1.2 and f 2 ( y ) =¿ for y=1,2,3
9 9
Continuous Case
Definition: Each time we have X and Y as two continuous R Vs, then we shall have the
function called the joint probability density function of X and Y
A lways the followings aretrue
1) f ( x , y ) ≥ 0for all x and y
∞ ∞
2) ∫ ∫ f ( x , y ) dxdy =1
−∞ −∞
Example (4) Let X and Y be two cont. random variables their j.p.d.f is given by
f(x , y) = {K ( x +2 y )0foreles0<where
x< 1∧0< y < 2
Remark: Again, in this case we can get the marginal probability density functions for X
and Y, were
∞ ∞
f 1(x) = ∫ f ( x , y )dy and f 2(y) = ∫ f ( x , y )dx
−∞ −∞
{
∞
1
2 1
( 2 x +4 ) for 0< x <1 ¿
f 1(x) = ∫ f ( x , y )dy = ∫ ( x +2 y ) dy =¿ 5
5 0
−∞ 0 elsewhere
{
∞
1
1 1
( 0.5+ 2 y ) for 0< y <2
f 2(y) = ∫ f ( x , y )dx = ∫ ( x +2 y ) dx= 5
50
−∞ 0 elsewhere
Example 5
Page 4 of 9
{
− ( x+ y )
e
Example 6 : f(x , y) = 0 elsewhere for x > 0 and y > 0
So f 1(x) = ∫ e
−(x+ y)
dy = e− x for x > 0 and f 2(y) = e− y for y> 0
0
∞
y
S0 f 1(x) = ∫ f ( x , y )dy = 2x for 0 < x <1 and f 2(y) =
2
for 0 < y <2
−∞
Page 5 of 9
x+ y
Back to example 3: Given f (x, y) = for x= 0, 1, 2 and y= 1, 2, 3
27
x+ 2 y+ 1
We get f 1 ( x )= for x = 0.1.2 and f 2 ( y ) =¿ for y=1,2,3
9 9
{
1
( x+2 y ) for 0< x <1∧0< y< 2
Back to example 4: f (x , y) = 5
0 eles where
{
1
( 2 x + 4 ) for 0< x <1
Where f 1(x) = 5
0 elsewhere
{
1
( 0.5+2 y ) for 0< y <2
and f 2(y) = 5
elsewhere
0
Page 6 of 9
2 0.5
1 13
and we got before P (0 < X < 0.5, 1 < Y < 2) =
5 ∫ ∫ ( x+ 2 y ) dx dy = 40
1 0
13
P(¿) P (0< x <0.5 , 1< y <2) 40
So, P (0 < x < 0.5 ¿ 1 < y < 2) = = = =¿13/28
P (1 ≤ Y ≤ 2) P (1<Y <2) 7
10
Definition: Let X and Y be two continuous random variables with joint probability
density function f (x, y) and marginal density functions f 1 ( x ) and f 2 ( y ) .
Note that the above general continuous formula can’t be used to calculate for example
P (a <X <b | Y = k) or P ( c < Y< d | X=k ) When X and Y are continuous, this
0
will lead us to get (undefined). To handle the problem, suppose we want to calculate
0
for example, P (a <X <b | Y = k), in such a case we need first to find the conditional
probability density function of a new continuous random variable (X |Y =k ¿which given
by
{
f (x ,k)
when f 2 ( k ) ≠ 0
g ( X |Y =k )= f 2 ( k )
0 elsewhere
b
{
We have f 1 ( x 1 )=
2 ( 1−x 1 ) 0≤ x 1 ≤ 1
0 elsewhere
and f 2 ( x 2 )={1 0 ≤ x 2 ≤1
0 elsewhere
{
f ( 0.5 , x 2 ) 1 1 for 0 ≤ x 2 ≤ 1
g ( X 2|X 1=0.5 ) = = = .
f 1 ( x 1=0.5 ) 1 0 elsewhere
0.75 0.75
Note that for this example, we can’t calculate, say P ( X 2 < 0.75| X 1=1 ) since
f ( 1 , x 2) 1
g ( x 2| x1=1 ) = = undefined ( f 1 ( 1 )=2 ( 1−1 )=0 ¿
f 1 ( x 1=1 ) 0
Page 7 of 9
∞
y
f 1(x) = ∫ f ( x , y )dy = 2x for 0 < x < 1 and f 2(y) =
2
for 0 < y <2
−∞
Let us find P (0 < X <0.5 ¿ Y =1 ¿
f ( x , 1) x
We need g (X | Y=1) = = = 2 x for 0 < x < 1
f 2 ( y =1) 0.5
0.5
Back to our example (1) of the discrete case, we can show that X 1 and X 2 are not
1
independent (they are dependent) since, for example P ( X=0 ,Y =0 )= ,while
9
4 4 16
P ( X=0 ) ⋅ P ( Y =0 ) ¿ . =¿ and hence ( X =0 , Y =0 ) ≠ P ( X=0 ) ⋅ P ( Y =0 )
9 9 81
Back to example 4, X and Y are not independent (they are dependent) since there are at
least one x and one y were,
1 1 1
f (x ,y) = ( x +2 y ) ≠ ( 2 x+ 4 ) . ( 0.5+2 y ) = f 1(x). f 2(y)
5 5 5
{
∑ ∑ g(x, y)f (x , y ) If X , Y discrete
E ( g ( X , Y ) )= over y over x
then ∞ ∞
∫ ∫ g ( x , y ) f ( x , y ) dxdy If X , Y continuous
−∞ −∞
Definition:
Let X, Y be two random variables, we define the covariance between X and Y (denote it
Cov ( X , Y ) ) to be given by Cov ( X , Y ) =E ( X ⋅Y )−E ( X ) ⋅ E ( Y ) .
The covariance helps us to have an idea about the relationship between X and Y,
If Y tends to be large (small) at the same time X is large (small) then cov ( X , Y ) is
positive, on the other hand.
If Y tends to be small (large) when X is large (small) and large when Y is small
then cov ( X , Y ) <0 (negative).
back to example (1)
2 2
0 ( 1 ) +0 ( 2 ) +0 ( 1 ) +0 ( 2 ) +1 ( 2 ) +2 ( 0 ) +0 ( 1 ) +2 ( 0 ) +4 ( 0 )
E ( X 1 ⋅ X 2 ) =¿ ∑ ∑ x . y P ( x , y ) = =¿ ¿
0 0 9
2 6
= while E ( X 1) =( X 2 ) = ⇒
9 9
2 6 6 −2
Cov ( X 1 , X 2) = − . = the answer is negative which means as X increases then Y
9 9 9 9
decreases and vice versa
Back to example 6
2 1 1
2
y
and E(Y) = ∫ y ( ¿ )dy =¿ ¿8/6, therefore Cov (X.Y) = 8/9 – 2/3. 8/6 = 0 (remember we
0 2
showed before, that X and Y are independent)
Theorem:
If X 1, X 2 are two random variables and Y =a1 X 1+ a2 X 2 +k , where a 1, a 2 , k ∈ R , then
1) E ( Y )=E ( a1 X 1 +a2 X 2 +k ) =a 1 E ( X 1 ) + a2 E ( X 2 ) +k .
2 2
2) V ( Y )=V ( a 1 X 1+ a2 X 2+ k ) =a1 V ( X 1 ) +a2 V ( X 2 ) +2 a1 a2 cov ( X 1 , X 2 ).
Example : Given two random variables X and Y with E(X)= 2, E(Y)= 5, V(X)= 9,
V(X)= 4 and Cov(X,Y)= 0.75. Let W= 3X – Y. Calculate E(W) and V(W)
x 1! x 2! … xk !
k k