Let RR be an and let a,b∈Ra,b\in R. A greatest common divisor of aa and bb is an element d∈Rd\in R such that:

  1. d∣ad\mid a and d∣bd\mid b, and
  2. if c∣ac\mid a and c∣bc\mid b, then c∣dc\mid d.
Remarks

A gcd is unique up to (so one often fixes a “normal form” when possible). When gcds exist for all pairs, one can define lcms and obtain identities relating gcd and .

Examples
  • In Z\mathbb{Z}, gcd⁡(12,18)=6\gcd(12,18)=6.
  • In Q[x]\mathbb{Q}[x], a gcd of x2−1x^2-1 and x2−3x+2x^2-3x+2 is x−1x-1 (up to nonzero rational scalars).
  • For any a∈Ra\in R, a gcd of aa and 00 is aa (up to associates).