Bezout’s identity (Bezout’s lemma)

Let a and b be any integer and g be its greatest common divisor of a and b. Then, there exists integers x and y such that ax + by = g …(1)

ax+by = g
g=gcd(a, b)

The pair (x, y) satisfying the above equation is not unique. However, all possible solutions can be calculated.

We can find x’ and y’ which satisfies (1) using Euclidean algorithms . All possible solutions of (1) is given by,

x=x'+  \dfrac{b}{g} k
y=y'- \dfrac{a}{g} k
k \in \Z

where k is any integer.

It is easy to see why this holds. Just plug in the solutions to (1) to have an intuition.

Also, it is important to see that for general equation of the form,


u=gcd(a, b) is the smallest positive integer for which ax+by=u has a solution with integral values of x and y.

Statement:  If gcd(a, c)=1 and gcd(b, c)=1, then gcd(ab, c)=1.


Above can be easily proved using Bezout’s Identity.

ax+cy=1 and bu+cv=1

Multiply the above two equations,


The above implies,


1 is the only integer dividing L.H.S and R.H.S .

Hence, gcd(ab, c) = 1.


Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.