Binary 101: The Language of Computers

by Zvonimir Tomesic, CEO

Series: From Binary to Processors: A Deep Dive into Digital Logic

  • Binary 101: The Language Of Computers

  • Number Systems: Binary, Decimal, Octal, Hexadecimal (coming soon)

  • Boolean Algebra: The Foundation Of Digital Logic (coming soon)

  • Logic Gates: The Building Blocks Of Digital Logic (coming soon)

  • Error Correction In Digital Systems: Understanding Hamming Code And Beyond (coming soon)

  • Digital Arithmetic Circuits: From Basic Adders To Complex Chips (coming soon)

  • The Anatomy Of Processors: ALU, Clock, And Core Components (coming soon)

In the beginning

Imagine a time when the most groundbreaking invention was the wheel. This simple, circular object set the stage for the agricultural revolution, transforming societies from nomadic tribes to settled communities. As centuries rolled on, human ingenuity didn't stop there. The steam engine roared to life, heralding the industrial revolution and reshaping cities and economies. Then, the world was electrified, quite literally, as the discovery of electricity illuminated our homes and powered our industries.

Yet, as transformative as these inventions were, none could have predicted the revolution that a tiny piece of silicon would bring. Enter the era of transistors, the building blocks of modern electronics. These minuscule components, no larger than a grain of sand, paved the way for the digital age we live in today.

But before we dive deep into the complexities of modern computing, let's start with a concept as fundamental as the wheel was to transportation: binary.

Binary as a language

Every language has an alphabet, a set of symbols or characters used to construct words and sentences. In most languages, these symbols are letters. However, in binary, the entire alphabet consists of just two symbols: 1 and 0.

Binary is a base-2 number system, in contrast to the decimal system which is base-10. This means that while we count using numbers 0 through 9 in decimal, in binary, we only use 0 and 1.

When we want a computer to recognize a letter, we represent that letter in its binary form. For instance:

A => 01000001, a => 01100001
B => 01000010, b => 01100010
C => 01000011, c => 01100011

Similarly, numbers can also be represented in binary:

1 => 00000001
2 => 00000010
3 => 00000011

To visualize how computers interpret numbers, consider the number 13:

BinaryValueDecimal
111
020
144
188
0160
0320
0640
01280
Total13

Mathematically, this can be represented as:

00001101
=> 0*2^7
+ 0*2^6
+ 0*2^5
+ 0*2^4
+ 1*2^3
+ 1*2^2
+ 0*2^1
+ 1*2^0
= 13

Binary Aritmetics

With a foundational understanding of binary, we can delve into binary arithmetic operations.

Addition

Binary addition is quite straightforward, but it's essential to understand a few basic rules to handle the process correctly.

Basic Rules for Binary Addition:

  1. 0 + 0 = 0
  2. 1 + 0 = 1
  3. 0 + 1 = 1
  4. 1 + 1 = 0 (with a carry of 1)

For example, when adding 26 and 12:

26 => 00011010
12 => 00001100

38 => 00100110

Here's a step-by-step breakdown:

  1. Add the rightmost bits of 26 (0) and 12 (0). The result is 0.
  2. Move to the next column. Add 1 (from 26) and 0 (from 12). The result is 1.
  3. Continue this process for each column.
  4. When you reach the third column from the right, adding 1 (from 26) and 1 (from 12) results in 0 with a carry of 1 to the next column.
  5. The final result is 00100110, which is 38 in decimal.
First binary numberSecond binary numberSumCarry
0000
1010
0110
1101
1001
0010
0000
0000

Subtraction

In binary, subtraction is akin to addition. Computers perform subtraction using addition:

C = A – B

C = A + (-B)

For instance, for 30 - 15:

C = 30 - 15

A => 30 = 00011110
B => 15 = 00001111

(-B) => 11110000 + 1 = 11110001

C => 00011110 + 11110001 = 00001111
First binary numberSecond binary numberSumCarry
0110
1010
1010
1010
1101
0101
0101
0101

Multiplication

