0:00 / 0:00

Conditional Probability & Joint Distribution

The joint distribution table of XX and YY can be represented using a table:

       (Y=y1)              (Y=y2)            ...     (X=x1)(X=x2)(X=x3)\begin{array}{c|c|c|} \\&\ \ \ \ \ \ \ (Y=y_1)\ \ \ \ \ \ \ &\ \ \ \ \ \ \ (Y=y_2)\ \ \ \ \ \ \ &\ \ \ \ \ ...\ \ \ \ \ \\\\ \hline\\ (X=x_1)\\\\ \hline\\ (X=x_2)\\\\ \hline\\ (X=x_3)\\\\ \hline \vdots \end{array}

The sum of all the probabilities is 1.


The random variables XX and YY are independent if P(XY)=P(X)×P(Y)P(X\cap Y)=P(X)\times P(Y).

For joint distributions, the random variablesXX and YY are independent if P(xiyi)=P(xi)×P(yi)P(x_i\cap y_i)=P(x_i)\times P(y_i) where i=1,2,3..i=1,2,3..

Watch Out!
XX and YY are independent only if this multiplication rule works in all of the cells in the joint distribution table! If not, then XX and YY are not independent.

Wize Tip
If XX and YY are independent random variables, then aXaX and bYbY are also independent.

PAGE BREAK

Example: Conditional Probability Formula

You can solve for conditional probabilities when dealing with joint distributions.


P(AB)=P(AB)P(B)\boxed{\displaystyle P\left(A\mid B\right)=\frac{P\left(A\cap B\right)}{P\left(B\right)}}

Example:


Given that the opponent plays "water", what is the probability that your Pokey Mon plays "fire"?

P(FireWater)=P(FireWater)P(Water)\displaystyle{P\left(Fire\mid Water\right)=\frac{P\left(Fire\cap Water\right)}{P\left(Water\right)}}

=0.150.15+0.10+0.10=0.150.35=0.4286\displaystyle{=\frac{0.15}{0.15+0.10+0.10}=\frac{0.15}{0.35}=0.4286}


Are the two random variables independent?
The random variables XX and YY are independent if P(XY)=P(X)×P(Y)P(X\cap Y)=P(X)\times P(Y).

P(FireWater)=0.15P\left(Fire\cap Water\right)=0.15
P(Fire)×P(Water)=(0.45)(0.35)=0.1575P\left(Fire\right)\times P\left(Water\right)=\left(0.45\right)\left(0.35\right)=0.1575

0.150.15750.15\ne0.1575

Therefore, they are not independent.

Wize Tip
See: Conditional Probability

0:00 / 0:00

Example: Conditional Probability & Joint Distribution


XX and YY are random variables and you are working in a busy office on a given day.

X=X= number of times your phone rings
Y=Y= number of times someone walks into your office
(i) What is the probability your phone rings 2 times and 1 person walks into your office?
P(X=2Y=1)=0.09P\left(X=2\cap Y=1\right)=0.09


(ii) Find P(X=0Y1)P\left(X=0\cap Y\ge1\right)
P(X=0Y1)=Px,y(0,1)+Px,y(0,2)=0.15+0.06=0.21P\left(X=0\cap Y\ge1\right)=P_{x,y}\left(0,1\right)+P_{x,y}\left(0,2\right)=0.15+0.06=0.21



(iii) Find P(Y=1X=0)P\left(Y=1\mid X=0\right)

Conditional probability formula:

P(AB)=P(AB)P(B)\displaystyle P\left(A\mid B\right)=\frac{P\left(A\cap B\right)}{P\left(B\right)}

P(Y=1X=0)=P(X=0Y=1)P(X=0)\displaystyle P\left(Y=1\mid X=0\right)=\frac{P\left(X=0\cap Y=1\right)}{P\left(X=0\right)}

=0.060.08+0.15+0.06=0.150.29=0.5172\displaystyle =\frac{0.06}{0.08+0.15+0.06}=\frac{0.15}{0.29}=0.5172


PAGE BREAK

(iv) Are XX and YY independent?

The random variables XX and YY are independent if P(xiyi)=P(xi)×P(yi)P(x_i\cap y_i)=P(x_i)\times P(y_i) where i=1,2,3..i=1,2,3... (This must be true for all cells.)

Let's test it for X=0,Y=2X=0, Y=2:

P(X=0Y=2)=0.06P(X=0\cap Y=2)=0.06

P(X=0)=0.08+0.15+0.06=0.29P(X=0)=0.08+0.15+0.06=0.29
P(Y=2)=0.06+0.03+0.13+0.04=0.26P(Y=2)=0.06+0.03+0.13+0.04=0.26

