Modular arithmetic: Division

151 Views Asked by At

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$ ?

2

There are 2 best solutions below

1
On BEST ANSWER

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.

1
On

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$.