# 2007 Indonesia MO Problems/Problem 8

## Problem

Let $m$ and $n$ be two positive integers. If there are infinitely many integers $k$ such that $k^2+2kn+m^2$ is a perfect square, prove that $m=n$.

## Solution (credit to crazyfehmy)

Note that we can complete the square to get $k^2 + 2kn + n^2 - n^2 + m^2$, which equals $(k+n)^2 + m^2 - n^2$.

Assume that $m > n$. Since $m, n$ are positive, we know that $m^2 - n^2 > 0$. In order to prove that $(k+n)^2 + m^2 - n^2$ is not a perfect square, we can show that there are values of $k$ where $(k+n)^2 < (k+n)^2 + m^2 - n^2 < (k+n+1)^2$.

Since $m^2 - n^2 > 0$, we know that $(k+n)^2 < (k+n)^2 + m^2 - n^2$. In the case where $(k+n)^2 + m^2 - n^2 < (k+n+1)^2$, we can expand and simplify to get \begin{align*} k^2 + 2kn + n^2 + m^2 - n^2 &< k^2 + 2kn + n^2 + 2k + 2n + 1 \\ m^2 - n^2 &< 2k + 2n + 1 \\ \frac{m^2 - n^2 - 2n - 1}{2} &< k. \end{align*} All steps are reversible, so there are values of $k$ where $(k+n)^2 < (k+n)^2 + m^2 - n^2 < (k+n+1)^2$, so there are no values of $m, n$ where $m > n$ that results in infinite number of integers $k$ that satisfy the original conditions.

Now assume that $m < n$. Since $m, n$ are positive, we know that $m^2 - n^2 < 0$. In order to prove that $(k+n)^2 + m^2 - n^2$ is not a perfect square, we can show that there are values of $k$ where $(k+n-1)^2 < (k+n)^2 + m^2 - n^2 < (k+n)^2$.

Since $m^2 - n^2 < 0$, we know that $(k+n)^2 + m^2 - n^2 < (k+n)^2$. In the case where $(k+n-1)^2 < (k+n)^2 + m^2 - n^2$, we can expand and simplify to get \begin{align*} k^2 + 2kn + n^2 - 2k - 2n + 1 &< k^2 + 2kn + n^2 + m^2 - n^2 \\ -2k - 2n + 1 &< m^2 - n^2 \\ k &> -\frac{m^2 - n^2 + 2n - 1}{2}. \end{align*} All steps are reversible, so there are values of $k$ where $(k+n-1)^2 < (k+n)^2 + m^2 - n^2$, so there are no values of $m, n$ where $m < n$ that results in infinite number of integers $k$ that satisfy the original conditions.

Now we need to prove that if $m = n$, there are an infinite number of integers $k$ that satisfy the original conditions. By the Substitution Property, we find that $k^2 + 2kn + m^2 = k^2 + 2kn + n^2$. The expression can be factored into $(k+n)^2$. Since the expression is a perfect square, for all integer values of $n, k$, there are an infinite number of integers $k$ that satisfies the original conditions when $m = n$.