Operations with binary numbers

The binary system It is made up of two digits or elements 0 and 1. It is also known as base system 2, since they use powers of two to represent the numbers. Example:

1101 → 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20

In decimal form it would be expressed:

8 + 4 + 1 = 13 = 1101

In the binary system 1101 represents 13 in the decimal system.

Sum of binary numbers

We must follow the following rules:

0 + 0 = 0

0 + 1 = 1

1 + 0 = 1

1 + 1 = 10

Example:

add binary numbers

  • We start from right to left, add 1 + 1 = 10, put 0 and bring 1 (red).
  • In the next column we add 1 (red) + 0 = 1 and 1 + 1 = 10, we put zero and we take 1 (red) ,.
  • Third column 1 (red) + 1 = 10 and 10 + 0 = 10, we put the 0 and take 1 (red).
  • Fourth column 1 (red) + 1 = 10 and 10 + 1 = 11, we put 1 and take 1 (red).
  • Fifth column 1 (red) + 1 = 10 and 10 + 0 = 10, we put 0 and take 1 (red).
  • Sixth column, 1 (red) + 0 = 1 and 1 + 1 = 10, we put 0 and take 1 (red).
  • Seventh column, 1 (red) + 0 = 1 and 1 + 1 = 10, we finally put 10.

Subtraction of binary numbers

The subtraction has the following rules:

0 - 0 = 0

1 - 0 = 1

1 - 1 = 0

0 - 1 = 1 takes 1

Example:

subtract binary numbers

  • We start from right to left, we subtract 1 - 0 = 1 we put 1.
  • Next column 1 - 1 = 0 we place 0.
  • Third column 0 - 1 = 1 but let's take 1 (red) to the next column, we put 1.
  • Fourth column 1 (red) - 0 = 1, but we take 1 (red) to the next column, 1 - 1 = 0 we put 0.
  • Fifth column 1 (red) - 0 = 1 we take 1 (red) for the next column, 1 - 1 = 0 we put 0.
  • Sixth column 1 (red) - 1 = 0 and 0 - 0 = 0, we put 0.
  • Seventh column 1 - 0 = 1 we put 1.
  • Eighth column 0 - 0 = 0 we put 0.
  • Ninth column 0 - 0 = 0 we finally put 0.

Multiplication of binary numbers

Binary multiplication is obtained in the same way as decimal multiplication.

Example:

multiplication binary numbers

Division of binary numbers

The division of binary numbers has the same procedure of the decimal system that we know.

Example:

division binary numbers