# Formula that takes on all integers

Given two integers $a,b$, how to prove that for every integer $z$, there exist integers $x,y$ such that $z=ay+bx+xy$

And how does one in general prove or disprove that a formula in one or more variables takes on every integer?

-
Do you want to prove this for particular values of $a$,$b$,$m$? It's clearly not true for arbitrary values, since $z$ is divisible by $\gcd(a,b,m)$. –  joriki Oct 7 '11 at 12:24
Try $y=1-b$ and $x=z+ab-a$. –  Did Oct 7 '11 at 13:14

The question has changed. We answer the changed question, which asks us to prove that for any integers $a$, $b$, and $z$ the equation $z=ay+bx+xy$ has a solution in integers $x$ and $y$.

Note that $ay+bx+xy=(x+a)(y+b)-ab$. Thus the equation $z=ay+bx+xy$ is equivalent to $(x+a)(y+b)=z+ab$. This equation is simple to solve. Indeed, it is not hard to describe all solutions.

If $z+ab=0$, the solutions are $x=-a$, $y$ anything, and $y=-b$, $x$ anything. If $z+ab \ne 0$, express $z+ab$ in any way as a product $uv$, where $u$ and $v$ are integers, not necessarily positive. Then $x=u-a$, $y=v-b$ is a solution of the original equation, and all solutions can be obtained in this way. In particular, if we know the prime power factorization of $z+ab$, we can find an explicit expression for the number of solutions.

-

The statement is false, since $z$ is necessarily divisible by $\gcd(a,b,m)$, which may not be $1$. Thus the equivalent statement in the comment is likewise false. For instance, the set of products of two numbers with remainder $2$ modulo $4$ only contains odd multiples of $4$.

-
Please see my comment under the question. –  joriki Oct 7 '11 at 14:14