An intermediate step in a problem I'm trying to solve is to find $gcd(1, 4)$. Using the Euclidean algorithm, this is $1$:
$$ 1 = 0\times4 + 1 \\ 4 = 4\times1 + 0 $$
Bezout's identity tells us that the $gcd$ of two numbers $a$ and $b$ can be written as a linear combination of some integers $x$ and $y$:
$$ ax + by = d $$
In our case:
$$ 1x + 4y = 1 $$
To find values of $x$ and $y$, I learned that we can use the Euclidean algorithm and back-substitution. But while I'm able to perform this successfully for other types of problems, I'm stuck on this particular one.
If we have these steps:
$$ 1 = 0\times4 + 1 \\ 4 = 4\times1 + 0 $$
Then working backwards to solve for $1$:
$$ 1 = 1 - 0\times4 = 1 - (4-4\times1)\times4 $$
And I feel like I'm not really making any meaningful progress. My book claims that the answer is $x = -3$ and $y = 1$ but does not clarify how it arrived at this solution. I understand that this solution works, but I don't understand how to derive it using the Euclidean algorithm. What am I missing?
The algorithm doesn't really work for cases like this because you start with $$4=4(1)+0$$ and then you usually work backwards but there is nothing to cancel. We can just guess $-3(1) + 1(4)=1$ in this case.
For example, if we $\text{gcd(15,22)}$ we would start by getting the gcd with a series of divisions. $$22=1(15)+7$$ $$15=2(7)+1$$ $$7=7(1)=0$$ and this gives us $\text{gcd}(15,22)=1$
Then we would work backward to get $$15-2(7)=1$$ $$15-2(22-15)=1$$ $$3(15)-2(22)=1$$
Since we start with with the gcd on the first line there is nothing to work backward with so we must end up guessing.
But for any $n$, $\text{gcd}(n,1)=1$ and we can use $(1-n)1+1(n)=1$.