(0.29)(0.26)=0.07540.060.0754(0.29)(0.26)=0.0754 \\0.06\neq0.0754
Therefore, XX and YY are not independent.

Practice: Conditional Probability & Joint Distribution


(a) Find P(X=0Y0)P\left(X=0\cap Y\ge0\right)

(b) Find P(Y=0X=1)P\left(Y=0\mid X=1\right)

(c) Are XX and YY independent?

0:00 / 0:00

Random Variables & Joint Distribution

It is a very good idea to review the following formulas as they are useful when dealing with joint probability distributions.

Review: Expected Value, Variance, and Standard Deviation of a Random Variable X


Let XX be a discrete random variable.

The expected value or mean of XX is denoted by E(X)E(X) or μ\mu , and is calculated by
E(X)=μ=[xiP(xi)]\boxed{E(X)=\mu=\sum \left[x_iP(x_i) \right]}

The variance of XX is denoted by Var(X)Var(X) or σ2\sigma^2, and is calculated by
Var(X)=σ2=[(xiμ)2P(xi)]\boxed{ Var(X)=\sigma^2=\sum\left[(x_i-\mu)^2P(x_i)\right]}
or
Var(X)=σ2=[xi 2P(xi)]μ2\boxed{ \begin{array}{c} Var(X)=\sigma^2 =\left[\sum x_i^{\ 2}P(x_i)\right]-\mu^2 \end{array}}
or
Var(X)=E(X2)E(X)2\boxed{Var\left(X\right)=E\left(X^2\right)-E\left(X\right)^2}
where

E(X2)=(xi)2P(xi)E(X^2)=\sum(x_i)^2P(x_i)

The standard deviation of XX is denoted by SD(X)SD(X) or σ\sigma, and is calculated by
SD(X)=σ=Var(X)\boxed{SD(X)=\sigma=\sqrt{Var(X)}}

Wize Tip
See: Discrete Random Variables

PAGE BREAK
Example with one random variable X:
xP(X)10.520.5\begin{array}{|c|c|} \hline x&P(X)\\ \hline 1&0.5\\ \hline 2&0.5\\ \hline \end{array}
Mean:

E(X)=μ=[xiP(xi)]E(X)=\mu=\sum[x_iP(x_i)]

E(X)=(1)(0.5)+(2)(0.5)=1.5E\left(X\right)=\left(1\right)\left(0.5\right)+\left(2\right)\left(0.5\right)=1.5

Variance (Method 1):

Var(X)=σ2=(xiμ)2P(xi)Var(X)=\sigma^2=\sum(x_i-\mu)^2P(x_i)

(11.5)2(0.5)+(21.5)2(0.5)=0.125+0.125=0.25\left(1-1.5\right)^2\left(0.5\right)+\left(2-1.5\right)^2\left(0.5\right)=0.125+0.125=0.25

Variance (Method 2):

Var(X)=σ2=[xi 2P(xi)]μ2Var(X)=\sigma^2 =\left[\sum x_i^{\ 2}P(x_i)\right]-\mu^2

[(1)2(0.5)+(2)2(0.5)](1.5)2=[0.5+2]2.25=2.52.25=0.25\left[\left(1\right)^2\left(0.5\right)+\left(2\right)^2\left(0.5\right)\right]-\left(1.5\right)^2=\left[0.5+2\right]-2.25=2.5-2.25=0.25

Variance (Method 3):

Var(X)=E(X2)E(X)2Var\left(X\right)=E\left(X^2\right)-E\left(X\right)^2

E(X)=(1)(0.5)+(2)(0.5)=1.5E\left(X\right)=\left(1\right)\left(0.5\right)+\left(2\right)\left(0.5\right)=1.5 (solved above)

E(X2)=[(1)2(0.5)+(2)2(0.5)]=0.5+2=2.5E\left(X^2\right)=\left[\left(1\right)^2\left(0.5\right)+\left(2\right)^2\left(0.5\right)\right]=0.5+2=2.5 (solved above)

So, Var(X)=E(W2)E(W)2=2.5(1.5)2=2.5+2.25=0.25Var\left(X\right)=E\left(W^2\right)-E\left(W\right)^2=2.5-\left(1.5\right)^2=2.5+2.25=0.25

Method 3 is really just the same as Method 2 but broken down into more steps.

Standard deviation:

SD(X)=σ=Var(X)SD(X)=\sigma=\sqrt{Var(X)}

SD(X)=0.25=0.5SD\left(X\right)=\sqrt{0.25}=0.5
PAGE BREAK
Example with 2 random variables X and Y:

