Section 3.3 Positive Integer Lattice Points
Now that we have the geometric viewpoint, here is a more subtle question:
Question 3.3.1.
Assume there exists a solution (hence infinitely many) to \(ax+by=c\text{.}\) How many such solution pairs \((x,y)\) have \(x\) and \(y\) both positive?
This is similar to the conductor question. It is closely related to integer programming, something with industrial applications.
Let's explore this. How many such points are there in the following cases? Draw pictures by hand, or use the interact above.
\(x+y=4\text{,}\) \(x+y=5\text{,}\) \(x+y=6\text{,}\) \(\ldots\)
\(2x+y=4\text{,}\) \(2x+y=5\text{,}\) \(2x+y=6\text{,}\) \(\ldots\)
\(2x+2y=4\text{,}\) \(2x+2y=5\text{,}\) \(2x+2y=6\text{,}\) \(\ldots\)
\(3x+y=4\text{,}\) \(3x+y=5\text{,}\) \(3x+y=6\text{,}\) \(\ldots\)
Can you get any good conjectures?
Subsection 3.3.1 Solution ideas
If you think about the question a little more carefully together with the picture, you may realize that we are really asking about how many integer lattice points lie between the intercepts. So one way to think about an answer would involve the distance between solutions.
To be concrete, let's assume that the equation is \(ax+by=c\text{,}\) and \(\gcd(a,b)=1\text{.}\) Then, using our technique from last time, from the solution \((x_0,y_0)\) we get a new solution \((x_0+b,y_0-a)\text{,}\) so the distance between any two solutions is, by the Pythagorean Theorem,
Our strategy is to ask:
How many times does that distance fit between the intercepts of the line?
Does that strategy make sense? It doesn't give an exact answer, but should give a good ballpark estimate.
Let's calculate these things. You may want to follow it \(a=3\text{,}\) \(b=2\text{,}\) \(c=4\text{.}\)
The intercepts are \(\frac{c}{a}\) and \(\frac{c}{b}\text{,}\) respectively.
-
Using the Pythagorean Theorem again, we see that the whole length available is
\begin{equation*} \sqrt{\Big(\frac{c}{a}\Big)^2+\Big(\frac{c}{b}\Big)^2}=\frac{c}{ab}\sqrt{a^2+b^2}\text{.} \end{equation*} The ratio of this total length and the length between solutions is thus \(\frac{c}{ab}\text{.}\)
That's a nice pat answer. There are two problems with it, though!
There is no guarantee that \(\frac{c}{ab}\) is an integer! In fact, it usually won't be. For instance, with \(2x+3y=10\text{,}\) \(\frac{10}{2\cdot 3}\approx 1.67\text{.}\) So should the number of points be bigger than or less than this?
Secondly, even so it's not clear what the precise connection between \(\frac{c}{ab}\) and the actual number of points is. \(2x+3y=5\) has one, and \(2x+3y=7\) has one, but \(2x+3y=6\) doesn't. Yet \(\frac{c}{ab}\) is about equal to one for all three of these. In fact, the number of points is thus not even monotone increasing with respect to \(c\) increasing, which is rather counterintuitive.
We will have to deal with each of these situations.
Subsection 3.3.2 Toward the full solution
We can deal with each of these problems. To do so, we introduce a new function:
Definition 3.3.3. Greatest integer function.
The greatest integer function (also called the floor function) is the function which takes a real number \(x\) and returns the largest integer below it (or equal to it). We notate it \(\lfloor x\rfloor\text{.}\)
Example 3.3.4.
A few examples should suffice to understand it:
Now let's use this to rectify our problems.
To take care of the integer problem, we will just consider \(n=\left\lfloor \frac{c}{ab}\right\rfloor\text{,}\) the greatest integer function applied to \(\frac{c}{ab}\text{.}\)
Secondly, we simply recognize that there isn't a nice formula. On average, we should expect \(n\) lengths between integer points along the line segment in question (and hence as many as \(n+1\) lattice points, since a partition of \(n\) intervals has \(n+1\) endpoints associated to it).
Rather than give a general formula, we examine individual cases to show what to expect. This applet can help supplement trying it by hand.
Let's focus on the case where \(a,b>0\) are relatively prime, such as in the graphic with \(2x+3y=c\) for various \(c\text{.}\) Naturally, if \(c\lt 6\) in this specific example, then \(n=\left\lfloor \frac{c}{ab}\right\rfloor=0\text{,}\) so one might not expect many points. What about in general?
-
The easiest case is when just one of the intercepts is a lattice point. Beginning at that point, there is definitely room for the full \(n\) lengths to appear, and you're guaranteed to get \(n\) lattice points, because we just said the other intercept isn't a lattice point, so the \(n\)th one must appear before that point. So the formula is just plain old
\begin{equation*} n=\left\lfloor \frac{c}{ab}\right\rfloor\text{.} \end{equation*}This will happen (where \(n=1\)) with \(2x+3y=8\) (or \(9\) or \(10\)), for instance.
If neither \(c/a\) nor \(c/b\) is an integer, then you could get \(n\) or \(n+1\) lattice points. There's no nice formula beyond this, and often examples will be like \(2x+3y=7\) with just one lattice point as ‘expected’. When the extra point ‘fits’ is in examples like the case \(2x+3y=11\text{,}\) where we have \(\frac{11}{2\cdot 3}-\left\lfloor \frac{11}{2\cdot 3}\right\rfloor\) very close to one, and you do get \(\left\lfloor \frac{11}{2\cdot 3}\right\rfloor+1=2\) positive lattice points here.
-
Finally, it's also possible for ‘not enough’ lattice points to fit; for example, \(2x+3y=12\) jumps back down to \(\left\lfloor\frac{12}{2\cdot 3}\right\rfloor-1=1\) points! This situation (not reaching \(n\) points) can occur when both the \(x\)- and \(y\)-intercepts actually are lattice points, because the intercepts by definition do not have positive coordinates. So if \(c/a\) and \(c/b\) are both integers, then we get precisely
\begin{equation*} n-1=\left\lfloor \frac{c}{ab}\right\rfloor-1 \end{equation*}lattice points.
As a side note, the number of points not being a monotone nonincreasing function of \(c\) should always be expected when \(c\) transitions to being a multiple of \(ab\text{,}\) such as also from \(2x+3y=5\) to \(2x+3y=6\text{.}\) In fact, since the closest solution to the origin of \(ax+by=-1\) must be no more than one half the usual distance \(\sqrt{a^2+b^2}\) away (cf. also [E.7.21]), all (positive) solutions of \(ax+by=kab\) will yield (positive) solutions to \(ax+by=kab-1\text{,}\) as will one of the intercepts. See Exercise 3.6.24 to fill in the details.
The excellent book The Geometry of Numbers [E.4.16, Section 2.2] gives many more details. For instance, if \(\gcd(a,b)\neq 1\text{,}\) it is not too hard to show that any such line with respect to lattice points is the same as a line \(a'x+b'y=c'\) for which \(\gcd(a',b')=1\text{.}\) Which line would that be?