If I have a finite field $F_p$, where $p$ is prime how can I define operations like $+, -, \times, / $? Can I just make: $$add: (a + b) \mod p$$ $$sub: (a-b) \mod p$$ $$mul: (a\times b) \mod p$$ $$div: (a/b) \mod p$$
-
Are you trying to construct a finite field? If you already have one then you already have the ring operations. – Bill Dubuque Jun 25 '14 at 17:57
-
with division you need to be careful. It requires inverses of the elements (so only non-zero element) – Anurag A Jun 25 '14 at 18:03
-
Can you be more specific? – Rop Jun 25 '14 at 18:04
-
@AnuragA I should inverte b? – Rop Jun 25 '14 at 18:04
2 Answers
Generally you do not define subtraction and division explicitly. Subtraction is addition with the additive inverse, ie. $a-b=a+(-b)$, where $-b$ is the additive inverse. In the same way, division is multiplication with the multiplicative inverse, such that $\frac{a}{b}=ab^{-1}$.
It is not possible to define division like you have done. For example, if you take $\mathbb{Z}_3$ and the elements $1$ and $2$, you would have $\frac{1}{2}\not\in\mathbb{Z}_3$.
How the specific compositions look, depend on the structure of the field and its elements. You can't even be sure, that the elements in the field are integers.
Division doesn't work that way. For example, we have $(2\cdot6\equiv1)\pmod{11}$, so $\dfrac 1 6$, i.e. $1$ divided by $6$, is $2$. How to divide modulo a prime number was the subject of one of my earlier answers: Calculating the Modular Multiplicative Inverse without all those strange looking symbols
For multiplication, suppose we observe that $2\equiv 24\pmod{11}$ and $3\equiv58\pmod{11}$. Does it follow that $(2\cdot3\equiv24\cdot58)\pmod{11}$? In fact that does follow, and it takes a bit of algebra to prove it. Similar things work with addition and subtraction, and with those it's easy to prove it. That makes addition, subtraction, and multiplication work as you conjectured.
Here's the proof for multiplication. We need to show that if $a\equiv a'$ and $b\equiv b'$, both mod $n$, then $ab\equiv a'b'$. We have $$ ab-a'b' = a\,\,\underbrace{(b-b')}+\underbrace{(a-a')}\,\,b. $$ Now observe that the two expressions over the $\underbrace{\text{underbraces}}$ are multiples of $n$, and then you've got it.