Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to show that range of $ax+by$ is $\mathbb{Z}$ if $\gcd(a,b) = 1$.

We can easily prove it if we can show that there exists some $x$ and $y$ such that $ax+by=1$. This could be showed by using Euclid's gcd algotithm method.

Can someone show it by using some other method?

share|cite|improve this question
The integers are written $\Bbb Z$, not $(-\infty,+\infty)$. – anon Apr 9 '12 at 18:47
A standard proof, that can be found in many (most?) books is to let $m$ be the least positive integer of the from $ax+by$, and then prove that $m$ divides $a$ and $b$, so is the gcd. – André Nicolas Apr 9 '12 at 18:51
Is “$\mathbb{Z}$ is a principal ideal domain” acceptable as “some other method”? – Christopher Creutzig Apr 9 '12 at 19:40
up vote 6 down vote accepted

I suspect that any proof will necessarily involve the division algorithm at some point, though perhaps not the entire Euclidean algorithm. Here's one where the division algorithm is used only once.

Let $a,b\in\mathbb{Z}$. Define $\mathcal{L}(a,b)$, the set of linear combinations of $a$ and $b$, to be the set $$\mathcal{L}(a,b) = \{ax+by\mid x,y\in\mathbb{Z}\}.$$

Lemma 1. Let $a,b\in\mathbb{Z}$. Then $\mathcal{L}(a,b)$ is an ideal of $\mathbb{Z}$; that is:

  1. $\mathcal{L}(a,b)\neq\varnothing$;
  2. If $r,s\in\mathcal{L}(a,b)$, then $r-s\in\mathcal{L}(a,b)$;
  3. If $r\in\mathcal{L}(a,b)$ and $t\in\mathbb{Z}$, then $tr\in\mathcal{L}(a,b)$.

Proof. We can express $0$ and $0a+0b$, so $0\in\mathcal{L}(a,b)$.

If $r,s\in\mathcal{L}(a,b)$, then there exist $x,y,v,w\in\mathbb{Z}$ such that $r=ax+by$, $s=av+bw$. Then $r-s = a(x-v) + b(y-w)\in\mathcal{L}(a,b)$.

If $r\in\mathcal{L}(a,b)$, then there exist $x,y\in\mathbb{Z}$ such that $r=ax+by$; hence, $tr = a(tx) + b(ty)$, so $tr\in\mathcal{L}(a,b)$. $\Box$

Lemma 2. Let $a,b\in\mathbb{Z}$. Then either $\mathcal{L}(a,b)=\{0\}$, or else there is a positive integer $d$ such that $\mathcal{L}(a,b) = d\mathbb{Z}=\{dt\mid t\in\mathbb{Z}\}$. In fact, $d$ is the smallest positive integer that lies $\mathcal{L}(a,b)$, when the latter is not equal to $\{0\}$.

Proof. Suppose that $\mathcal{L}(a,b)\neq\{0\}$. Then there exists $r\neq 0$, $r\in\mathcal{L}(a,b)$; if $r\lt 0$, then $-r=(-1)r\gt 0$, and $-r\in\mathcal{L}(a,b)$ by Lemma 1.3. Hence, $\mathcal{L}(a,b)$ contains positive integers.

Let $S = \{x\in\mathcal{L}(a,b)\mid x\gt 0\}$. Then $S$ is a nonempty set of positive integers, so by the well-ordering principle of the natural numbers we conclude that $S$ has a smallest element. Let $d$ be this element.

I claim that $\mathcal{L}(a,b)=d\mathbb{Z}$. Since $d\in\mathcal{L}(a,b)$, then by Lemma 1.3 we know that $dt\in\mathcal{L}(a,b)$ for all $t\in\mathbb{Z}$, so $d\mathbb{Z}\subseteq\mathcal{L}(a,b)$. Conversely, let $x\in\mathcal{L}(a,b)$. Using the division algorithm, there exist unique $q,r\in\mathbb{Z}$ such that $$x = qd + r,\quad 0\leq r\lt d.$$ Since $x,qd\in\mathcal{L}(a,b)$, then by Lemma 1.2 we know that $x-qd=r\in \mathcal{L}(a,b)$. Since $r\lt d$, we cannot have $r\gt 0$ (that would contradict the fact that $d$ is the smallest positive integer in $\mathcal{L}(a,b)$), so we must conclude that $r=0$. Therefore, $x=qd$, so $x\in d\mathbb{Z}$. This proves $\mathcal{L}(a,b)\subseteq d\mathbb{Z}$, and so proves the equality. $\Box$

