MathorynMathematical Formula Database

Number Theory

Bézout's Identity

For any integers aa and bb there are integers xx and yy with ax+by=gcd⁡(a,b)ax+by=\gcd(a,b); they are found with the extended Euclidean algorithm. It is used to compute modular inverses and to solve linear Diophantine equations.

ax+by=gcd⁡(a,b)  for some integers x, yax+by=\gcd(a,b)\ \ \text{for some integers}\ x,\ y
LaTeXax+by=\gcd(a,b)\ \ \text{for some integers}\ x,\ y

Variables

a, ba,\ b
integers, not both zero
x, yx,\ y
Bézout coefficients

Example

Find x,yx,y with 240x+46y=gcd⁡(240,46)240x+46y=\gcd(240,46).

  1. The Euclidean algorithm gives gcd⁡(240,46)=2\gcd(240,46)=2.
  2. Back-substitution yields x=−9, y=47x=-9,\ y=47.
  3. Check: 240(−9)+46⋅47=−2160+2162240(-9)+46\cdot47=-2160+2162.

Answer: 240(−9)+46(47)=2240(-9)+46(47)=2.

Related formulas