# Connexions

You are here: Home » Content » Applied Probability » Function of Random Vectors

• Preface to Pfeiffer Applied Probability

### Lenses

What is a lens?

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

#### Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
• Rice Digital Scholarship

This collection is included in aLens by: Digital Scholarship at Rice University

Click the "Rice Digital Scholarship" link to see all content affiliated with them.

#### Also in these lenses

• UniqU content

This collection is included inLens: UniqU's lens
By: UniqU, LLC

Click the "UniqU content" link to see all content selected in this lens.

### Recently Viewed

This feature requires Javascript to be enabled.

Inside Collection:

Collection by: Paul E Pfeiffer. E-mail the author

# Function of Random Vectors

Module by: Paul E Pfeiffer. E-mail the author

Summary: For a pair {X, Y} having joint distribution on the plane, the approach is analogous to the single variable case. To find the probability an absolutely continuous pair takes on values in a set Q on the plane, integrate the joint density over the set. In the discrete case, identify those pairs of values which meet the defining conditions for Q and add the associated probabilities. To find the probability that g(X, Y ) takes on a a value in set M, determine the set Q of those pairs (t, u) mapped into M by the function g and then determine, as in the previous case, the probability the pair {X, Y} takes on values in Q.

Introduction

The general mapping approach for a single random variable and the discrete alternative extends to functions of more than one variable. It is convenient to consider the case of two random variables, considered jointly. Extensions to more than two random variables are made similarly, although the details are more complicated.

## The general approach extended to a pair

Consider a pair {X,Y}{X,Y} having joint distribution on the plane. The approach is analogous to that for a single random variable with distribution on the line.

