# 1994 AIME Problems/Problem 7

## Problem

For certain ordered pairs $(a,b)\,$ of real numbers, the system of equations $ax+by=1\,$ $x^2+y^2=50\,$

has at least one solution, and each solution is an ordered pair $(x,y)\,$ of integers. How many such ordered pairs $(a,b)\,$ are there?

## Solution

The equation $x^2+y^2=50$ is that of a circle of radius $\sqrt{50}$, centered at the origin. By testing integers until the left side becomes too big, we see that the lattice points on this circle are $(\pm1,\pm7)$, $(\pm5,\pm5)$, and $(\pm7,\pm1)$ where the signs are all independent of each other, for a total of $3\cdot 2\cdot 2=12$ lattice points. They are indicated by the blue dots below.

Since $(x,y)=(0,0)$ yields $a\cdot 0+b\cdot 0=0 \neq 1$, we know that $ax+by=1$ is the equation of a line that does not pass through the origin. So, we are looking for the number of lines which pass through at least one of the $12$ lattice points on the circle, but do not pass through the origin or through any non-lattice point on the circle. An example is the green line above. It is straightforward to show that a line passes through the origin precisely when there exist two opposite points $(p,q)$ and $(-p,-q)$ through which it passes. And example is the red line above.

There are $\binom{12}{2}=66$ ways to pick two distinct lattice points, and subsequently $66$ distinct lines which pass through two distinct lattice points on the circle. Then we subtract the lines which pass through the origin by noting that the lattice points on the circle can be grouped into opposite pairs $(p,q)$ and $(-p,-q)$, for a total of $\frac{12}{2}=6$ lines. Finally, we add the $12$ unique tangent lines to the circle at each of the lattice points.

Therefore, our final count of distinct lines which pass through one or two of the lattice points on the circle, but do not pass through the origin, is $$66-6+12=\boxed{72}.$$

The problems on this page are copyrighted by the Mathematical Association of America's American Mathematics Competitions. 