How many integer solutions does $xy+9(x+y)=2006$ have? Here $x$ and $y$ are both integers.

My trying: I have tried to solve this problem. But I have no idea to solve this. Please help


3 Answers 3


Add $81$ to both sides to give $$xy + 9x + 9y + 81 = (x+9)(y+9) = 2087,$$ and then consider the divisors of the RHS.

  • 1
    $\begingroup$ This answer is too awesome . $\endgroup$ Jan 25, 2014 at 16:42
  • 8
    $\begingroup$ This is popularly called Simon's Favorite Factoring Trick. $\endgroup$
    – Ayesha
    Jan 25, 2014 at 17:05
  • 2
    $\begingroup$ Seems like this can be generalized. Assuming $a\neq 0$, from $$axy+bx+cy=d$$ we can always change it to $$(ax+c)(ay+b)=ad+bc$$ (not the form presented in APoS.) $\endgroup$ Jan 25, 2014 at 17:58
  • $\begingroup$ @BillDubuque Thanks, nice to know some algebraic connections. :) $\endgroup$ Jan 25, 2014 at 19:23
  • $\begingroup$ YongHaoNg Yes, one easily reduces it to the monic case by using the AC method (see my remark there that it also works in the multivariate case). I've explained this in a Remark in my answer. $\endgroup$ Jan 25, 2014 at 19:23

Key Idea $\ $ Completing a square $ $ generalizes to $ $ completing a product (rectangle)

$$\begin{eqnarray} x^2\:\! &+&\ \ \,2bx &=& (x + b)^2 - b^2\\ \iff\ x\color{#c00}x &+& bx\!+\!b\color{#c00}x &=\,& (x+b)(\color{#c00}x+b)-b^2\\ \iff \ x\color{#c00}y &+& bx\!+\!b\color{#c00}y\ &=& (x+b)(\color{#c00}y+b)-b^2\\ {\rm generally}\quad {xy}&+&bx\!+\!cy &=& \color{#0a0}{(x+c)(y+b) - bc} \end{eqnarray}\quad\ \ \,$$

Remark $\ $ The AC-method extends it to non-monics (lead coef $\,a\neq 1)$ as follows

$$\begin{eqnarray} && \ \ \ a\ x\ y &+& b\ x&+&c\ y &=&\ \ d\\ \smash{ \overset{\large \times\ a}\iff} && \ \ ax\,ay &+& b\,ax &+& c\,ay &=& ad\\ \iff && \ \ \ {X\ Y} &+& {b\,X} &+& {c\,Y} &=& ad,\quad X = ax,\ \ Y = ay\\ \iff && \ \color{#0a0}{(X\!+\!c)}&&\!\!\!\!\! \color{#0a0}{(Y\!+\!b)}&\color{#0a0}-&\, \color{#0a0}{bc} &=\,& ad,\quad {\rm by\ \ \color{#0a0}{monic\ \ case}\ \ above}\\ \iff && (ax\!+\!c)\!\!&&\!\!\!\!\!\!(ay\!+\!b)\!\! && &=& ad\!+\!bc \end{eqnarray}$$

Summarizing, if $\,a\,$ is cancellable (e.g. $\,a\neq 0\,$ in $\Bbb Z)\,$ then

$$\bbox[1px,border:3px solid #c60]{\bbox[8px,border:1px solid #c00]{\begin{align} axy + bx + cy &\,=\, d\\[.2em] \!\!\!\iff (ax+c)(ay+b) &\,=\, ad+bc\end{align}}}\qquad\qquad\qquad$$

In this form it is clear that the solution reduces to a finite process, namely, test which of the factorizations of $ad+bc$ can be written in the form $\,(ax+c)(ay+b)$.

This is one case of Lagrange's solution of the general quadratic binary Diophantine equation.

Note $ $ The special monic case $(a = 1)$ is sometimes called Simon's Favorite Factoring Trick in some problem solving / contest communities, but this name is not in wide use.


Just to give another way to solve.

$$p+9s=2006\Rightarrow p\equiv8\pmod9\Rightarrow p=8+9n$$Then $s=t-n$ for some $t$ which is deduced from $$(8+9n)+9(t-n)=2006\Rightarrow t=222$$ so we have the general solution for the sum and the product $$\begin{cases}p=8+9n\\s=222-n\end{cases}$$ Now we have for values of $x$ and $y$ $$X^2-(222-n)X+(8+9n)=0$$ where for confort we put $2n$ instead of $n$ so we have the equation $$X^2-2(111-n)X+(8+18n)=0\Rightarrow X=111-n\pm\sqrt{n^2-240n+12313}$$ We need $$n^2-240n+12313=Y^2\\(n-120)^2+2087=Y^2\\2087=(Y+n-120)(Y-n+120)$$ Since $2087$ is prime we have an easy factorization giving setting values of $n$.

(By the way, $2087$ is the same integer reached in the concise and beautiful proof by @heropup).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.