math.wiki
Logic, proof and discrete math › Introductory number theory › Bezout's identity and the extended Euclidean algorithm
Open on the map
Discrete Mathematics and Proof

Bezout's identity and the extended Euclidean algorithm

The greatest common divisor of two integers divides every combination of them. Is the greatest common divisor itself one of those combinations, and how would you find the multipliers?

Where you are 8 in Introductory number theory

When you reach for it

The The Euclidean algorithm and coprime numbers finds \gcd(527, 403) = 31 in three divisions. Every common divisor of 527 and 403 divides every combination 527x + 403y with x, y \in \mathbb{Z} (Proving statements about divisibility), so every such combination is a multiple of 31. A sharper question is whether 31 itself is one of them. It is: 31 = 4 \cdot 403 - 3 \cdot 527 (Example 1), and the multipliers come from the same divisions, read backward.

Reach for this move when a proof needs the greatest common divisor written as a combination: to show two integers are coprime by producing 1, to prove Euclid’s lemma (a prime dividing a product divides a factor), and to solve an equation ax + by = c in integers, such as finding how many \$7 and \$11 items cost exactly \$100. The lesson runs over two days. Day 1 finds the combination and proves it always exists (Bezout’s identity). Day 2 uses it: Euclid’s lemma and equations ax + by = c.

The procedure

Day 1: running the divisions backward

An integer combination (or linear combination) of a and b is a number ax + by with x, y \in \mathbb{Z}; the integers x, y are its coefficients. Run the Euclidean algorithm on a and b > 0:

\begin{aligned} a &= bq_1 + r_1, \\ b &= r_1 q_2 + r_2, \\ &\ \ \vdots \\ r_{n-2} &= r_{n-1} q_n + r_n, \end{aligned}

and then r_{n-1} = r_n q_{n+1}, with r_n = \gcd(a, b). Back substitution solves each line for its remainder, r_k = r_{k-2} - q_k r_{k-1} (with r_{-1} = a, r_0 = b), and works upward. The last line writes r_n as a combination of r_{n-2} and r_{n-1}. Replace r_{n-1} by its own expression in r_{n-3} and r_{n-2}, collect terms, and the result is a combination of r_{n-3} and r_{n-2}. Each substitution moves one line up, and at the top only a and b are left. Every step is the distributive property and collecting like terms, so the final equation is true because each one before it was.

Day 1: the table form

Back substitution needs every division written down first, then a second pass. The table form carries the coefficients forward in one pass. Keep a row (r, x, y) with the promise r = ax + by. The first two rows keep it trivially:

a = a \cdot 1 + b \cdot 0, \qquad b = a \cdot 0 + b \cdot 1.

Each new remainder is r_k = r_{k-2} - q_k r_{k-1}, so form each new row as (the row two up) minus q_k times (the row just above), entry by entry. If r_{k-2} = ax' + by' and r_{k-1} = ax'' + by'', subtracting q_k times the second equation from the first gives

r_k = a(x' - q_k x'') + b(y' - q_k y''),

so the new row keeps the promise too. The row whose r is the last nonzero remainder holds the coefficients of \gcd(a, b).

Day 1: Bezout’s identity

Both methods stop after finitely many steps and always end at a combination, so the algorithm already proves that one exists. A second proof, by the well-ordering principle of Strong induction and well-ordering (every nonempty set of positive integers has a least member), shows more: the gcd is the least positive combination.

Bezout’s identity. Let a, b \in \mathbb{Z}, not both zero. Then \gcd(a, b) is the least positive integer of the form ax + by with x, y \in \mathbb{Z}.

Proof. Let S be the set of positive integers of the form ax + by. It is not empty, because a \cdot a + b \cdot b = a^2 + b^2 > 0. By the well-ordering principle S has a least member d = ax_0 + by_0.

First, d \mid a. By The division algorithm, a = dq + r with 0 \le r < d. Then

\begin{aligned} r &= a - q(ax_0 + by_0) \\ &= a(1 - qx_0) + b(-qy_0), \end{aligned}

an integer combination of a and b. If r > 0, then r \in S and r < d, contradicting the choice of d. So r = 0 and d \mid a. The same argument with b in place of a gives d \mid b. So d is a positive common divisor, and d \le \gcd(a, b).

Second, g = \gcd(a, b) divides a and b, so it divides the combination ax_0 + by_0 = d. Since d > 0, the size bound of Divisibility as a relation gives g \le d. Hence d = g. \square

