Solution to Diophantine equation with constraint.

228 Views Asked by At

solve the following equation over $z_x,z_y$ \begin{align} &az_x=bz_y\\ &\text{s.t. } a,b,z_x,z_y \in \mathbb{Z} \text{ and } 1 \le z_x \le N \text{ and } 1 \le z_y \le N \end{align}

How many solutions are there? What are the solutions?

I can show that if $bN<a$ or $aN<b$ then there is no solutions. Is there any other conditions like this?

Thank you.

1

There are 1 best solutions below

9
On BEST ANSWER

First of all, if $a=b=0$, then any pair $(z_x,z_y)$ is a solution. If, only one of $a$ or $b$ equals $0$, then you have no solutions. Now we'll assume that $ab\neq 0$

You can rewrite your equation as $\frac{a}{b}=\frac{z_y}{z_x}$. This gives us a geometric intuition: we want $(z_x,z_y)$ to be a lattice point, collinear with the origin and $(b,a)$, lying within the region $[1,N]\times[1,N]$. If $b$ and $a$ have different signs, there will be no solutions (since $N>1$).

Let $d=\gcd(a,b)$, and let $\overline{a}=\left|\frac{a}{d}\right|, \overline{b}=\left|\frac{b}{d}\right|$. Let $k=\min\left\{\left\lfloor\frac{N}{\overline{a}}\right\rfloor\,\left\lfloor\frac{N}{\overline{b}}\right\rfloor\right\}$. Then your complete set of solutions is $(z_x,z_y)=(m\overline{b},m\overline{a})$, where $m=1,\ldots,k$. In the case where $k=0$, there is no solution.