I have the diophantine equation $y(x+y+z) = xz$ where all variables are positive integers. Given some bound $y \leq B$, how can I count the number of solutions?


Notice $$ y(x+y+z) = xz \iff 2y^2 = (y-x)(y-z)$$

For any solution $(x,y,z) \in \mathbb{Z}_{+}^3$ of above equation, $2y^2 > 0$ implies $(y-x), (y-z)$ are either both positive or both negative. The $1^{st}$ case has been ruled out because that will imply $0 < (y-z), (y-x) < y$ and make $(y-x)(y-z) < 2y^2$.

As a result, any solution of above equation must have the form:

$$(x,y,z) = (y+d_1, y, y+d_2)\tag{*}$$

where $d_1, d_2 \in \mathbb{Z}_{+}$ are divisors of $n$ and $d_1 d_2 = 2y^2$. If we consider solutions differ in ordering of $x$ and $z$ as distinct, the number of solutions of $(*)$ for $y$ equals to a fixed $n$ is just $d(2n^2)$, the number of divisors of $2n^2$. The total number of solutions for $0 < y \le B$ becomes:

$$\mathscr{N}_B = \sum_{k=1}^{B} d(2k^2)$$

Dirichlet has showed the average order of the divisor function satisfies an inequality:

$$\sum_{k=1}^{x} d(k) \simeq x\log x + (2\gamma - 1)x + O(\sqrt{x})$$

Since $d(2k^2) > d(k)$, this immediately give us a lower bound of number of solutions:

$$\mathscr{N}_B = \sum_{k=1}^{B} d(2k^2) \ge O(B \log B)$$

  • $\begingroup$ How did you know to rearrange the equation like that? $\endgroup$ – user74255 Apr 25 '13 at 18:49
  • $\begingroup$ @user74255 This is one of my rule of thumb to simplify a problem. You identify the center of the problem, adjust the parameters so that the less important pieces get absorbed into the most important pieces. This reduces noise and let you easier to figure what to do next. In this case, $xz$ is the heart of the problem. So I adjust $x$, $z$ in order to absorb $xy$, $zy$ into $(y - x)(y - z)$... $\endgroup$ – achille hui Apr 25 '13 at 19:07
  • $\begingroup$ So once you rearrange it, how do you know that the solution has to be of form (y+d1, y, y+d2)? How do you know that the divisors are involved? $\endgroup$ – user74255 Apr 25 '13 at 19:08
  • $\begingroup$ you are dealing with an equality between two set of products of integers: $2y^2 = (y-x)(y-z)$. So $y-x$ and $y-z$ are both divisors of $2y^2$. The only detail left to verify is whether $y-x$, $y-z$ are positive or negative... $\endgroup$ – achille hui Apr 25 '13 at 19:14

If $$ y=(x-z) $$ then $$ 2x^2 - 2xz = xz \Longrightarrow 2x^2 - 3xz = 0 $$ Which has integer solutions: $$ x=3n, n\in \mathbb{Z}, z= 2n, n\in \mathbb{Z} \Longrightarrow y= n\in \mathbb{Z} $$

For example, pick any positive integer $m$. Then:
$$ (x,y,z) = (3m,m,2m) $$ is a solution to your equation and the number of these types of solutions under a certain bound $y\le B$ where $B$ is a positive integer is $B$.

Of course these do not encapsulate all solutions. $$ (x,y,z) = (7,5,30) $$ Is a solution that doesn't have this construction.
We can say however that if $y \le B$ and $B >> 1$ then $B$ is a lower bound for the number of solutions.

  • $\begingroup$ I don't think this is right, because consider x,y,z = 7, 5, 30 $\endgroup$ – user74255 Apr 25 '13 at 16:09
  • $\begingroup$ @user74255 thanks for pointing out more solutions. $\endgroup$ – Rustyn Apr 25 '13 at 16:14

You can rearrange your equation to $y^2+(x+z)y-xz=0$ and use the quadratic equation to get $y=\frac 12\left(-(x+z)+\sqrt{x^2+6xz+z^2}\right)$ where we took the plus sign to make $y$ positive. Now the square root needs to be integral. Because of symmetry, we can require that $x \lt z$ and any multiple of a solution will again be a solution. I find a class of solutions $(n, n-1,2n^2-3n+1)$ that gives $(2,1,3), (3,2,10), (4,3,21), (5,4,36), \ldots$ and another $(2n+1,2n-1,4n^2-2n)$ giving solutions $(5,3,12),(7,5,30),(9,7,56),(11,9,90)\ldots$ It seems likely there are more. It looks like grouping them by $x-y$ could be useful.

  • $\begingroup$ How do you find classes? $\endgroup$ – user74255 Apr 25 '13 at 16:44
  • $\begingroup$ @user74255: I just made a spreadsheet with $x$ across the top and $z$ down the left. In each cell I put the square root formula (copy right and down made that easy) and scanned for integers. Then I noticed the patterns. By taking first differences on $3,10,21,36$ you get $7,11,15$ and seconds gives $4,4$ so it looks like a quadratic with leading term $2n^2$ You can plug the formulas for $x,z$ into the formula for $y$ and prove them. $\endgroup$ – Ross Millikan Apr 25 '13 at 16:49

the equation:


Has the solutions:




$p,s$ - integers and sets us.


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.