Skill stop · How is this move done?

Linear Diophantine Equations (and Systems)

In the Chinese book: 一次不定方程(组)

ax+by=c hits lattice points iff gcd(a,b) | c, and then they are evenly spaced.

📖 §3.1 of 《整除、同余与不定方程》

Before this stop, visit:Greatest Common Divisor and Least Common Multiple (Skill)Perfect Squares (Concept)

WorkbenchDrag t to jump from one lattice point on the line to the next. With each jump, how much do x and y change?

Loading figure…

What this move does

The equation is a single equation with two unknowns, so its solutions are not pinned down: it is called a Diophantine equation, and we only want its integer solutions, that is, the lattice points on the line.

When there are solutions, let be one of them. Then all the solutions are

  1. Find . If , there are no integer solutions and you are done.
  2. Find a particular solution : with small numbers, by trying; with big ones, by running the Euclidean algorithm and working backwards.
  3. Write down the general solution, then use what the problem asks for (positive integers, a certain range) to decide which values can take.

Predict first

How many integer solutions does have?

Choose an answer first; then you can see the result.

Work through one

Example: find all positive integer solutions of 4x + 7y = 53

Step 1 / 5
Loading figure…
  1. First ask whether there are solutions

    , and divides every number. There are solutions.

When you can't find a particular solution by trying

When the coefficients are big, let the Euclidean algorithm find one for you. First solve , then scale the whole solution up by .

Loading figure…
Cut all the way down. The last line of the “Work backwards” column gives . So one particular solution of is .

Systems: eliminate first

With three unknowns and two equations, eliminate one unknown first and you are back in the situation above.

Example (the “Hundred Fowls Problem”, from the ancient Chinese Zhang Qiujian Suanjing) A rooster costs coins, a hen costs coins, and chicks cost coin. With coins you buy birds. How many of each do you buy?

Let there be roosters, hens and chicks: and . Multiply the second equation by and subtract the first to eliminate :

A particular solution is , the general solution is , , and then . For none of the three to be negative, :

When it fails

Break it

Counterexample lab: remove one condition

Conclusion: has integer solutions

: and . There is a lattice point on the line every .

Loading figure…

Practice

Exercise 1Basic

How many positive integer solutions does have?

Exercise 2Basic

has integer solutions, and . What can be?

Exercise 3Advanced

Write as “a positive multiple of ” plus “a positive multiple of ”: with , positive integers. Find .

Exercise 4Challenge

There are only -cent and -cent stamps (as many of each as you like). What is the largest postage, in cents, that cannot be made?

Mistake Museum · Exhibits from this stop

Before you leave, look at the traps other people fell into here.See every exhibit in the museum →

Exhibit

Forgetting to divide the step of the general solution by the gcd

The wrong step: has the particular solution , so the general solution is .
What went wrong? Think first, then open

Diagnosis Everything this gives really is a solution, but it misses two thirds of them: is also a solution (), and it is not on the list. Neighboring solutions differ by only , not .

The right step: The step is with : .

“Take the smallest possible step”

Exhibit

Making x and y both increase in the general solution

The wrong step: has the particular solution , so the general solution is .
What went wrong? Think first, then open

Diagnosis Put in : . Increasing makes the left side bigger, so has to decrease to make up for it.

The right step: . The change is : one goes up and one goes down, so they cancel. When you have written it down, check it with one value of .

“One goes up, the other goes down”