Two consequences are used constantly.

Combinations are the multiples of the gcd. The integers of the form ax + by are exactly the multiples of g = \gcd(a, b). Every combination is a multiple, since g \mid a and g \mid b. Conversely, if g = ax_0 + by_0, then kg = a(kx_0) + b(ky_0) for every integer k.

Coprime means 1 is a combination. \gcd(a, b) = 1 exactly when ax + by = 1 for some integers x, y. If the gcd is 1, Bezout’s identity writes it so. If 1 = ax + by, then 1 is a multiple of the gcd, so the gcd is 1.

The same argument gives a fact proved by other means in the Euclidean algorithm lesson: if c \mid a and c \mid b, then c divides ax_0 + by_0 = \gcd(a, b).

Day 2: Euclid’s lemma

Lemma (coprime factor). If a \mid bc and \gcd(a, b) = 1, then a \mid c.

Proof. Since \gcd(a, b) = 1, there are integers x, y with ax + by = 1. Multiply by c:

c = a(cx) + (bc)y.

Now a \mid a(cx), and a \mid bc by hypothesis, so a \mid (bc)y. A divisor of two integers divides their sum, so a \mid c. \square

Euclid’s lemma. If p is prime and p \mid ab, then p \mid a or p \mid b.

Proof. If p \mid a we are done. Otherwise \gcd(p, a) is a positive divisor of p, so it is 1 or p; it is not p, since p \nmid a. So \gcd(p, a) = 1, and the coprime factor lemma with p \mid ab gives p \mid b. \square

This closes two gaps left open earlier. Proving statements about divisibility stated Euclid’s lemma without proof; the proof above supplies it. Every number has exactly one prime factorization assumed it as the prime divisor property; Exercise 19 extends it to any number of factors, which is exactly that property, so the uniqueness of prime factorization now rests on proved ground.

Day 2: linear equations in integers

An equation ax + by = c to be solved with x, y \in \mathbb{Z} is a linear Diophantine equation.

Theorem. Let a, b be nonzero integers and d = \gcd(a, b). The equation ax + by = c has an integer solution exactly when d \mid c. If (x_0, y_0) is one solution, the solutions are exactly

x = x_0 + \tfrac{b}{d}t, \qquad y = y_0 - \tfrac{a}{d}t, \qquad t \in \mathbb{Z}.

Proof. The first sentence is “combinations are the multiples of the gcd”. Each pair in the list is a solution, since \displaystyle a \cdot \frac{b}{d}t - b \cdot \frac{a}{d}t = 0. Conversely, let (x, y) be any solution. Subtracting ax_0 + by_0 = c from ax + by = c gives a(x - x_0) = b(y_0 - y), and dividing by d,

\tfrac{a}{d}(x - x_0) = \tfrac{b}{d}(y_0 - y).

By Example 4, \displaystyle \gcd(\frac{a}{d}, \frac{b}{d}) = 1. So \displaystyle \frac{b}{d} divides \displaystyle \frac{a}{d}(x - x_0) and is coprime to \displaystyle \frac{a}{d}, and the coprime factor lemma gives \displaystyle x - x_0 = \frac{b}{d}t for some integer t. Substituting, \displaystyle \frac{a}{d} \cdot \frac{b}{d}t = \frac{b}{d}(y_0 - y), and cancelling \displaystyle \frac{b}{d} \ne 0 gives \displaystyle y = y_0 - \frac{a}{d}t. \square

To find (x_0, y_0): write d = ax' + by' by the algorithm and multiply by \displaystyle \frac{c}{d}.

Worked examples

Examples 1 to 4 belong to Day 1, Examples 5 to 7 to Day 2.

Example 1

Back substitution on 527 and 403

Write \gcd(527, 403) as an integer combination of 527 and 403.

Solution

Run the algorithm:

\begin{aligned} 527 &= 1 \cdot 403 + 124 \\ 403 &= 3 \cdot 124 + 31 \\ 124 &= 4 \cdot 31 + 0 \end{aligned}

So \gcd(527, 403) = 31. Solve the second line for its remainder, 31 = 403 - 3 \cdot 124. The first line gives 124 = 527 - 403; substitute and collect the multiples of 403:

\begin{aligned} 31 &= 403 - 3(527 - 403) \\ &= 4 \cdot 403 - 3 \cdot 527. \end{aligned}

