0

I don't know much about Galois fields. My question is the following Assume we are working with GF(8). Let say for example I want to multiply 2 by 4 in GF(8).

Then it should be equal to $2*4 \text{ mod 8}=0$, is this correct?

Boby
  • 5,985
  • 1
    No, it is not correct. $4$ and $2$ are not elements of $GF(8)$ in a very natural way, and the multiplication is not that of integers modulo $8$. See this Q&A pair for some examples. Other examples on the site abound. – Jyrki Lahtonen Jul 24 '14 at 14:39
  • 1
    Multiplication in GF(8) is not the same as in $\mathbb{Z}_8,;$ see e.g. http://en.wikipedia.org/wiki/Finite_field#F8_2 – gammatester Jul 24 '14 at 14:40
  • 1
    Some people (programmers?) cherish an internal presentation of polynomials in $\Bbb{F}_2[x]$ as strings of bits, and try to interpret those bit-fields as integers. This is all fine for writing elements of $GF(2^n)$ compactly (I do it that way in my programs as well!). But, it comes with the cost. Namely it hides the fact that addition in $GF(2^n)$ is the bitwise XOR of those bitfields, and multiplication should be done as polynomials modulo the defining polynomial. – Jyrki Lahtonen Jul 24 '14 at 14:42
  • See examples in http://www.doc.ic.ac.uk/~mrh/330tutor/ch04s02.html. – Martín-Blas Pérez Pinilla Jul 24 '14 at 14:42
  • 1
    Jyrki: I would argue that $4$ and $2$ are elements of $GF(8)$ in a very natural way, and specifically they are both the element $0$. –  Jul 24 '14 at 14:44
  • 1
    @Hurkyl: In that sense, yes. I am more worried about unsuspecting programming students taking the identification of the coset $x+\langle p(x)\rangle\in\Bbb{F}_2[x]/\langle p(x)\rangle$ with the integer $2$ way too seriously. The mapping $q(x)\mapsto q(2)$ for polynomials $q\in\Bbb{F}_2[x]$ is not without merit, but it does lead to several misunderstandings such as the one witnessed here. I've seen (more than) my share, trust me. – Jyrki Lahtonen Jul 24 '14 at 15:15

4 Answers4

3

I guess you are possibly making the common mistake assuming the Galois fields $\operatorname{GF}(n)$ are the quotient rings $\mathbf{Z}/n\mathbf{Z}$, they aren't! (There are several questions on this site you can find explaining what they actually are in more detail).

In fact the Galois field $\operatorname{GF}(8)$ can be explicitly constructed as $$ (\mathbf{Z}/2\mathbf{Z})[T]/(T^3 + T + 1). $$ Here $2 = 1 + 1 =0$ and so $4 = 1 + 1 + 1 +1 = 0$ too and so their product is also $0$.

Alex J Best
  • 4,578
  • 1
  • 18
  • 35
  • 1
    It is true that $1+1=0$ and that this is what 2 should denote. However, as Jyrki Lahtonen correctly points out in the comments to the question, many people (in computer science especially) use 2 to to denote the class of $T$ (and 4 to denote the class of $T^2$) in $GF(8)$. This is probably what user63050 meant, and it is the cause of much confusion. Another thing, of course, is that the irreductible polynomial is not unique, and multiplication in $GF(8)$ can only be computed if we know which one was chosen. – Gro-Tsen Jul 24 '14 at 16:19
  • @Gro-Tsen I accept that that could have been the issue here but assumed from the fact that the user referred to mod 8 in the question that they were thinking of modular arithmetic and wrote an answer based on that (also their previous questions are pretty mathematical). In any case having two slightly different answers is not an issue is it? I can compute the product of $0$ and $0$ no matter what polynomial you give me :). – Alex J Best Jul 24 '14 at 16:26
2

GF(8), the field with 8 elements is definitely not $\mathbb{Z}_8$. One way to realize GF(8) is as $\mathbb{Z}_2[\alpha]$ where $\alpha$ satisfies the relation $\alpha^3=\alpha+1$ (all arithmetic is done mod 2. Equivalently GF(8) may be thought of as $\mathbb{Z}_2[x]/<x^3+x+1>$ (quotient ring). In the first realization we would have GF(8)$=\{p+q\alpha+r\alpha^2\mid p,q,r\in\mathbb{Z}_2\}$.

Then for instance we would have $(1+\alpha)(1+\alpha+\alpha^2)=1+\alpha+\alpha^2+\alpha+\alpha^2+\alpha^3=1+\alpha^3=1+1+\alpha=\alpha$. [In this calculation, $\alpha+\alpha=0$ because our coefficients are in $\mathbb{Z}_2$; and also $\alpha^3$ may be replaced by $\alpha+1$.

paw88789
  • 40,402
2

Most typically we have $GF(8)=\Bbb{F}_2[x]/\langle x^3+x+1\rangle$, and we use shorthand notation $q(2)$ for the element $q(x)+\langle x^3+x+1\rangle$. For that to work we first interpret the coefficients of $q$ from $\Bbb{F}_2=\{\overline{0},\overline{1}\}$ as integers $0,1$, and then we can evaluate $q(2)$ as an integer.

Let us denote $\alpha=x+\langle x^3+x+1\rangle$. Then the above identifications lead to $"2"=\alpha$ (with $q(x)=x$ we have $q(2)=2$) and $"4"=\alpha^2$ (coming from $q(x)=x^2$). Because $\alpha^3+\alpha+1=0$ we get that in $GF(8)$ $$ "4"\cdot"2"=\alpha^2\cdot\alpha=\alpha^3=\alpha^3+^(\alpha^3+\alpha+1)=\alpha+1="2+1"="3", $$ because $\alpha^3+\alpha^3=2\alpha^3=0$, as the polynomial $2x^3$ is the zero polynomial in $\Bbb{F}_2[x]$. In that ring the coefficients are reduced modulo two.

The full list of elements of $GF(8)$ is thus $$ \begin{aligned} "0"&=0\\ "1"&=1\\ "2"&=\alpha\\ "3"&=1+\alpha\\ "4"&=\alpha^2\\ "5"&=1+\alpha^2\\ "6"&=\alpha+\alpha^2\\ "7"&=1+\alpha+\alpha^2 \end{aligned} $$


TL;DR; with educated guessing in place in $GF(8)$ we have $$4\cdot2=3.$$

Jyrki Lahtonen
  • 133,153
1

You can interprete that as a multiplication in the prime field $\mathbb{Z}/2\mathbb{Z}$, via the canonic monomorphism $\mathbb{Z}/2\mathbb{Z} \rightarrow \operatorname{GF}(8)$, so you're actually calculating modulo 2. Already $4$, $2$ and $0$ denote the same element in GF(8) in the mentioned way.

Maybe I should explain this a little more detailed.

We define $f: \mathbb{Z} \rightarrow \operatorname{GF}(8)$ as the ring homomorphism which sends the $1$ in $\mathbb{Z}$ to the $1$ in $\operatorname{GF}(8)$. Regard the characteristic of the Galois Field $\operatorname{GF}(8)$ now.

It is $\operatorname{Char} \operatorname{GF}(8) = 2$, such that f has the Kernel $2\mathbb{Z}$ and hence with the homomorphism theorem we know that $\operatorname{im} f \cong \mathbb{Z}/2\mathbb{Z}$ is our prime field.

That means $4$, $2$ and $0$ identify the same element in GF(8) through the homomorphism f and therefore all are $0$.

Celsius
  • 208