Course Computational Mathematics
Extended Euclidean Algorithm
In this lesson, we'll talk about the Extended Euclidean Algorithm and Linear Diophantine Equations.
Extended Euclidean Algorithm
As we saw in the last lesson, the Euclidean Algorithm finds the greatest common divisor between two integers. There's an extended version of this algorithm. But before talking about it, we need to talk about a theorem:
Bรฉzout's Identity: Let
The purpose of the Extended Euclidean Algorithm is to calculate such
- If
, return - Otherwise, return the gcd of
and
If
Now, let's try to find
So