Skip to main content
Mathematics LibreTexts

5.4: Contingency Tables, Conditional Probability, and Independence

  • Page ID
    237236
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\dsum}{\displaystyle\sum\limits} \)

    \( \newcommand{\dint}{\displaystyle\int\limits} \)

    \( \newcommand{\dlim}{\displaystyle\lim\limits} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \(\newcommand{\longvect}{\overrightarrow}\)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\ket}[1]{\left| #1 \right>}\)
    \(\newcommand{\bra}[1]{\left< #1 \right|}\)
    \(\newcommand{\braket}[2]{\left< #1 \vphantom{#2} \right| \left. #2 \vphantom{#1} \right>}\)
    \(\newcommand{\braopket}[3]{\left< #1 \vphantom{#2}\vphantom{#3} \right| #2 \vphantom{#1}\vphantom{#3} \left| #3 \vphantom{#1}\vphantom{#2} \right>}\)
    \(\newcommand{\qmvec}[1]{\mathbf{\vec{#1}}}\)
    \(\newcommand{\op}[1]{\hat{\mathbf{#1}}}\)
    \(\newcommand{\expect}[1]{\langle #1 \rangle}\)
    \(\newcommand{\dfn}[1]{\emph{\textbf{#1}}}\)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)
    Learning Objectives
    • Compute probabilities from contingency tables.
    • Find and interpret conditional probability.
    • Assess independence using conditional probabilities.

    Introduction

    A contingency table is a structured way to display data for two categorical variables at the same time. Contingency tables are especially useful in probability because they allow you to quickly identify totals for each category, compare groups, and compute probabilities directly from the counts in the table. They also provide a clear framework for checking whether two events are related using these probabilities. By organizing information visually and numerically, contingency tables make it easier to analyze relationships between events and draw meaningful conclusions.

    Reading a Contingency Table

    When a survey collects two pieces of categorical information from each person, the results can be organized in a contingency table, or two‑way table. One variable is organized by rows, and the other by columns, creating a grid that shows how often each combination of categories occurs. The table shows how many people fall into each combination of responses.

    \[ \begin{array}{|l|c|c|c|} \hline & \textbf{Took a Vacation} & \textbf{No Vacation} & \textbf{Total} \\ \hline \textbf{Has Cable TV} & 97 & 38 & 135 \\ \hline \textbf{Doesn't Have Cable TV} & 14 & 17 & 31 \\ \hline \textbf{Total} & 111 & 55 & 166 \\ \hline \end{array} \nonumber \]

    The table above displays whether people have cable TV and whether they took a vacation in the past year. Each cell tells you how many people fit a specific pair of responses—for instance, 97 people have cable TV and took a vacation, while 17 people do neither of these.

    Row and column totals summarize how many people fall into each single category: 135 people have cable TV, 31 do not, and 166 people were surveyed in total. Likewise, 111 people took a vacation and 55 did not.

    A contingency table makes it easy to define events and compute probabilities directly from the counts in the table. By reading across rows, down columns, or within individual cells, you can quickly determine how likely different combinations of outcomes are.

    Example \(\PageIndex{1}\)

    Use the table above to find the probability that a randomly selected person took a vacation last year.

    Solution

    Let \(A\) be the event that a person took a vacation. To find \(P(A)\), we use the total number of people surveyed as the sample space. Since 166 people participated in the survey, the sample space contains 166 outcomes.

    From the contingency table, the total number of people who took a vacation is 111. Therefore,

    \(P(A)=\dfrac{n(A)}{n(S)}=\dfrac{111}{166} \approx 0.6687\)

    So the probability that a randomly chosen person took a vacation last year is approximately 66.87%.

    Example \(\PageIndex{2}\)

    Find the probability that a randomly selected person took a vacation last year and has cable TV.

    Solution

    Let \(A =\) the event that a person took a vacation, and \(B =\) the event that a person has cable TV.

    We want the probability of both events occurring, written \(P(A \cap B)\).

    From the contingency table, 97 people both took a vacation and have cable TV. Since 166 people were surveyed, the probability is

    \(P(A \cap B)=\dfrac{n(A \cap B)}{n(S)}=\dfrac{97}{166} \approx 0.5843\)

    Thus, the probability that a randomly chosen person both took a vacation and has cable TV is about 58.43%.

    Example \(\PageIndex{3}\)

    Find the probability that a randomly selected person took a vacation last year or has cable TV.

    Solution

    Again, let \(A =\) the event that a person took a vacation, and \(B =\) the event that a person has cable TV.

    We want the probability of the union of the two events, written \(P(A \cup B)\).

    From the contingency table, 149 people did one, the other, or both of these things. Since 166 people were surveyed, the probability is

    \(P(A \cup B)=\dfrac{n(A \cup B)}{n(S)}=\dfrac{149}{166} \approx 0.8976\)

    Thus, the probability that a randomly chosen person took a vacation last year or has cable TV is about 89.76%.

    Example \(\PageIndex{4}\)

    Given a randomly selected person from this group has cable TV, what is the probability they took a vacation last year?

    Solution

    Once again, let \(A =\) the event that a person took a vacation and \(B =\) the event that a person has cable TV.

    Since you know that the person has cable TV \((B)\), the sample space has been restricted to the 135 people with cable TV and \(n(S)=135\).

    Of these, 97 people took a vacation so \(n(A \cap B)=97\).

    \(P(A \text{ given } B)=P(A | B)= \dfrac{n(A \cap B)}{n(B)}=\dfrac{97}{135} \approx 0.7185\)

    Given a randomly selected person from this group has cable TV, the probability they took a vacation last year is about 71.85%.

    The sample space was restricted to the people who have cable TV -- and the remainder of the sample space was ignored. This type of probability is called a conditional probability. We will see similar ideas in subsequent examples and more formally define it there.

    Example \(\PageIndex{5}\)

    Nate recorded the topping and type of crust for all pizzas sold yesterday.

    \[ \begin{array}{|l|c|c|c|c|} \hline & \textbf{Pepperoni, P} & \textbf{Sausage, G} & \textbf{Veggie, V} & \textbf{Total} \\ \hline \textbf{Thick Crust, T} & 10 & 15 & 5 & 30 \\ \hline \textbf{Thin Crust, T'} & 24 & 16 & 10 & 50 \\ \hline \textbf{Total} & 34 & 31 & 15 & 80 \\ \hline \end{array} \nonumber \]

    Use the contingency table to find the following probabilities.

    a. If Nate sells a pizza, what is the probability it has sausage topping?

    Solution

    Let \(G\) be the event that a pizza has sausage topping. The sample space consists of \(n(S)=80\) pizzas. Nate sold \(n(G)= 31\) sausage pizzas, so

    \(P(G)= \dfrac{n(G)}{n(S)}=\dfrac{31}{80} = 0.3875\)

    The probability is 38.75%.

    b. If Nate sells a pizza, what is the probability it has sausage topping or thick crust?

    Solution

    We want the probability of the union of sausage topping with thick crust, \(P(G \cup T)\).

    Nate sold 31 sausage pizzas, 10 thick‑crust pepperoni pizzas, and 5 thick‑crust veggie pizzas. Adding these gives \(n(G \cup T)=46\) pizzas, making sure not to double‑count any pizzas already included.

    \(P(G \cup T) = \dfrac{n(G \cup T)}{n(S)}=\dfrac{46}{80} =0.575\)

    The probability is 57.5%.

    c. If Nate sells a pizza, what is the probability it has sausage topping and thick crust?

    Solution

    We want the probability of the intersection of sausage topping with thick crust, \(P(G \cap T)\).

    Nate sold \(n(G \cap T) = 15\) pizzas that were both sausage and thick crust

    \(P(G \cap T) = \dfrac{n(G \cap T)}{n(S)}=\dfrac{15}{80} =0.1875\)

    The probability is 18.75%.

    d. Given Nate sells a sausage pizza, what is the probability it has thick crust?

    This is a conditional probability. The sample space is restricted to the 31 sausage pizzas that Nate sold: \(n(S)=31\).

    Of these sausage pizzas, 15 have thick crust so \(n(G \cap T)=15\).

    \(P(T \text{ given } G) = P(T | G) = \dfrac{n(T \cap G)}{n(S)}=\dfrac{15}{31} \approx 0.4839\)

    The probability is about 48.39%.

    You Try It \(\PageIndex{A}\)

    The table below shows the number of credit cards owned by a group of individuals. One person will be selected at random. Find the probability of each event below.

    \[ \begin{array}{|l|c|c|c|c|} \hline & \textbf{Zero} & \textbf{One} & \textbf{Two or more} & \textbf{Total} \\ \hline \textbf{Male} & 9 & 5 & 19 & 33 \\ \hline \textbf{Female} & 18 & 10 & 20 & 48 \\ \hline \textbf{Total} & 27 & 15 & 39 & 81 \\ \hline \end{array} \nonumber \]

    1. the person is female
    2. the person is male and has exactly one credit card
    3. the person is male or has no credit cards.
    4. the person is female given that they have 2 or more credit cards
    Answer
    1. \(\frac{48}{81} \approx 59\%\)
    2. \(\frac{5}{81} \approx 6\%\)
    3. \(\frac{51}{81} \approx 63\%\)
    4. \(\frac{20}{39} \approx 51\%\)

    Conditional Probability

    Conditional probability describes the likelihood of an event once additional information -- a condition -- is known. When new information restricts the set of possible outcomes in the sample space, the probability is calculated within this smaller, more specific group. For example, the probability that a student is in the honor society changes when we know the student earned all A’s this semester. In that case, the sample space is limited to students with straight‑A grades rather than the entire student body.

    In general, conditional probability focuses on how probabilities shift when the context changes. By narrowing the sample space to only those outcomes that satisfy a given condition, we can determine how likely another event is within that restricted group. The next example illustrates how this idea works in practice.

    Example \(\PageIndex{6}\)

    Consider a high school with 400 students. The contingency table shows the number of students in each grade who earned each midterm letter grade.

    \[ \begin{array}{|l|c|c|c|c|c|} \hline & \textbf{9th Grade} & \textbf{10th Grade} & \textbf{11th Grade} & \textbf{12th Grade} & \textbf{Total} \\ \hline \textbf{A} & 20 & 18 & 24 & 18 & 80 \\ \hline \textbf{B} & 30 & 35 & 39 & 55 & 159 \\ \hline \textbf{C} & 30 & 17 & 20 & 20 & 87 \\ \hline \textbf{D} & 15 & 15 & 12 & 4 & 46 \\ \hline \textbf{F} & 5 & 15 & 5 & 3 & 28 \\ \hline \textbf{Total} & 100 & 100 & 100 & 100 & 400 \\ \hline \end{array} \nonumber \]

    Suppose one student is selected at random. Find the probability that a student

    a. earned an A

    b. earned an A, given the student is a 9th grader.

    Solution

    a. The total number of students who earned an A is \(20+18+24+18=80\) out of 400 students:

    \(P(\text{earned an A})= \frac{80}{400}=0.20 = 20\%\).

    b. The sample space is restricted to 9th graders only. There are 100 9th graders and 20 of them earned an A.

    \(P(\text{earned an A given 9th grader})=\frac{20}{100}=0.20 = 20\%\).

    The probability in part b of Example 5.4.6 is conditional because the additional information -- knowing the student is a 9th grader -- restricts the sample space. A conditional probability describes the likelihood of event \(B\) occurring given that event \(A\) has already occurred. The notation \(P(B | A)\) is read as “the probability of \(B\) given \(A\).”

    In this case, we calculated \(P(A ∣ \text{9th grader})\). To find this probability, we focused only on the 100 students who are 9th graders and then determined how many of them earned an A (20):

    \(P(\text{earned an A given 9th grader})=\frac{20}{100}=0.20 = 20\%\)

    This result can also be obtained using a formula for conditional probability:

    \(P(B | A) = \dfrac{P(A \cap B)}{P(A)}\).

    Here, \(A =\) “student is a 9th grader” and \(B =\) “student earned an A.”

    Since \(P(A \cap B) = \frac{20}{400}\) and \(P(A)=\frac{100}{400}\), we have

    \(P(\text{earned an A given 9th grader})=\dfrac{\frac{20}{400}}{\frac{100}{400}}=\dfrac{20}{100}=0.20\)

    Conditional Probability

    In general, the conditional probability of event \(B\) given \(A\) can be computed using the formula

    \(P(B|A)=\dfrac{n(A \cap B)}{n(A)} = \dfrac{P(A \cap B)}{P(A)}\).

    Independence

    Two events are independent when knowing that one event has occurred does not change the probability of the other event. In other words, the occurrence of event \(A\) has no effect on the likelihood of event B. We express this idea using the notation

    \(P(B | A)=P(B)\),

    which states that the conditional probability of \(B\) given \(A\) is the same as the original probability of \(B\).

    In the previous example, the probability that a randomly selected student from the entire school earned an A was

    \(P(\text{earned an A})=0.20\).

    We also found that the probability a 9th grader earned an A was

    \(P(\text{earned an A } | \text{ 9th grader})=0.20\).

    Because these two probabilities are equal, knowing that a student is in 9th grade does not affect the chance of earning an A. Therefore, the events “9th grader” and “earned an A” are independent.

    Independence is an important concept because it tells us when two events do not influence each other. When events are independent, their relationship is simpler to analyze, and probabilities involving both events can be computed using straightforward rules.

    Independent Events

    Two events \(A\) and \(B\) are independent if and only if

    \(P(B) = P(B | A)\).

    Example \(\PageIndex{7}\)

    A group of people were surveyed about the type of movies they prefer. Suppose one person is selected at random from this group. The table shows the number of males and females who prefer each movie type.

    \[ \begin{array}{|l|c|c|c|} \hline & \textbf{Romantic Comedies} & \textbf{Action} & \textbf{Horror} \\ \hline \textbf{Females} & 12 & 10 & 3 \\ \hline \textbf{Males} & 8 & 25 & 6 \\ \hline \end{array} \nonumber \]

    You may find it useful to find the totals for each row and column. There are 25 females and 39 males in the group. The distribution of movies is 20 romantic comedies, 35 action, and 9 horror. There are 64 total people in the group.

    a. Let \(F\) be the event that the person is female. Find \(P(F)\).

    Solution

    There are 25 females out of 64 people, so \(P(F)=\frac{25}{64} \approx 0.3906\).

    b. Let \(R\) be the event that the person prefers romantic comedies. Find \(P(F | R)\).

    Solution

    The probability that the person is female given that the person prefers romantic comedies is a conditional probability.

    Among the 20 people who prefer romantic comedies, 12 are female, so \(P(F |R)=\frac{12}{20}=0.60\).

    c. Are events \(F\) and \(R\) independent? Justify your answer.

    Solution

    To determine independence, compare \(P(F)\) and \(P(F |R)\). If the events are independent, these probabilities will be equal.

    \(P(F) \approx 0.3906\) and \(P(F | R)=0.60\). Because \(P(F) \neq P(F |R)\), knowing that a person prefers romantic comedies changes the probability that the person is female. Therefore, the events “female” and “prefers romantic comedies” are not independent.

    It should be noted that there is a second way to check whether \(F\) and \(R\) are independent. Compare \(P(R)\) and \(P(R |F)\).

    From the table,

    \(P(R)=\frac{20}{64}=0.3125\)

    \(P(R |F)=\frac{12}{25}=0.48\)

    Because \(P(R) \neq P(R |F)\), the probability of preferring romantic comedies changes when we know the person is female. In other words, the chance of selecting someone who prefers romantic comedies is higher when we restrict the sample space to females.

    Therefore, the events female and prefers romantic comedies are not independent.

    Example \(\PageIndex{8}\)

    Recall the contingency table from Example 5.4.5 where Nate recorded the topping and type of crust for all pizzas sold yesterday.

    \[ \begin{array}{|l|c|c|c|c|} \hline & \textbf{Pepperoni, P} & \textbf{Sausage, G} & \textbf{Veggie, V} & \textbf{Total} \\ \hline \textbf{Thick Crust, T} & 10 & 15 & 5 & 30 \\ \hline \textbf{Thin Crust, T'} & 24 & 16 & 10 & 50 \\ \hline \textbf{Total} & 34 & 31 & 15 & 80 \\ \hline \end{array} \nonumber \]

    Are "selling veggie" and "selling thin crust" independent?

    Solution

    To determine independence, compare \(P(V)\) and \(P(V |T')\). If the events are independent, these probabilities will be equal.

    \(P(V) = \frac{15}{80} = 0.1875\) and \(P(V | T')=\frac{10}{50} = 0.20\)

    Because \(P(V) \neq P(V |T')\), knowing that a pizza has thin crust changes the probability that the pizza is veggie. Therefore, the events “selling veggie” and “selling think crust” are not independent.

    Exercise \(\PageIndex{B}\)

    Recall the table from You Try It A about credit cards and gender.

    \[ \begin{array}{|l|c|c|c|c|} \hline & \textbf{Zero} & \textbf{One} & \textbf{Two or more} & \textbf{Total} \\ \hline \textbf{Male} & 9 & 5 & 19 & 33 \\ \hline \textbf{Female} & 18 & 10 & 20 & 48 \\ \hline \textbf{Total} & 27 & 15 & 39 & 81 \\ \hline \end{array} \nonumber \]

    Are the events "two or more credit cards" and "male" independent? Explain why or why not with two probabilities.

    Answer

    Not independent because \(P(\text{two or more credit cards}) \neq P(\text{two or more credit cards | male})\)

    \(P(\text{two or more credit cards}) = \frac{39}{81} \approx 0.4815\)

    \(P(\text{two or more credit cards | male}) = \frac{19}{33} \approx 0.5758\)

    Example \(\PageIndex{9}\)

    A medicine label reports the following results from clinical trials:

    • The probability of experiencing insomnia is \(P(I)=0.14\).
    • The probability of experiencing a headache is \(P(H)=0.26\).
    • The probability of experiencing both side effects is \(P(I \cap H)=0.05\)

    Are experiencing insomnia and experiencing headaches independent events?

    Solution

    To check for independence, compare \(P(I)\) with the conditional probability \(P(I |H)\). If the events are independent, these probabilities will be equal.

    We are told that \(P(I)=0.14\).

    \(P(I | H)=\dfrac{P(I \cap H)}{P(H)}=\dfrac{0.05}{0.26} \approx 0.1923\).

    Because \(P(I) \neq P(I | H)\), the probability of experiencing insomnia changes when we know the patient has a headache. A patient who experiences headaches is more likely to experience insomnia. Therefore, the events insomnia and headache are not independent.

    Section Summary

    A contingency table displays the joint distribution of two categorical variables. It shows how often two events occur together and allows us to compute probabilities such as individual event probabilities, joint probabilities, and conditional probabilities.

    A conditional probability is a probability computed under additional information that restricts the sample space. Instead of considering all possible outcomes, we focus only on those outcomes for which a given condition is true. Conditional probabilities are computed using

    \(P(B | A)=\dfrac{n(A \cap B)}{n(A)}=\dfrac{P(A \cap B)}{P(A)}\).

    This formula reflects the idea that once event \(A\) has occurred, only the outcomes within \(A\) remain possible.

    Two events are independent when knowing that one event has occurred does not change the probability of the other. Formally, events \(A\) and \(B\) are independent if and only if

    \(P(B) =P(B | A)\).

    When this equality holds, the occurrence of \(A\) has no influence on the likelihood of \(B\). Independence is an important concept because it simplifies probability calculations and helps identify when two events do not affect each other.

    Together, contingency tables, conditional probability, and independence form a foundational toolkit for analyzing relationships between categorical variables and understanding how information changes probability assessments.

    Section 5.4 Review Questions

    1. The contingency table shows the results of a survey of high school students. The grade and preferred pet (cat or dog) were recorded for each respondent. Suppose a person is chosen at random from this group. Let \(C\) be the event that the student prefers cats. Let \(T\)be the event that the student is in 10th grade.

    \[ \begin{array}{|l|c|c|c|} \hline & \textbf{Dogs} & \textbf{Cats} & \textbf{Total} \\ \hline \textbf{9th Grade} & 20 & 5 & 25 \\ \hline \textbf{10th Grade} & 16 & 4 & 20 \\ \hline \textbf{11th Grade} & 22 & 6 & 28 \\ \hline \textbf{12th Grade} & 30 & 7 & 37 \\ \hline \textbf{Total} & 88 & 22 & 110 \\ \hline \end{array} \nonumber\]

    1. Find \(P(C)\).
    2. Find \(P(T)\).
    3. Find \(P(C \cap T)\).
    4. Find \(P(C \cup T)\).
    5. Find \(P(C | T)\).
    6. Find \(P(T | C )\).
    7. Are \(C\) and \(T\) independent? Justify your answer.
    1. The middle school students at your school were surveyed and classified according to grade level and response to the question “How do you usually get to school?” The data are summarized in the two-way table below. A student is chosen random.

    \[ \begin{array}{|l|c|c|c|c|} \hline & \textbf{Walk} & \textbf{Bus} & \textbf{Car} & \textbf{Total} \\ \hline \textbf{6th Grade} & 30 & 120 & 65 & 215 \\ \hline \textbf{7th Grade} & 25 & 170 & 25 & 220 \\ \hline \textbf{8th Grade} & 40 & 130 & 41 & 211 \\ \hline \textbf{Total} & 95 & 420 & 131 & 646 \\ \hline \end{array} \nonumber\]

    1. What is the probability that the student is in 6th grade and takes the bus?
    2. What is the probability that a 6th grade student takes the bus?
    3. What is the probability that a student who rides the bus is in 6th grade?
    4. The previous three questions each have to do with 6th grade and taking the bus. Why are the answers to these questions different?
    5. Are the events “being in 6th grade” and “taking the bus” independent? Justify your answer.
    1. The table shows a random sample of cyclists and the routes they prefer. Suppose a cyclist is selected randomly. Find each probability.

    \[ \begin{array}{|l|c|c|c|c|} \hline & \textbf{Lake Path} & \textbf{Hilly Path} & \textbf{Wooded Path} & \textbf{Total} \\ \hline \textbf{Female} & 45 & 38 & 27 & 110 \\ \hline \textbf{Male} & 26 & 52 & 12 & 90 \\ \hline \textbf{Total} & 71 & 90 & 39 & 200 \\ \hline \end{array} \nonumber \]

    1. prefers the hilly path
    2. is female
    3. prefers the hilly path or female
    4. prefers the hilly path and female
    5. prefers the hilly path given the cyclist is female
    6. is a female given the cyclist prefers the hilly path
    7. Are “prefers hilly path” and “female” independent?
    1. The fifth-grade math students at Hill Elementary recently were part of an experiment with two books. Of the 200 students, some students used Book A and the rest used Book B. At the end of the experiment, the students were given a test to measure their grade level. The results are in the table below. Study the results and use them to answer the questions.

    \[ \begin{array}{|l|c|c|} \hline & \textbf{Scored at Grade Level} & \textbf{Scored Below Grade Level} \\ \hline \textbf{Used Book A} & 84 & 66 \\ \hline \textbf{Used Book B} & 32 & 18 \\ \hline \end{array} \nonumber \]

    1. Find P(a student scored below grade level).
    2. Find P(a student used Book A and scored below grade level).
    3. Find P(a student used Book A or scored below grade level).
    4. Find P(a student scored below grade level given they used Book A).
    5. Find P(a student scored below grade level given they used Book B).
    6. Does it appear that ‘scoring below grade level’ and ‘using Book A’ are independent? Explain clearly with probabilities.
    1. A survey of 350 students at a university revealed the following data about class standing and place of residence. One student is selected at random.

    \[ \begin{array}{|l|c|c|c|c|c|} \hline & \textbf{Freshman} & \textbf{Sophomore} & \textbf{Junior} & \textbf{Senior} & \textbf{Total} \\ \hline \textbf{Dormitory} & 89 & 34 & 46 & 15 & 184 \\ \hline \textbf{Apartment} & 32 & 17 & 22 & 48 & 119 \\ \hline \textbf{with Parents} & 13 & 31 & 3 & 0 & 47 \\ \hline \textbf{Total} & 134 & 82 & 71 & 63 & 350 \\ \hline \end{array}\nonumber\]

    1. What is the probability the student lives with their parents?
    2. What is the probability the student is a freshman and lives in an apartment?
    3. What is the probability the student is a junior or lives in in the dormitory?
    4. What is the probability that a student is a sophomore if the student lives in an apartment?
    5. What is the probability that a student lives with parents if the student is a freshman?
    1. For a group of people, the probability of having blond hair is 25%. The probability of having blond hair and blue eyes is 10%. What is the probability that person has blue eyes given they have blond hair?
    1. At a college, 40% of students belong to a club and 50% work part time. Five percent of the students work part time and belong to a club. Are being a member of a club and working part time independent? Justify with probabilities.
    1. A hospital runs a test to determine whether patients have certain disease. The test is not always accurate. The two-way table below summarizes the numbers of patients in the past year that received each result. Assume a patient is randomly selected.

    \[ \begin{array}{|l|c|c|c|} \hline & \textbf{Positive Result on Test} & \textbf{Negative Result on Test} & \textbf{Total} \\ \hline \textbf{Has Disease} & 100 & 4 & 104 \\ \hline \textbf{Does Not Have Disease} & 12 & 560 & 572 \\ \hline \textbf{Total} & 112 & 564 & 676 \\ \hline \end{array} \nonumber \]

    1. What is the probability that the patient has the disease?
    2. A patient from this group received a positive test result. What is the probability that he or she has the disease?
    3. A patient from this group has the disease. What is the probability that he or she received a positive result on the test?
    4. A “false positive” is when a patient receives a positive result on the test, but does not actually have the disease. What is the probability of a false positive?
    5. What is the probability that a patient receives accurate test results?

    This page titled 5.4: Contingency Tables, Conditional Probability, and Independence was last modified on Thu, 06 Aug 2026 02:02:26 GMT and is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by Andy Jones.

    • Was this article helpful?