Skip to content

The two-way table and conditional probability

The two-way table and conditional probability

The two-way table

A two-way table sorts the data by two variables at once: one variable in the rows and one in the columns. Each cell is the intersection of two events.

All the residents of a neighbourhood were asked whether they want a cinema built in the shopping centre:

Want oneDo not want oneTotal
Young7585160
Adults14050190
Total215135350

A resident of the neighbourhood is chosen at random.
Y\displaystyle Y – the resident is young; C\displaystyle C – the resident wants a cinema built.

  • P(Y)=160350=1635\displaystyle {P(Y)}={\frac{160}{350}}={\frac{16}{35}} – from the row’s total.
  • P(C)=215350=4370\displaystyle {P(C)}={\frac{215}{350}}={\frac{43}{70}} – from the column’s total.
  • P(Y∩C)=75350=314\displaystyle {P(Y\cap C)}={\frac{75}{350}}={\frac{3}{14}} – from the cell where the row and the column meet.
A table of probabilities

A table can hold probabilities instead of numbers of people. In such a table the four inner cells add up to 1, and the total of a row or a column is the probability of its event.

Given: P(A)=0.6\displaystyle {P(A)}={0.6}, P(B)=0.3\displaystyle {P(B)}={0.3}, P(A∩B)=0.2\displaystyle {P(A\cap B)}={0.2}.
The table is completed by subtracting, row by row and column by column:

B\displaystyle BB‾\displaystyle \overline{B}Total
A\displaystyle A0.20.6−0.2=0.4\displaystyle {0.6-0.2}={0.4}0.6
A‾\displaystyle \overline{A}0.3−0.2=0.1\displaystyle {0.3-0.2}={0.1}0.4−0.1=0.3\displaystyle {0.4-0.1}={0.3}1−0.6=0.4\displaystyle {1-0.6}={0.4}
Total0.31−0.3=0.7\displaystyle {1-0.3}={0.7}1

From the table we read, for example, P(A‾∩B‾)=0.3\displaystyle {P(\overline{A}\cap\overline{B})}={0.3}: neither A\displaystyle A nor B\displaystyle B.

Conditional probability from the table

A conditional probability is the probability of an event when another event is already known to have happened. The probability of C\displaystyle C given Y\displaystyle Y is written P(C∣Y)\displaystyle P(C|Y) (also P(C/Y)\displaystyle P(C/Y)).

You met a young resident of the neighbourhood. What is the probability that he wants a cinema?

  • The resident is known to be young, so the choice is only among the 160 young people – the young row is now the whole sample space.
  • 75 of them want one.
P(C∣Y)=75160=1532P(C|Y)=\frac{75}{160}=\frac{15}{32}

Of all the residents 4370≈0.61\displaystyle \frac{43}{70}\approx0.61 want one, and of the young only 1532≈0.47\displaystyle \frac{15}{32}\approx0.47.

The definition of conditional probability

In a table of counts the cell is divided by the row’s total. Dividing both by the number of residents, 350, gives the same fraction – and that is the definition of conditional probability:

P(A∣B)=P(A∩B)P(B)\displaystyle P(A|B)=\frac{P(A\cap B)}{P(B)}

In the neighbourhood: P(Y∩C)=75350\displaystyle {P(Y\cap C)}={\frac{75}{350}} and P(Y)=160350\displaystyle {P(Y)}={\frac{160}{350}}.

P(C∣Y)=75350160350=75160=1532P(C|Y)=\frac{\frac{75}{350}}{\frac{160}{350}}=\frac{75}{160}=\frac{15}{32}

From the formula, multiplying by P(B)\displaystyle P(B): P(A∩B)=P(B)⋅P(A∣B)\displaystyle {P(A\cap B)}={P(B)\cdot P(A|B)}.

The difference between P(A∣B)\displaystyle P(A|B) and P(B∣A)\displaystyle P(B|A)

P(A∣B)\displaystyle P(A|B) and P(B∣A)\displaystyle P(B|A) are two different questions: their numerators are the same intersection, but the denominators differ – once P(B)\displaystyle P(B) and once P(A)\displaystyle P(A).

The residents’ committee held a meeting for all 135 residents who do not want a cinema. C‾\displaystyle \overline{C} – the resident does not want one.

  • You met a resident at the meeting. The probability that he is young: P(Y∣C‾)=85135=1727\displaystyle {P(Y|\overline{C})}={\frac{85}{135}}={\frac{17}{27}} – among the 135 who do not want one.
  • You met a young resident. The probability that he does not want one: P(C‾∣Y)=85160=1732\displaystyle {P(\overline{C}|Y)}={\frac{85}{160}}={\frac{17}{32}} – among the 160 young.

The words “given that …” say what to divide by: the event known to have happened is the denominator.

Exercise 1

A school asked its 400 students in years 10, 11 and 12 whether they come to school by bus:

Year 10Year 11Year 12Total
By bus604535140
Not by bus907595260
Total150120130400

A student is chosen at random.

a

What is the probability that the student comes by bus?

    / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

    / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

    b

    What is the probability that the student is in year 11 and comes by bus?

      / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

      / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

      c

      The student is known to be in year 12. What is the probability that he comes by bus?

        / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

        / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

        d

        The student is known to come by bus. What is the probability that he is in year 12?

          / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

          / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

          Exercise 2

          P(A)=0.7\displaystyle {P(A)}={0.7}, P(B)=0.4\displaystyle {P(B)}={0.4}, P(A∩B)=0.3\displaystyle {P(A\cap B)}={0.3}.
          Build a two-way table of probabilities, as in the example.

          a

          Work out P(A‾∩B‾)\displaystyle P(\overline{A}\cap\overline{B}).

            / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

            / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

            b

            Work out P(A∣B)\displaystyle P(A|B).

              / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

              / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

              c

              Is P(B∣A)\displaystyle P(B|A) equal to P(A∣B)\displaystyle P(A|B)? Work it out and explain.

                / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

                / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

                Exercise 3

                An insurance company checked 250 young drivers: who has been driving for less than two years, and who was in an accident in the last year.

                In an accidentNot in an accidentTotal
                Driving less than two years124860
                Driving two years or more19171190
                Total31219250
                a

                What is the probability that a driver was in an accident, given that he has been driving for less than two years? Write a decimal.

                  / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

                  / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

                  b

                  What is the probability that a driver was in an accident, given that he has been driving for two years or more?

                    / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

                    / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

                    c

                    A driver is known to have been in an accident. What is the probability that he has been driving for less than two years?

                      / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

                      / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

                      Exercise 4

                      In a certain town 25% of the residents are teenagers.
                      60% of the town’s teenagers play computer games every day.

                      A resident is chosen at random. What is the probability that he is a teenager who plays computer games every day? Write a decimal.

                        / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

                        / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

                        Exercise 5

                        Dana says: “Always P(A∣B)=P(B∣A)\displaystyle {P(A|B)}={P(B|A)}, since both have the same two events.”

                        Show from the neighbourhood’s table that Dana is wrong, and explain the difference.