xyP(XY)260.2480.8\begin{array}{|c|c|c|} \hline x&y&P(X\cap Y)\\ \hline 2&6&0.2\\ \hline 4&8&0.8\\ \hline \end{array}


0:00 / 0:00

Example: Random Variables & Joint Distribution

xyP(XY)260.2480.8\begin{array}{|c|c|c|} \hline x&y&P(X\cap Y)\\ \hline 2&6&0.2\\ \hline 4&8&0.8\\ \hline \end{array}

E(XY)=E\left(XY\right)=

Let W=XYW=XY

E(XY)E(W)=(2×6)(0.2)+(4×8)(0.8)=2.4+25.6=28E\left(XY\right)\rightarrow E\left(W\right)=\left(2\times6\right)\left(0.2\right)+\left(4\times8\right)\left(0.8\right)=2.4+25.6=28

Var(XY)=Var\left(XY\right)=

Let W=XYW=XY
Var(W)=E(W2)E(W)2Var\left(W\right)=E\left(W^2\right)-E\left(W\right)^2

E(W)=28E(W)=28

E(W2)=(2×6)2(0.2)+(4×8)2(0.8)=28.8+819.2=848E\left(W^2\right)=\left(2\times6\right)^2\left(0.2\right)+\left(4\times8\right)^2\left(0.8\right)=28.8+819.2=848

Var(XY) Var(W)=E(W2)E(W)2=848(28)2=64\therefore Var\left(XY\right)\rightarrow\ Var\left(W\right)=E\left(W^2\right)-E\left(W\right)^2=848-\left(28\right)^2=64

SD(XY)=SD\left(XY\right)=

=Var(XY)=64=8=\sqrt{Var\left(XY\right)}=\sqrt{64}=8


checklist
Mark Yourself Question
  1. Grab a piece of paper and try this problem yourself.
  2. When you're done, check the "I have answered this question" box below.
  3. View the solution and report whether you got it right or wrong.

Practice: Random Variables & Joint Distribution


Let X and Y be two discrete random variables with the following joint probability distribution function:

xyP(XY)101/3212/3\begin{array}{|c|c|c|} \hline x&y&P(X\cap Y)\\ \hline 1&0&1/3\\ \hline 2&1&2/3\\ \hline \end{array}


(a) Find E(X)E(X)

(b) Find E(Y)E(Y)

(c) Find E(XY)E(XY)

(d) Find Var(XY)Var(XY)


Example: Random Variables & Joint Distribution

Let X and Y be two discrete random variables with the following joint probability distribution function:

xyP(XY)101/3212/3\begin{array}{|c|c|c|} \hline x&y&P(X\cap Y)\\ \hline 1&0&1/3\\ \hline 2&1&2/3\\ \hline \end{array}



Find SD(2XY)SD(2X-Y)

Let 𝑊=2𝑋𝑌𝑊 = 2𝑋 − 𝑌. Then we get the following pdf:
wP(W=w)\begin{array}{c|c} w&P(W=w)\\ \hline \\ \\ \end{array}


wP(W=w)2(1)0=21/32(2)1=32/3\begin{array}{c|c} w&P(W=w)\\ \hline 2(1)-0=2&1/3\\ 2(2)-1=3&2/3 \end{array}


E(W)=(2)(13)+(3)(23)=83E(W)=\left(2\right)\left(\frac{1}{3}\right)+\left(3\right)\left(\frac{2}{3}\right)=\frac{8}{3}

E(W2)=(2)2(13)+(3)2(23)=223E\left(W^2\right)=\left(2\right)^2\left(\frac{1}{3}\right)+\left(3\right)^2\left(\frac{2}{3}\right)=\frac{22}{3}

So, Var(W)=E(W2)E(W)2=223(83)2=223649=29Var\left(W\right)=E\left(W^2\right)-E\left(W\right)^2=\frac{22}{3}-\left(\frac{8}{3}\right)^2=\frac{22}{3}-\frac{64}{9}=\frac{2}{9}

Therefore, SD(2XY)SD(W)=29=23SD\left(2X-Y\right)\rightarrow SD\left(W\right)=\sqrt{\frac{2}{9}}=\frac{\sqrt{2}}{3}

Practice: Random Variables & Joint Distribution

Let X and Y be two discrete random variables with the following joint probability distribution function:

xyP(XY)240.6370.4\begin{array}{|c|c|c|} \hline x&y&P(X\cap Y)\\ \hline 2&4&0.6\\ \hline 3&7&0.4\\ \hline \end{array}

Assume independence.

(a) Find E(X+Y)E(X+Y)

(b) Find SD(4XY1)SD(4X-Y-1)