Given $\frac {x^2-y^2}{a^2-b^2}$ is an integer,

For which non-zero $x, y, a, b\in\mathbb Z$, the fraction $\frac {x^2-y^2}{a^2-b^2}$ is an integer?

I can start with $x^2-y^2 = (x-y)(x+y)$ but it does not lead anywhere.

  • 1
    $\begingroup$ @ViktorGlombik Thats a good idea, I might try this time, no, it is not a exercise, I saw various time such expressions, and curious to know how such cases are solved for integer solutions $\endgroup$ Commented Jan 29, 2020 at 18:00
  • $\begingroup$ @ViktorGlombik am looking for a closed form formula, brute force or other type of programming is not what I am interested. $\endgroup$ Commented Jan 29, 2020 at 18:04
  • $\begingroup$ Notice that for since you are taking squares it suffices to consider $x,y,a,b \ge 0$. Some solutions are given by $\{ (a k,0,k,0): a, k \in \mathbb Z\}$. $\endgroup$ Commented Jan 29, 2020 at 19:05
  • 1
    $\begingroup$ Also, there are many solutions. For $x,y,a,b \in \{0, \ldots, 100\}$ and $x > y$ and $a > b$ there are $138790$ solutions. $\endgroup$ Commented Jan 29, 2020 at 20:33

2 Answers 2


Above equation shown below is equivalent to:

$x^2-y^2=w(a^2-b^2)$ ----$(1)$

where '$w$' is an integer

Equation (1) has parametric solution given below:






For, k=4 we get, $(x,y,a,b)=(105,80,31,6)$

and, $w=5$

  • $\begingroup$ Upvoted ur answer but not confirm it is correct, how u obtain? what is the method? $\endgroup$ Commented Jan 30, 2020 at 0:16

Here is one description of the solution set that may be unsatisfying.

Fix any $x,y$. Then $x^2-y^2$ has some finite list of factors. For each factor in that list, either $a^2-b^2=(\text{that factor})$ has integer solutions for $a$ and $b$ or it does not. There is a solution exactly when that factor is not congruent to $2$ mod $4$. When there is a solution, there may be multiple solutions, but not infinitely many.

So the solution set can be described as:

  • Let $x$ be any integer.
  • Let $y$ be any integer.
  • For each factor $d$ of $x^2-y^2$ where $d\not\equiv 2$ mod $4$, take all solutions to $a^2-b^2=d$.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .