Tutorials › Exam P - Probability › The Cross-Product Test for Two-by-Two Tables

Exam P · Conditional Distributions and Independence · Tutorial 744 of 915

The Cross-Product Test for Two-by-Two Tables

Learn to test independence in a two-by-two table by comparing its diagonal cross-products, without repeatedly calculating conditional probabilities.

Intermediate 10 min read

What You'll Learn

  • Set up a two-by-two probability table with consistent cell labels.
  • Derive why independence is equivalent to equality of the diagonal cross-products.
  • Test a complete table without calculating conditional probabilities.
  • Solve for a missing table entry under an independence assumption.
  • Apply the same equality to counts and distinguish table independence from statistical evidence.
  • Handle zero marginals and recognize incorrect cross-product comparisons.

Why a Two-by-Two Table Has a Shortcut

When two variables each have only two possible outcomes, their joint distribution can be displayed in four cells. Testing independence by comparing conditional probabilities is valid, but it can require several calculations and may create undefined expressions when a conditioning event has probability zero. For a two-by-two table, the same question has a compact answer: compare the products along the two diagonals.

The shortcut is useful only when the cells are placed and labelled consistently. It is an exact equality for a probability table, not a statistical significance test for a sample. The method is aligned with the SOA Exam P (Probability) syllabus.

Definition: Let \(X\) and \(Y\) each have two outcomes, labelled 1 and 0. Write their joint probability table as $$ \begin{array}{c|cc|c} & Y=1 & Y=0 & \text{Row total}\\ \hline X=1 & a & b & a+b\\ X=0 & c & d & c+d\\ \hline \text{Column total} & a+c & b+d & 1 \end{array} $$ The entries \(a,b,c,d\) are nonnegative and sum to 1. The cross-product equality for independence is \(ad=bc\). In words, the product of the upper-left and lower-right cells must equal the product of the upper-right and lower-left cells.

Why the Cross-Product Equality Works

Independence means that every joint cell probability equals the product of its row and column probabilities. For example, the upper-left cell must satisfy \(a=(a+b)(a+c)\): the row total is \(P(X=1)\), and the column total is \(P(Y=1)\). Expanding this requirement and using the fact that the four entries sum to 1 gives the diagonal-product condition.

$$ \begin{aligned} a=(a+b)(a+c) &\iff a=a^2+a(b+c)+bc\\ &\iff a(1-a-b-c)=bc\\ &\iff ad=bc. \end{aligned} $$

The last equivalence uses \(1-a-b-c=d\). This proves that independence implies the cross-product equality. To see that the equality is also sufficient, suppose \(ad=bc\). The same expansion shows that \(a=(a+b)(a+c)\). The other three cells also factor into their row and column totals:

$$ \begin{aligned} b&=(a+b)(b+d),\\ c&=(c+d)(a+c),\\ d&=(c+d)(b+d). \end{aligned} $$

For example, the difference between \(b\) and its proposed factorization is \(b-(a+b)(b+d)=bc-ad=0\), where the table total is 1. The corresponding differences for \(c\) and \(d\) are also zero when \(ad=bc\). Thus all four joint probabilities factor as the products of their marginals, which is exactly independence.

This argument does not divide by a cell or by a marginal probability. Consequently, the equality remains valid when some cells are zero, including when one variable has an outcome with probability zero. That detail matters: a conditional probability given an impossible event is undefined, but the cross-product equality is still well-defined.

Using the Test

The practical test is short: first map the outcomes to the four cells, then multiply opposite corners. Equality means the table represents independent variables; inequality means it does not. Keep the layout fixed while doing the calculation, since changing the placement of a cell changes which products are diagonals.

1
Label the outcomes.
Choose which outcome is 1 and which is 0 for each variable, and write the four joint probabilities in the table.
2
Check the table.
Confirm that all entries are nonnegative and sum to 1. For counts, confirm that the cells describe the same total population or sample.
3
Multiply the diagonals.
Calculate \(ad\) and \(bc\) using the displayed layout.
4
State the conclusion in context.
Equal products indicate independence in this probability table; unequal products indicate dependence.

Worked Example: Testing a Complete Probability Table

In a hypothetical monitoring program, let \(X=1\) mean a sensor issued an alert and \(Y=1\) mean a reviewed reading was classified as unusual. The joint probability table is

$$ \begin{array}{c|cc} & Y=1 & Y=0\\ \hline X=1 & 0.2400 & 0.1600\\ X=0 & 0.3600 & 0.2400 \end{array} $$

Determine whether \(X\) and \(Y\) are independent. If they are, calculate the probability that at least one of \(X=1\) or \(Y=1\) occurs.

Method. Use the cross-product equality. The entries sum to \(0.2400+0.1600+0.3600+0.2400=1.0000\), so this is a probability table.

The diagonal products are \(ad=(0.2400)(0.2400)=0.0576\) and \(bc=(0.1600)(0.3600)=0.0576\). Since they are equal, the variables are independent.

For the second part, the row and column totals give \(P(X=1)=0.2400+0.1600=0.4000\) and \(P(Y=1)=0.2400+0.3600=0.6000\). The probability of at least one event is \(P(X=1)+P(Y=1)-P(X=1,Y=1)=0.4000+0.6000-0.2400=0.7600\).

Check. Independence predicts \(P(X=1,Y=1)=P(X=1)P(Y=1)=(0.4000)(0.6000)=0.2400\), matching the table. The answer is \(0.7600\). A common mistake this method avoids is comparing products of cells in the same row instead of opposite corners.

Worked Example: Finding a Missing Cell Under Independence

A hypothetical two-outcome screening study has a joint probability table with entries \(x\) and \(0.2000-x\) in the first row, and \(0.3000\) and \(0.5000\) in the second row. Find \(x\) if the two outcomes are independent, and check that the resulting table is valid.

