Properties
- Every common divisor of a and b is a divisor of gcd(a, b).
- gcd(a, b), where a and b are not both zero, may be defined alternatively and equivalently as the smallest positive integer d which can be written in the form d = a·p + b·q where p and q are integers. This expression is called Bézout's identity. Numbers p and q like this can be computed with the extended Euclidean algorithm.
- gcd(a, 0) = |a|, for a ≠ 0, since any number is a divisor of 0, and the greatest divisor of a is |a|. This is usually used as the base case in the Euclidean algorithm.
- If a divides the product b·c, and gcd(a, b) = d, then a/d divides c.
- If m is a non-negative integer, then gcd(m·a, m·b) = m·gcd(a, b).
- If m is any integer, then gcd(a + m·b, b) = gcd(a, b).
- If m is a nonzero common divisor of a and b, then gcd(a/m, b/m) = gcd(a, b)/m.
- The gcd is a multiplicative function in the following sense: if a1 and a2 are relatively prime, then gcd(a1·a2, b) = gcd(a1, b)·gcd(a2, b).
- The gcd is a commutative function: gcd(a, b) = gcd(b, a).
- The gcd is an associative function: gcd(a, gcd(b, c)) = gcd(gcd(a, b), c).
- The gcd of three numbers can be computed as gcd(a, b, c) = gcd(gcd(a, b), c), or in some different way by applying commutativity and associativity. This can be extended to any number of numbers.
- gcd(a, b) is closely related to the least common multiple lcm(a, b): we have
-
- gcd(a, b)·lcm(a, b) = a·b.
- This formula is often used to compute least common multiples: one first computes the gcd with Euclid's algorithm and then divides the product of the given numbers by their gcd.
- The following versions of distributivity 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)).
- It is useful to define gcd(0, 0) = 0 and lcm(0, 0) = 0 because then the natural numbers become a complete distributive lattice with gcd as meet and lcm as join operation. This extension of the definition is also compatible with the generalization for commutative rings given below.
- In a Cartesian coordinate system, gcd(a, b) can be interpreted as the number of points with integral coordinates on the straight line joining the points (0, 0) and (a, b), excluding (0, 0).
Read more about this topic: Greatest Common Divisor
Famous quotes containing the word properties:
“The reason why men enter into society, is the preservation of their property; and the end why they choose and authorize a legislative, is, that there may be laws made, and rules set, as guards and fences to the properties of all the members of the society: to limit the power, and moderate the dominion, of every part and member of the society.”
—John Locke (16321704)
“A drop of water has the properties of the sea, but cannot exhibit a storm. There is beauty of a concert, as well as of a flute; strength of a host, as well as of a hero.”
—Ralph Waldo Emerson (18031882)