# proof of product rule on conditonal probabilitiy

From the basic product rule on conditional probability, we know the following:
p(x,y) = P(x|y)P(y).
But I cannot understand this formula:
p(x,y|z) = p(x|y,z)p(y|z).
I have tried to prove this as:
p(x,y|z) = p(x|y|z)p(y|z)
But i am confused on p(x|y|z)[don't know this notation exists or not.]. And if p(x|y|z) exists then again confused why p(x|y|z) = p(x|y,z)

• $p(x\mid y \mid z)$ is not good notation, but to the extent it suggests something like "the probability (or probability density) of $X$ given $Y=y$ given $Z=z$" then this might really be "the probability (or probability density) of $X$ given $Y=y$ and $Z=z$", i.e. $p(x\mid y , z)$ – Henry Aug 7 '17 at 6:33
• – Henry Aug 7 '17 at 6:33
• Thanks Henry... – Anjan Aug 7 '17 at 6:37

Note that $$p(x,y\mid z) = p(x,y,z)/p(z)$$, that $$p(x\mid y,z) = p(x,y,z)/p(y,z)$$, and that $$p(y,z) = p(z)p(y\mid z)$$ by definition. So $$p(x\mid y,z)p(y\mid z) = p(x,y\mid z).$$

• Late message here, but I just noticed that you may have a typo in the first equation with the denominator. P(x,y|z) = p(x,y,z)/p(z) not P(x,y|z) = p(x,y,z)/p(x). – Arrow Oct 7 '19 at 0:29
• @Arrow, Hi thanks; exactly. – Megadeth Oct 7 '19 at 4:28

But i am confused on p(x|y|z)[don't know this notation exists or not.]. And if p(x|y|z) exists then again confused why p(x|y|z) = p(x|y,z)

The notation does not exist.   The divider is not a set operator; it is a separator between the event (or random variable) and the condition over which it is being measured.   The event can be joint, as can the condition, but there can only be one event-condition-divider in any measure function.

$p(x\mid y,z)$ is a representation for $\mathsf P(X=x\mid Y=y\cap Z=z)$, the probability measure for the event of $X=x$ under the condition that $Y=y$ and $Z=z$.

And such.

$$\begin{array}{lll}& p(x,y\mid z)&=\mathsf P(X=x\cap Y=y\mid Z=z)\\[1ex] =& \dfrac{p(x,y,z)}{p(z)} &= \dfrac{\mathsf P(X=x\cap Y=y\cap Z=z)}{\mathsf P(Z=z)}\\[1ex]=&\dfrac{p(x\mid y,z)\,p(y,z)}{p(z)} &=\dfrac{\mathsf P(X=x\mid Y=y\cap Z=z)\,\mathsf P(Y=y\cap Z=z)}{\mathsf P(Z=z)}\\[1ex]=& p(x\mid y,z)\,p(y\mid z) &= \mathsf P(X=x\mid Y=y\cap Z=z)\,\mathsf P(Y=y\mid Z=z) \end{array}$$

Sum Rule:

$$p(a) = \sum_{b}p(a,b)$$

As the sum rule holds for any probability distribution it trivially holds for the distribution a|c:

$$p(a|c) = \sum_{b}p(b, a|c)$$

For the product rule:

$$p(a,b)=p(a|b)p(b)$$ but does $$p(a,b|c)=p(a|b|c)p(b|c)$$?

Well presumably, they are equal if $$p(a|b|c) = p(a|b,c)$$ - but does this equality hold?

Yes: Aim to prove: $$p(a|b|c) = p(a|b,c)$$

$$p(a,b|c) = p(a|b|c)p(b|c)$$

$$p(a|b|c) = \dfrac{p(a,b|c)}{p(b|c)} = \dfrac{ \dfrac{p(a,b,c)}{p(c)}} {\dfrac{p(b,c)}{p(c)}} = \dfrac{p(a,b,c)}{p(b,c)} = \dfrac{p(a|b,c)p(b,c)}{p(b,c)} = p(a|b,c)$$

• For others' benefit, I note that this answer (and the underlying topic) is very similar to that in this post. – davidlowryduda Jan 23 '19 at 21:21

The said notation does not exist for $x,y,z$ events. However, the identity could be proved by $$P(x,y\mid z)=\frac{P(x,y,z)}{P(z)}=\frac{P(x\mid y,z)P(y,z)}{P(z)}$$ $$=P(x\mid y,z)\frac{P(y,z)}{P(z)}=P(x\mid y,z)P(y\mid z)$$

Doubtless this derivation is included either in the body of the text or as an exercise across a great array of textbooks across numerous fields. For example, #13.16(a.) from Russell & Norvig's Artificial Intelligence, A Modern Approach, Third Edition, says,

Prove the conditionalized version of the general product rule: $P(X,Y|e) = P(X|Y,e)P(Y|e)$.

$$P(X,Y|e) = \frac{P(X,Y,e)}{P(e)}$$ $$P(X|Y,e) = \frac{P(X,Y,e)}{P(Y,e)}$$ $$P(X,Y,e) = \frac{P(X|Y,e)}{P(Y,e)}$$ $$P(X,Y|e) = \frac{P(X|y,e)P(Y,e)}{P(e)} = P(X|Y,e)P(Y|e)$$

In the first of the 4 lines in the derivation, above, we have $P(X,Y|e) = \frac{P(X,Y,e)}{P(e)}$. We can think of this, perhaps overly simplistically (but it is a nice, workable mental representation so we can see what is going on here), as $P(A|B) = P(A, B)/P(B)$, simply Bayes familiar rule, where we have replaced A with $X\cap Y$ and e with B. To map my answer back on to the original question replace X with x, Y with y, and e with z. C.f. page 9 of 10, question & answer #6, here as well. Cheers!

• Line 3 doesn't make sense (and implies $P(Y,e) = 1$). Copy/paste error? – Marcel Jan 21 at 12:58