We seek to solve the sytem of equations:

$\left\{ \begin{array}{cc} \bar 3x + \bar2y &= \bar1 \\ \bar 5x + \bar1y &= \bar4 \end{array} \right.$

In $\mathbb{Z}_{19}$

The following properties of modular arithmetic are assumed:

$a\equiv c \pmod n$ and $b \equiv d \pmod n$ imply that:

$a\cdot b \equiv c\cdot d \pmod n$ and $a+b \equiv c+d \pmod n$

We have a system of equations mod 19. We can then simply add and subtract integer multiples of one equation to another and this will not change the congruence relationships, as such by doing linear combinations we get:

$\left\{ \begin{array}{cc} \bar 3x + \bar2y &= \bar1 \\ \bar 5x + \bar1y &= \bar4 \end{array} \right.$ $\implies$ $\left\{ \begin{array}{cc} -\bar {2}x + \bar1y &= -\bar3 \\ \bar 5x + \bar1y &= \bar4 \end{array} \right.$ $\implies$ $\left\{ \begin{array}{cc} -\bar {2}x + \bar1y &= -\bar3 \\ \bar 1x + \bar3y &= -\bar2 \end{array} \right.$ $\implies$

$\left\{ \begin{array}{cc} \bar 1x + \bar3y &= -\bar2 \\ -\bar {2}x + \bar1y &= -\bar3 \end{array} \right.$ $\implies$ $\left\{ \begin{array}{cc} \bar 1x + \bar3y &= -\bar2 \\ \bar7y &= -\bar7 \end{array} \right.$ $\implies$ $\left\{ \begin{array}{cc} \bar 1x + \bar3y &= -\bar2 \\ \bar 1y &= -\bar1 \end{array} \right.$ $\implies$

$\left\{ \begin{array}{cc} \bar 1x &= \bar1 \\ \bar 1y &= -\bar1 \end{array} \right.$

And thus we know that:

$\bar1x=\bar1 \iff x = 19k+1$ for $k\in \mathbb{Z}$

$\bar 1y = -\bar1 \iff y = 19k' -1 \iff y = 19k'' + 18$ for $k',k'' \in \mathbb{Z}$

Are these all the possible solutions? Is this the correct approach?

  • 1
    $\begingroup$ It seems harder than it has to be. Remember $\mathbb{Z}_p$ is a field when $p$ is prime, so $5/3$ is actually a thing that you can multiply the first equation by. You just have to figure out what $1/3$ (i.e. the solution to $3x \equiv 1 \pmod {19}$) is. $\endgroup$
    – Ian
    Commented Feb 24, 2018 at 0:08
  • 2
    $\begingroup$ You know, you can simply run the usual method of elementary row operations. Over any field. $\endgroup$ Commented Feb 24, 2018 at 0:12
  • $\begingroup$ @Ian I cannot use properties of fields for this question $\endgroup$
    – Makogan
    Commented Feb 24, 2018 at 0:16
  • 1
    $\begingroup$ One nitpick: how do you justify $\bar 7 y = - \bar 7 \Rightarrow \bar 1 y = - \bar 1$? $\endgroup$ Commented Feb 24, 2018 at 0:27
  • 1
    $\begingroup$ More or less. Good job :-) $\endgroup$ Commented Feb 24, 2018 at 6:21

4 Answers 4


All your steps are correct.

You could have solved the system by elimination with less efforts.

For example $$ \left\{ \begin{array}{cc} \bar 3x + \bar2y &= \bar1 \\ \bar 5x + \bar1y &= \bar4 \end{array} \right.$$

$-2R2+R1\to R1\implies x= \overline 1$

And substitution the result in $R2$ gives $y= -\overline 1.$


Your derivation is correct, but it might be useful to ruminate on where it can "go wrong". In matrix form, the equation to be solved is $$\begin{bmatrix} 3&2 \\ 5&1 \end{bmatrix}\begin{bmatrix}x \\ y\end{bmatrix}=\begin{bmatrix}1 \\ 4\end{bmatrix}$$ Solving this linear equation via elementary operations amounts to calculating a Smith Normal Form: $$\begin{bmatrix}3&2\\5&1\end{bmatrix}=\begin{bmatrix}2&-1\\1&0\end{bmatrix}\begin{bmatrix}1&0\\0&-7\end{bmatrix}\begin{bmatrix}5&1\\-1&0\end{bmatrix}$$ Note that the left and right matrices in the normal form have determinant 1—they can be inverted without the use of any division. Using these inverses, we can recast the problem as $$\begin{bmatrix}1&0\\0&-7\end{bmatrix}\begin{bmatrix}x' \\ y'\end{bmatrix}=\begin{bmatrix}2&-1\\1&0\end{bmatrix}^{-1}\begin{bmatrix}1 \\ 4\end{bmatrix}=\begin{bmatrix}0&1\\-1&2\end{bmatrix}\begin{bmatrix}1 \\ 4\end{bmatrix}=\begin{bmatrix}4\\ 7\end{bmatrix}$$ with $$\begin{bmatrix}x \\y \end{bmatrix}=\begin{bmatrix}5&1\\-1&0\end{bmatrix}^{-1}\begin{bmatrix}x' \\y'\end{bmatrix}=\begin{bmatrix}0&-1\\1&5\end{bmatrix}\begin{bmatrix}x' \\y'\end{bmatrix}$$ So far, all of the manipulations done have been valid in any commutative ring with identity: $x$ and $y$ are uniquely determined in terms of the auxiliary variables $x'$ and $y'$, and $x'$ is uniquely determined to be $4$. The remaining equation for $y'$ is $$-7y'=7$$ i.e., $$7(y'+1)=0$$ Certainly $y'=-1$ is a solution in any commutative ring. It is the only solution if and only if $7$ is not a zero divisor in the ring. For $\mathbb{Z}/(n)$, this is the case iff $7$ and $n$ are coprime–if they aren't, then there can be several solutions in $\mathbb{Z}/(n)$, lifting to several families of solutions to the modular arithmetic problem in $\mathbb{Z}$.


There is no "the" correct approach. Your approach is "a" correct approach. I did notice that you could have done this...

$\left\{ \begin{array}{cc} \bar 3x + \bar2y &= \bar1 \\ \bar 5x + \bar1y &= \bar4 \end{array} \right.$ $\implies$ $\left\{ \begin{array}{cc} -\bar {2}x + \bar1y &= -\bar3 \\ \bar 5x + \bar1y &= \bar4 \end{array} \right. \implies \left\{ \begin{array}{cc} -\bar7x &= -\bar7 \\ \bar 5x + \bar1y &= \bar4 \end{array} \right.$


A simpler approach is to use elementary row operations.

Step 1: multiply the second equation by $2$.

Step 2: subtract the second equation from the first, eliminating $y$ and giving $-7x=-7$.

Step 3: $x=1$ is a solution to $-7x=-7$; you need to know $\mathbb{Z}_p$ is a field, or at least that $7$ and $19$ are coprime, to ensure that this is the only solution.

Step 4: Back-substitute, obtaining $5+y=4$.

Step 5: Conclude $y=-1$.

Step 6: Rewrite these as statements about integers instead of statements about residue classes.

You could do this by eliminating $x$ first instead, but then you would have some nontrivial divisions to do.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .