We find values for
\(s\) and
\(t\) from
Theorem 4.4.1 for
\(a := 28\) and
\(b :=12\text{.}\)
First, we compute the
\(\gcd(28, 12)\) using the Euclidean Algorithm (
Algorithm 4.3.2). In the table we give the values of the variables at the end of step (1) in each iteration of the loop.
|
|
|
|
| Input |
|
\(28\) |
\(12\) |
| (1) |
\(28\fmod 12=4\) |
\(12\) |
\(4\) |
| (1) |
\(12\fmod 4=0\) |
\(1\) |
\(0\) |
| Output |
|
4 |
So the \(\gcd(28, 12) = 28 \fmod 12 = 4\text{.}\) To find \(s\) and \(t\) with \((s\cdot 28)+(t\cdot 12)=\gcd(28,12)=4\) we need
-
the remainder from the first iteration of the loop
\(r:=a\fmod b = 28\fmod 12=4\) and
-
the quotient
\(q := a\fdiv b = 28 \fdiv 12 = 2\text{.}\)
Now we can write \(a\) in the form \(a = b\cdot q + r\text{:}\)
\begin{equation*}
28 = 12 \cdot 2 + 4
\end{equation*}
We write \(a = (b\cdot q) + r\) in slightly more complicated way, namely as \((1 \cdot a) = (q \cdot b) + r\text{.}\) Solving \((1\cdot a) = (q\cdot b) + r\) for \(r\) we get \((1 \cdot a) - (q \cdot b) = r\text{.}\) To bring this into the desired form \((s\cdot a)+(t\cdot b)=\gcd(a,b)\) we write \(- (q \cdot b)\) as \(+ ((-q) \cdot b)\) and obtain
\begin{equation*}
(1 \cdot a) + ((-q) \cdot b) = r
\end{equation*}
Plugging in our values for \(a\text{,}\) \(b\text{,}\) \(q\text{,}\) and \(r\) we obtain
\begin{equation*}
(1 \cdot 28) + ((-2)\cdot 12) = 4
\end{equation*}
So
\(s = 1\) and
\(t = -2\text{.}\)
The cofactors \(s\) and \(t\) are not unique. Using the numbers from this example, the values \(s=-5\) and \(t=12\) would also have been a solution since then
\begin{equation*}
(s\cdot 28)+(t\cdot 12)
(-5\cdot 28)+(12\cdot 12)
=-140 +144=4.
\end{equation*}