Binary multiplication is straightforward and mirrors the multiplication process in the decimal system. However, since we only have two digits in binary (0 and 1), the multiplication rules are much simpler.

Basic Rules for Binary Multiplication:

  1. 0 x 0 = 0
  2. 0 x 1 = 0
  3. 1 x 0 = 0
  4. 1 x 1 = 1

To better understand multiplication, let’s look at the example.

26 => 00011010
12 => 00001100

26 * 12 = 312
00011010 * 00001100 = 100111000

   00011010   (This is 26)
x  00001100   (This is 12)
____________
   00000000   (26 multiplied by 0)
  00011010    (26 multiplied by 0, shifted one position to the left)
 00011010     (26 multiplied by 1, shifted two positions to the left)
00000000      (26 multiplied by 0, shifted three positions to the left)
____________
  100111000   (Sum of all the products, which is 312 in decimal)

Here's a step-by-step breakdown:

  1. Multiply 26 (00011010) by the rightmost bit of 12 (0). The product is 00000000.
  2. Multiply 26 by the next bit of 12 (0) and shift the result one position to the left.
  3. Multiply 26 by the next bit of 12 (1) and shift the result two positions to the left. This gives 00011010.
  4. Multiply 26 by the leftmost bit of 12 (0) and shift the result three positions to the left.
  5. Sum all the individual products to get the final result: 100111000, which is 312 in decimal.
OperationBinaryDecimalDecimal Multi.
Multiplicand110102626
Multiplier011001212
Partial product0000012
Partial product000000040
Partial product110100010460
Partial product11010000208200
Final product100111000312312

Division

Binary division is similar to the long division method we learned in school, but with only two digits: 0 and 1. The process involves repeatedly subtracting the divisor from the dividend and keeping track of the quotient and remainder.

Basic Rules for Binary Subtraction:

  1. 0 - 0 = 0
  2. 1 - 0 = 1
  3. 1 - 1 = 0
  4. 0 - 1 requires borrowing. Just like in decimal subtraction where you'd borrow from the next column, in binary, you borrow a 1 making the current column 10. Thus, 10 - 1 = 1.

Example: Dividing 39 by 3 in Binary

dividend 39 => 00100111
divisor   3 => 00000011

   Quotient
   00001101
___________
00000011 | 00100111
          - 11
         _________
            011
          - 11
         _________
              0011
            - 11
         _________
                  0 (Remainder)

Here's a step-by-step breakdown:

  1. Subtract the divisor 11 from the first part of the dividend 1001. The result is 011.
  2. Bring down the next bit from the dividend, making it 0110.
  3. Subtract the divisor 11 again. The result is 0011.
  4. Bring down the final bit from the dividend, making it 0011.
  5. Subtract the divisor 11 one last time. The result is 0, which is our remainder.
  6. The quotient from this division is 00001101 or 13 in decimal.
OperationBinaryBinaryDecimal
Quotient0000110113
Divisor / Dividend00000011001001113 / 39
-000113
Subtraction result0000113
-0000113
Rest000000000

In the end

In our upcoming series, we'll delve deeper into the details of digital logic, exploring the gates that shape our digital decisions and the algorithms that drive our online experiences. We'll demystify the magic behind the screens (no pun intended), from the vast world of data structures to the real-time operations that keep our world ticking.

So, stay tuned. The digital age is vast, and our exploration has only just begun. Join us as we continue to unravel the marvels of the computing universe, one article at a time.

More articles

Number System: Binary, Decimal, Octal, Hexadecimal

Dive into the world of number systems, exploring the intricacies and practical applications of binary, decimal, octal, and hexadecimal conversions in computing and digital technology.

Read more

Linux Schedulers - Ensuring Optimal System Performance

Evolution and functionality of Linux schedulers, from simple round-robin to the Completely Fair Scheduler and real-time alternatives, emphasizing their critical role in balancing system responsiveness, fairness, and efficiency across various computing environments.

Read more

Tell us about your project

Our offices

  • Zagreb
    Bozidara Magovca 14
    10000, Zagreb, Croatia