# Inverse/Division in finite field?

Think of multiplictavie group of finite field F[p,n], where p is a prime number and n is a positive integer. The whole elements of F[p,n] can be represented as
p^n-p^(n-1) positive integers in the following list :

{1,2,...,p-1,
p+1,p+2,..,2p-1,
2p+1,2p+2,...,3p-1,
...
p^n-p+1,p^n-p+2,...,p^n-1}

One can define addition,subtraction,multiplication easily :
Mod[a+b,p^n],Mod[a-b,p^n],Mod[a*b,p^n]. (addition and subtraction are not closed.. if they are divisible by p)

For Inverse a^-1 and division a/b, currently I am using
Mod[ExtendedGCD[a,p^n][[2,1]],p^n],
Mod[a*ExtendedGCD[b,p^n][[2,1]],p^n].

For example 7/3 (mod 11) is 6, since 7 = 3*6 (mod 11)

In Mod[7*ExtendedGCD[3,11][[2,1]],11]
Out 6


What do you use for inverse or division ?

• Hmm...I don't think what you have is a finite field. A finite field is something that's an abelian group under addition whose nonzero elements form an abelian group under multiplication. But for example, $p$ here doesn't have a multiplicative inverse, yet it would necessarily be part of your finite field (as it can be written as an addition of elements you have, $1 + (p - 1)$). I think what you have is the ring $\mathbb{Z}/p^n\mathbb{Z}$, which for $n > 1$ is not a field. Sep 20 at 23:56
• Mod[7 * ModularInverse[3, 11], 11] Sep 20 at 23:58
• I think you'd be interested in the Finite Fields Package which is included with Mathematica; the finite field $\mathbb{F}_{p^n}$ can be obtained via GF[p, n]. Sep 21 at 0:00
• (Also, I should have made it clear: fields must be closed under addition, as they must be an abelian group under addition. If it's not, it's not a field. but might still be interesting! :) ) Sep 21 at 0:05
• Thank you, what I wantd is ModularInverse, and apologize for my math knowledge! Sep 22 at 2:36