1. To find P((X,Y)Q)P((X,Y)Q).
1. Mapping approach. Simply find the amount of probability mass mapped into the set Q on the plane by the random vector W=(X,Y)W=(X,Y).
• In the absolutely continuous case, calculate QfXYQfXY.
• In the discrete case, identify those vector values (ti,uj)(ti,uj) of (X,Y)(X,Y) which are in the set Q and add the associated probabilities.
2. Discrete alternative. Consider each vector value (ti,uj)(ti,uj) of (X,Y)(X,Y). Select those which meet the defining conditions for Q and add the associated probabilities. This is the approach we use in the MATLAB calculations. It does not require that we describe geometrically the region Q.
2. To find P(g(X,Y)M)P(g(X,Y)M). g is real valued and M is a subset the real line.
1. Mapping approach. Determine the set Q of all those (t,u)(t,u) which are mapped into M by the function g. Now
W(ω)=(X(ω),Y(ω))Qiffg((X(ω),Y(ω))MHenceW(ω)=(X(ω),Y(ω))Qiffg((X(ω),Y(ω))MHence
(1)
{ω:g(X(ω),Y(ω))M}={ω:(X(ω),Y(ω))Q}{ω:g(X(ω),Y(ω))M}={ω:(X(ω),Y(ω))Q}
(2)
Since these are the same event, they must have the same probability. Once Q is identified on the plane, determine P((X,Y)Q)P((X,Y)Q) in the usual manner (see part a, above).
2. Discrete alternative. For each possible vector value (ti,uj)(ti,uj) of (X,Y)(X,Y), determine whether g(ti,uj)g(ti,uj) meets the defining condition for M. Select those (ti,uj)(ti,uj) which do and add the associated probabilities.

We illustrate the mapping approach in the absolutely continuous case. A key element in the approach is finding the set Q on the plane such that g(X,Y)Mg(X,Y)M iff (X,Y)Q(X,Y)Q. The desired probability is obtained by integrating fXYfXY over Q.

### Example 1: A numerical example

The pair {X,Y}{X,Y} has joint density fXY(t,u)=637(t+2u)fXY(t,u)=637(t+2u) on the region bounded by t=0t=0, t=2t=2, u=0u=0, u=max{1,t}u=max{1,t} (see Figure 1). Determine P(YX)=P(X-Y0)P(YX)=P(X-Y0). Here g(t,u)=t-ug(t,u)=t-u and M=[0,)M=[0,). Now Q={(t,u):t-u0}={(t,u):ut}Q={(t,u):t-u0}={(t,u):ut} which is the region on the plane on or below the line u=tu=t. Examination of the figure shows that for this region, fXYfXY is different from zero on the triangle bounded by t=2t=2, u=0u=0, and u=tu=t. The desired probability is

P ( Y X ) = 0 2 0 t 6 37 ( t + 2 u ) d u d t = 32 / 37 0 . 8649 P ( Y X ) = 0 2 0 t 6 37 ( t + 2 u ) d u d t = 32 / 37 0 . 8649
(3)

### Example 2: The density for the sum X+YX+Y

Suppose the pair {X,Y}{X,Y} has joint density fXYfXY. Determine the density for

Z = X + Y Z = X + Y
(4)

SOLUTION

F Z ( v ) = P ( X + Y v ) = P ( ( X , Y ) Q v ) where Q v = { ( t , u ) : t + u v } = { ( t , u ) : u v - t } F Z ( v ) = P ( X + Y v ) = P ( ( X , Y ) Q v ) where Q v = { ( t , u ) : t + u v } = { ( t , u ) : u v - t }
(5)

For any fixed v, the region Qv is the portion of the plane on or below the line u=v-tu=v-t (see Figure 2). Thus

F Z ( v ) = Q v f X Y = - - v - t f X Y ( t , u ) d u d t F Z ( v ) = Q v f X Y = - - v - t f X Y ( t , u ) d u d t
(6)

Differentiating with the aid of the fundamental theorem of calculus, we get

f Z ( v ) = f X Y ( t , v - t ) d t f Z ( v ) = f X Y ( t , v - t ) d t
(7)

This integral expresssion is known as a convolution integral.

### Example 3: Sum of joint uniform random variables

Suppose the pair {X,Y}{X,Y} has joint uniform density on the unit square 0t10t1, 0u10u1. Determine the density for Z=X+YZ=X+Y.

SOLUTION

FZ(v)FZ(v) is the probability in the region Qv:uv-tQv:uv-t. Now PXY(Qv)=1-PXY(Qvc)PXY(Qv)=1-PXY(Qvc), where the complementary set Qvc is the set of points above the line. As Figure 3 shows, for v1v1, the part of Qv which has probability mass is the lower shaded triangular region on the figure, which has area (and hence probability) v2/2v2/2. For v>1v>1, the complementary region Qvc is the upper shaded region. It has area (2-v)2/2(2-v)2/2. so that in this case,

PXY(Qv)=1-(2-v)2/2PXY(Qv)=1-(2-v)2/2. Thus,

F Z ( v ) = v 2 2 for 0 v 1 and F Z ( v ) = 1 - ( 2 - v ) 2 2 for 1 v 2 F Z ( v ) = v 2 2 for 0 v 1 and F Z ( v ) = 1 - ( 2 - v ) 2 2 for 1 v 2
(8)

Differentiation shows that Z has the symmetric triangular distribution on [0,2][0,2], since

f Z ( v ) = v for 0 v 1 and f Z ( v ) = ( 2 - v ) for 1 v 2 f Z ( v ) = v for 0 v 1 and f Z ( v ) = ( 2 - v ) for 1 v 2
(9)

With the use of indicator functions, these may be combined into a single expression

f Z ( v ) = I [ 0 , 1 ] ( v ) v + I ( 1 , 2 ] ( v ) ( 2 - v ) f Z ( v ) = I [ 0 , 1 ] ( v ) v + I ( 1 , 2 ] ( v ) ( 2 - v )
(10)

ALTERNATE SOLUTION

Since fXY(t,u)=I[0,1](t)I[0,1](u)fXY(t,u)=I[0,1](t)I[0,1](u), we have fXY(t,v-t)=I[0,1](t)I[0,1](v-t)fXY(t,v-t)=I[0,1](t)I[0,1](v-t). Now 0v-t10v-t1 iff v-1tvv-1tv, so that

f X Y ( t , v - t ) = I [ 0 , 1 ] ( v ) I [ 0 , v ] ( t ) + I ( 1 , 2 ] ( v ) I [ v - 1 , 1 ] ( t ) f X Y ( t , v - t ) = I [ 0 , 1 ] ( v ) I [ 0 , v ] ( t ) + I ( 1 , 2 ] ( v ) I [ v - 1 , 1 ] ( t )
(11)

Integration with respect to t gives the result above.

Independence of functions of independent random variables

Suppose {X,Y}{X,Y} is an independent pair. Let Z=g(X),W=h(Y)Z=g(X),W=h(Y). Since

Z - 1 ( M ) = X - 1 [ g - 1 ( M ) ] and W - 1 ( N ) = Y - 1 [ h - 1 ( N ) Z - 1 ( M ) = X - 1 [ g - 1 ( M ) ] and W - 1 ( N ) = Y - 1 [ h - 1 ( N )
(12)

the pair {Z-1(M),W-1(N)}{Z-1(M),W-1(N)} is independent for each pair {M,N}{M,N}. Thus, the pair {Z,W}{Z,W} is independent.

If {X,Y}{X,Y} is an independent pair and Z=g(X),W=h(Y)Z=g(X),W=h(Y), then the pair {Z,W}{Z,W} is independent. However, if Z=g(X,Y)Z=g(X,Y) and W=h(X,Y)W=h(X,Y), then in general {Z,W}{Z,W} is not independent. This is illustrated for simple random variables with the aid of the m-procedure jointzw at the end of the next section.

### Example 4: Independence of simple approximations to an independent pair

Suppose {X,Y}{X,Y} is an independent pair with simple approximations Xs and Ys as described in Distribution Approximations.

X s = i = 1 n t i I E i = i = 1 n t i I M i ( X ) and Y s = j = 1 m u j I F j = j = 1 m u j I N j ( Y ) X s = i = 1 n t i I E i = i = 1 n t i I M i ( X ) and Y s = j = 1 m u j I F j = j = 1 m u j I N j ( Y )
(13)

As functions of X and Y, respectively, the pair {Xs,Ys}{Xs,Ys} is independent. Also each pair {IMi(X),INj(Y)}{IMi(X),INj(Y)} is independent.

## Use of MATLAB on pairs of simple random variables

In the single-variable case, we use array operations on the values of X to determine a matrix of values of g(X)g(X). In the two-variable case, we must use array operations on the calculating matrices t and u to obtain a matrix G whose elements are g(ti,uj)g(ti,uj). To obtain the distribution for Z=g(X,Y)Z=g(X,Y), we may use the m-function csort on G and the joint probability matrix P. A first step, then, is the use of jcalc or icalc to set up the joint distribution and the calculating matrices. This is illustrated in the following example.

### Example 5

% file jdemo3.m
% data for joint simple distribution
X = [-4 -2 0 1 3];
Y = [0 1 2 4];
P = [0.0132    0.0198    0.0297    0.0209    0.0264;
0.0372    0.0558    0.0837    0.0589    0.0744;
0.0516    0.0774    0.1161    0.0817    0.1032;
0.0180    0.0270    0.0405    0.0285    0.0360];
jdemo3                % Call for data
jcalc                 % Set up of calculating matrices t, u.
Enter JOINT PROBABILITIES (as on the plane)  P
Enter row matrix of VALUES of X  X
Enter row matrix of VALUES of Y  Y
Use array operations on matrices X, Y, PX, PY, t, u, and P
G = t.^2 -3*u;        % Formation of G = [g(ti,uj)]
M = G >= 1;           % Calculation using the XY distribution
PM = total(M.*P)      % Alternately, use total((G>=1).*P)
PM =  0.4665
[Z,PZ] = csort(G,P);
PM = (Z>=1)*PZ'     % Calculation using the Z distribution
PM =  0.4665
disp([Z;PZ]')         % Display of the Z distribution
-12.0000    0.0297
-11.0000    0.0209
-8.0000    0.0198
-6.0000    0.0837
-5.0000    0.0589
-3.0000    0.1425
-2.0000    0.1375
0    0.0405
1.0000    0.1059
3.0000    0.0744
4.0000    0.0402
6.0000    0.1032
9.0000    0.0360
10.0000    0.0372
13.0000    0.0516
16.0000    0.0180


We extend the example above by considering a function W=h(X,Y)W=h(X,Y) which has a composite definition.

### Example 6: Continuation of Example 5

Let

W = X for X + Y 1 X 2 + Y 2 for X + Y < 1 Determine the distribution for W W = X for X + Y 1 X 2 + Y 2 for X + Y < 1 Determine the distribution for W
(14)
H = t.*(t+u>=1) + (t.^2 + u.^2).*(t+u<1);  % Specification of h(t,u)

[W,PW] = csort(H,P);                       % Distribution for W = h(X,Y)
disp([W;PW]')
-2.0000    0.0198
0    0.2700
1.0000    0.1900
3.0000    0.2400
4.0000    0.0270
5.0000    0.0774
8.0000    0.0558
16.0000    0.0180
17.0000    0.0516
20.0000    0.0372
32.0000    0.0132
ddbn                                        % Plot of distribution function
Enter row matrix of values  W
Enter row matrix of probabilities  PW
print                                       % See Figure 4


Joint distributions for two functions of ( X , Y ) ( X , Y )

In previous treatments, we use csort to obtain the marginal distribution for a single function Z=g(X,Y)Z=g(X,Y). It is often desirable to have the joint distribution for a pair Z=g(X,Y)Z=g(X,Y) and W=h(X,Y)W=h(X,Y). As special cases, we may have Z=XZ=X or W=YW=Y. Suppose

Z has values [ z 1 z 2 z c ] and W has values [ w 1 w 2 w r ] Z has values [ z 1 z 2 z c ] and W has values [ w 1 w 2 w r ]
(15)

The joint distribution requires the probability of each pair, P(W=wi,Z=zj)P(W=wi,Z=zj). Each such pair of values corresponds to a set of pairs of X and Y values. To determine the joint probability matrix PZWPZW for (Z,W)(Z,W) arranged as on the plane, we assign to each position (i,j)(i,j) the probability P(W=wi,Z=zj)P(W=wi,Z=zj), with values of W increasing upward. Each pair of (W,Z)(W,Z) values corresponds to one or more pairs of (Y,X)(Y,X) values. If we select and add the probabilities corresponding to the latter pairs, we have P(W=wi,Z=zj)P(W=wi,Z=zj). This may be accomplished as follows:

1. Set up calculation matrices t and u as with jcalc.
2. Use array arithmetic to determine the matrices of values G=[g(t,u)]G=[g(t,u)] and H=[h(t,u)]H=[h(t,u)].
3. Use csort to determine the Z and W value matrices and the PZPZ and PWPW marginal probability matrices.
4. For each pair (wi,zj)(wi,zj), use the MATLAB function find to determine the positions a for which
(H==W(i))&(G==Z(j))(H==W(i))&(G==Z(j))
(16)
5. Assign to the (i,j)(i,j) position in the joint probability matrix PZWPZW for (Z,W)(Z,W) the probability
PZW(i,j)=total(P(a))PZW(i,j)=total(P(a))
(17)

We first examine the basic calculations, which are then implemented in the m-procedure jointzw.

### Example 7: Illustration of the basic joint calculations

% file jdemo7.m
P = [0.061  0.030  0.060  0.027  0.009;
0.015  0.001  0.048  0.058  0.013;
0.040  0.054  0.012  0.004  0.013;
0.032  0.029  0.026  0.023  0.039;
0.058  0.040  0.061  0.053  0.018;
0.050  0.052  0.060  0.001  0.013];
X = -2:2;
Y = -2:3;
jdemo7                      % Call for data in jdemo7.m
jcalc                       % Used to set up calculation matrices t, u
- - - - - - - - - -
H = u.^2                    % Matrix of values for W = h(X,Y)
H =
9     9     9     9     9
4     4     4     4     4
1     1     1     1     1
0     0     0     0     0
1     1     1     1     1
4     4     4     4     4
G = abs(t)                  % Matrix of values for Z = g(X,Y)

G =
2     1     0     1     2
2     1     0     1     2
2     1     0     1     2
2     1     0     1     2
2     1     0     1     2
2     1     0     1     2
[W,PW] = csort(H,P)         % Determination of marginal for W
W =     0     1     4     9
PW =    0.1490    0.3530    0.3110    0.1870
[Z,PZ] = csort(G,P)         % Determination of marginal for Z
Z =     0     1     2
PZ =    0.2670    0.3720    0.3610
r = W(3)                    % Third value for W
r =   4
s = Z(2)                    % Second value for Z
s =   1


To determine P(W=4,Z=1)P(W=4,Z=1), we need to determine the (t,u)(t,u) positions for which this pair of (W,Z)(W,Z) values is taken on. By inspection, we find these to be (2,2), (6,2), (2,4), and (6,4). Then P(W=4,Z=1)P(W=4,Z=1) is the total probability at these positions. This is 0.001 + 0.052 + 0.058 + 0.001 = 0.112. We put this probability in the joint probability matrix PZWPZW at the W=4,Z=1W=4,Z=1 position. This may be achieved by MATLAB with the following operations.

[i,j] = find((H==W(3))&(G==Z(2)));  % Location of (t,u) positions
disp([i j])                         % Optional display of positions
2     2
6     2
2     4
6     4
a = find((H==W(3))&(G==Z(2)));      % Location in more convenient form
P0 = zeros(size(P));                % Setup of zero matrix
P0(a) = P(a)                        % Display of designated probabilities in P
P0 =
0         0         0         0         0
0    0.0010         0    0.0580         0
0         0         0         0         0
0         0         0         0         0
0         0         0         0         0
0    0.0520         0    0.0010         0
PZW = zeros(length(W),length(Z))    % Initialization of PZW matrix
PZW(3,2) = total(P(a))              % Assignment to PZW matrix with
PZW =    0         0         0      % W increasing downward
0         0         0
0    0.1120         0
0         0         0

PZW = flipud(PZW)                   % Assignment with W increasing upward
PZW =
0         0         0
0    0.1120         0
0         0         0
0         0         0


The procedure jointzw carries out this operation for each possible pair of W and Z values (with the flipud operation coming only after all individual assignments are made).

### Example 8: Joint distribution for Z=g(X,Y)=||X|-Y|Z=g(X,Y)=||X|-Y| and W = h ( X , Y ) = | X Y | W = h ( X , Y ) = | X Y |

% file jdemo3.m   data for joint simple distribution
X = [-4 -2 0 1 3];
Y = [0 1 2 4];
P = [0.0132    0.0198    0.0297    0.0209    0.0264;
0.0372    0.0558    0.0837    0.0589    0.0744;
0.0516    0.0774    0.1161    0.0817    0.1032;
0.0180    0.0270    0.0405    0.0285    0.0360];
jdemo3          % Call for data
jointzw         % Call for m-program
Enter joint prob for (X,Y): P
Enter values for X: X
Enter values for Y: Y
Enter expression for g(t,u): abs(abs(t)-u)
Enter expression for h(t,u): abs(t.*u)
Use array operations on Z, W, PZ, PW, v, w, PZW
disp(PZW)
0.0132         0         0         0         0
0    0.0264         0         0         0
0         0    0.0570         0         0
0    0.0744         0         0         0
0.0558         0         0    0.0725         0
0         0    0.1032         0         0
0    0.1363         0         0         0
0.0817         0         0         0         0
0.0405    0.1446    0.1107    0.0360    0.0477
EZ = total(v.*PZW)
EZ =   1.4398

ez = Z*PZ'       % Alternate, using marginal dbn
ez =   1.4398
EW = total(w.*PZW)
EW =   2.6075
ew = W*PW'       % Alternate, using marginal dbn
ew =   2.6075
M = v > w;           % P(Z>W)
PM = total(M.*PZW)
PM =   0.3390


At noted in the previous section, if {X,Y}{X,Y} is an independent pair and Z=g(X)Z=g(X),

W=h(Y)W=h(Y), then the pair {Z,W}{Z,W} is independent. However, if Z=g(X,Y)Z=g(X,Y) and

W=h(X,Y)W=h(X,Y), then in general the pair {Z,W}{Z,W} is not independent. We may illustrate this with the aid of the m-procedure jointzw

### Example 9: Functions of independent random variables

jdemo3
itest
Enter matrix of joint probabilities  P
The pair {X,Y} is independent           % The pair {X,Y} is independent
jointzw
Enter joint prob for (X,Y): P
Enter values for X: X
Enter values for Y: Y
Enter expression for g(t,u): t.^2 - 3*t  % Z = g(X)
Enter expression for h(t,u): abs(u) + 3  % W = h(Y)
Use array operations on Z, W, PZ, PW, v, w, PZW
itest
Enter matrix of joint probabilities  PZW
The pair {X,Y} is independent           % The pair {g(X),h(Y)} is independent
jdemo3                                  % Refresh data
jointzw
Enter joint prob for (X,Y): P
Enter values for X: X
Enter values for Y: Y
Enter expression for g(t,u): t+u         % Z = g(X,Y)
Enter expression for h(t,u): t.*u        % W = h(X,Y)
Use array operations on Z, W, PZ, PW, v, w, PZW

itest
Enter matrix of joint probabilities  PZW
The pair {X,Y} is NOT independent  % The pair {g(X,Y),h(X,Y)} is not indep
To see where the product rule fails, call for D  % Fails for all pairs


## Absolutely continuous case: analysis and approximation

As in the analysis Joint Distributions, we may set up a simple approximation to the joint distribution and proceed as for simple random variables. In this section, we solve several examples analytically, then obtain simple approximations.

### Example 10: Distribution for a product

Suppose the pair {X,Y}{X,Y} has joint density fXYfXY. Let Z=XYZ=XY. Determine Qv such that P(Zv)=P(X,Y)QvP(Zv)=P(X,Y)Qv.

SOLUTION (see Figure 5)

Q v = { ( t , u ) : t u v } = { ( t , u ) : t > 0 , u v / t } { ( t , u ) : t < 0 , u v / t } } Q v = { ( t , u ) : t u v } = { ( t , u ) : t > 0 , u v / t } { ( t , u ) : t < 0 , u v / t } }
(18)

### Example 11

{X,Y}{X,Y} uniform on unit square

fXY(t,u)=1,0t1,0u1fXY(t,u)=1,0t1,0u1. Then (see Figure 6)

P ( X Y v ) = Q v 1 d u d t where Q v = { ( t , u ) : 0 t 1 , 0 u min { 1 , v / t } } P ( X Y v ) = Q v 1 d u d t where Q v = { ( t , u ) : 0 t 1 , 0 u min { 1 , v / t } }
(19)

Integration shows

F Z ( v ) = P ( X Y v ) = v 1 - ln ( v ) so that f Z ( v ) = - ln ( v ) = ln ( 1 / v ) , 0 < v 1 F Z ( v ) = P ( X Y v ) = v 1 - ln ( v ) so that f Z ( v ) = - ln ( v ) = ln ( 1 / v ) , 0 < v 1
(20)

For v=0.5,FZ(0.5)=0.8466v=0.5,FZ(0.5)=0.8466.

% Note that although f = 1, it must be expressed in terms of t, u.
tuappr
Enter matrix [a b] of X-range endpoints  [0 1]
Enter matrix [c d] of Y-range endpoints  [0 1]
Enter number of X approximation points  200
Enter number of Y approximation points  200
Enter expression for joint density  (u>=0)&(t>=0)
Use array operations on X, Y, PX, PY, t, u, and P
G = t.*u;

[Z,PZ] = csort(G,P);
p = (Z<=0.5)*PZ'
p =  0.8465                 % Theoretical value 0.8466, above


### Example 12: Continuation of Example 5 from "Random Vectors and Joint Distributions"

The pair {X,Y}{X,Y} has joint density fXY(t,u)=637(t+2u)fXY(t,u)=637(t+2u) on the region bounded by t=0t=0, t=2t=2, u=0u=0, and u=max{1,t}u=max{1,t} (see Figure 7). Let Z=XYZ=XY. Determine P(Z1)P(Z1).

ANALYTIC SOLUTION

P ( Z 1 ) = P ( X , Y ) Q where Q = { ( t , u ) : u 1 / t } P ( Z 1 ) = P ( X , Y ) Q where Q = { ( t , u ) : u 1 / t }
(21)

Reference to Figure 7 shows that

P ( X , Y ) Q = 6 37 0 1 0 1 ( t + 2 u ) d u d t + 6 37 1 2 0 1 / t ( t + 2 u ) d u d t = 9 / 37 + 9 / 37 = 18 / 37 0 . 4865 P ( X , Y ) Q = 6 37 0 1 0 1 ( t + 2 u ) d u d t + 6 37 1 2 0 1 / t ( t + 2 u ) d u d t = 9 / 37 + 9 / 37 = 18 / 37 0 . 4865
(22)

APPROXIMATE SOLUTION

tuappr
Enter matrix [a b] of X-range endpoints  [0 2]
Enter matrix [c d] of Y-range endpoints  [0 2]
Enter number of X approximation points  300
Enter number of Y approximation points  300
Enter expression for joint density  (6/37)*(t + 2*u).*(u<=max(t,1))
Use array operations on X, Y, PX, PY, t, u, and P
Q = t.*u<=1;
PQ = total(Q.*P)
PQ =  0.4853             % Theoretical value 0.4865, above
G = t.*u;                % Alternate, using the distribution for Z
[Z,PZ] = csort(G,P);
PZ1 = (Z<=1)*PZ'
PZ1 = 0.4853


In the following example, the function g has a compound definition. That is, it has a different rule for different parts of the plane.

### Example 13: A compound function

The pair {X,Y}{X,Y} has joint density fXY(t,u)=23(t+2u)fXY(t,u)=23(t+2u) on the unit square 0t1,0u10t1,0u1.

Z = Y for X 2 - Y 0 X + Y for X 2 - Y < 0 = I Q ( X , Y ) Y + I Q c ( X , Y ) ( X + Y ) Z = Y for X 2 - Y 0 X + Y for X 2 - Y < 0 = I Q ( X , Y ) Y + I Q c ( X , Y ) ( X + Y )
(23)

for Q={(t,u):ut2}Q={(t,u):ut2}. Determine P(Z<=0.5)P(Z<=0.5).

ANALYTICAL SOLUTION

P ( Z 1 / 2 ) = P ( Y 1 / 2 , Y X 2 ) + P ( X + Y 1 / 2 , Y > X 2 ) = P ( X , Y ) Q A Q B P ( Z 1 / 2 ) = P ( Y 1 / 2 , Y X 2 ) + P ( X + Y 1 / 2 , Y > X 2 ) = P ( X , Y ) Q A Q B
(24)

where QA={(t,u):u1/2,ut2}QA={(t,u):u1/2,ut2} and QB={(t,u):t+u1/2,u>t2}QB={(t,u):t+u1/2,u>t2}. Reference to Figure 8 shows that this is the part of the unit square for which umin(max(1/2-t,t2),1/2)umin(max(1/2-t,t2),1/2). We may break up the integral into three parts. Let 1/2-t1=t121/2-t1=t12 and t22=1/2t22=1/2. Then

P ( Z 1 / 2 ) = 2 3 0 t 1 0 1 / 2 - t ( t + 2 u ) d u d t + 2 3 t 1 t 2 0 t 2 ( t + 2 u ) d u d t + 2 3 t 2 1 0 1 / 2 ( t + 2 u ) d u d t = 0 . 2322 P ( Z 1 / 2 ) = 2 3 0 t 1 0 1 / 2 - t ( t + 2 u ) d u d t + 2 3 t 1 t 2 0 t 2 ( t + 2 u ) d u d t + 2 3 t 2 1 0 1 / 2 ( t + 2 u ) d u d t = 0 . 2322
(25)

APPROXIMATE SOLUTION

tuappr
Enter matrix [a b] of X-range endpoints  [0 1]
Enter matrix [c d] of Y-range endpoints  [0 1]
Enter number of X approximation points  200
Enter number of Y approximation points  200
Enter expression for joint density  (2/3)*(t + 2*u)
Use array operations on X, Y, PX, PY, t, u, and P
Q = u <= t.^2;
G = u.*Q + (t + u).*(1-Q);
prob = total((G<=1/2).*P)
prob =  0.2328          % Theoretical is 0.2322, above


The setup of the integrals involves careful attention to the geometry of the system. Once set up, the evaluation is elementary but tedious. On the other hand, the approximation proceeds in a straightforward manner from the normal description of the problem. The numerical result compares quite closely with the theoretical value and accuracy could be improved by taking more subdivision points.

## Content actions

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

#### Collection to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

#### Module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks