Solving Linear Diophantine Equations

April 12, 2026

Problem

Find integer solutions to 7x + 11y = 1 using the extended Euclidean algorithm. Show lattice points.

Explanation

What is a Diophantine equation?

A Diophantine equation requires integer solutions only. The linear Diophantine equation ax+by=cax + by = c has integer solutions if and only if gcd(a,b)\gcd(a, b) divides cc.

Step-by-step: Solve 7x+11y=17x + 11y = 1

Step 1 — Check solvability. gcd(7,11)=1\gcd(7, 11) = 1, and 11 divides 11. ✓ Solutions exist.

Step 2 — Use the Extended Euclidean Algorithm to express gcd(7,11)=1\gcd(7, 11) = 1 as a combination of 7 and 11.

Run the Euclidean algorithm backward:

11=7×1+411 = 7 \times 1 + 44=117×14 = 11 - 7 \times 1

7=4×1+37 = 4 \times 1 + 33=74×1=7(117)=2×7113 = 7 - 4 \times 1 = 7 - (11 - 7) = 2 \times 7 - 11

4=3×1+14 = 3 \times 1 + 11=43=(117)(2×711)=2×113×71 = 4 - 3 = (11 - 7) - (2 \times 7 - 11) = 2 \times 11 - 3 \times 7

So 1=(3)×7+2×111 = (-3) \times 7 + 2 \times 11, giving 7(3)+11(2)=17(-3) + 11(2) = 1.

One particular solution: x0=3x_0 = -3, y0=2y_0 = 2.

Check: 7(3)+11(2)=21+22=17(-3) + 11(2) = -21 + 22 = 1

Step 3 — Write the general solution. All integer solutions are:

x=3+11t,y=27t(tZ)x = -3 + 11t, \quad y = 2 - 7t \quad (t \in \mathbb{Z})

For t=0t = 0: (x,y)=(3,2)(x, y) = (-3, 2). For t=1t = 1: (8,5)(8, -5). For t=1t = -1: (14,9)(-14, 9).

Check t=1t = 1: 7(8)+11(5)=5655=17(8) + 11(-5) = 56 - 55 = 1

Why the general solution has that form

If (x0,y0)(x_0, y_0) is one solution, then (x0+b/dt,  y0a/dt)(x_0 + b/d \cdot t, \; y_0 - a/d \cdot t) gives all solutions, where d=gcd(a,b)d = \gcd(a, b). The shifts b/db/d and a/d-a/d ensure the equation stays balanced.

When there are no solutions

6x+4y=56x + 4y = 5: gcd(6,4)=2\gcd(6, 4) = 2, and 2 does not divide 5. No solutions exist — the left side is always even, but 5 is odd.

Try it in the visualization

Enter aa, bb, cc. The lattice shows integer points (x,y)(x, y). The line ax+by=cax + by = c is drawn — solutions are the lattice points ON the line. The extended Euclidean algorithm steps are animated.

Interactive Visualization

Parameters

7.00
11.00
1.00
3.00
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day
Solving Linear Diophantine Equations | MathSpin