sum and product rules of probability I am reading Bishop's Pattern Recognition and Machine Learning. 
In page 73, chapter 2.1. I can't understand the formula 2.19 :
$$p(x=1|\mathcal{D})=\int_0^1 p(x=1|\mu)p(\mu|\mathcal{D})\text{d}\mu $$
The author say, this is obtained by sum and product rules. 
The sum rule is:
$$p(X) = \sum_Y p(X,Y)$$
and the product rule is:
$$p(X,Y)=p(Y|X)p(X)$$
But from this, I can't deduce the formula. Could you help me please.. thanks very much.
 A: I just write the answer here, because I have the feeling the comment section is just getting longer without coming to a clear end.
You want to understand the formula
$$p(x=1|\mathcal D) = \int_0^1 p(x=1|\mu)p(\mu|\mathcal D)\mathrm d \mu$$
First, you apply the product rule in the integral. This yields
$$p(x=1|\mathcal D) = \int_0^1 p(x=1,\mu|\mathcal D) \mathrm d \mu$$
This is basically the definition of the summation rule which integrates out $\mu$.
A few comments on that 


*

*Note, that in the comments above you said that $\mu$ is in front of "|", but you wrote $p(x=1|\mu,\mathcal D)$. The expression $\int_0^1 p(x=1|\mu, \mathcal D) \mathrm d \mu$ does not give you $p(x=1|\mathcal D)$ since a variable must in front of the conditioning bar "|" before applying the summation rule.

*The formula only works if $x$ and $\mathcal D$ are conditionally independent given $\mu$. In the most general case, the equation should be 
$$p(x=1|\mathcal D) = \int_0^1 p(x=1|\mu,\mathcal D)p(\mu|\mathcal D)\mathrm d \mu.$$

A: Just thought I'd add to the above answer by saying that; it makes sense the $x$ and $D$ are conditionally independent given $\mu$. Since if you know the parameter $\mu$, it doesn't matter what your data set is you will know how to calculate $p(x=1)$ using $\mu$ i.e. $p(x=1|\mu, D)=p(x=1|\mu)$.
