How to remember n modulo m operations better?

86 Views Asked by At

In Linear Algebra, we need to solve linear equation systems in fields $\mathbb{Z}_n$. As an example: In the field $\mathbb{Z}_6:2 \odot 3\equiv 2\cdot3\mod6\equiv 0$ My question is now, how can I remember them more easily? Is there a structure that you can follow in order to solve $n \mod m$ for positive and negative integers?

1

There are 1 best solutions below

0
On BEST ANSWER

$\mathbb{Z}_6$ is not a field. It is a ring. $\mathbb{Z}_p$ is a field iff $p$ is prime.

Note, that $\mathbb{Z}_6$ contains 'zero divisors'. It is $2,3\neq 0$ but $2\cdot 3=6=0\mod 6$

If you have such a field $\mathbb{Z}_p$ given, there is not much different from other fields, you know by heart, like $\mathbb{R}$. Everything works the same. You just have to slightly adapt.

For example:

How do you solve a linear equation in $\mathbb{R}$ and in $\mathbb{Z}_p$.

If you have this equation given:

$2x=3$ and you have to solve for $x$, then it is pretty easy in $\mathbb{R}$. You just multiply by $\frac12=2^{-1}$ and get $x=\frac32$.

When you have the same equation in $\mathbb{Z}_7$ (where I take the prime number 7 for the example), it works the same, but it is not obvious, what $2^{-1}\in\mathbb{Z}_7$ is. But we know it exists, because $2\neq 0\in\mathbb{Z}_7$, so there is an inverse, we just have to find it.

For that you might ask: For which $a\in\mathbb{Z}_7$ holds $a\cdot 2=1$

And you can just go by brute force, since the field is finite (has 7 elements)

$1\cdot 2=2\mod 7$

$2\cdot 2=4\mod 7$

$3\cdot 2=6\mod 7$

$4\cdot 2=8=1\mod 7$

So we found the inverse of $2$. It is $4=2^{-1}$

So $2x=3\Leftrightarrow 4\cdot 2x=4\dot 3\Leftrightarrow 8x=12\Leftrightarrow x=5$

Note also, how we reduce the 'numbers' here. I write 'numbers' because it are not actuall numbers. We are working with the remainder clases you get when you divide an integer by 7, which are $0,1,2,3,4,5,6$

And it is for example $\dotso=-14=-7=0=7=14=\dotso$

or $\dotso=-3=4=11=\dotso$

Note here, that you just have to add $7$. This might be the easiest (and dumbest) way, so find these equalities.

So all you have to remember, is

1) $\mathbb{Z}_n$ is a field if and only if $n$ happens to be a prime number

2) The elements of $\mathbb{Z}_n$ are the numbers which can occur by the integer division with n, which are $0,1,2,\dotso, n-1$

And when you work with them, there is not much that can really happen. In your example, you can write $2\cdot 3=6$ which is completely fine, but one might want to reduce that to $0$. (It is the same thing!)

So you can just add and multiply like always and after that you subtract $n$ as often as possible, until you get the smallest nonnegative number.