Let $a$ and $b$ be integers, not both zero. An integer $d$ is called a common divisor of $a$ and $b$ if
Common Divisors
Let and be integers, not both zero. An integer is called a common divisor of and if
and
For example, the positive divisors of are
and the positive divisors of are
Their common positive divisors are
The largest of these is . Hence
Definition
The greatest common divisor of two integers and , not both zero, is the largest positive integer such that
and
It is denoted by
The condition that be positive removes the ambiguity caused by signs. If divides both and , then also divides both. The greatest common divisor is chosen to be positive.
For example,
Basic Examples
If one integer divides the other, the greatest common divisor is the smaller integer in absolute value. For example,
If two integers share no positive divisor greater than , their greatest common divisor is . For example,
If , then
This follows because every integer divides , and the positive divisors of are exactly the possible common positive divisors of and .
Existence
The greatest common divisor always exists for two integers not both zero.
Indeed, the set of positive common divisors of and is nonempty because divides every integer. It is also finite, since any positive divisor of a nonzero integer is at most . If , then , and any common divisor is at most .
Therefore the positive common divisors form a finite nonempty set, so they have a largest element.
Symmetry and Sign
The greatest common divisor is symmetric:
It is also insensitive to signs:
For example,
Thus one may usually reduce questions about greatest common divisors to positive integers.
Coprime Integers
Two integers and are called coprime, or relatively prime, if
For example,
so and are coprime.
Coprime integers need not be prime individually. The integers and are both composite, yet they share no common positive divisor greater than .
Coprimality measures shared factor structure, not primality of the individual numbers.
Prime Factorization View
If the prime factorizations of and are known, their greatest common divisor can be read off directly.
For example,
and
The common prime powers are
Therefore
In general, the greatest common divisor contains exactly the prime powers that occur in both integers, with the smaller exponent chosen.
Divisibility Characterization
If
then every common divisor of and divides .
This property is deeper than the definition as the largest common divisor. It will follow naturally from Bézout identities after the Euclidean algorithm is developed.
For example, since
every common divisor of and divides .
The common divisors are therefore precisely the divisors of the greatest common divisor.
Greatest Common Divisors and Linear Combinations
A central theorem states that can be written as an integer linear combination of and :
for some integers and .
For example,
and
Thus
This representation is known as Bézout’s identity. It gives the greatest common divisor a constructive form and is one of the most useful facts in elementary number theory.
Role in Number Theory
Greatest common divisors measure the shared arithmetic content of integers. They occur in divisibility problems, reduction of fractions, modular inverses, Diophantine equations, and the Chinese remainder theorem.
For example, the fraction
is in lowest terms precisely when
A linear congruence
is solvable exactly when
Thus the greatest common divisor is one of the main organizing invariants of elementary number theory.