Check: 4 \cdot 403 = 1612 and 3 \cdot 527 = 1581, and 1612 - 1581 = 31.

Example 2

The table form on 2363 and 1819

Find \gcd(2363, 1819) and integers x, y with 2363x + 1819y = \gcd(2363, 1819), carrying the coefficients forward.

Solution

Each row satisfies r = 2363x + 1819y. The first two rows are a and b; each later row is the row two up minus q times the row above, where q is the quotient of the division that produced it.

rqxy
236310
181901
54411-1
1873-34
17027-9
171-1013
010107-139

For instance, 1819 = 3 \cdot 544 + 187, so the 187 row is (0, 1) minus 3(1, -1), which is (-3, 4). The last nonzero remainder is 17, so

\gcd(2363, 1819) = 17 = -10 \cdot 2363 + 13 \cdot 1819.

Check: 13 \cdot 1819 = 23{,}647 and 10 \cdot 2363 = 23{,}630, a difference of 17. The zero row is a bonus: 107 \cdot 2363 = 139 \cdot 1819, and \displaystyle 107 = \frac{1819}{17}, \displaystyle 139 = \frac{2363}{17}. Those are the steps \displaystyle \frac{b}{d} and \displaystyle \frac{a}{d} of Day 2’s theorem.

Example 3

Which numbers are combinations

Which integers can be written as 84x + 132y with x, y \in \mathbb{Z}? Write 60 that way, and explain why 50 cannot be.

Solution

By the consequence of Bezout’s identity, they are exactly the multiples of \gcd(84, 132). The algorithm:

\begin{aligned} 132 &= 1 \cdot 84 + 48 \\ 84 &= 1 \cdot 48 + 36 \\ 48 &= 1 \cdot 36 + 12 \\ 36 &= 3 \cdot 12 + 0 \end{aligned}

So the gcd is 12, and the combinations are the multiples of 12. Back substitution:

\begin{aligned} 12 &= 48 - 36 = 48 - (84 - 48) \\ &= 2 \cdot 48 - 84 = 2(132 - 84) - 84 \\ &= 2 \cdot 132 - 3 \cdot 84. \end{aligned}

Multiply by 5: 60 = 10 \cdot 132 - 15 \cdot 84, and indeed 1320 - 1260 = 60. The number 50 is not a multiple of 12, while every 84x + 132y is, so 50 is no combination.

Example 4

Dividing out the gcd leaves a coprime pair

Let a, b be integers, not both zero, with d = \gcd(a, b). Prove that \displaystyle \gcd(\frac{a}{d}, \frac{b}{d}) = 1.

Solution

Proof. Since d \mid a and d \mid b, the numbers \displaystyle \frac{a}{d} and \displaystyle \frac{b}{d} are integers, not both zero. By Bezout’s identity, d = ax_0 + by_0 for some integers x_0, y_0. Divide by d \ne 0:

1 = \tfrac{a}{d}x_0 + \tfrac{b}{d}y_0.

So 1 is an integer combination of \displaystyle \frac{a}{d} and \displaystyle \frac{b}{d}, and they are coprime. \square

In Example 2, \displaystyle \frac{2363}{17} = 139 and \displaystyle \frac{1819}{17} = 107, and dividing 17 = -10 \cdot 2363 + 13 \cdot 1819 by 17 gives 1 = -10 \cdot 139 + 13 \cdot 107.

Example 5

Two coprime divisors

Prove that if a \mid c, b \mid c and \gcd(a, b) = 1, then ab \mid c.

Solution

Proof. Since a \mid c, write c = am for some integer m. Then b \mid am, and \gcd(b, a) = 1, so the coprime factor lemma gives b \mid m, say m = bk. Hence c = abk and ab \mid c. \square

So an integer divisible by 4 and by 9 is divisible by 36. The hypothesis matters: 4 and 6 both divide 12, but 24 \nmid 12, because \gcd(4, 6) = 2.

Example 6

Exactly one hundred dollars

Daku spends exactly \$100 on puzzles at \$7 each and model kits at \$11 each. Find every integer solution of 7x + 11y = 100, then every way Daku can do it.

Solution

First write \gcd(7, 11) as a combination:

\begin{aligned} 11 &= 1 \cdot 7 + 4 \\ 7 &= 1 \cdot 4 + 3 \\ 4 &= 1 \cdot 3 + 1 \end{aligned}

