Binary Arithmetic

Binary arithmetic is the foundation of modern digital computing. Since electronic circuits (transistors) are most naturally operated in two states—on or off—computers represent all data and perform all calculations using the base-2 (binary) system.

1. Binary Addition

Binary addition follows the same positional logic as decimal addition, but with only two possible digits: 0 and 1.

The four basic rules are:

Example: 5 + 3

  111  (carries)
   101 (5)
+  011 (3)
------
  1000 (8)

2. Binary Subtraction (Two's Complement)

While subtraction can be performed directly, modern computers use Two's Complement to represent negative numbers. This allows the CPU to perform subtraction using the same hardware circuits as addition.

How to find the Two's Complement of a number:

  1. Invert all the bits (0 becomes 1, 1 becomes 0).
  2. Add 1 to the result.

Example: 5 - 3 (using 4-bit representation)

3. Bitwise Operations

Bitwise operations are used to manipulate individual bits within a word. They are extremely fast and essential for low-level programming (drivers, graphics, cryptography).

Logical Operators

Shift Operators

See Also