Skip to main content

GCD

Definition of GCD

Formal Mathematical Definition

For integers ( a ) and ( b ), not both zero:

gcd(a,b)=maxdd divides both a and b\gcd(a, b) = \max { d \mid d \text{ divides both } a \text{ and } b }

This means the GCD is the largest number that divides both.

Simple Definition

The GCD is the biggest number that divides both numbers exactly.


Methods to Calculate GCD

There are several methods to calculate GCD.


1. Listing Factors Method

Steps

  1. List factors of both numbers
  2. Find common factors
  3. Choose the largest one

Example: GCD(18, 24)

Factors of 18:

1,2,3,6,9,181, 2, 3, 6, 9, 18

Factors of 24:

1,2,3,4,6,8,12,241, 2, 3, 4, 6, 8, 12, 24

Common factors:

1,2,3,61, 2, 3, 6

GCD:

6\boxed{6}

2. Prime Factorization Method

Steps

  1. Find prime factors
  2. Multiply common prime factors

Example: GCD(24, 36)

Prime factors of 24:

24=23×324 = 2^3 \times 3

Prime factors of 36:

36=22×3236 = 2^2 \times 3^2

Common factors:

22×32^2 \times 3

GCD:

=4×3= 4 \times 3 =12= \boxed{12}

3. Euclidean Algorithm

This is the most efficient method.

Formula:

gcd(a,b)=gcd(b,amodb)\gcd(a, b) = \gcd(b, a \bmod b)

Example: GCD(48, 18)

Step 1:

48÷18=2 remainder 1248 \div 18 = 2 \text{ remainder } 12

Step 2:

18÷12=1 remainder 618 \div 12 = 1 \text{ remainder } 6

Step 3:

12÷6=2 remainder 012 \div 6 = 2 \text{ remainder } 0

GCD:

6\boxed{6}

4. Division Method

This is similar to the Euclidean algorithm.

Example: GCD(56, 42)

Step 1:

56÷42=1 remainder 1456 \div 42 = 1 \text{ remainder } 14

Step 2:

42÷14=3 remainder 042 \div 14 = 3 \text{ remainder } 0

GCD:

14\boxed{14}

5. Repeated Subtraction Method

Subtract smaller number from larger until equal.

Example: GCD(15, 9)

Step 1:

159=615 - 9 = 6

Now find GCD(9, 6)

Step 2:

96=39 - 6 = 3

Now find GCD(6, 3)

Step 3:

63=36 - 3 = 3

Now both equal.

GCD:

3\boxed{3}

6. Using Recursion (Programming Method)

Recursive formula:

gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)

Example: GCD(24, 18)

Step 1:

gcd(24,18)gcd(24, 18)

Step 2:

gcd(18,6)gcd(18, 6)

Step 3:

gcd(6,0)gcd(6, 0)

Result:

6\boxed{6}

Important Properties of GCD

These properties are very useful.


Property 1: Commutative Property

gcd(a,b)=gcd(b,a)\gcd(a, b) = \gcd(b, a)

Example:

gcd(12,18)=gcd(18,12)=6\gcd(12, 18) = \gcd(18, 12) = 6

Property 2: GCD with Zero

gcd(a,0)=a\gcd(a, 0) = |a| gcd(0,b)=b\gcd(0, b) = |b| gcd(0,0)=0\gcd(0, 0) = 0

Example:

gcd(10,0)=10\gcd(10, 0) = 10

Property 3: Product Relationship with LCM

gcd(a,b)×lcm(a,b)=a×b\gcd(a, b) \times \text{lcm}(a, b) = a \times b

Example:

gcd(6,8)=2\gcd(6, 8) = 2 lcm(6,8)=24\text{lcm}(6, 8) = 24 2×24=482 \times 24 = 48 6×8=486 \times 8 = 48

Correct.


Property 4: If a divides b

If:

aba \mid b

Then:

gcd(a,b)=a\gcd(a, b) = a

Example:

gcd(5,20)=5\gcd(5, 20) = 5

Property 5: GCD of Co-prime Numbers

If numbers are co-prime:

gcd(a,b)=1\gcd(a, b) = 1

Example:

gcd(8,15)=1\gcd(8, 15) = 1

Property 6: Associative Property

gcd(a,b,c)=gcd(gcd(a,b),c)\gcd(a, b, c) = \gcd(\gcd(a, b), c)

Example:

gcd(12,18,24)\gcd(12, 18, 24)

Step 1:

gcd(12,18)=6\gcd(12, 18) = 6

Step 2:

gcd(6,24)=6\gcd(6, 24) = 6

Property 7: Linear Combination Property

If:

d=gcd(a,b)d = \gcd(a, b)

Then:

d(ax+by)d \mid (ax + by)

for any integers ( x ) and ( y ).

Example:

gcd(6,9)=3\gcd(6, 9) = 3 3(6×2+9×1=21)3 \mid (6 \times 2 + 9 \times 1 = 21)

True.


Property 8: GCD is Always Positive

gcd(a,b)0\gcd(a, b) \ge 0

Property 9: Divisibility Property

gcd(a,b)a\gcd(a, b) \mid a gcd(a,b)b\gcd(a, b) \mid b

(The GCD divides both numbers.)


Property 10: Euclidean Property

gcd(a,b)=gcd(a,ba)\gcd(a, b) = \gcd(a, b - a)

More generally:

gcd(a,b)=gcd(a,bmoda)\gcd(a, b) = \gcd(a, b \bmod a)

Property 11: Scaling Property

For any integer ( k \ne 0 ):

gcd(ka,kb)=kgcd(a,b)\gcd(ka, kb) = |k| \gcd(a, b)

Property 12: Multiplicative Property (when coprime)

If:

gcd(a,b)=1\gcd(a, b) = 1

Then:

gcd(a,bc)=gcd(a,c)\gcd(a, bc) = \gcd(a, c)

Property 13: Important Coprime Property

If:

gcd(a,b)=1\gcd(a, b) = 1

and

abca \mid bc

Then:

aca \mid c

Property 14: Relation with Powers

gcd(am,an)=amin(m,n)\gcd(a^m, a^n) = a^{\min(m, n)}

Applications of GCD

2. Solving Diophantine Equations

Example:

6x+9y=36x + 9y = 3

Solution exists because:

gcd(6,9)=3\gcd(6, 9) = 3

5. Geometry Problems

Finding largest square tile size.

Example:

Rectangle:

12 × 18

GCD = 6

Largest square tile = 6 × 6

Common Mistakes Students Make

Mistake 1: Confusing GCD with LCM

GCD = Largest common divisor LCM = Smallest common multiple

Mistake 3: Stopping Euclidean Algorithm Early

Must continue until remainder = 0.

Key Points:

  • Euclidean algorithm is the most efficient