Lemma 3. Let $a,b\in\mathbb{Z}$. If $s|a$ and $s|b$, then $s|t$ for all $t\in\mathcal{L}(a,b)$.

Proof. Let $s$ be a common divisor of $a$ and $b$, and let $t\in\mathcal{L}(a,b)$; then there exist $x,y\in\mathbb{Z}$ such that $t=ax+by$. Since $s|a$, then $s|ax$. Since $s|b$, then $s|by$. Since $s|ax$ and $s|by$, then $s|ax+by=t$. Thus, $s|t$, as claimed. $\Box$

Lemma 4. Let $a,b\in\mathbb{Z}$. If $\mathcal{L}(a,b) = d\mathbb{Z}$, then $d$ is a common divisor of $a$ and $b$.

Proof. Every element of $\mathcal{L}(a,b)$ is a multiple of $d$; and $a=a\times 1 + b\times 0$, $b=a\times 0 + b\times 1$, so $a,b\in\mathcal{L}(a,b)$. Thus, $a$ and $b$ are both multiples of $d$, so $d$ is a common divisor of $a$ and $b$. $\Box$

Theorem. Let $a$ and $b$ be integers. If $\mathcal{L}(a,b) = d\mathbb{Z}$, then $d$ is a greatest common divisor of $a$ and $b$. That is:

  1. $d|a$ and $d|b$.
  2. If $c|a$ and $c|b$, then $c|d$.

Conversely, if $d$ is a greatest common divisor of $a$ and $b$, then $\mathcal{L}(a,b)=d\mathbb{Z}$.

Proof. Part 1 follows by Lemma 4, and Part 2 by Lemma 3, proving that if $\mathcal{L}(a,b)=d\mathbb{Z}$, then $d$ is a gcd of $a$ and $b$.

Conversely, suppose that $d$ is a gcd of $a$ and $b$. Let $\mathcal{L}(a,b) = c\mathbb{Z}$. Then since $d$ is a common divisor of $a$ and $b$ and $c\in\mathcal{L}(a,b)$, then $d|c$ by Lemma 3. And by Lemma $4$, $c|a$ and $c|b$, so $c|d$ (since we are assuming $d$ is a gcd of $a$ and $b$). Therefore, $d=\pm c$, so $d\mathbb{Z}=c\mathbb{Z} = \mathcal{L}(a,b)$. $\Box$

Corollary. Let $a$ and $b$ be integers. Then $\mathcal{L}(a,b)=\mathbb{Z}$ if and only if $\gcd(a,b)=1$.

Proof. $$\begin{align*} \mathcal{L}(a,b)=\mathbb{Z} &\iff \mathcal{L}(a,b) = 1\mathbb{Z}\\ &\iff \gcd(a,b) = 1.\quad\Box \end{align*}$$

share|cite|improve this answer
And the reason for the downvote is... – Arturo Magidin Apr 9 '12 at 20:02
Note that in the proof of Lemma 2, you would have not needed the division algorithm either: Since $d$ is, by definition, a member of $\mathcal{L}(a,b)$, and by Lemma 1, for any two numbers, the difference is also in $\mathcal{L}(a,b)$. Now take some $c$ from that set. Then $c-d$ is in the set, too, and thus $c-2d$ and so on. Sooner or later, you'll reach a number smaller than $d$ this way. The first such number you reach cannot be smaller than $0$ because otherwise the previous one would already have been $<d$. Also, it cannot be $>0$ because you've chosen $d$ to be the smallest positive ... – celtschk Sep 13 '12 at 15:27
number in $\mathcal L(a,b)$. Therefore the number you reach must be $0$, which means that $c$ must have been a multiple of $d$. – celtschk Sep 13 '12 at 15:31

Hint $\:\!$ Subsets of $\mathbb Z$ closed under subtraction have form $\rm m\:\mathbb Z$ $(= \mathbb Z$ if it has two coprime elements)

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.