# Solving a quadratic diophantine equation in two variables

I have an equation in the following form:

$$6mn+m+n=x$$ $$m,n,x\in\Bbb Z; \qquad0 < m,n$$

If I were given a value for $$x$$, how would I go about finding solutions to this equality for $$m$$ and $$n$$ or determining that there are no solutions for $$x$$ in this form?

Example: $$x = 15 \implies6(1)(2)+1+2=15 \implies(m=1,n=2),(m=2,n=1)$$

• This problem is not novel but was posed on arxiv.org as a theoretical basis for composite formulations one year ago. It is however possibly to solve using a 200 year old discovery.
– user64882
Mar 4, 2013 at 3:27

Hint $$\,\$$ In order to solve the equation $$\rm\,\ 6ab+a+b\, =\, 15,\$$ multiply by $$\,6,\,$$ then add $$\,1\,$$ to obtain

$$\rm (6a+1)(6b+1)\, =\, 91$$

Clearly the same method works generally, i.e.

$$\rm a\,(axy+bx+cy)+bc\, =\, (ax+c)(ay+b)$$

Remark $$\$$ Dario Alpern has a web page Quadratic two integer variable equation solver that will solve any binary quadratic Diophatine equation, using ideas that go back to Lagrange over 200 years ago. The web page has an option to configure it to provide step-by-step solutions. You may find the output instructive. You might also find of interest some more recent optimizations of Lagrange's old algorithm in this paper by H. C. Williams et al.  A new look at an old equation.

• I started with that equation, then reduced it to $6ab+a+b=15$; I wanted to know if there was a general approach to solve the reduced form... Mar 3, 2013 at 17:36
• The above method does work generally for equations of this type. Mar 3, 2013 at 17:38
• How exactly does the Quadratic two integer variable equation solver relate to this equality? Mar 3, 2013 at 17:54
• Your Diophantine equation is a special case, viz. $\rm\ a=0=c,\ b=6,\ d=1=e,\ f = -15.\ \$ Mar 3, 2013 at 17:58
• I've heard of Diophantine equations before but never really studied them, let me look into this and see if it is a general way to solve these equations. Mar 3, 2013 at 18:20