Method. Place the entries in the stated order:

$$ \begin{array}{c|cc} & Y=1 & Y=0\\ \hline X=1 & x & 0.2000-x\\ X=0 & 0.3000 & 0.5000 \end{array} $$

Independence requires equality of the diagonal products: \(x(0.5000)=(0.2000-x)(0.3000)\). Expanding the right-hand side gives \(0.5000x=0.0600-0.3000x\), so \(0.8000x=0.0600\), and therefore \(x=0.0750\).

The remaining first-row entry is \(0.2000-0.0750=0.1250\). All four entries are nonnegative and their sum is \(0.0750+0.1250+0.3000+0.5000=1.0000\). The diagonal products check: \((0.0750)(0.5000)=0.0375\) and \((0.1250)(0.3000)=0.0375\). Thus the valid independent table has \(x=0.0750\).

Check. The first-row total is \(0.2000\), and the first-column total is \(0.3750\). Their product is \(0.0750\), exactly the upper-left cell. The common trap is to solve the equation with the wrong diagonal pairing; the cell \(0.2000-x\) is opposite \(0.3000\), not \(0.5000\).

Worked Example: Applying the Equality to Counts

A hypothetical quality audit records whether each of 100 components received a secondary inspection (\(X=1\)) and whether it had a marked surface flaw (\(Y=1\)). The counts are:

$$ \begin{array}{c|cc|c} & Y=1 & Y=0 & \text{Total}\\ \hline X=1 & 36 & 24 & 60\\ X=0 & 24 & 16 & 40\\ \hline \text{Total} & 60 & 40 & 100 \end{array} $$

Decide whether the empirical two-by-two table factors as an independent table. Then find the empirical probability that a component was inspected or had a flaw, counting components with both outcomes only once.

Method. For a count table with total \(N\), the cell probabilities are the counts divided by \(N\). The probability cross-products are therefore the count cross-products divided by \(N^2\). It is enough to compare the count products: \(ad=(36)(16)=576\) and \(bc=(24)(24)=576\). The equality holds, so the empirical probability table represents independence.

The marginal probabilities are \(P(X=1)=60/100=0.6000\), \(P(Y=1)=60/100=0.6000\), and \(P(X=1,Y=1)=36/100=0.3600\). Thus the probability of inspection or a flaw is \(0.6000+0.6000-0.3600=0.8400\).

Check. Under independence, the joint probability of both outcomes is \(0.6000(0.6000)=0.3600\), as observed. The answer is \(0.8400\). This conclusion describes the empirical table; it does not, by itself, establish a population-level relationship or provide a statistical significance assessment.

Common Traps and Interpretation

The equality is simple, but several errors can reverse the conclusion or overstate what has been established.

  • Using the wrong cell pairing. With the displayed layout, compare \(ad\) with \(bc\). Do not compare cells in the same row or column.
  • Ignoring the table layout. If outcomes are swapped or rows and columns are rearranged, redraw the table and identify its diagonals again. A consistent rearrangement preserves the test, but an inconsistent cell labelling does not.
  • Treating approximate equality as exact. For exact probabilities, independence requires exact equality. If values are rounded, apparent small discrepancies may be caused by rounding; use unrounded values when available.
  • Confusing an empirical table with a population model. For observed counts, the equality says the proportions in that particular table factor exactly. It is not a test statistic, does not quantify sampling uncertainty, and does not prove that the underlying population variables are independent.
  • Assuming a zero cell automatically decides the result. If \(a=0\), for instance, independence requires \(bc=0\). A zero cell can therefore occur in an independent table or a dependent one; compare both products.

For a two-by-two probability table, this test is equivalent to checking the joint-marginal factorization of independence, but it avoids calculating conditional probabilities separately. It is especially convenient when the table is already given, when one cell is unknown, or when zero marginals make conditional-probability calculations inconvenient.

Key takeaway: Arrange the four joint probabilities as \(a,b,c,d\) in a two-by-two table. The variables are independent exactly when the diagonal products match: \(ad=bc\). For counts, compare the corresponding count products; remember that the result describes the table being analyzed.

Check Your Understanding

For each problem, identify the diagonal products before deciding whether the two outcomes are independent.

  1. A hypothetical table, with rows \(X=1,0\) and columns \(Y=1,0\), has entries \(0.1200, 0.2800, 0.1800, 0.4200\), in row order. Test independence. (Answer: Independent; \(0.1200(0.4200)=0.2800(0.1800)=0.0504\).)
  2. A joint probability table has rows \(X=1,0\), columns \(Y=1,0\), and entries \(0.1600, 0.2400, 0.2400, 0.3600\), in row order. Check that its entries sum to 1 and test independence. (Answer: The entries sum to \(1.0000\), and the variables are independent because both diagonal products equal \(0.0576\).)
  3. The first row of a probability table is \(x, 0.4000-x\), and the second row is \(0.2000, 0.4000\), in column order \(Y=1,0\). Find \(x\) if the variables are independent, and verify that the table is valid. (Answer: \(x=0.1333\ldots=2/15\); the other first-row entry is \(4/15\), and the four entries are nonnegative and sum to 1.)
  4. A hypothetical count table has cells \(25,15\) in its first row and \(20,40\) in its second row. Decide whether the empirical table factors as an independent table. (Answer: No; \(25(40)=1000\), whereas \(15(20)=300\).)
  5. A probability table has rows \(X=1,0\), columns \(Y=1,0\), and entries \(0,0,0.4000,0.6000\), in row order. Does the cross-product equality hold, and are the variables independent? Explain the zero-row case. (Answer: Yes, the products are both 0; the variables are independent because \(P(X=1)=0\), so \(X\) is constant.)
Clinical Biostats