Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that: $$P(c|o) = \frac{P(o|c) P(c)}{P(o)}$$

My question is why can't one calculate $P(c|o)$ directly and not use this formula?

share|cite|improve this question
What do you mean 'calculate it directly'? This formula is meant only to put the (typically unknown) posterior distribution, P(c | o) in this case, in terms of the (typically known) sampling distribution and prior distributions. – Nick Nov 21 '11 at 16:10

Bayes' formula should be written using the law of total probability as $$ P(B|A) = \frac{P(A|B)P(B)}{P(A|B)P(B)+P(A|B^c)P(B^c)} $$ which emphasizes that the numerator is one of the terms in the denominator. If $P(B|A)$ can be computed directly, then there is no need to use Bayes' formula. But, when $P(B|A)$ is not easy to compute directly but $P(A|B)$ and $P(A|B^c)$ can be determined more easily, then Bayes' formula is used to "turn the conditioning around, getting $P(B|A)$ from $P(A|B)$".

Example: The experiment consists of picking one coin at random from three coins, two of which are fair and one is biased, turning up Heads with probability $p \neq \frac{1}{2}$, and tossing it. Let $A$ be the event that the coin turn up Heads, and $B$ the event that the coin picked is fair. What is $P(B|A)$? This is a bit tricky to get directly, while $P(A|B) = \frac{1}{2}$, $P(A|B^c) = p$, $P(B) = \frac{2}{3}$, and $P(B^c) = \frac{1}{3}$ are all known. Thus, $$P(B|A) = P\{\text{fair}\mid \text{Heads}\} = \frac{\frac{1}{2}\times\frac{2}{3}}{\frac{1}{2}\times\frac{2}{3} + p\times\frac{1}{3}} = \frac{1}{1+p}. $$

share|cite|improve this answer

Often you can calculate the conditional probability directly. For example, if you're given the following table of frequencies

        | Positive | Negative |
Group A | 100      | 200      |
Group B | 500      | 200      |    

Then you can easily calculate P(positive|A) = 1/3 and P(A|positive) = 1/6.

Bayes' rule still applies, although it's not the easiest way to compute the conditional probabilities. A quick calculation shows that

  • P(A) = 3/10
  • P(positive) = 6/10

and you can check that

1/6 = P(A|positive) = P(positive|A) P(A) / P(positive) = 1/3 * (3/10) / (6/10)

However, in a more complicated situation it may not be obvious what the conditional probabilities are. In this case you can use Bayes' rule to describe a conditional probability in terms of its inversion, if you also know the unconditional probabilities. One way to view Bayes' rule is simply as a method to calculate one of the quantities given the other three (although that's not the most sophisticated point of view).

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.