ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Modulo 2 Arithmetic

Updated on May 22, 2011


These notes describe how to go about modulo 2 addition, subtraction and division.

Modulo 2 Arithmetic

Modulo 2 arithmetic is performed digit by digit on binary numbers. Each digit is considered independently from its neighbours. Numbers are not carried or borrowed.


Modulo 2 addition is performed using an exclusive OR (xor) operation on the corresponding binary digits of each operand. The following table describes the xor operation:

    A  B  A xor B
    0  0     0
    0  1     1
    1  0     1
    1  1     0

We can add two binary numbers, X and Y as follows:

    (X) 10110100
    (Y) 00101010 +
    (Z) 10011110


Modulo 2 subtraction provides the same results as addition. This can be illustrated by adding the numbers X and Z from the addition example.

    (X) 10110100
    (Z) 10011110 -
    (Y) 00101010

The addition example shows us that X + Y = Z so Y = Z - X.

However, the subtraction example shows us that Y = Z + X.

As neither Z nor X is zero, the addition and subtraction operators must behave in the same way.


Modulo 2 division can be performed in a manner similar to arithmetic long division. Subtract the denominator (the bottom number) from the leading parts of the enumerator (the top number). Proceed along the enumerator until its end is reached. Remember that we are using modulo 2 subtraction. For example, we can divide 100100111 by 10011 as follows:

             10001 remainder 100

This has the effect that X/Y = Y/X. For example:

             1 remainder 1011

             1 remainder 1011


  • A.S. Tanenbaum (1996). Computer Networks. Prentice Hall ISBN 0-13-394248-1. See section 3.2.2.


    0 of 8192 characters used
    Post Comment

    • profile image

      felixdolot3 7 years ago

      this is very helpful

    • profile image

      vick 7 years ago

      nice work, unrelated question though

      what is an inverse randomizer in cryptography

    • profile image

      Jesinth 6 years ago

      Thank You Booster911. Very Useful

    • profile image

      hassan 5 years ago


    • profile image

      arfname 5 years ago

      Thank you =)

    • profile image

      gul khan 5 years ago

      thanks mate. appreciated:))

    • profile image

      Ogi 4 years ago

      Addition is wrong!

      (X) 10110100

      (Y) 00101010 +

      (Z) 10011110 -wrong

      (Z) 11011110 -correct

    • Booster911 profile image

      Stewart Smith 4 years ago from UK


      Your example performs a Binary Addition. The example I give is of Modulo 2 Addition. As the article says, Modulo 2 Addition performs the XOR operation on each column, no carry is performed.

      I hope this helps.

    • profile image

      Goht 4 years ago

      Thanks! =D

    • profile image

      Alphonce 4 years ago


    • profile image

      Raj 3 years ago

      Thanks explained very well

    • profile image

      Debrah 2 years ago

      Your answer was just what I neeedd. It's made my day!

    • profile image

      Shim 2 years ago

      How about modulo 2 multiplication?

    Click to Rate This Article