4

For example: Solving for $x$ and $y$ given the following linear congruences.

$x + 2y \equiv 3 \pmod9\,$, $3x + y \equiv 2 \pmod9$

So far, I've tried taking the difference of the two congruences.

Since $x + 2y \equiv 3 \pmod9 \Rightarrow x + 2y = 3 + 9k\,$, and $3x + y \equiv 2 \pmod9 \Rightarrow 3x + y = 2 + 9l$. $$(x + 2y = 3 + 9k) - (-3x + y = 2 + 9l) \Rightarrow -2x + y = 1 + 9(k - l)$$. So now, are you supposed to solve this like a normal linear Diophantine equation?

  • 3
    Both equations are mod 9. So this is not a case for the Chinese Remainder Theorem (you would need coprime moduli). – azimut Mar 03 '13 at 19:55
  • @TMM I've added my attempt. –  Mar 03 '13 at 20:04
  • How would you go about solving it without using the CRT? –  Mar 03 '13 at 20:07
  • I just don't see how to apply the CRT. So please: Give the statement of the CRT you are going to use and show me where you check the preconditions. – azimut Mar 03 '13 at 20:11

5 Answers5

4

$$x+2y\equiv3\pmod9$$ $$6x+12y\equiv18\pmod9$$ $$6x+3y\equiv0\pmod9$$

Adding this to the other equation

$$9x+4y\equiv2\pmod9$$ $$4y\equiv2\pmod9$$ $$28y\equiv14\pmod9$$ $$y\equiv5\pmod9$$

Plugging back in for $y$ in the first equation $$x+2(5)\equiv3\pmod9$$ $$x+1\equiv3\pmod9$$ $$x\equiv2\pmod9$$

Mike
  • 13,318
3

The CRT is used solve systems of congruences of the form $\rm x\equiv a_i\bmod m_{\,i}$ for distinct moduli $\rm m_{\,i}$; in our situation, there is only one variable and only one moduli, but different linear congruences, so this is not the sort of problem where CRT applies. Rather, this is linear algebra.

Instead, you are working with a $2\times2$ linear system over a given modulus, $9$. Here, the first two elementary methods of solving linear systems apply: substitution and elimination. The difference, however, is that we cannot generally divide by anything sharing divisors with $9$, i.e. multiples of $3$. And if, in your quest to eliminate variables, you multiply by things not coprime to the modulus, you can end up adding extraneous non-solutions, so it can be dangerous if you're not careful.

Let's use substitution. The congruences here are

$$\begin{cases}\rm x+2y\equiv 3 \mod 9, \\ \rm 3x+y\equiv2 \mod 9.\end{cases}$$

The first congruence gives $\rm x\equiv 3-2y$; plug this into the second to obtain

$$\rm 3x+y\equiv 3(3-2y)+y\equiv -5y\equiv2\mod 9.$$

Now $-5$ is coprime to $9$ so we can divide by it, i.e. multiply by its reciprocal mod $9$. In this case the reciprocal is $-5^{-1}\equiv-2\equiv7\bmod 9$, so the solution for $\rm y$ is $\rm y\equiv7\cdot2\equiv5\bmod 9$. To find $\rm x$, plug in $\rm y\equiv5$ into the congruences, obtaining $\rm x+10\equiv3$ and $\rm 3x+5\equiv2$. The first gives $\rm x\equiv2$, so that we have the unique solution $\rm (x,y)\equiv(2,5)$. However the second gives $\rm 3x\equiv-3\bmod9$, which, after dividing, gives $\rm x\equiv-1\equiv2\bmod3$ so that $\rm x\in\{2,5,7\}\bmod 9$; this doesn't change the fact that $(2,5)$ is the unique solution to the system, but it does illustrate that dividing by things that are not coprime to the modulus can introduce unwanted, fake solutions.

