Tic-Tac-Toe by Random Ball Placement

Probability · Medium · Free problem

You have a $3 \times 3$ grid. You randomly drop three (distinguishable) balls into the grid, where each ball independently lands in one of the 9 squares with equal probability. The only restriction is that all three balls cannot land in the same square.

What is the probability that the three balls form a tic-tac-toe -- that is, they occupy three squares in a row, column, or diagonal?

Hints

  1. Think about how many winning lines exist on a $3 \times 3$ grid (rows, columns, diagonals) and how many total ways the balls can be placed.
  2. The balls are distinguishable, so the sample space is $9^3$ minus the degenerate cases. For each winning line, count the number of ways to assign one ball per square.
  3. There are 8 winning lines and $3! = 6$ assignments per line. The valid sample space is $9^3 - 9 = 720$. Compute the ratio.

Worked Solution

How to Think About It: This is a counting problem with a small twist: we are sampling with replacement (balls can share squares) but excluding the degenerate case where all three pile into the same cell. The grid has exactly 8 winning lines (3 rows, 3 columns, 2 diagonals), and for each line the balls must land in all three distinct squares. The numerator is easy to count; the denominator is just the full sample space minus the excluded arrangements.

Quick Estimate: There are $9^3 = 729$ unrestricted placements and only 9 degenerate ones, so the valid sample space is 720. Each winning line requires one ball per square, giving $3! = 6$ arrangements per line. With 8 lines that is $48$ winners. A quick ratio: $48/720 \approx 0.067$. So roughly a 1-in-15 chance -- pretty rare, which makes sense because three random balls have a lot of room to scatter.

Approach: Straight combinatorial counting -- enumerate the sample space and favorable outcomes, then divide.

Formal Solution:

  1. Sample space. Each of the 3 distinguishable balls is placed independently and uniformly at random into one of 9 squares. The total number of unrestricted placements is $9^3 = 729$. We subtract the 9 outcomes where all three balls land in the same square:

$$|\Omega| = 729 - 9 = 720$$

2. Winning lines. A tic-tac-toe requires the three balls to occupy a complete row, column, or diagonal. The 8 winning lines are: - 3 rows - 3 columns - 2 diagonals

  1. Favorable outcomes per line. For a given line of 3 squares, we need each ball in a different square of that line. The number of ways to assign 3 distinguishable balls to 3 distinct squares is $3! = 6$.
  1. No double-counting. No two distinct winning lines share all 3 squares, so no arrangement is counted twice.
  1. Total favorable outcomes:

$$|W| = 8 \times 6 = 48$$

  1. Probability:

$$P(\text{tic-tac-toe}) = \frac{48}{720} = \frac{1}{15}$$

Answer: The probability of tic-tac-toe is $\dfrac{1}{15} \approx 0.0667$.

Intuition

This problem is a clean exercise in setting up the right sample space. The key modeling choice is whether the balls are distinguishable or not -- here they are, since each ball is independently dropped. That gives a uniform sample space of size $9^3$ (minus the excluded all-same-square cases). Once you frame it that way, the counting is mechanical: 8 lines, $3!$ orderings each, done. The constraint that all three balls cannot occupy the same square barely changes the denominator (removing 9 out of 729) and does not affect the numerator at all, since winning arrangements always have one ball per square.

The broader lesson is about careful sample-space construction. In interview combinatorics, most mistakes come from misidentifying whether objects are distinguishable, whether order matters, or whether sampling is with or without replacement. Getting those choices right at the start makes the counting trivial. Here, recognizing that each ball is an independent uniform draw instantly gives you the right denominator, and the rest follows.

Open the full interactive solver →