TITLE: Writing a GCD of two numbers as a linear combination
QUESTION [11 upvotes]: I am working on GCD's in my Algebraic Structures class.  I was told to find the GCD of 34 and 126.  I did so using the Euclidean Algorithm and determined that it was two.  I was then asked to write it as a linear combination of 34 and 126 and I am really unsure of how to do so.  I appreciate any help.

REPLY [2 votes]: We can also say that; $a=b(q)+r$, from our equation $a=126,b=34$, $q$ being the quotient and $r$ the remainder. Hence
$$126=34(3)+24$$
Next $a=34$ and $b=24$, then
$$34=24(1)+10$$
Following the process we will find:
$$24=10(2)+4$$
$$10=4(2)+2$$
$$4=2(2)=0$$
Our GCD is the last remainder of the non-zero equation, 2. When writing as a linear combination we start from the non-zero equation. I.e.
$$10=4(2)+2$$
Making 2 the subject:
$$2=10-4(2)$$
But $24=10(2)+4$.
We can write 
$$4=24-10(2)$$
Substituting in $2=10-4(2)$ we find
$$2=10-(24-10(2))2$$
$$2=10-24(2)+10(4)$$
$$2=10(1)+10(4)-24(2)$$
$$2=10(5)-24(2)$$
This implies that $50-48=2$ which is our GCD.