2.5.9 · D4Number Theory (Intermediate)

Exercises — Bézout's identity

3,459 words16 min readBack to topic

Before we start, one reminder in plain words. Bézout's identity says: take two whole numbers and (not both zero). Their greatest common divisor — the biggest number that divides both — can be written as a recipe , where and are whole numbers that are allowed to be negative. Negative just means "subtract that many copies". That's the whole game.

The two pictures you will use everywhere

Two visual ideas power every exercise below. Meet them now so the solutions feel like reading a map, not decoding algebra.

Picture A — why back-substitution builds Bézout coefficients. Look at the figure below. The Euclidean Algorithm works by repeated division: divide the bigger number by the smaller, and keep the remainder. One such division reads where (the quotient) is how many whole copies of the smaller number fit inside the bigger one, and (the remainder) is what's left over — always smaller than the number you divided by. We label the successive remainders : is the leftover from the first division, from the second, and so on. Each new remainder is strictly smaller than the previous one, so the trail marches downward and must stop — the last non-zero remainder is the gcd.

Now rearrange any one line to isolate its remainder: This says "this remainder is a combination of the two numbers just above it on the ladder." Back-substitution walks up the trail. At every rung, the gcd is already written as a combination of two numbers on that rung; we swap the lower one for its own combination-recipe from the rung above. Because each recipe only ever uses numbers from higher up, we keep climbing until the only numbers left are the original and . That is exactly why the process must terminate in — the ladder has a top.

In the figure, worked for : the teal down-arrow is the Euclidean phase producing the shrinking remainders then (the gcd); the orange up-arrow is back-substitution. Follow the plum line at the bottom — it shows the single swap (using the gcd-line) turning into once the remainder is replaced by its recipe . Watch where the "" disappears and "" appear — that is the whole method in one move.

Figure — Bézout's identity

Picture B — why the general solution steps by and . The solutions of are the integer points sitting on a single straight line. Slope of that line: , so moving right by drops you by . To stay on the line and land on integers again, you need the smallest whole step: move across, and you fall down — because , the recipe's value doesn't change, yet both coordinates stay integers. That single equal-and-opposite cancellation is the whole reason the step is . We draw this line explicitly in Exercise 5.2 below.


Level 1 — Recognition

Here you only need to decide things, not compute long chains.

Exercise 1.1

For each pair, state , and say whether can have integer solutions. (a) (b) (c)

Recall Solution 1.1

The key fact: has integer solutions exactly when (the numbers are coprime). Why? Because the smallest positive number you can build from and is — you can never make anything positive smaller than it. So you can only reach if the gcd already is .

(a) : , , , . Yes, is solvable. (b) (since , ). No, cannot equal — the smallest positive value is . (c) . Yes (trivially ).

Exercise 1.2

Which of these are valid Bézout equations (i.e. right-hand side truly equals the gcd)? (a) (b) (c)

Recall Solution 1.2

