Overview
The greatest common divisor measures the common divisibility of two integers. It also answers an apparently different question: which integers can be made by adding integer multiples of the two inputs? This second interpretation makes the gcd useful for linear Diophantine equations, modular inverses, and calculations with ideals.
Prerequisites
For integers , write if for some integer . Understand division with remainder: for , every integer has a unique expression with . Negative inputs can be replaced by their absolute values when computing a gcd.
Definition and conventions
If are not both zero, is the unique positive integer dividing both such that every common divisor divides . Equivalently, it is their largest positive common divisor. We use the extension and ; this convention keeps the ideal characterization valid even for zero inputs. Two integers are coprime when their gcd is , without any requirement that either integer itself be prime.
Intuition
Divisibility is a better guide than numerical size. The gcd gathers exactly the prime powers shared by the inputs, using the smaller exponent at each prime. Yet computing it need not require factoring either input. Repeated remainder operations preserve the common divisors while shrinking the numbers under consideration.
Examples and non-examples
For and , calculate
The next remainder is zero, so the gcd is . Reversing the equations gives
Thus has the solution , while has no integer solution because . Although divides both inputs, it is not their gcd: the larger common divisor does not divide .
Important properties
For inputs not both zero, there exist integers with . To see the mechanism, choose the smallest positive integer linear combination. Dividing either input by that combination leaves a remainder that is again a linear combination. Minimality forces each remainder to vanish. Every common divisor divides all such combinations, completing the argument.
Consequently , and is solvable precisely when . If , reducing modulo produces a multiplicative inverse of . The coprimality hypothesis cannot be omitted.
Connections and further reading
The Euclidean algorithm supplies the gcd and, by back substitution, its linear-combination coefficients. The same viewpoint extends to principal ideal domains, where a gcd is determined up to multiplication by a unit. See Judson, Section 2.2 and Subsection 2.2.1 for the underlying arithmetic statements.