Functions on two random variables

01 Theory

Theory 1

PMF of (any) function of two discrete variables

Suppose W=g(X,Y) and X,Y are discrete RVs.

The PMF of W:

PW(w)=g(x,y)=w(x,y) s.t.PX,Y(x,y)

CDF of (continuous) function of two continuous variables

Suppose W=g(X,Y) and X,Y are continuous RVs, and g is a continuous function.

The CDF of W:

FW(w)=P[Ww]=g(x,y)wfX,Y(x,y)dxdy

If desired, one can then compute the PDF of W by differentiating the continuous CDF:

fW(w)=ddwFW(w)Link to original

02 Illustration

Exercise - PMF of XY2 from chart

PMF of XY squared from chart

Suppose the joint PMF of X and Y is given by this chart:

YX12
10.20.2
00.350.1
10.050.1

Define W=XY2.

(a) Find the PMF PW(w).

(b) Find the expectation E[W].

Link to original

Example - Max and Min from joint PDF

Max and Min from joint PDF

Suppose the joint PDF of X and Y is given by:

fX,Y(x,y)={32(x2+y2)x,y[0,1]0otherwise

Find the PDF of (a) W=Max(X,Y), and of (b) W=Min(X,Y).

Solution

(a)

(1) Compute CDF of W:

Convert to event form:

FW(w)=P[Max(X,Y)w]P[XwandYw]

Integrate PDF over the region, assuming w[0,1]:

wwfX,Y(x,y)dxdy0w0w32(x2+y2)dxdyw4

(2) Differentiate to find fW(w):

fW=ddwFW(w):

fW(w)={4w3w[0,1]0otherwise

(b)

(1) Compute CDF of W:

Convert to event form:

FW(w)=P[Min(X,Y)w]1P[Min(X,Y)>w]1P[X>wandY>w]

Integrate PDF over the region:

P[X>wandY>w]w1w132(x2+y2)dxdyw4w3w+1

Therefore:

FW(w)=w4+w3+w

(2) Differentiate to find fW(w):

fW=ddwFW(w):

fW(w)={4w3+3w2+1w[0,1]0otherwise Link to original

Example - PDF of a sum

PDF of sums practice

Suppose X is an RV with density:

fX={2xx[0,1]0otherwise

Suppose Y is uniform on [0,1] and independent of X.

Find the PDF of X+Y. Sketch the graph of this PDF.

Solution

(1) Write the CDF of W=X+Y as a double integral:

FW(w)=P[X+Yw]=x+ywfX,Ydxdy

The joint density on the unit square x[0,1],y[0,1] is:

fX,YfXfY2x12x

There is positive density in the region x+yw only for xw (otherwise y<0).

  • When w[0,1], there is positive density in the region (only) when ywx.
  • When w[1,2], there is positive density in the region whenever y1.

(2) Evaluate FW(w) for w[0,1]:

Here x[0,w] and wx1, so y[0,wx].

FW(w)=0w0wx2xdydx0w2x(wx)dx[wx22x33]0ww32w33w33

Differentiate:

fW(w)=ddww33w2

(3) Evaluate FW(w) for w[1,2]:

Now x ranges over [0,1]. Split by whether the y-bound is 1 or wx:

  • x[0,w1]: wx1, so y[0,1]
  • x[w1,1]: wx<1, so y[0,wx]
FW(w)=0w1012xdydx+w110wx2xdydx0w12xdx+w112x(wx)dx(w1)2+[wx22x33]w11(w1)2+(w23)(w(w1)22(w1)33)13x3+w213

(4) Differentiate for the final PDF:

fW(w)=ddw(13x3+w213)w2+2w

Therefore:

fX+Y(w)={w2w[0,1]w2+2ww[1,2]0otherwise Link to original

Extra - Convolution

Extra Example - PDF of a quotient

PDF of a quotient

Suppose the joint PDF of X and Y is given by:

fX,Y(x,y)={λμe(λx+μy)x,y00otherwise

Find the PDF of W=g(X,Y) for g(X,Y)=Y/X.

Solution

(1) Find the CDF using logic:

FW(w)=P[Y/Xw]P[YwX]

center

Integrate over this region:

P[YwX]=00wxfX,Y(x,y)dydx0λeλx0wxμeμydydx0λeλx(eμwx+1)dx1λλ+μw

(2) Differentiate to find PDF:

Compute ddwFW(w):

fW(w)={λμ(λ+μw)2w00otherwiseLink to original

03 Theory

Theory 6

Recall that in a Poisson process:

  • XExp(λ) measures continuous wait time until one arrival
  • XErlang(,λ) measures continuous wait time until th arrival

Since the wait times between arrivals are independent, we expect that the sum of exponential distributions is an Erlang distribution. This is true!

Erlang sum rule

Specify a given Poisson process with arrival rate λ. Suppose that:

  • XErlang(r,λ) for any r=1,2,3,
  • YErlang(s,λ) or any s=1,2,3,
  • X and Y are independent

Then:

X+YErlang(r+s,λ)

Exp plus Exp is Erlang

Recall that Erlang(1,λ)Exp(λ).

So we could say: Exp(λ)+Exp(λ)Erlang(2,λ)

And:

Exp(λ)+Erlang(,λ)Erlang(+1,λ)
Link to original

04 Illustration

Example - Exp plus Exp equals Erlang

Exp plus Exp equals Erlang - Without Convolution

Let us verify this formula by direct calculation:

Exp(λ)+Exp(λ)Erlang(2,λ)

Solution

Let X,YExp(λ) be independent RVs, and let W=X+Y.

Therefore:

fX,Y(x,y)=λeλxλeλy=λ2eλ(x+y)x0,y0

(1) Write the CDF as a double integral over the region x0,y0,x+yw:

For w0, the region is x[0,w], y[0,wx].

FW(w)=0w0wxλ2eλ(x+y)dydx

(2) Evaluate the inner integral:

0wxλ2eλxeλydyλ2eλx[1λeλy]0wxλeλx(1eλ(wx))λ(eλxeλw)

(3) Evaluate the outer integral:

FW(w)=λ0w(eλxeλw)dxλ[1λeλxxeλw]0wλ[(1λeλwweλw)(1λ)]1eλwλweλw

(4) Differentiate for the PDF:

fW(w)=ddw(1eλwλweλw)λeλwλeλw+λ2weλwλ2weλw

This is the Erlang(2,λ) density function:

λ(1)!t1eλt|=2 Link to original

Exercise - Erlang induction step

Erlang induction step

Derive the formula:

Exp(λ)+Erlang(,λ)Erlang(+1,λ)

Observation: By repeatedly applying the above formula, we see that:

Exp(λ)++Exp(λ) termsErlang(,λ)Link to original