You are on page 1of 15

Statistics for Data Science - 2

Week 5 graded Assignment


Solution

1. A person randomly chooses a battery from a store which has 40 batteries of type A and
60 batteries of type B. Battery life of type A and type B batteries are exponentially
distributed with average life of 4 years and 6 years, respectively. If the chosen battery
lasts for 5 years, what is the probability that the battery is of type A?
1
(a) 5
1 + e 12
1
(b) −5
1 + e 12
−4
e5
(c) −6
1+e 5
−6
e5
(d) −4
1+e 5

Solution:
Define a event X as follows:
(
1 If the chosen battery is of type A
X=
0 If the chosen battery is of type B

Let Y denote the battery life of the chosen battery.


By the given information, we have
Y |X = 1 ∼ Exp( 14 ) and

Y |X = 0 ∼ Exp( 16 )

It implies that

−y
fY |X=1 (y) = 14 e 4 ; y > 0 and

−y
fY |X=0 (y) = 16 e 6 ;y > 0

Also given that

40 2
P (X = 1) = = and
100 5
60 3
P (X = 0) = =
100 5

To find: fX|Y =5 (1). Now,

fY |X=1 (5).P (X = 1)
fX|Y =5 (1) =
fY (5)

fY |X=1 (5).P (X = 1)
=
fY |X=1 (5).P (X = 1) + fY |X=0 (5).P (X = 0)

1 −5
4
e 4 . 52
= 1 −5 −5
4
e 4 . 52 + 16 e 6 . 35

1 −5
10
e4
= 1 −5
1 −5
10
e 4 + 10 e6

−5
e 4
= −5 −5
e 4+e 6

1
= 5
1 + e 12

2. Let Y = XZ + X, where X ∼ Uniform{1, 2, 3} and Z ∼ Normal(1, 4) are independent.


Find the value of fX|Y =2 (2).

3 exp( 18 )
(a)
3 exp( 18 ) + 6 + 2 exp( 29 )
3 exp( −1
8
)
(b)
3 exp( −1
8
) + 6 + 2 exp( −2
9
)
2 exp( −2
9
)
(c)
3 exp( 8 ) + 6 + 2 exp( −2
−1
9
)
6
(d)
3 exp( 32 ) + 6 + 2 exp( −1
−1
18
)
Solution:
Given that X ∼ Uniform{1, 2, 3} and Z ∼ Normal(1, 4) are independent.
Y = XZ + X
It implies that

Page 2
Y |X = 1 = Z + 1 ∼ Normal(2, 4)
Y |X = 2 = 2Z + 2 ∼ Normal(4, 16)
Y |X = 3 = 3Z + 3 ∼ Normal(6, 36)

Therefore,  
−(y−2)2
fY |X=1 (y) = √1 exp
2 2π 8
 
−(y−4)2
fY |X=2 (y) = √1 exp
4 2π 32
 
−(y−6)2
fY |X=3 (y) = √1 exp
6 2π 72

To find: fX|Y =2 (2).

fY |X=2 (2).fX (2)


fX|Y =2 (2) =
fY |X=2 (2).fX (2) + fY |X=1 (2).fX (1) + fY |X=3 (2).fX (3)

 
−(2−4)2
√1 exp . 13
4 2π 32
=      
−(2−4)2 −(2−2)2 −(2−6)2
√1 exp . 31 + √1 exp . 13 + √1 exp . 31
4 2π 32 2 2π 8 6 2π 72

exp −1 1

8 4
= 1
exp −1 −2
 1
+ 2 exp(0) + 16 exp

4 8 9

3 exp( −1
8
)
=
3 exp( 8 ) + 6 + 2 exp( −2
−1
9
)

3. The joint pdf of two continuous ranodm variables X and Y is given by


(
4xy 0 ≤ x ≤ 1, 0 ≤ y ≤ 1
fXY (x, y) =
0 otherwise

Are X and Y independent?

1. Yes
2. No

Solution:
First we will calculate the marginal densities of X and Y .

Page 3
For 0 ≤ x ≤ 1
Z 1
fX (x) = fXY (x, y)dy
0
Z 1
= 4xydy
0
1

= 2xy 2


0
= 2x

For 0 ≤ y ≤ 1
Z 1
fY (y) = fXY (x, y)dx
0
Z 1
= 4xydx
0
1

2
= 2x y

0
= 2y

Therefore,
fX (x).fY (y) = 4xy = fXY (x, y)
It implies that X and Y are independent random variables.

4. Let (X, Y ) ∼ Uniform(D), where D = {(x, y) : (x − k)2 + (y − k)2 ≤ r}. Calculate


P (X ≥ Y ).
Solution:

y=x
2

x
1 2

Page 4
The region X ≥ Y will be the lower half part of the circle.

Therefore,
Area of lower half circle
P (X ≥ Y ) =
Area of the circle
π(1)2/2
=
π(1)2
1
=
2

5. Let (X, Y ) ∼ Uniform(D), where D = {(x, y) : y ≤ 2x, 0 < x < 1, 0 < y < 2} ∪ [1, 2] ×
[0, 2]. Find the marginal density of X.

(a) 
 2x + 2 0≤x≤2
fX (x) = 3 3
0 otherwise

(b) 
 2x + 1 0≤x≤2
fX (x) = 3 3
0 otherwise

(c) 
2x
3
 0≤x≤1
2
fX (x) = 1≤x≤2
3
0 otherwise

(d) 
2x
3
 0≤x≤1
1
fX (x) = 1≤x≤2
3
0 otherwise

Page 5
y

2 y = 2x

x
1 2

D denotes the area of the support(X, Y ).


Area of D = 12 × 1 × 2 + 1 × 2 = 3
Since (X, Y ) ∼ Uniform(D), it implies that
1
fXY (x, y) = , x, y ∈ D
3
R
We know that fX (x) = fXY (x, y)dy

For 0 < x < 1


Z 2x
1
fX (x) = dy
0 3
2x
1
= y
3
0
2x
=
3
For 1 < x < 2
Z 2
1
fX (x) = dy
0 3
2
1
= y
3
0
2
=
3
Therefore, marginal density of X is given by

2x
3 0≤x≤1

fX (x) = 23 1 ≤ x ≤ 2

0 otherwise

Page 6
6. The joint pdf of two random variables X and Y is given by
(
24xy 0 ≤ x ≤ 1, 0 ≤ y ≤ 1, x + y ≤ 1
fXY (x, y) =
0 otherwise

Choose the correct option(s).


(a) P (X + Y ≤ 41 ) = 1
2
(b) P (X + Y ≤ 12 ) = 1
16
(c) X and Y are independent random variables.
(d) X and Y are dependent random variables.
Solution:
Option (a)

x+y =1

0.25

x
0.25 1

Orange region will denote X + Y x≤+ 14y. =


Now,
1
Z 1/4 Z 1/4−y
1
P (X + Y ≤ ) = fXY (x, y)dxdy
4 y=0 x=0

Z 1/4 Z 1/4−y

= 24xydxdy
y=0 x=0

1/4−y
Z 1/4
= 12x2 y dy

y=0
x=0

Page 7
Z 1/4  2
1
= 12y −y dy
y=0 4

Z 1/4
12
= y(1 − 4y)2 dy
y=0 16

Z 1/4
3
= y(1 + 16y 2 − 8y)dy
4 y=0

 1/4
y2 8y 3

3
= + 4y 4 −

4 2 3


y=0

 
3 1 1 1
= + −
4 32 64 24
3 1 1
= . =
4 192 256

Hence, option (a) is wrong.

Option (b)

x + y = 0.5
0.5 x+y =1

x
0.5 1

Page 8
Orange region will denote X + Y ≤ 12 . Now,
Z 1/2 Z 1/2−y
1
P (X + Y ≤ ) = fXY (x, y)dxdy
2 y=0 x=0

Z 1/2 Z 1/2−y

= 24xydxdy
y=0 x=0

1/2−y
Z 1/2
2
= 12x y dy
y=0
x=0

Z 1/2  2
1
= 12y −y dy
y=0 2

Z 1/2
12
= y(1 − 2y)2 dy
y=0 4

Z 1/2

=3 y(1 + 4y 2 − 4y)dy
y=0

 1/2
y2 4y 3

=3 + y4 −

2 3


y=0

 
1 1 1
=3 + −
8 16 6
2 1
=3× =
96 16

Hence, option (b) is correct.

Option (c) and (d)

Page 9
y

0.5 x+y =1

x
0.5 1

For 0 < x < 1


Z 1−x
fX (x) = fXY (x, y)dy
y=0
Z 1−x
= 24xydy
y=0
1−x

2
= 12xy

y=0
= 12x(1 − x)2

For 0 < y < 1


Z 1−y
fY (y) = fXY (x, y)dx
Zx=0
1−y
= 24xydx
0
1−y

= 12x2 y


x=0
= 12y(1 − y)2

Therefore, fX (x).fY (y) = 144xy(1 − x)2 (1 − y)2 6= fXY (x, y)

Hence, X and Y are not independent.

Page 10
7. The joint pdf of two random variables X and Y is given by
(
3xy(1 − x) 0 ≤ x ≤ 1, 0 ≤ y ≤ 2
fXY (x, y) =
0 otherwise

Calculate P (X > 12 |Y = 1).


Solution:
We know that
fXY (a < X < b, y)
P (a < X < b|Y = y) =
fY (y)
Now,
Z 1
fY (y) = 3xy(1 − x)dx
0
Z 1
= (3xy − 3x2 y)dx
0
 2  1
3x y
= − x3 y

2
0
3y y
= −y =
2 2
1
Therefore, fY (1) = 2
Now,

1 fXY (X > 12 , Y = 1)
P (X > |Y = 1) =
2 fY (1)
1
= 2fXY (X > , Y = 1)
2
Z 1
= 2(3x(1 − x))dx
x= 12
Z 1
=6 (x − x2 )dx
1
2
 1
x2 x3

=6 −
2 3 1

  2 
1 1 1 1 1 1
=6 − −6 − =1− =
2 3 8 24 2 2

8. The amount of milk (in litres) in a shop at the beginning of any day is a random amount
X from which a random amount Y (in litres) is sold during that day. Assume that the

Page 11
joint density function of X and Y is given by
(
1
0 ≤ x ≤ 10, 0 ≤ y ≤ x
fXY (x, y) = 50
0 otherwise
Find the probability that amount of milk left at the end of day is less than 5 litres. Write
your answer correct to two decimal points.
Solution:
y
y=x
10

5
x−y =5

x
5 10

X denotes the amount of milk at the beginning of any day and Y denotes the amount
of milk which is sold during that day.
Therefore, amount of milk left at the end of the day will be denoted by X − Y .

To find: P (X − Y < 5)

In the diagram above, brown region denotes X −Y < 5 and brown + blue region denotes
the support of X and Y .

1
Area of the support(X, Y ) = 2
× 10 × 10 = 50.

Area of brown region = Area of support(X, Y )− area of blue region

⇒ area of brown region = 50 − 12 × 5 × 5 = 75


2

Therefore,
area of brown region
P (X − Y < 5) =
area of support
75/2
=
50
75
=
100

Page 12
9. The joint pdf of two continuous random variables X and Y is given by
(
ke−(x+y) x ≥ 0, y ≥ 0
fXY (x, y) =
0 otherwise

Find the value of P (X ≥ 5, Y ≤ 5).

(a) e−10
(b) (e−5 − 1)e−5
(c) (1 − e−5 )e−5
(d) (e−5 + 1)e−5

Solution:
We know that Z Z
fXY dxdy = 1
Supp(X,Y )

Therefore,
Z ∞ Z ∞
(ke−(x+y) )dxdy = 1
y=0 x=0
Z ∞ Z ∞
⇒k e−y e−x dxdy = 1
y=0 x=0
Z ∞ ∞

−y −x
⇒k e (−e ) dy = 1
y=0
0
Z ∞
−y
⇒k e (0 + 1)dy = 1
y=0
Z ∞
⇒k e−y dy = 1
y=0


⇒k(−e−y ) = 1


0
⇒k(0 + 1) = 1
⇒k = 1

To find: P (X ≥ 5, Y ≤ 5)

Page 13
Now,
Z 5 Z ∞
P (X ≥ 5, Y ≤ 5) = (e−(x+y) )dxdy
y=0 x=5
Z 5 Z∞
= e−y e−x dxdy
y=0 x=5
Z 5 ∞

−y −x
= e (−e ) dy
y=0
5
Z 5
= e−y (0 + e−5 )dy
y=0
Z 5
−5
= (e ) e−y dy
y=0
5

−5 −y
= (e )(−e )

0
= (e−5 )(−e−5 + 1)
= (e−5 )(1 − e−5 )

10. The joint pdf of two random variables X and Y is given by


(
1
(x + y) 0 ≤ x ≤ 2, 0 ≤ y ≤ 2
fXY (x, y) = 8
0 otherwise
 
1 1
Find the value of P ≤ y ≤ 1 | (X = ) . Write your answer correct to two decimal
2 2
points.
Solution:
We know that
fXY (X = x, a < Y < b)
P (a < Y < b|X = x) =
fX (x)
Now,
Z 2
1
fX (x) = (x + y)dy
0 8
 2
y 2

1
= xy +
8 2

0
2x + 2 x+1
= =
8 4

Therefore, fX ( 12 ) = 3
8

Page 14
Now,

1 1 fXY (X = 12 , 12 ≤ Y ≤ 1)
P ( ≤ Y ≤ 1|X = ) =
2 2 fX ( 12 )

Z 1   
8 1 1
= + y dy
1/2 3 8 2

Z 1  
1 1
= + y dy
1/2 3 2

 1
y y2

= +

6 6


1/2

   
1 1 1 1
= + − +
6 6 12 24

1 1 5
= − = = 0.20
3 8 24

Page 15

You might also like