Current Article  

Greatest common divisor

In mathematics,greatest common divisor (abbreviated GCD), or highest common factor (HCF)two integers whichnot both zero islargest integer that divides both numbers.

The GCDaboften written as gcd(a,b) or simply (a,b). For example, gcd(12,18) = 6, gcd(-4,14) = 2gcd(5,0) = 5. Two numberscalled coprime or relatively prime if their greatest common divisor equals 1. For example, 928relatively prime.

The greatest common divisorusefulwriting fractionslowest terms. Considerinstance

42/56 = 3/4
where we cancelled 14,greatest common divisor4256.

Tablecontents
1 CalculatingGCD
2 Properties
3 GCDcommutative rings

CalculatingGCD

WhileGCDtwo numbers canprinciple be computed by determiningprime factorizations oftwo numberscomparing factors, thisnever donepractice, because ittoo slow. A much more efficient method isEuclidean algorithm. An extended versionthis algorithm can also compute integers pq such that ap + bq = gcd(a, b).

Properties

Every common divisorab dividesGCDab.

The greatest common divisorab (not both zero) may be defined alternativelyequivalently as follows: it issmallest positive integer d which can be written inform ap+bq where pqintegers.

If d isGCDab,a dividesproduct bc, then a/d divides c.

If many integer, then gcd(ma,mb) = m gcd(a,b)gcd(a+mb,b) = gcd(a,b). If m isnonzero common divisorab, then gcd(a/m,b/m) = gcd(a,b)/m.

The GCDthree numbers can be computed as gcd(a,b,c) = gcd(gcd(a,b),c) = gcd(a, gcd(b, c)).

The GCDabclosely relatedtheir least common multiple lcm(a, b): we have

gcd(a, b) × lcm(a, b) = ab.
Furthermore,following versionsdistributivity hold true:
gcd(a, lcm(b, c)) = lcm(gcd(a, b), gcd(a, c))
lcm(a, gcd(b, c)) = gcd(lcm(a, b), lcm(a, c)).

Geometrically, gcd(a,b) isnumberpointsintegral coordinates onstraight line joiningpoints (0,0)(a,b), excluding (0,0).

GCDcommutative rings

The greatest common divisor can more generally be definedelementsan arbitrary commutative ring.

If R iscommutative ring,abin R, then an elementcRcalledcommon divisorab ifdivides both ab (that is, if thereelements xyR such that cx = acy = b). If c iscommon divisorab,every common divisorab divides c, then ccalledgreatest common divisorab.

Note thatGCDab need not be unique, but if Ran integral domain then any two GCDsab must be associate elements. Also, ab need not haveGCD at all unless R isunique factorization domain. If R isEuclidean domain thenform ofEuclidean algorithm can be usedcomputeGCD.


Copyright 2004. All rights reserved.