2

I have the following equation:

$2x = -2y$, where coefficients are from $\Bbb Z_7$

Could you tell me please, whether I am allowed to simplify the equation this way: $x = -y \rightarrow x = 6y$ ?

Ina
  • 523

2 Answers2

3

In this case, yes. This is because $2\cdot 4=1\pmod7,$ so multiplying both sides of $2x=-2y$ by $4,$ we have $x=-y\pmod7,$ and so $x=6y\pmod7,$ since $6=-1\pmod7.$

More generally, given two integers $m,n$ such that $\gcd(m,n)=1,$ we know that $m$ has a multiplicative inverse, modulo $n$, meaning there is an integer $k$ such that $km=1\pmod n.$ The upshot is that once we've found $k,$ we can rewrite any equation of the form $mx=a\pmod n$ as $x=ka\pmod n.$ Unless $\gcd(m,n)=1,$ though, we cannot "divide by" $m$ modulo $n.$

To actually find such a $k$, we can use the extended Euclidean algorithm, or a slick version of it that robjohn likes, called the Euclid-Wallis algorithm.

Cameron Buie
  • 105,149
  • 1
    +1 because you were first. I think a mention that the inverse exists since $\gcd(7,2)=1$ would be useful, too. – robjohn Nov 26 '13 at 21:35
1

Since $\gcd(7,2)=1$, you can divide by $2$ mod $7$. In fact, $1/2\equiv4\pmod{7}$; more precisely $1\equiv2\cdot4\pmod{7}$. Thus, cancelling the $2$ is valid mod $7$.

robjohn
  • 353,833
  • I was going to delete my answer since Cameron Buie answered first, but I'll leave it since I did mention the gcd :-) – robjohn Nov 26 '13 at 21:32