The right-hand side of a Bézout equation must be exactly . (a) . RHS . Valid. (b) . Not a Bézout equation. (It's still a solvable Diophantine equation only if , which is false — so it has no solutions at all.) (c) . RHS . Valid.


Level 2 — Application

Now run the Extended Euclidean Algorithm end to end. Keep Picture A in mind: each back-substitution swaps a remainder for its recipe from the rung above, climbing the ladder until only and remain.

Exercise 2.1

Find integers with .

Recall Solution 2.1

Forward — Euclidean Algorithm (divide, keep the remainder): Back-substitute — start at the equation whose remainder is the gcd (). Why this works (Picture A): the line already writes the gcd as a combination of and . But is not one of our originals — it is itself a remainder, so it has a recipe one rung up. Swapping it in trades for and . Since every swap only introduces numbers from higher rungs, we must eventually reach the top, where only and survive. Replace using its recipe : Only and remain — the ladder is climbed. So . . Verify: . ✓

Exercise 2.2

Find Bézout coefficients for .

Recall Solution 2.2

Forward: Back-substitute from the -line. At each step (Picture A) the newest remainder is the one not originally or , so it is the one we replace by its higher recipe: Replace (climb one rung — swap out ): Replace (top rung reached — swap out ): So . Verify: . ✓

Exercise 2.3

Find Bézout coefficients for .

Recall Solution 2.3

Forward: Back-substitute from the -line. Why (Picture A): at each rung the equation already expresses using two remainders; we always replace the smaller, more-recently-created one by its recipe from the rung above, because that is the number still hiding the originals inside it. Each swap peels one layer off; after four swaps only and are left. (swap out ): (swap out ): (top rung — swap out ): So (writing ). Verify: . ✓

Exercise 2.4

Find Bézout coefficients for — the zero edge case.

Recall Solution 2.4

With there is nothing to divide by on the second slot; the Euclidean Algorithm stops immediately and reports (every integer divides , so the limiting divisor is itself). Bézout is then trivial: So (and may be any integer, since always). Verify: . ✓


Level 3 — Analysis

Now reason about why and about all the solutions, not just one. Keep Picture B open: solutions are integer dots on one straight line, spaced by .

Exercise 3.1

Using the seed from Exercise 2.1, write the general solution and find the solution with the smallest non-negative .

Recall Solution 3.1

The non-uniqueness rule from the parent note: if works, so does Why (Picture B): replacing by changes the value by exactly — the two shifts are equal and opposite, so you stay on the same line. And are the smallest whole steps that keep you on integer points, so this generates all integer solutions, evenly spaced. Here , , , : Smallest non-negative : need . Then . Verify: . ✓

Exercise 3.2

Explain, using the smallest-positive-combination idea, why has no integer solutions — and confirm with the gcd rule.

Recall Solution 3.2

Every value of is a multiple of , because and , so which is always even. But is odd, so it can never be reached. In parent-note language: the smallest positive combination is , and every reachable value is a multiple of . The number is simply not on that grid. Gcd rule check: solutions exist , which is false. No solutions. ✓


Level 4 — Synthesis

Combine Bézout with Modular Arithmetic and Linear Diophantine Equations.

Exercise 4.1

Find the multiplicative inverse of modulo (i.e. with ), and give the answer in the range .

Recall Solution 4.1

An inverse exists because (coprime). Solving gives , because vanishes mod . Forward: , , , . Back (Picture A): start where the gcd appears, then keep swapping each remainder for its recipe one rung up until only and survive. (swap out ): (top rung — swap out ): So . Reduce into range: . Inverse . Check: . ✓

Exercise 4.2

A machine dispenses only \9$16$1$**, and give one explicit combination.

Recall Solution 4.2

"Add or return" means coefficients may be negative — precisely a Bézout combination . Since , a total of \116 = 9\cdot 1 + 7\ 9 = 7\cdot 1 + 2\ 7 = 2\cdot 3 + 1\ 2=1\cdot2+01916remain. $$1 = 7 - 2\cdot 3$$2 = 9 - 72\quad 1 = 7 - 3(9-7) = 4\cdot 7 - 3\cdot 97 = 16 - 97\quad 1 = 4(16 - 9) - 3\cdot 9 = 4\cdot 16 - 7\cdot 99\cdot(-7) + 16\cdot 4 = 1$9$16-63 + 64 = 1$. ✓


Level 5 — Mastery

Build and prove something.

Exercise 5.1

Prove: if and , then . Use Bézout twice.

Recall Solution 5.1

Coprimality is equivalent to " is a Bézout combination". So there exist integers with Multiply the two equations: Expand the left side and group so one term is a multiple of and the rest a multiple of : Define the integers Both are integers (sums and products of integers), and we have produced By the Bézout characterisation of coprimality, the existence of integers with forces .

Exercise 5.2

The equation is a Diophantine equation. Decide whether it is solvable; if so, produce the full family of solutions and list the three with smallest .

Recall Solution 5.2

Solvable? , and (indeed ). ✓ Solvable. Seed via Bézout on the gcd: , so . Scale up by to hit : Full family (step by and ): Smallest : . At ; ; . The three smallest values are:

  • — check
  • — check
  • — check

Read the figure below alongside this solution. The solid teal line is ; every burnt-orange dot on it is an integer solution. Notice the dots are evenly spaced: from any dot, stepping across and down lands you exactly on the next dot — this is the step of Picture B, and it is why the family is . The dashed plum line is the lower gcd line ; its square seed dot is not on our target line. The dotted arrow shows the "" scaling that lifts the gcd-seed onto the line — the move you make whenever the right-hand side is a multiple of the gcd rather than the gcd itself.

Figure — Bézout's identity

Recall Quick self-test after finishing

Solvable-check for ? ::: solutions exist . How do you turn a gcd-seed into a -solution? ::: multiply the seed pair by . Step sizes in the general solution? ::: steps by , steps by . Why does stepping by keep the value fixed? ::: because , so the two changes cancel and you stay on the same line. Why does back-substitution end in ? ::: each swap trades a remainder for numbers from a higher rung, so you must eventually reach the top where only and remain. What is ? ::: , because every integer divides , so itself is the limiting divisor. Why does a modular inverse of exist mod ? ::: because lets you write , so .