2
$\begingroup$

Given an equation of a straight line of form $Ax + By = C$. where $A,B,C$ are integers. How could we check if this passes through any lattice point or not?

Please suggest me a suitable algorithm.

  • 2
    What is the lattice?2011-04-10
  • 2
    Assuming you mean the integer lattice in $\mathbb{R}^2$, it might be instructive to consider Euclid's Algorithm, since there are always integer solutions to the equation $Ax+By=GCD(A,B)$. So if $GCD(A,B)\vert C$ then you definitely have integer solutions. I'm not sure about the converse, i.e. if GCD isn't a factor.2011-04-10
  • 0
    i assume $\mathbb{Z}^2$. $Ax+By=C$ has solutions iff $(A,B)|C$ ($C$ would have to be in the ideal generated by $A,B$)2011-04-10
  • 1
    @JBeardz Your argument is an if and only if statement.2011-04-10

2 Answers 2

3

Assuming you mean the lattice of integers, that is equivalent to checking if the equation has integer solutions.

Assume that $k\times GCD(A,B)=C$. Then by Euclid's algorithm, there are $X,Y$ such that $AX+BY=GCD(A,B)$, so $AkX+BkY=C$, where $kX$ and $kY$ must be integers.

On the other hand, assume $Ax+By=C$ has a solution. Then $GCD(A,B)\left(\frac{A}{GCD(A,B)}X+\frac{B}{GCD(A,B)}Y\right)=C$ so $GCD(A,B)$ divides $C$.

1

I assume the lattice you are using is $\mathbb{Z}^2$, consisting of all integer pairs $(x,y)$. What you have is an example of a linear diophantine equation, meaning that you are looking for integer pairs $(x,y)$ satisfying this equation. The key here is to see whether or not $C$ is divisible by $gcd(A,B)$. If so, there are infinitely many solutions (this is known as Bezout's identity).