so the gcd is 1, which divides 100, and solutions exist. Back substitution:

\begin{aligned} 1 &= 4 - 3 = 4 - (7 - 4) = 2 \cdot 4 - 7 \\ &= 2(11 - 7) - 7 = 2 \cdot 11 - 3 \cdot 7. \end{aligned}

Multiply by 100: 7(-300) + 11(200) = 100. With d = 1 the theorem gives every solution:

x = -300 + 11t, \qquad y = 200 - 7t, \qquad t \in \mathbb{Z}.

Daku needs x \ge 0 and y \ge 0. The first says 11t \ge 300, so t \ge 28 (since 11 \cdot 27 = 297). The second says 7t \le 200, so t \le 28 (since 7 \cdot 29 = 203). So t = 28 is the only choice: x = 8, y = 4. Daku buys 8 puzzles and 4 kits, and 56 + 44 = 100. This is the only way.

x y (−3, 11) (8, 4) (19, −3) step (11, −7)
Figure 1The integer solutions of 7x + 11y = 100 sit on the line at equal steps of (11, -7). Exactly one of them, (8, 4), has both coordinates nonnegative.
Example 7

Marking a length with two sticks

Ozias has two sticks with no marks, 33 inches and 21 inches long. Laying a stick along a board moves a pencil mark forward or back by its length. Which distances from the start can he mark? Mark 30 inches using as few stick lengths as possible, and explain why 20 inches cannot be marked.

Solution

Laying the 33-inch stick x times and the 21-inch stick y times, with a negative count meaning laid backward, reaches 33x + 21y. So the reachable distances are the multiples of \gcd(33, 21):

\begin{aligned} 33 &= 1 \cdot 21 + 12 \\ 21 &= 1 \cdot 12 + 9 \\ 12 &= 1 \cdot 9 + 3 \\ 9 &= 3 \cdot 3 + 0 \end{aligned}

The gcd is 3, so every multiple of 3 inches can be marked and nothing else; 20 is not a multiple of 3. Back substitution:

\begin{aligned} 3 &= 12 - 9 = 12 - (21 - 12) = 2 \cdot 12 - 21 \\ &= 2(33 - 21) - 21 = 2 \cdot 33 - 3 \cdot 21. \end{aligned}

Times 10: 30 = 20 \cdot 33 - 30 \cdot 21, which uses 50 lengths. Here \displaystyle \frac{b}{d} = 7 and \displaystyle \frac{a}{d} = 11, so all solutions are x = 20 + 7t, y = -30 - 11t. The number of lengths is |x| + |y|:

t-2-3-4
(x, y)(6, -8)(-1, 3)(-8, 14)
\lvert x \rvert + \lvert y \rvert14422

For t \ge -2, x \ge 6 and y \le -8, and both grow in size as t rises; for t \le -4 they grow as t falls. So t = -3 is best: lay the 21-inch stick forward three times, to 63, then the 33-inch stick back once, to 63 - 33 = 30. Four lengths.

Boundaries

  • Not both zero. \gcd(0, 0) is undefined, so Bezout’s identity needs a, b not both zero. The theorem on ax + by = c is stated for a, b both nonzero; if, say, a = 0, the equation is by = c in one unknown, with x free.
  • The coefficients are not unique. One combination gives infinitely many: \displaystyle x + \frac{b}{d}t, \displaystyle y - \frac{a}{d}t. The algorithm returns one particular pair.
  • Integers, not counts. Bezout’s identity promises integer coefficients, usually one negative. Whether ax + by = c has a solution with x, y \ge 0 is a different question: 7x + 11y = 59 has integer solutions but none with both nonnegative, as trying y = 0, 1, \dots, 5 shows.
  • Euclid’s lemma needs a prime. 10 \mid 4 \cdot 15, yet 10 \nmid 4 and 10 \nmid 15. The coprime factor lemma needs \gcd(a, b) = 1: 4 \mid 2 \cdot 6 but 4 \nmid 6.
  • Least positive, not least. The combinations include 0 and negative numbers. The gcd is the least positive one.

Where this goes next

