Bayes' Theorem help! How can I prove that P(A) in the denominator is equivalent to the Total Probability Theorem? As I understand it, the formula of Bayes' Theorem is generally expressed as:
$$\mathsf P(B_i\mid A) ~=~ \dfrac{\mathsf P(A\mid B_i)~\mathsf P(B_i)}{\mathsf P(A)}$$
Yet some reference material says that the theorem can also be expressed as the following since we do not always know the value of $P(A)$:

$$\mathsf P(B_i\mid A) ~=~ \dfrac{\mathsf P(A\mid B_i)~\mathsf P(B_i)}{\sum\limits_{i=1}^{n}\mathsf P(A\mid B_i)~\mathsf P(B_i)}$$

I noticed that this denominator is essentially the Total Probability Theorem. Could somebody please provide a proof showing that $~\mathsf P(A) = \sum\limits_{i=1}^{n}\mathsf P(A\mid B_i)~\mathsf P(B_i)~$ by the Total Probability Theorem? I am very lost on this and would love some guidance.
Thank you very much!
 A: The formulae above aren't correct. In the first I suppose you meant to write $B_i$ on the left hand side? In the second, the numerator should read $\sum_{i=1}^n P(B_i)P(A \mid B_i)$.
Pending these two changes, the second formula holds if the events $B_i$ are mutually exclusive and $$A \subset \bigcup_{i=1}^n B_i.$$ This result is milder than the total probability theorem. To prove it, simply note that if $A \subset \bigcup_{i=1}^n B_i$ then $$P(A) = P\left(A \cap \bigcup_{i=1}^n B_i\right) = P\left(\bigcup_{i=1}^n (A \cap B_i)\right).$$ Given that $B_i$ are mutually exclusive, so are $A \cap B_i$, and as a result $$P(A) = P\left(\bigcup_{i=1}^n (A \cap B_i)\right) = \sum_{i=1}^n P(A \cap B_i) = \sum_{i=1}^n P(B_i) P(A \mid B_i).$$
A: $$
\Pr(B_i\mid A) = \frac{\Pr(A\mid B_i)\Pr(B_i)}{\sum\limits_{i=1}^n \Pr(A\mid B_i) \Pr(B_i)}
$$
The only thing I find displeasing in the equality written above is that the letter $i$ is used for two different things.  I'd rather write something like
$$
\Pr(B_i\mid A) = \frac{\Pr(A\mid B_i)\Pr(B_i)}{\sum\limits_{j=1}^n \Pr(A\mid B_j) \Pr(B_j)},
$$
Let us as why $\Pr(A) = \sum\limits_{j=1}^n \Pr(A\mid B_j) \Pr(B_j).$
\begin{align}
\Pr(A) & = \Pr( (A\ \&\ B_1) \text{ or }(A\ \&\ B_2) \text{ or } \ldots \text{ or } (A\ \&\ B_n)) \\[10pt]
& = \Pr(A\ \&\ B_1) + \Pr(A\ \&\ B_2) + \cdots + \Pr(A\ \&\ B_n) \\[10pt]
& = \Pr(A\mid B_1)\Pr(B_1)+\Pr(A\mid B_2)\Pr(B_2) + \cdots + \Pr(A\mid B_n)\Pr(B_n). \tag 1
\end{align}
(All this assumes that the events $B_1,\ldots,B_n$ are mutually exclusive and exhaustive, i.e. at least one of them must be true but no two of them can both be true.)
Now notice that the line labeled $(1)$ above is the expected value of a random variable that is equal to $\Pr(A\mid B_j)$ if $B_j$ is true, for $j=1,\ldots,n$.  Thus the expected value of the conditional probability is equal to the unconditional probability. That is the law of total probability. Sometimes it is phrased thus: The prior expected value of the posterior probability of $A$ is equal to the prior probability of $A$.
