3 minute read Introductory

From the archive (2024). Corrected in October 2026; see the note at the end.

Problem (IMO 1988, Problem 6). Let \(a\) and \(b\) be positive integers such that \(ab + 1\) divides \(a^2 + b^2\). Show that \(\dfrac{a^2 + b^2}{ab + 1}\) is the square of an integer.

This is one of the most famous problems in the history of the IMO. The technique below, now called Vieta jumping, combines Vieta’s formulas with infinite descent.

Setting up a contradiction

Suppose, for contradiction, that for some positive integers \(a, b\) the quotient

\[k = \frac{a^2 + b^2}{ab + 1}\]

is an integer but not a perfect square. Fix this value of \(k\), and among all pairs of positive integers giving this \(k\), choose \((A, B)\) with \(A+B\) as small as possible. Without loss of generality \(A \geq B\).

A quadratic in \(A\)

Rearranging \(A^2+B^2=k(AB+1)\) gives

\[A^2-(kB)A+(B^2-k)=0,\]

so \(A\) is a root of the quadratic \(x^2-(kB)x+(B^2-k)=0\). Let \(C\) be its other root.

Vieta’s formulas

By Vieta’s formulas (the sum and product of the roots of a quadratic),

\[A+C=kB, \qquad AC=B^2-k .\]

The first shows that \(C = kB - A\) is an integer, and the second gives

\[C=\frac{B^2-k}{A}.\]

Moreover \(C \neq 0\), since otherwise \(k = B^2\) would be a perfect square, and \(C\) is positive (see the first exercise). So \((C, B)\) is another pair of positive integers giving the same \(k\).

The contradiction

Since \(A \geq B\),

\[C = \frac{B^2-k}{A} < \frac{B^2}{A} \le \frac{A^2}{A} = A .\]

So \(C<A\), and the pair \((C, B)\) has \(C+B<A+B\). This contradicts the minimality of \(A + B\). Therefore \(\frac{a^2 + b^2}{ab + 1}\) must be a perfect square. \(\blacksquare\)

Visualising the jumps

The argument shows that if \(k\) is not a square there can be no minimal solution. When \(k\) is a perfect square, the same “jump” \((A, B) \mapsto (B, C)\) can be run backwards from the minimal solution \((0, \sqrt{k})\), producing a ladder of solutions. This process is what gives Vieta jumping its name.

Plot of the solution ladder for k = 4: (0, 2), (2, 8), (8, 30), (30, 112).
Solutions for \(k = 4\): \((0, 2) \to (2, 8) \to (8, 30) \to (30, 112)\).
Plot of the solution ladder for k = 9: (0, 3), (3, 27), (27, 240), (240, 2133).
Solutions for \(k = 9\): \((0, 3) \to (3, 27) \to (27, 240) \to (240, 2133)\).

Code

import matplotlib.pyplot as plt

def find_initial_points(n, max_range=4000):
    points = []
    for a in range(0, max_range):
        for b in range(a + 1, max_range):
            if (a**2 + b**2) % (a * b + 1) == 0:
                if (a**2 + b**2) // (a * b + 1) == n:
                    points.append((a, b))
    return points

def plot_initial_points(points, n):
    fig, ax = plt.subplots()
    x_coords = [x for x, y in points]
    y_coords = [y for x, y in points]

    ax.plot(x_coords, y_coords, marker='o', linestyle='-')

    ax.set_xlabel('a')
    ax.set_ylabel('b')
    ax.set_title(f'Vieta Jumping for n = {n}')
    plt.grid()
    plt.show()

n = 9
number_of_points_plotted = 4

initial_points = find_initial_points(n)

if initial_points:
    print(f'Found initial points for n = {n}:')
    for idx, (a, b) in enumerate(initial_points):
        print(f'{idx + 1}: a = {a}, b = {b}')

    # Flip the order of every other point so consecutive points share a coordinate
    for i in range(len(initial_points)):
        if i % 2 == 1:
            initial_points[i] = initial_points[i][::-1]

    plot_initial_points(initial_points[:number_of_points_plotted], n)
else:
    print('No initial points found')

Exercises

  • Prove that \(C > 0\). (Hint: if \(C < 0\), show that \(C^2 - kBC + B^2 - k > 0\).)
  • State and prove Vieta’s formulas for a polynomial of degree \(n\), and check that they reduce to the formulas above for a quadratic.
  • (IMO 2007, Problem 5) Let \(a\) and \(b\) be positive integers. Show that if \(4ab - 1\) divides \((4a^2 - 1)^2\), then \(a = b\).

Credits

The solution is based on Kyle Wu’s article Vieta jumping: visualization and intuition in Parabola 60(1), 2024, and this video.

Changes on 25 October 2026

What was wrong. The proof skipped a step: it did not show that the new root \(C\) is a positive integer, which the descent needs. The link to the Parabola article had moved.

What changed. The missing step is added, the jumps for \(k = 4\) and \(k = 9\) are written as chains, and the link is updated. Previously titled “Infinite Descent and Vieta’s Formulas”.