Euclidean algorithm
g = (−1) N+1 ( m 22 a − m 12 b), the two integers of Bézout's identity are s = (−1) N+1 m 22 and t = (−1) N m 12. The matrix method is as efficient as the equivalent recursion, with two multipliions and two additions per step of the Euclidean algorithm. Euclid's lemma and unique factorization