Note that matrix multiplication makes sense taken modulo an integer. The potential issues arise when we want inverses. If a matrix inverse $\rm A^{-1}$ exists of an integer-entry matrix $\rm A$, and every denominator appearing in the resulting rationals is coprime to the modulus (equivalently: $\rm\det A$ is coprime to the modulus), then $\rm A^{-1}$ can be reduced under the modulus (rationals like $\rm a/b$ become as $\rm ab^{-1}\bmod m$; this sort of thing is valid because there is a "ring homomorphism ${\bf Z}_{(p)}\to{\bf Z}/p{\bf Z}$"), and the result will be an inverse of $\rm A$ with respect to the modulus, i.e. $\rm A\, A^{-1}\equiv I\bmod m$. This is why bikenaga's answer works, using matrices, and it makes things quite easier when applicable.

anon
  • 151,657
  • Since the equations are defined over $\mathbb{Z}/9\mathbb{Z}$, which is not a field, this is not linear algebra, but module theory. – Álvaro Lozano-Robledo Mar 03 '13 at 20:54
  • Take it to be a figurative statement, if you please. I am not concerned with the purity of the term. Various linear algebra materials do cover "linear algebra" over ${\bf Z}/n{\bf Z}$ briefly in some generality, though it is perhaps better appropriated to commutative algebra in the end. – anon Mar 03 '13 at 21:01
  • AFAIK, the term 'linear algebra' is not used exclusively over fields. – azimut Mar 03 '13 at 21:48
2

Write the system in matrix form: $$\left[\matrix{1 & 2 \cr 3 & 1 \cr}\right] \left[\matrix{x \cr y \cr}\right] = \left[\matrix{3 \cr 2 \cr}\right].$$

Since $\det \left[\matrix{1 & 2 \cr 3 & 1 \cr}\right] = -5 = 4 \ne 0$, the matrix is invertible mod $9$; its inverse (using the standard formula for the inverse of a $2 \times 2$ matrix is $$\left[\matrix{7 & 4 \cr 6 & 7 \cr}\right].$$

So $$\left[\matrix{x \cr y \cr}\right] = \left[\matrix{7 & 4 \cr 6 & 7 \cr}\right] \left[\matrix{3 \cr 2 \cr}\right] = \left[\matrix{2 \cr 5 \cr}\right].$$

  • If the det = 0 does that mean the system is unsolvable? In a problem i'm doing I get x,y=0,0 but in this form the det = 0. Thanks – teddyt55 Feb 06 '14 at 01:08
1

Why not do it the easy way?

Since both equations involve the same modulus, this is no different from solving an ordinary pair of linear equations. As a previous poster noted, substitution is still a valid technique.

Since $3x + y ≡ 2 \pmod 9$, therefore y ≡ 2 - 3x \pmod 9.

Substituting into the other equation,

$$x + 2(2 - 3x) ≡ 3 \pmod 9$$

$$x + 4 - 6x ≡ 3 \pmod 9$$

$$4 - 5x ≡ 3 \pmod 9$$

$$5x - 4 ≡ -3 \pmod 9$$

$$5x ≡ 1 \pmod 9$$

$$5x ≡ 10 \pmod 9$$

$$x ≡ 2 \pmod 9$$

Substituting back into the previous equation used,

$$y ≡ 2 - 3(2) \pmod 9$$

$$y ≡ -4 \pmod 9$$ $$y ≡ 5 \pmod 9$$

Thus $$x ≡ 2, y ≡ 5 \pmod 9$$

PNT
  • 4,164
  • 2
    Welcome to Mathematics StackExchange. Please consider using MathJax to better format your answer, and make it more readable and searchable. – M. Vinay Jul 05 '16 at 03:32
1

Here's a method with only logical reasoning, and not the CRT.

Considering each equation modulo $3$, we get $x \equiv y \mod 3$ and $y \equiv 2 \mod 3$. So any solution must satisfy $x \equiv y \equiv 2 \mod 3$. But if $x \equiv 2 \mod 3$, then $3x \equiv 6 \mod 9$, so in the second equation we get $y \equiv 5 \mod 9$. Plugging this into the first equation, this leads to the only solution: $(x, y) \equiv (2, 5) \mod 9$.

TMM
  • 9,976