
Problem 9.1. Find all quadratic functions $f(x)=x^{2}-a x+b$ with integer coefficients such that there exist distinct integer numbers $m$, $n, p$ in the interval $[1,9]$ for which $|f(m)|=|f(n)|=|f(p)|=7$.


Solution: Let $f(x)$ be a function satisfying the conditions of the problem. Such a function cannot take one and the same value for three different arguments (otherwise we would have a quadratic equation having three distinct roots). Therefore two of the numbers $f(m), f(n)$ and $f(p)$ equal 7 (or -7 ) and the third one equals -7 (or 7 ).

Case 1. $f(m)=f(n)=7, f(p)=-7$. Without loss of generality we may assume that $m>n$. Since $m, n$ are roots of $x^{2}-a x+b-7=0$, we obtain that $a=m+n, b=m n+7$.

Subtracting the two equalities

$$
\begin{array}{ccc}
m^{2}-a m+b & = & 7 \\
p^{2}-a p+b & = & -7
\end{array}
$$

we find

$$
14=m^{2}-p^{2}-a(m-p)=(m-p)(m+p-a)=(m-p)(p-n)
$$

Thus the numbers $m-p$ and $p-n$ are either both positive or both negative and since $m>n$, they are positive. Moreover they are integer and therefore are equal to 1 and 14 or to 2 and 7. But since $m, n, p \in[1,9]$ it follows that neither $m-p$ nor $p-n$ is 14 . There are two cases to consider: $m-p=2, p-n=7$ and $m-p=7$, $p-n=2$, i. e., either $m=p+2, n=p-7$ or $m=p+7, n=p-2$. It is obvious that in both cases at least one of $m, n, p$ lies outside the interval $[1,9]$.

Case 2. $f(m)=f(n)=-7, f(p)=7$. As in Case 1 we get $a=m+n, b=m n-7$ and $(m-p)(p-n)=-14$. Using similar arguments we obtain that either $m-p=2, p-n=-7$ or $m-$ $p=-2, p-n=7$. (Without loss of generality we suppose that $|m-p|<|p-n|$.) Therefore the two options are $m=p+2$, $n=p+7$ and $m=p-2, n=p-7$. Simple calculations show that all triples $(m, n, p)$ satisfying the conditions are $(3,8,1),(4,9,2)$, $(6,1,8)$ and $(7,2,9)$. So the functions are $f(x)=x^{2}-11 x+17$, $f(x)=x^{2}-13 x+29, f(x)=x^{2}-7 x-1$ and $f(x)=x^{2}-9 x+7$.