The equation ax + ny = 1 is the heart of modular inverses: an integer a has an inverse modulo n exactly when \gcd(a, n) = 1, and the table form computes it. The same combinations of coprime moduli build the solutions in the The Chinese remainder theorem. Euclid’s lemma is what makes prime factorization unique (Every number has exactly one prime factorization, fundamental-theorem-of-arithmetic), and it is the step behind irrationality proofs such as “p \mid n^2 forces p \mid n” (Exercise 17).

Exercises

Day 1: finding combinations

  1. Use back substitution to write \gcd(589, 437) as an integer combination of 589 and 437.
  2. Use the table form to find \gcd(1147, 899) and integers x, y with 1147x + 899y = \gcd(1147, 899).
  3. Write 1 as an integer combination of 43 and 30.
  4. Find \gcd(-168, 120) and integers x, y with -168x + 120y = \gcd(-168, 120).
  5. Which of 18, 20 and 105 can be written as 35x + 50y with x, y \in \mathbb{Z}? Write each one that can.
  6. Find the least positive value of 126x + 90y over all integers x, y, and a pair that gives it.

Day 1: reasoning

  1. Prove that 11n + 6 and 2n + 1 are coprime for every integer n by writing 1 as a combination of them.
  2. Prove that \gcd(ka, kb) = k \gcd(a, b) for every positive integer k and integers a, b not both zero.
  3. Prove that if d > 0 is a common divisor of a and b and d = ax + by for some integers x, y, then d = \gcd(a, b).
  4. Prove that if \gcd(a, b) = 1 and \gcd(a, c) = 1, then \gcd(a, bc) = 1.
  5. Find integers x, y, z with 10x + 14y + 35z = 1. Explain why no combination of just two of 10, 14, 35 equals 1.

Day 2: equations in integers

  1. Using Exercise 1, find every integer solution of 589x + 437y = 19, and the solution with x negative and as close to 0 as possible.
  2. Find every integer solution of 12x + 21y = 75.
  3. Show that 14x + 35y = 50 has no integer solution.
  4. A club spends exactly \$200 on caps at \$9 and scarves at \$13. Find every way to do it.
  5. Find every integer n with 35 \mid 14n.

Day 2: reasoning and proof

  1. Let p be prime. Prove that if p \mid n^2, then p \mid n, and then that p^2 \mid n^2.
  2. Find positive integers a, b with 12 \mid ab, 12 \nmid a and 12 \nmid b. Which hypothesis of Euclid’s lemma fails?
  3. Prove by induction on n \ge 1: if a prime p divides a_1 a_2 \cdots a_n, then p divides some a_i.
  4. Let a, b be coprime positive integers and c any integer. Prove that ax + by = c has a solution with 0 \le x < b.
  5. Show that 31 is not 5x + 9y with x, y \ge 0 integers, that each of 32, 33, 34, 35, 36 is, and conclude that every integer c \ge 32 is.
  6. Prove that if \gcd(a, b) = 1, then \gcd(a + b, ab) = 1.
