Explainer

Bézout's Identity: Integers and Polynomials over a Field

Why the gcd of two integers is an integer linear combination, with a least-positive-combination proof and the field-only polynomial analogue.

On this page

Interactive

Bézout coefficients travel alongside the remainders

Extended Euclidean table for a = 30, b = 18

qrxya·x + b·y

Press Extend to compute the next remainder and its coefficients.

a·x + b·y = gcd(a, b)

The extended Euclidean algorithm keeps the invariant r = a·x + b·y. When the remainder reaches zero, the previous row is the gcd together with its Bézout coefficients.

A greatest common divisor is more than a number that divides two inputs: it is itself an integer linear combination of them. This fact is useful, for example, when constructing modular inverses. For a=30a=30 and b=18b=18, the Euclidean algorithm gives 30−18=1230-18=12, 18−12=618-12=6, and 12−2⋅6=012-2\cdot6=0, so

6=18−12=2⋅18−30.6=18-12=2\cdot18-30.

The identity below explains why such coefficients always exist, including when the inputs are negative.

Bézout’s identity for integers

Let a,b∈Za,b\in\mathbb Z be not both zero and put g=gcd⁡(∣a∣,∣b∣)>0g=\gcd(|a|,|b|)>0. Then there are integers x,yx,y such that

ax+by=g.ax+by=g.

Moreover, the integer linear combinations of a,ba,b are exactly the multiples of gg:

{ax+by:x,y∈Z}=gZ.\{ax+by:x,y\in\mathbb Z\}=g\mathbb Z.

Proof by the least positive combination

Consider

S={ax+by:x,y∈Z, ax+by>0}.S=\{ax+by:x,y\in\mathbb Z,\ ax+by>0\}.

This set is nonempty: since at least one input is nonzero, its absolute value is a positive combination (choose its coefficient to be 11 or −1-1 as needed, and the other coefficient 00). By well-ordering, SS has a least element m=ax0+by0>0m=ax_0+by_0>0.

Divide aa by mm: a=qm+ra=qm+r with 0≤r<m0\le r<m. Since m=ax0+by0m=ax_0+by_0,

r=a−qm=a(1−qx0)+b(−qy0),r=a-qm=a(1-qx_0)+b(-qy_0),

so rr is also an integer linear combination. If r>0r>0, it would be in SS and smaller than mm, a contradiction. Hence r=0r=0, so m∣am\mid a. Applying the same argument to bb gives m∣bm\mid b.

Every common divisor of a,ba,b divides every linear combination, including mm. Thus mm is a positive common divisor divisible by every common divisor: it is gg. Its defining expression proves ax0+by0=gax_0+by_0=g.

Since gg divides both inputs, it divides every ax+byax+by. Conversely, multiplying ax0+by0=gax_0+by_0=g by any integer nn shows ng=a(nx0)+b(ny0)ng=a(nx_0)+b(ny_0). Therefore the combinations are precisely gZg\mathbb Z.

Polynomial version—over a field

This is a separate statement with a different coefficient domain. Let KK be a field, and let f,g∈K[x]f,g\in K[x] not both be zero. Let I=(f,g)⊆K[x]I=(f,g)\subseteq K[x] be the ideal they generate; if dd is their monic greatest common divisor, then

uf+vg=dfor some u,v∈K[x],I=dK[x].\begin{aligned} uf+vg &= d\quad\text{for some }u,v\in K[x],\\ I=dK[x]. \end{aligned}

To see this, take the nonzero elements of I={uf+vg:u,v∈K[x]}I=\{uf+vg:u,v\in K[x]\}, choose one of least degree, and scale it to be monic; call it dd. Polynomial division over KK gives f=qd+rf=qd+r, where r=0r=0 or deg⁡r<deg⁡d\deg r<\deg d. As d∈Id\in I, also r=f−qd∈Ir=f-qd\in I; minimality forces r=0r=0, so d∣fd\mid f. The same argument gives d∣gd\mid g. Every common divisor of f,gf,g divides every element of II, including dd, so dd is their monic gcd. Because d∈Id\in I, it has a representation uf+vg=duf+vg=d. All combinations are divisible by dd, and multiplying this representation by any polynomial shows every multiple of dd is a combination. Hence I=dK[x]I=dK[x]. This proof uses division with remainder over a field; it does not assert the result for arbitrary coefficient rings.

Source and attribution

The polynomial extension was prompted by Tistory ID 25, published on 2022-04-03 by 0archlinux0 / MINJUN PARK and marked CC BY 4.0. That source states the polynomial analogue but does not prove it there; the field-based proof above is supplied separately.