Range of $ax+by$ where $\gcd(a,b)=1$ 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?
 A: 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:


*

*$\mathcal{L}(a,b)\neq\varnothing$;

*If $r,s\in\mathcal{L}(a,b)$, then $r-s\in\mathcal{L}(a,b)$;

*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:


*

*$d|a$ and $d|b$.

*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*}$$
A: Hint $\:\!$ Subsets of $\,\mathbb Z\,$ closed under subtraction have form $\, m\mathbb Z,\,$ where $\,m\,$ is the gcd of all elements (so $\,m=1\,$ if the set contains two coprime elements). 
