Recent chats

How can I calculate a conditional probability from a small outcome table?

Quick answer

To find P(A|B), first keep only the outcomes where condition B is true. Count how many of those also satisfy A, then divide that count by the size of the B group: P(A|B) = count(A and B) / count(B). If the B group is empty, the conditional probability is undefined; do not divide by zero. [S1]

LET’S WORK THROUGH IT

The question, the details, the next step.

Question

I have a small table of possible outcomes and need the probability of A given B. What should I count?

Geez

Treat “given B” as an instruction to narrow the table before calculating. First identify every outcome where B is true. That subset is your denominator group. Then, within that subset, count the outcomes where A is also true. Divide the second count by the first: P(A|B) = count(A and B) / count(B). For equally likely outcomes, this means counting rows in the B group and then counting which of those also meet A. [S1]

The important detail is that you do not use the entire original table as the denominator unless every outcome in it satisfies B.

Follow-up question

Can you show that with a filled table? I’m using the six possible results of a fair die, with A meaning “greater than 3” and B meaning “even.”

Geez

Assuming the six die results are equally likely, here is the filled table. “Yes” means the outcome meets that condition.

Outcome | A: greater than 3? | B: even? | Both A and B?
1       | No                | No       | No
2       | No                | Yes      | No
3       | No                | No       | No
4       | Yes               | Yes      | Yes
5       | Yes               | No       | No
6       | Yes               | Yes      | Yes

Now keep only the rows where B is Yes: outcomes 2, 4, and 6. That group has 3 outcomes. Of those, 4 and 6 also satisfy A, so 2 outcomes qualify. Therefore P(A|B) = 2/3. The calculation uses the B rows as its denominator group, not all six rows. [S1]

Follow-up question

How can I avoid mixing up the numerator and denominator, especially if I’m working from my own table?

Geez

Write the two counts in words before writing the fraction:

  1. Denominator: number of outcomes where B is true.
  2. Numerator: number of outcomes where both B and A are true.
  3. Divide the numerator by the denominator.

For the die example, the denominator is “even outcomes,” or 3. The numerator is “even outcomes that are greater than 3,” or 2. So the fraction is 2/3, not 2/6. A useful check is that every outcome counted in the numerator must also belong to the denominator group. [S1]

If your table lists outcomes with different probabilities rather than equally likely possibilities, simple row counts may not be enough. Use the probabilities for the relevant outcomes instead: P(A and B) divided by P(B). [S1]

Follow-up question

What if no outcome in my table meets B, or if the table has repeated outcomes?

Geez

If no outcome meets B, then count(B) is zero and the conditional probability is undefined. Stop there rather than trying to divide by zero. [S1]

For repeated outcomes, first determine what each row represents and whether outcomes are equally likely. Count rows only when they represent equally likely cases; otherwise, use the relevant probabilities. The formula is P(A and B) divided by P(B), and the conditional probability is undefined when P(B) is zero. [S1]

A practical checklist

  • Define A and B clearly before marking the table.

  • Mark each outcome as meeting or not meeting B.

  • Count only the B outcomes for the denominator.

  • Among those B outcomes, count the ones that also meet A for the numerator.

  • Check that the denominator is not zero before dividing.

  • If outcomes are not equally likely, use their probabilities instead of raw row counts.

A few more useful answers

Why isn’t the denominator the total number of outcomes?

Because “given B” restricts the calculation to outcomes where B is true. The denominator is the size or probability of that B group, not the full original set. [S1]

What should I write if the condition group is empty?

Write that the conditional probability is undefined because the probability of B is zero. Do not divide by zero. [S1]

Does counting rows work when outcomes are not equally likely?

Not generally. Use the probabilities of outcomes: divide P(A and B) by P(B), rather than relying on unweighted row counts. [S1]

Sources

References used for this guide.

  1. [S1] OpenStax Introductory Statistics 2e, Section 3.3: Two Basic Rules of Probability
    openstax.org · Checked

YOUR QUESTION. YOUR DETAILS.

Let’s work through your situation.

Get a tailored answer or help with your next task. Starts at $1, with a quote before you pay.

Ask your own question
← Back to Geez at Work