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$

which is (trivially) a divisor of $4$.

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

First we find a single solution to $2 x + 3 y = 4$:

and so:

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

From Solution of Linear Diophantine Equation, the general solution is then:


 * $\forall t \in \Z: x = x_0 + \dfrac b d t, y = y_0 - \dfrac a d t$

where $d = \gcd \set {a, b}$.

In this case:

giving: