# How do you calculate marginal, joint, and conditional probabilities from a two-way table?

May 18, 2015

If you are given a pmf = ${p}_{X Y} \left(x , y\right)$

and you would like to find the marginal ${p}_{Y} \left(y\right)$

we would use the formula ${p}_{y} \left(y\right) = {\sum}_{i} p \left({x}_{i} , y\right)$

in other words you would sum over all of $x$ at the point $y$

So if we look at this table and want to find the marginal ${p}_{Y} \left(3\right)$

we go:

${p}_{Y} \left(3\right) = P \left(Y = 3\right)$
$= P \left(Y = 3 , X = 3\right) + P \left(Y = 3 , X = 4\right)$
$= 0.1 + 0.2$
$= 0.3$

Now to look at the formula for the conditional probability

we can look at the formula for $x$ given $y$ which is a conditional probability.

${p}_{X | Y} \left(x | y\right) = P \left(X = {x}_{i} | Y = {y}_{j}\right) = \frac{P \left(X = {x}_{i} , Y = {y}_{j}\right)}{P \left(Y = {y}_{j}\right)}$

$= \frac{{p}_{X Y} \left({x}_{i} , {y}_{j}\right)}{{p}_{Y} \left({y}_{i}\right)}$

now to use an example, we will look back at our table.

let us look for the conditional probability of:

${p}_{X | Y} \left(3 | 4\right) = \frac{0.1}{0.4} = 0.25$

Thus, the probability that $X = 3$ given that $Y = 4$ is $0.25$