Balance Scale and Weights

Combinatorics · Medium · Free problem

You have a two-pan balance scale and an unlimited supply of custom weights. You want to be able to weigh any unknown object whose weight is an integer from

$ to $40$ pounds.

The key twist: you can place weights on either side of the scale -- both the same side as the object and the opposite side.

  1. What is the minimum number of weights you need?
  2. What should those weights be?
  3. Demonstrate how to weigh $5$ pounds, $7$ pounds, and $40$ pounds with your chosen set.

Hints

  1. Each weight can be placed on the object's side (subtract), the other side (add), or left off (zero). How many states does that give you per weight?
  2. With $n$ weights each having $3$ states, you get $3^n$ combinations. For $n = 4$ that is $81$ -- which covers integers from $-40$ to $40$ by symmetry.
  3. Try powers of $3$: the weights
    , 3, 9, 27$ let you express any target as $W = \pm 1 \pm 3 \pm 9 \pm 27$ (with some terms possibly omitted). For example, $5 = 9 - 3 - 1$.

Worked Solution

How to Think About It: The key insight is that placing a weight on the same side as the object effectively *subtracts* that weight from the measurement. If the object weighs $W$ and you put weight $a$ on the object's side and weight $b$ on the other side, the scale balances when $W + a = b$, i.e., $W = b - a$. So each weight has three possible states: on the opposite side from the object (add), on the same side as the object (subtract), or not used at all. That is three choices per weight -- which screams base 3.

Quick Estimate: With $n$ weights, each having 3 states, you get $3^n$ total combinations. By symmetry, half represent negative values (where you'd swap which side the object is on), one combination is zero (no weights used), and the other half are positive. So you can represent integers from $-\frac{3^n - 1}{2}$ to $\frac{3^n - 1}{2}$. You need $\frac{3^n - 1}{2} \geq 40$, so $3^n \geq 81$, giving $n \geq 4$. Four weights cover up to $\frac{81 - 1}{2} = 40$ -- exactly the range we need.

Approach: This is balanced ternary representation. Each integer from

$ to $40$ can be written using digits $\{-1, 0, 1\}$ in base 3, where the place values are
, 3, 9, 27$.

Formal Solution:

The weights are

, 3, 9, 27$ pounds (the powers of $3^0, 3^1, 3^2, 3^3$).

For any target weight $W$ between

$ and $40$, express $W$ in balanced ternary:

$W = a_0 \cdot 1 + a_1 \cdot 3 + a_2 \cdot 9 + a_3 \cdot 27$

where each $a_i \in \{-1, 0, 1\}$.

  • $a_i = 1$: place weight $3^i$ on the opposite side from the object
  • $a_i = -1$: place weight $3^i$ on the same side as the object
  • $a_i = 0$: don't use weight $3^i$

Worked examples:

  • $W = 5$: We need $5 = 9 - 3 - 1$. Place $9$ on the empty side; place $3$ and
    $ on the object's side. The scale balances because $5 + 3 + 1 = 9$.
  • $W = 7$: We need $7 = 9 - 3 + 1$. Place $9$ and
    $ on the empty side; place $3$ on the object's side. Check: $7 + 3 = 9 + 1 = 10$.
  • $W = 40$: We need $40 = 27 + 9 + 3 + 1$. Place all four weights on the empty side. Check: $40 = 27 + 9 + 3 + 1$.

Why powers of 3 are optimal: With $n$ weights, the maximum measurable range is $\frac{3^n - 1}{2}$. For weights restricted to one side only (no subtraction), you'd need powers of 2 and could only cover

$ to
^n - 1 = 15$ with 4 weights. Allowing both sides upgrades the base from 2 to 3, expanding coverage from
5$ to $40$ with the same number of weights.

Answer: The minimum number of weights is $4$, with values

, 3, 9, 27$ pounds. Every integer from
$ to $40$ has a unique balanced ternary representation using these weights.

Intuition

This problem is really about number representation in disguise. When weights can only go on one side, each weight is either used or not -- binary, base 2. But a balance scale lets you subtract by putting weights on the object's side, which gives each weight three states: add, subtract, or skip. That upgrades you from binary to balanced ternary (base 3 with digits $-1, 0, 1$). The payoff is dramatic: four weights cover

$ to $40$ instead of just
$ to
5$.

This shows up in quant work more than you'd expect. Balanced ternary is an example of a "signed digit" representation, which appears in efficient multiplication algorithms and in coding theory. The broader lesson is that whenever you add a degree of freedom to each component (here, allowing subtraction), you change the base of the system and get exponentially more coverage. It is the same principle behind why ternary search is sometimes more efficient than binary, and why three-valued logic can be more expressive than Boolean.

Open the full interactive solver →