Subgroup that generates $\mathbb{Z}$ For reference, the example in question is taken from Contemporary Abstract Algebra (Gallian):
$$\left< 8, 13 \right> = \mathbb{Z}$$
My first question is to confirm that this is saying  that $8a+13b=n$, where $a,b,n \in \mathbb{Z}$, and that $n$ can take on any integer, hence $\left<8, 13 \right> = \mathbb{Z}$.
My second question is how can I pick an $n$ value and find out the necessary values for $a$ and $b$. For example, when $n=4, a=2,b=-1$, but what if I wanted to be able to find $a$ and $b$ for any $n$?
 A: The only thing you need to do is find a combination $8a+13b=1$. From this one you can get any other, by multiplying by $n$.
To find the required combination use the extended euclidean algorithm:
$13=8+5$
$8=5+3$
$5=3+2$
$3=2+1$
Now we flip the equalities:
$1=3-2$
$2=5-3$
$3=8-5$
$5=13-8$
Then we use them recursively to get a combination of $8$ and $13$:
$1=3-2=3-(5-3)=2(3)-5=2(8-5)-5=2(8)-3(5)=2(8)-3(13-8)=$
$5(8)-3(13)$
A: The solution comes from a Bézout's relation between $8$ and $13$, e.g.
$$5\cdot 13-8\cdot 8=1,$$
from which you deduce
$$5n\cdot 13 -8n\cdot 8=n.$$
A: Hint   $\ a\Bbb Z + b \Bbb Z = c\Bbb Z\iff \gcd(a,b) = c\,\ $  since
$ c\Bbb Z \supseteq a\Bbb Z+b\Bbb Z\iff a,b\in c\Bbb Z\iff \color{}{c\mid a,b}$
$c\Bbb Z \subseteq a\Bbb Z+b\Bbb Z\iff c \in a\Bbb Z+b\Bbb Z\iff  c=aj+bk\,$ for some $\,j,k\in\Bbb Z$
Thus $\ a\Bbb Z + b \Bbb Z = c\Bbb Z\iff c\mid a,b\,\ $ and $\,\  c=aj+bk\,$ for some $\,j,k\in\Bbb Z$
But the latter is a very well-known equational characterization of the gcd. Thus your question reduces to standard comptations with the (extended) Euclidean algorithm, i.e. use the algorithm to compute the Bezout equation for the gcd, then scale that to obtain reps for all multiples of the gcd.
