Show the equation $ax+by+cz=n$ always have nonnegative solutions

elementary-number-theorylinear-diophantine-equations

Consider integers $a,b,c\geq1,$ such that gcd$(a,b,c)=1.$ Show that there exists an integer $n_0$ such that for all $n\geq n_0,$ one can find nonnegative integers $x,y,z$ such that $ax+by+cz=n.$

My attempts:

  1. Because $(a, b, c)=1,$ Bezout's theorem guarantees that for any $n,$ there always exists $x_0,y_0,z_0,$ such that $ax_0+by_0+cz_0=n.$
  2. The set of all solutions is given by $\{(x_0+kbc,y_0+kac,z_0-2kab):k\in \mathbb{Z}\}$(not quite sure if this is correct though).
  3. To get nonnegative solutions, one should have
    \begin{align*}
    &x_0+kbc\geq0 \Rightarrow k\geq-\frac{x_0}{bc}\\
    &y_0+kab\geq0\Rightarrow k\geq-\frac{y_0}{ab}\\
    &z_0-2kab\geq0\Rightarrow k\leq \frac{z_0}{2ab}.\\
    \end{align*}
  4. In order to get integer $k,$ we must have
    $$\frac{z_0}{2ab}+\frac{y_0}{ab}\geq0\quad\text{and}\quad\frac{z_0}{2ab}+\frac{x_0}{bc}\geq0.$$
    And then I stuck, and not quite sure how could we satisfy the above conditions at the same time. Perhaps there is something wrong with my method or this method does not work in this case. How should I finish this proof? Many thanks in advance for any hints and solutions.

Best Answer

In your proof attempt, your point #$2$ doesn't give the set of all solutions (e.g., it has the parity of $z$ always being the same as that of $z_0$). Also, I don't offhand see how, but I believe it's fairly complicated, to try finishing using your approach.

Instead, note the question just asks to prove there exists an $n_0$, not necessarily to determine the smallest one. As you indicated, Bézout's identity states there exist integers $x_0$, $y_0$ and $z_0$ where

$$ax_0 + by_0 + cz_0 = 1 \tag{1}\label{eq1B}$$

Choose sufficiently large non-negative integers $i_1$, $i_2$ and $i_3$ so $x_1 = x_0 + i_1 \ge 0$, $y_1 = y_0 + ai_2 \ge 0$ and $z_1 = z_0 + ai_3 \ge 0$. Using these new values on the LHS increases the result by $ja$, where $j = i_1 + bi_2 + ci_3 \ge 0$, to now have

$$v_1 = ax_1 + by_1 + cz_1 = ja + 1 \tag{2}\label{eq2B}$$

Multiplying by $k$ for $1 \le k \le a$ gives

$$v_k = ax_k + by_k + cz_k = jka + k \tag{3}\label{eq3B}$$

where $x_k = kx_1$, $y_k = ky_1$ and $z_k = kz_1$.

Set $n_0 = v_a$. For any $n \ge n_0$, there's a $1 \le k \le a$ where $n \equiv k \equiv v_k \pmod{a}$. Thus, using \eqref{eq3B}, $x = x_k + \frac{n - v_k}{a}$, $y = y_k$ and $z = z_k$ are non-negative integers such that

$$ax + by + cz = n \tag{4}\label{eq4B}$$

Note if $a$ is not the smallest among $a$, $b$ and $c$, then using the smallest instead will usually give a smaller $n_0$. Also, the procedure above also shows how to prove there's an $n_0$ for any set of $4$ or more coprime coefficients.


FYI, regarding finding the smallest $n_0$, as stated in Coin problem,

If the number of coin denominations is three or more, no explicit formula is known.

Also, as indicated in Pete L. Clark's answer,

In the $k = 3$ case that you are asking about, an earlier paper of Harold Greenberg gives an algorithm which is simpler, and (if I am not mistaken) faster than that of the general case.

Related Question