Introduction One Function of Random Variables
Functions of a Random Variable: Density
Let g(x) = y be a one-to-one function whose derivative is nonzero
Math 425
Intro to Probability
Lecture 30
on some region A of the real line.
Suppose g maps A onto B, so that there is an inverse map
x = h(y ) from B back to A.
Let X be a continuous random variable with known density f (x).
Kenneth Harris
kaharri@[Link]
Let Y = G(X ). Then the density of Y is
Department of Mathematics
University of Michigan
fY (y ) = fX h(y )
d
h(y ) .
dt
April 3, 2009
Note: Compare to Ross, Theorem 5.7.1, page 243.
Kenneth Harris (Math 425)
Math 425 Intro to Probability Lecture 30
April 3, 2009
1 / 32
Kenneth Harris (Math 425)
Two Functions of Two Random Variables
April 3, 2009
3 / 32
Two Functions of Two Random Variables
Problem
Denition Nice Transformations
Let the continuous random variables (X , Y ) have joint density
fX ,Y (x, y ) and let A = {(x, y ) : fX ,Y (x, y ) > 0}.
(X , Y ) determines a point with xy -coordinates in the region A.
Denition
A transformation from xy -coordinates to uv -coordinates (xy uv )
given by
Consider the continuous random variables (U, V ) given by
U = g1 (X , Y )
u = g1 (x, y )
(U, V ) determines a point with uv -coordinates in some region B.
Problem. If the transformation from xy -coordinates to uv -coordinates
given by
u = g1 (x, y )
v = g2 (x, y ).
is nice on A, then we can produce the joint density fU,V (u, v ) for the
random variable (U, V ).
Math 425 Intro to Probability Lecture 30
v = g2 (x, y ).
is nice on A, if
V = g2 (X , Y ).
Kenneth Harris (Math 425)
Math 425 Intro to Probability Lecture 30
April 3, 2009
The partial derivatives u , u , v , and v exist and are continuous
x y x
y
on A.
The Jacobian of the transformation is nonzero on A:
J(x, y ) =
u
x
v
x
u
y
v
y
u v
u v
=0
x y
y x
whenever (x, y ) A.
5 / 32
Kenneth Harris (Math 425)
Math 425 Intro to Probability Lecture 30
April 3, 2009
6 / 32
Two Functions of Two Random Variables
Two Functions of Two Random Variables
Change of coordinates
Jacobians
A nice transformation on A (xy uv ) amounts to simply a change
of coordinates of the plane from xy -coordinates to uv -coordinates.
We can recover the original xy -coordinates from the new
uv -coordinates.
J(x, y ) =
J(u, v ) =
v = g2 (x, y )
to uv -coordinates on a region B.
There is a reverse transformation (uv xy ) from uv -coordinates to
xy -coordinates
x = h1 (u, v )
y = h2 (u, v ).
Math 425 Intro to Probability Lecture 30
u
y
v
y
x
u
y
u
x
v
y
v
u v
u v
x y
y x
x y
x y
u v
v u
Since (xy uv ) is nice on A,
J(x, y ) = 0 whenever (x, y ) A and
J(u, v ) = 0 whenever (u, v ) B.
Furthermore, the two Jacobian determinants are inverses
which maps B onto A and which are also nice on B.
Kenneth Harris (Math 425)
u
x
v
x
The Jacobian of the inverse transformation (uv xy ) is the
determinant
Suppose (xy uv ) is nice transformation on A
u = g1 (x, y )
The Jacobian of the original transformation (xy uv ) is the
determinant
J(x, y ) = J(u, v )1
April 3, 2009
7 / 32
Two Functions of Two Random Variables
Kenneth Harris (Math 425)
Math 425 Intro to Probability Lecture 30
April 3, 2009
8 / 32
Two Functions of Two Random Variables
Main Theorem
Picture of Theorem
Theorem
fU,V (u, v ) du dv P {(U, V ) B}
Let (X , Y ) be continuous random variables with joint density fX ,Y (x, y ), and
(U, V ) be random variables given by
U = g1 (X , Y )
P {(X , Y ) A} fX ,Y (x, y ) J(u, v ) du dv
V = g2 (X , Y ).
Suppose the (xy uv ) transformation
u = g1 (x, y )
UV
v = g2 (x, y ).
P U,V
is nice on A = {(x, y ) : fX ,Y (x, y ) = 0}.
Let the inverse (uv xy ) from B to A be
x = h1 (u, v )
XY
P X,Y
A
B
y = h2 (u, v ).
u,v
The joint density of (U, V ) is given for (u, v ) B by either equation
x,y
dv
du
fU,V (u, v ) = fX ,Y h1 (u, v ), h2 (u, v ) J(u, v )
Area of B
fU,V (u, v ) = fX ,Y h1 (u, v ), h2 (u, v ) J(x, y )1
du dv
Area of A
J u,v
du dv
whichever is more convenient to compute.
Kenneth Harris (Math 425)
Math 425 Intro to Probability Lecture 30
April 3, 2009
9 / 32
Kenneth Harris (Math 425)
Math 425 Intro to Probability Lecture 30
April 3, 2009
10 / 32
Two Functions of Two Random Variables
Example
Sketch of Proof of Theorem
Functions of a Random Variable: Density
Let B B and suppose (uv xy ) maps B to A A.
P {(U, V ) B}
Example. Let X and Y be continuous random variables with joint
density fX ,Y (x, y ) and where X = 0. Consider
= P {(X , Y ) A}
fX ,Y (x, y ) dx dy
U = XY
u = xy
fX ,Y h1 (u, v ), h2 (u, v ) J(u, v ) du dv
=
(u,v )B
using the Change of Variables Theorem of analysis.
Intuitively, we can break B into small regions B which (uv xy )
x =v
fU,V (u, v ) Area B fX ,Y (h1 (u, v ), h2 (u, v )) Area A
where Area A Area B J(u, v ) .
Differentiate the integrals to get the transformation rule:
fU,V (u, v ) =
Kenneth Harris (Math 425)
April 3, 2009
y=
u
.
v
The Jacobian for transformation for (uv xy ) is
if (u, v ) B
otherwise.
Math 425 Intro to Probability Lecture 30
v = x.
The inverse transformation (uv xy ) is given by
transforms to small regions A of A where for any (u, v ) B:
fX ,Y h1 (u, v ), h2 (u, v ) J(u, v )
0
V = X.
The transformation (xy uv ) is given by
(x,y )A
J(u, v ) =
11 / 32
Kenneth Harris (Math 425)
Example
1
1
0
v
=
1 vu2
v
Math 425 Intro to Probability Lecture 30
April 3, 2009
13 / 32
Examples: Polar Coordinates
Functions of a Random Variable: Density
Rectangle to Polar coordinates
So, the joint density is
It iscoordinates r . The transformationrectangular is
often convenient to change from
coordinates xy to
polar
(xy r )
fU,V (u, v ) = fX ,Y h1 (u, v ), h2 (u, v ) J(u, v )
u
1
= fX ,Y v ,
v
|v |
We can compute the marginal f (u) = f
U
fXY (u) =
fX ,Y v ,
XY (u)
r = x2 + y2
where r > 0 and
= arctan
y
.
x
< .
The inverse transformation (r xy ) from polar back to
rectangular is
by
x = r cos
1
u
dv
v
|v |
y = r sin .
The transformation is (xy r ) nice in the punctured plane
R2 {(0, 0)}. Veried in three slides.
Kenneth Harris (Math 425)
Math 425 Intro to Probability Lecture 30
April 3, 2009
14 / 32
Kenneth Harris (Math 425)
Math 425 Intro to Probability Lecture 30
April 3, 2009
16 / 32
Examples: Polar Coordinates
Examples: Polar Coordinates
Converting Rectangle to Polar
Converting Rectangle to Polar
Rectangle xy -coordinates to polar r -coordinates:
y
r = x 2 + y 2, r > 0
= arctan ,
x
Polar r -coordinates to rectangle xy -coordinates
x = r cos
Plot of tan
x,y
on [, ]. The four quadrants of the plane are
I : x, y > 0
< ,
< x, y < .
y = r sin
y
x
II : x < 0, y > 0
II
III
III : x, y < 0
IV : x > 0, y < 0
IV
r,
4
2
r
x2
y2
y rsin
2
4
arctan
y
x
x rcos
Kenneth Harris (Math 425)
Math 425 Intro to Probability Lecture 30
April 3, 2009
17 / 32
Kenneth Harris (Math 425)
Examples: Polar Coordinates
Math 425 Intro to Probability Lecture 30
April 3, 2009
18 / 32
Examples: Polar Coordinates
Problem: Rectangle to Polar
Example
Problem. Let (X , Y ) be randomly chosen in some region R of the
xy -plane with joint density fX ,Y (x, y ).
Consider the random variables giving the polar coordinates
Example. Let (X , Y ) be uniformly distributed in R = unit circle. So,
R=
X2 + Y2
= arctan
fX ,Y (x, y ) =
cos
r sin
fR, (r , ) = r fX ,Y (r cos , r sin ) =
0 < r 1, <
The marginals are
sin
= r cos2 + r sin2 = r
r cos
The joint distribution of R, is
fR, (r , ) = r fX ,Y (r cos , r sin )
when x 2 + y 2 1.
So,
Y
X
where R > 0 and < .
The Jacobian is easiest to compute on the r -plane:
J(r , ) =
fR (r )
f ()
r > 0, < .
=
0
r
d = 2r
0 < r 1,
r
1
dr =
< .
Thus, is uniformly distributed on (, ].
Kenneth Harris (Math 425)
Math 425 Intro to Probability Lecture 30
April 3, 2009
19 / 32
Kenneth Harris (Math 425)
Math 425 Intro to Probability Lecture 30
April 3, 2009
20 / 32
Examples: Polar Coordinates
Examples: Polar Coordinates
Example
Example
Example. Let (X , Y ) be independent and normally distributed in the
plane with ( = 0, 2 ). So,
Example. Let R be exponentially distributed with mean 2 and be
uniformly distributed in (, ], both independent. The joint distribution
is
fX ,Y (x, y ) =
Since f
R, (r , )
2
2
2
1
e(x +y )/2
2
2
The marginals are
f () =
2
2
r
er /2 d =
2 2
2
2
r
er /2 dr =
2
2
0
0 < r , < .
Math 425 Intro to Probability Lecture 30
April 3, 2009
Y = R sin
Solve for r , in the transformation x = 2r cos and y = 2r sin :
J(r , ) =
21 / 32
= arctan
y
.
x
Kenneth Harris (Math 425)
cos
2
r
r sin
sin
2 r
r cos
cos2 sin2
1
+
= .
2
2
2
Math 425 Intro to Probability Lecture 30
April 3, 2009
22 / 32
April 3, 2009
24 / 32
Examples: Polar Coordinates
Example continued
So,
R cos
The Jacobian determinant is easiest to compute using r -coordinates:
Examples: Polar Coordinates
fR, (r , ) =
0 < r , <
X =
r = x2 + y2
r r 2 /22
e
0 < r,
2
1
< .
2
Thus, is uniformly distributed on (, ] and R is the Rayleigh
distribution (the distance of (X , Y ) from the origin).
Kenneth Harris (Math 425)
1 1 r /2
e
2 2
Let X and Y be random variables determined by
= r fX ,Y (r cos , r sin ),
2
2
2
2
2
2
2
r
r
e(r cos +r sin )/2 =
er /2
fR, (r , ) =
2
2
2
2
fR (r ) =
fR, (r , ) =
Examplecontinued
1 1 r /2
e
2 2
Let U and V be uniformly distributed on (0, 1).
Consider the random variable :
0 < r , <
= 2V
fX ,Y (x, y )
=
=
y
fR, (x 2 + y 2 , arctan ) 2
x
1 (x 2 +y 2 )/2
e
2
So, is uniformly distributed on (, ).
Consider the random variable R:
X and Y are independent and normally distributed random
variables with ( = 0, 2 = 1). The marginals are obtained by
integrating fX ,Y (x, y ):
fX (x)
fY (y )
Kenneth Harris (Math 425)
=
=
R = 2 ln
solving, u = er /2 .
By Proposition 5.7.1 (Ross, page 243),
2
1
ex /2
2
2
1
ey /2
2
Math 425 Intro to Probability Lecture 30
1
U
fR (r ) = fU (er /2 ) u =
1 r /2
e
2
So, R is exponentially distributed with mean 2.
April 3, 2009
23 / 32
Kenneth Harris (Math 425)
Math 425 Intro to Probability Lecture 30
Examples: Polar Coordinates
Examples: Polar Coordinates
Example continued
Converting Rectangle to Polar
Let X and Y be random variables determined by
Simulating a standard normal random variable with a pair of independent
X =
uniform random variables on (0, 1).
R cos
Y =
R sin
Then X and Y are independent standard normal random variables!!
We can simulate a standard normal random variable X by using two
independent uniform random variables U and V on (0, 1):
X =
Kenneth Harris (Math 425)
2 ln
1
cos 2V .
U
Math 425 Intro to Probability Lecture 30
April 3, 2009
25 / 32
1000 data points
0.5
0.4
0.3
0.2
0.1
0.0
1 0
Kenneth Harris (Math 425)
Example of Joint Distribution
10,000 data points
0.5
0.4
0.3
0.2
0.1
0.0
1 0
Math 425 Intro to Probability Lecture 30
April 3, 2009
26 / 32
Example of Joint Distribution
Example
Example continued
The transformation into uv -coordinates
Example. Let X and Y be independent and uniformly distributed on
(0, 1]. Find the joint probability density function for the random
variables
U=
X
Y
u=
1
0
if 0 x 1
otherwise
fY (y ) =
x=
1
0
So, the joint distribution fX ,Y (x, y ) is
fX ,Y (x, y ) = fX (x) fY (y ) =
Kenneth Harris (Math 425)
So, u, v > 0 and
if 0 x, y 1
otherwise.
Math 425 Intro to Probability Lecture 30
fU,V (u, v ) = fX ,Y
April 3, 2009
uv
v
.
u
y=
The Jacobian determinant is easiest when computed in xy
coordinates:
if 0 y 1
otherwise
J(x, y ) =
1
0
v = xy ,
is one-to-one and has an inverse
V = XY .
Individually, the distribution of X and Y are
fX (x) =
x
y
28 / 32
Kenneth Harris (Math 425)
uv ,
1
y
x
yx2
= 2 = 2u
y
x
v
1
=
u
2u
1
2u
if 0 <
otherwise.
Math 425 Intro to Probability Lecture 30
uv ,
v
u
April 3, 2009
29 / 32
Example of Joint Distribution
Example of Joint Distribution
Example continued
Example continued
It remains to compute the bounds on u and v .
0<
uv ,
fU,V (u, v ) =
v
1
1 = 0 < v , 0 < v u.
u
u
We compute the marginals.
Only one of these ranges need be retained, depending upon whether
u (0, 1] or u [1, ):
fU (u) =
fU,V (u, v ) =
1
2u
if 0 < u < 1, 0 < v u,
1
or, if u 1, 0 < v u ,
otherwise.
April 3, 2009
30 / 32
Example of Joint Distribution
Example continued
Plot of area determined by
and
u 1 = 0 < v
1
.
u
v
1.0
0.8
0.6
1
v
0.4
0.2
1
Kenneth Harris (Math 425)
Math 425 Intro to Probability Lecture 30
u 1
dv
0 2u
1
u 1
dv
0 2u
1
v
Math 425 Intro to Probability Lecture 30
0 < u < 1 = 0 < v u
fv (v )
Kenneth Harris (Math 425)
1
2u
u
April 3, 2009
32 / 32
Kenneth Harris (Math 425)
1
2u
du
if 0 < u < 1, 0 < v u,
1
or, if u 1, 0 < v u ,
otherwise.
if 0 < u < 1
if u 1
otherwise
1 dv
2
1
= 2u 2 dv
if 0 < v 1
=
otherwise
1
ln v
0
Math 425 Intro to Probability Lecture 30
if 0 < u < 1
if u 1
otherwise
if 0 < v 1
otherwise
April 3, 2009
31 / 32