Linear Diophantine Equation/Examples/2x + 3y = 4

Example of Linear Diophantine Equation
The linear diophantine equation:
 * $2 x + 3 y = 4$

has the general solution:
 * $x = -4 + 3 t, y = 4 - 2 t$

Proof
We have that:
 * $\gcd \set {2, 3} = 1 \divides 4$

so, from Solution of Linear Diophantine Equation, a solution exists.

First we solve $2 x + 3 y = 1$:


 * $1 = 1 \times 3 - 1 \times 2$

So $y_0 = 1, x_0 = -1$ is a solution.

Then:
 * $2 w_0 + 3 z_0 = 1 \implies z_0 = 1, w_0 = -1$

We have:
 * $4 = 4 \times 1$

so:
 * $2 \times 4 w_0 + 3 \times 4 z_0 = 4$

So:
 * $x_0 = 4 w_0 = -4$
 * $y_0 - 4 z_0 = 4$

Thus:
 * $x = -4 + t \paren {3 / 1} + 4 - t \paren {2 / 1} = y$

So all solutions given by:
 * $x = -4 + 3 t, y = 4 - 2 t$