Solution of Linear Congruence/Examples/9 x = 8 mod 7

Example of Solution of Linear Congruence
Let $9 x = 8 \pmod 7$.

Then:
 * $x = 4 + 7 t$

where $t \in \Z$.

Proof
We have that:
 * $8 \equiv 1 \pmod 7$

and so:

That should simplify the arithmetic.

Then:

From Solution of Linear Diophantine Equation, the general solution to $(1)$ is:
 * $(2): \quad \forall t \in \Z: x = x_0 + 7 t, k = k_0 + 9 t$

where $x_0, k_0$ can be found as follows.

Using the Euclidean Algorithm:

Thus we have that:
 * $\gcd \set {9, -7} = 1$

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

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

Next we find a single solution to $9 x - 7 k = 1$.

Again with the Euclidean Algorithm:

and so:

is a solution.

Thus from $(2)$:
 * $x = 4 + 7 t$