Answers
  1. 19 = 3 \cdot 589 - 4 \cdot 437. The divisions are 589 = 1 \cdot 437 + 152, 437 = 2 \cdot 152 + 133, 152 = 1 \cdot 133 + 19, 133 = 7 \cdot 19. Then 19 = 152 - 133, which is 152 - (437 - 2 \cdot 152) = 3 \cdot 152 - 437, which is 3(589 - 437) - 437.
  2. 31 = 11 \cdot 1147 - 14 \cdot 899. Quotients 1, 3, 1, 1, 1, 2 and remainders 248, 155, 93, 62, 31, 0; the rows (x, y) run (1, -1), (-3, 4), (4, -5), (-7, 9), (11, -14).
  3. 1 = 7 \cdot 43 - 10 \cdot 30, from 43 = 1 \cdot 30 + 13, 30 = 2 \cdot 13 + 4, 13 = 3 \cdot 4 + 1: 1 = 13 - 3 \cdot 4 = 7 \cdot 13 - 3 \cdot 30 = 7 \cdot 43 - 10 \cdot 30.
  4. The gcd is 24, and x = 2, y = 3. From 168 = 1 \cdot 120 + 48 and 120 = 2 \cdot 48 + 24: 24 = 120 - 2(168 - 120) = 3 \cdot 120 - 2 \cdot 168, and -2 \cdot 168 = 2 \cdot (-168).
  5. 20 and 105, not 18. Since \gcd(35, 50) = 5, the combinations are the multiples of 5. 20 = 2 \cdot 35 - 1 \cdot 50 and 105 = 3 \cdot 35 + 0 \cdot 50.
  6. 18, for example x = -2, y = 3. The least positive value is \gcd(126, 90): 126 = 1 \cdot 90 + 36, 90 = 2 \cdot 36 + 18, so 18 = 90 - 2(126 - 90) = 3 \cdot 90 - 2 \cdot 126.
  7. Proof. 2(11n + 6) - 11(2n + 1) = 12 - 11 = 1, so 1 is a combination and the gcd is 1. \square
  8. Proof. (ka)x + (kb)y = k(ax + by), and since k > 0, this is positive exactly when ax + by is. So the positive combinations of ka, kb are k times those of a, b, and the least is k \gcd(a, b). By Bezout’s identity it equals \gcd(ka, kb). \square
  9. Proof. As a positive common divisor, d \le \gcd(a, b). And \gcd(a, b) divides a and b, hence ax + by = d, so \gcd(a, b) \le d. \square
  10. Proof. Write 1 = ax + by and 1 = au + cv. Multiplying, 1 = a(axu + xcv + byu) + (bc)(yv), so 1 is a combination of a and bc. \square
  11. x = -2, y = -1, z = 1: -20 - 14 + 35 = 1. Two at a time, \gcd(10, 14) = 2, \gcd(10, 35) = 5 and \gcd(14, 35) = 7, and every combination of a pair is a multiple of its gcd, so none is 1.
  12. x = 3 + 23t, y = -4 - 31t, t \in \mathbb{Z}, since \displaystyle \frac{437}{19} = 23 and \displaystyle \frac{589}{19} = 31. The closest negative x is at t = -1: (-20, 27), and -11{,}780 + 11{,}799 = 19.
  13. x = 1 + 7t, y = 3 - 4t. The gcd is 3 and 3 = 2 \cdot 12 - 21, so (50, -25) is a solution; steps are \displaystyle \frac{21}{3} = 7 and \displaystyle \frac{12}{3} = 4, and t = -7 gives (1, 3): 12 + 63 = 75.
  14. \gcd(14, 35) = 7 divides every 14x + 35y, and 7 \nmid 50.
  15. Two ways: 2 caps and 14 scarves, or 15 caps and 5 scarves. From 1 = 3 \cdot 9 - 2 \cdot 13, the solutions of 9x + 13y = 200 are x = 600 + 13t, y = -400 - 9t; nonnegative needs -46 \le t \le -45.
  16. Exactly the multiples of 5. 35 \mid 14n means 14n = 35m, so 2n = 5m and 5 \mid 2n; since \gcd(5, 2) = 1, 5 \mid n. Conversely 14 \cdot 5k = 35 \cdot 2k.
  17. Proof. p \mid n \cdot n, so by Euclid’s lemma p \mid n. Then n = pk and n^2 = p^2 k^2. \square
  18. a = 6, b = 10: 12 \mid 60, but 12 \nmid 6 and 12 \nmid 10. The hypothesis that fails is that 12 be prime.
  19. Proof. For n = 1 there is nothing to prove. Suppose it holds for n, and p \mid (a_1 \cdots a_n) a_{n+1}. By Euclid’s lemma, p \mid a_1 \cdots a_n or p \mid a_{n+1}. In the first case the induction hypothesis gives some a_i with i \le n and p \mid a_i. Either way p divides one of the factors. \square
  20. Proof. Since \gcd(a, b) = 1 \mid c, there is a solution (x_0, y_0), and all solutions are x = x_0 + bt, y = y_0 - at. Divide: x_0 = bq + r with 0 \le r < b. Taking t = -q gives x = r. \square
  21. For 31: y = 0, 1, 2, 3 leave 31, 22, 13, 4, none a multiple of 5. Then 32 = 5 + 27, 33 = 15 + 18, 34 = 25 + 9, 35 = 5 \cdot 7, 36 = 9 \cdot 4. Any c \ge 32 is c' + 5k with 32 \le c' \le 36 and k \ge 0; add k to x.
  22. Proof. Suppose a prime p divides a + b and ab. By Euclid’s lemma p \mid a or p \mid b, say p \mid a. Then p \mid (a + b) - a = b, so p divides \gcd(a, b) = 1, which is impossible. An integer greater than 1 has a prime divisor, so the gcd is 1. \square
kg1128 · updated 2026-10-22 · CC-BY-SA-4.0