2
$\begingroup$

Alright, I am being asked to solve this problem:

Problem: For the vectors v = [0, one, one] and u = [one, one, one] over GF(2), find v + u and v + u + u.

I am stuck and I need some help. So what I assumed I need to do, is:

v = [0, one, one] = 0, 1, 1
u = [one, one, one] = 1, 1, 1

So:

v + u  = 
0,1,1
1,1,1   +
--------
1,0,0

Why? Because I am assuming that GF(2) is based on XOR. First question: is this correct?

Second:

v + u + u =
0,1,1
1,1,1
1,1,1  +
--------
?,?,?

I have no idea what to do. Is GF(2) the same as modulo 2 or should I also work with XOR here?

As you can see, I have just no clue what GF(2) essentially means / is and I can't use it correctly because of that.

Could someone help me with this please? I want to understand it.

  • 0
    First answer: yes, it is correct, and the second one is $\;(0,1,1)\;$ ,as you do arithmetic modulo $\;2\;$ (Google it if you want) .2017-02-12
  • 0
    DonAntonio, thanks for the reaction, but what I don't get is that I am NOT doing arithmetic modulo 2 in the first question (why?) and I am doing that in the second question (why?). So why does the meaning of GF(2) change per context?2017-02-12
  • 0
    You are doing arithmetic modulo $2$: addition looks just like XOR (or, to put another way, XOR *is* addition modulo $2$).2017-02-12
  • 0
    Okay, if that is the case, how can the second question have the answer of (0,1,1) in that case @DonAntonio? You would expect that 1+1+1 = 0 because it's XOR... what am I doing wrong in my thoughts?2017-02-12
  • 2
    Ah, I see. For addition modulo $2$, it's the binary XOR in the sense that it can only take two inputs at a time: so $1+1+1 = (1+1)+1 = 0 + 1 = 1$.2017-02-12
  • 0
    Ahhhhhh nice! So, because 0+1+1 = (0+1) + 1 = 1 + 1 = 0 and so on... Got it! Thanks a million! Now I understand it! You can put it as an answer and I'll accept it!2017-02-12

1 Answers 1

1

Addition modulo $2$ is the (possibly more) familiar XOR operation on bits; we have $1 + 1 = 0$, and $x + 0 = x = 0 + x$ for all $x \in GF(2)$.

However, there's something that may not be obvious when it comes to expressions like $x + y + z$.

For sums with more than two terms, by definition we must add one pair at a time; $x + y + z = (x + y) + z$, and this can be viewed as a sequence of binary (meaning, having two inputs) XOR operations if you like, where the exact parenthesization doesn't matter, since $+$ is associative. So for example, $1 + 1 + 1 = (1 + 1) + 1 = 0 + 1 = 1$ (and more generally, a sum is $1$ if and only if an odd number of inputs are $1$).

This might be a bit unusual, depending on how you think about XOR with more than two inputs (see for example this answer on EE.SE). Evidently some define this as a sequence of binary XOR operations, as we do here, while others output $1$ if and only if exactly one input is $1$. I hadn't given much thought to the latter viewpoint, and am not sure whether these differing views of multi-input XOR came up in practice, or in what fields one definition might be more common than the other.

So with only two inputs, addition modulo $2$ acts exactly as you'd expect, but you may need some (mental) recalibration with more than two inputs.

  • 1
    Thanks mate, I get the idea now!2017-02-12