I have the following exercise, and I don't understand its solution (the picture):
Consider a student who has the choice to buy or not buy a textbook for a course. We’ll model this as a decision problem with one Boolean decision, B, indicating whether the agent chooses to buy the book, and two Boolean chance nodes, M, indicating whether the student has mastered the material in the book, and P, indicating whether the student passes the course.
A certain student, Sam, has an additive utility function: 0 for not buying the book and -\$100 for buying it; and $2000 for passing the course and 0 for not passing. Sam’s conditional probability estimates are as follows:
P(p|b,m)=0.9
P(m|b)=0.9
P(p|b,¬m)=0.5
P(m|¬b)=0.7
P(p|¬b,m)=0.8
P(p|¬b,¬m)=0.3
Q: What should Sam do?
What I don't understand is why
$$P(p|b) = \sum_{m} P(p|b,m)P(m|b)$$
For example, I tried: $$P(p,b,m) = P(p|m,b)P(m|b)P(b)$$ $$P(p,b,m) = P(m|p,b)P(p|b)P(b)$$ $$P(p|b) = \frac{P(p|m,b)P(m|b)}{P(m|p,b)}$$
But I don't see how
$$\frac{P(p|m,b)P(m|b)}{P(m|p,b)} = \sum_{m} P(p|b,m)P(m|b)$$
Thanks anyone who can help.