Lab Wk8soln PDF
Lab Wk8soln PDF
Lab Wk8soln PDF
## [1] 6.291558
(b) Because the function exp(−x2 ) is symmetric about the origin,
Z ∞ Z ∞
exp(−x2 )dx = 2 exp(−x2 )dx.
−∞ 0
Now,
Z ∞ Z 1 2 !
2 1 1
exp(−x )dx = exp − −1 du
0 0 u2 u
## [1] 1.763603
√
(The true answer is π ≈ 1.77).
(c)
Z 1 Z 1
exp((x + y)2 )dydx = E exp((U1 + U2 )2 )
0 0
## [1] 4.925057
(d) With Iy (x) defined by
1 if y < x
Iy (x) =
0 otherwise
1
we can write
Z ∞ Z x Z ∞ Z ∞
exp(−(x + y))dydx = exp(−(x + y))Iy (x)dydx.
0 0 0 0
Z ∞ Z ∞
exp(−(x + y))Iy (x)dydx =
0 0
Z 1 Z 1
1 1 1 1
exp − + − 2 I 1
u2 −1
− 1 .
0 0 u21 u22 u1 u2 u1
1
Note that I u1 −1 u1 − 1 = Iu1 (u2 ) (since
2
1 1
−1< −1
u2 u1
if and only if u1 < u2 ).
Now approximate the integral:
u1 <- runif(10000)
u2 <- runif(10000)
z1 <- 1 / u1 - 1
z2 <- 1 / u2 - 1
mean(1 / u1 ^ 2 / u2 ^ 2 * exp(-(z1 + z2)) * (u1 < u2))
## [1] 0.5010676
(The true answer is 0.5).
2
y
}
4. Suppose that
F (x) = xn 0 ≤ x ≤ 1
where n is a positive integer. A random variable with density function
nxn−1 0 ≤ x ≤ 1
f (x) =
0 otherwise
Now,
f (x)
max = max f (x) ≤ n.
0≤x≤1 g(x) 0≤x≤1