A method for finding solutions and to a linear congruence
by constructing a matrix formed by adjoining a vector containing and with a unit matrix,
and applying the Euclidean algorithm to the first column, while extending the operations to all rows. The algorithm terminates when the first column contains the greatest common divisor .