There are balls that look identical, but their weights all dier by a little. We have a balance that can compare only two balls at a time. What is the minimum number of times, in the worst case, we
have to use to balance to rank all balls by weight?
To determine the minimum number of weighings required to rank all balls by weight using a balance that can compare only two balls at a time, we need to consider the worst-case scenario. Let's denote the number of balls as \( n \).

1. **Initial Comparison**:
   - Compare two balls, say \( A \) and \( B \). This gives us one piece of information: either \( A \) is heavier than \( B \) or \( B \) is heavier than \( A \).

2. **Inserting the Third Ball**:
   - Compare the third ball \( C \) with the lighter of the first comparison. Suppose \( A \) is heavier than \( B \), then compare \( C \) with \( B \).
   - If \( C \) is heavier than \( B \), we need to compare \( C \) with \( A \) to determine if \( C \) is the heaviest or if \( A \) is still the heaviest.

3. **General Case for \( n \) Balls**:
   - For \( n \) balls, we need to perform comparisons in a way that each new ball is compared with the already ranked balls to find its correct position.
   - This process is similar to insertion sort, where each new element (ball) is inserted into its correct position among the already sorted elements.

4. **Number of Comparisons**:
   - In the worst case, each new ball might need to be compared with all previously sorted balls.
   - For \( n \) balls, the number of comparisons required is:
     \[
     \sum_{i=1}^{n-1} i = \frac{(n-1)n}{2}
     \]
   - This is because the first ball requires 0 comparisons, the second ball requires 1 comparison, the third ball requires 2 comparisons, and so on.

5. **Specific Case for 3 Balls**:
   - For 3 balls, the number of comparisons required is:
     \[
     \sum_{i=1}^{2} i = 1 + 2 = 3
     \]

Thus, the minimum number of weighings required to rank 3 balls by weight in the worst case is 3.

The final answer is \(\boxed{3}\)