# Basic conditional probability calculation needed from table question/ evidential reasoning

This is a very basic probability question. I'm trying to calculate P(d1|g3) as given below. I don't get .63. I'm wondering why the columns don't total to 1... after all for a given grade(g) value, that value has to be coincident with one of the combinations of i,d. What am I missing?

This table is representing the conditional probabilities $P(g^1|i^0, d^0)$, and others like that. Let $X$ represent $i^0,d^0$ for convenience. Adding the first row, we have $P(g^1|X)+P(g^2|X)+P(g^3|X)=\frac{P(g^1\cap X)}{P(X)}+\frac{P(g^2\cap X)}{P(X)}+\frac{P(g^3\cap X)}{P(X)}=\frac{P(X)}{P(X)}=1$, because $g^1, g^2, g^3$ are disjoint (no two can happen at the same time) and their union is everything (one of them must happen).

If we tried to do the same thing with the columns, we would get a similar situation in the numerators, but the denominators would now be all different, so the fractions couldn't be added in the same way.

This took me a while to figure out. I'm not sure if this is the most elegant way as I'm new to this as well.

According to the definition of conditional probability, $P(d^{1} | g^{3}) = \frac{P(d^{1}, g^{3})}{P(g^{3})}$

Firstly, we compute $P(d^{1}, g^{3}) = P(d^{1}, g^{3}, i^{0}) + P(d^{1}, g^{3}, i^{1})$

where $P(d^{1}, g^{3}, i^{0}) = P(g^{3} | d^{1}, i^{0}) \cdot P(d^{1}, i^{0}) = P(g^{3} | d^{1}, i^{0}) \cdot P(d^{1}) \cdot P(i^{0}) = 0.7 \times 0.4 \times 0.7 = 0.196$

Similarly, $P(d^{1}, g^{3}, i^{1}) = 0.024$

Therefore, $P(d^{1}, g^{3}) = 0.196 + 0.024 = \textbf{0.22}$

Next, we compute $P(g^{3}) = P(g^{3} | i^{0}, d^{0}) \cdot P(i^{0}, d^{0}) + P(g^{3} | i^{0}, d^{1}) \cdot P(i^{0}, d^{1}) + P(g^{3} | i^{1}, d^{0}) \cdot P(i^{1}, d^{0}) + P(g^{3} | i^{1}, d^{1}) \cdot P(i^{1}, d^{1}) = 0.3 \times 0.7 \times 0.6 + 0.7 \times 0.7 \times 0.4 + 0.02 \times 0.3 \times 0.6 + 0.2 \times 0.3 \times 0.4 = \textbf{0.3496}$

Lastly, since we already have $P(d^{1}, g^{3})$ and $P(g^{3})$, plug them back into the first equation and we get $P(d^{1} | g^{3}) = \frac{P(d^{1}, g^{3})}{P(g^{3})} = \frac{0.22}{0.3496} \approx 0.63$