How Computers Calculate with Electricity : Binary Numbers and the Logic of 0s and 1s
Last time, I described the computer as a giant calculator that works by electricity—converting everything into numbers and then processing them. But you might wonder: how exactly does electricity perform calculations?
Computers Are Just Switches
At the most basic level, a computer is a massive collection of switches. When electricity flows, it’s considered ON (1). When it doesn’t, it’s OFF (0). By arranging long patterns of these 0s and 1s, the computer can represent all information. This sequence of 0s and 1s is called a binary number.
For example, the sequence 1001001 is just electricity turning on and off in a specific pattern.
Photo by torstensimon on Pexels |
From Decimal to Binary
We normally use decimal numbers (0–9). Computers, however, only use 0 and 1, so all information is ultimately stored and calculated in binary.
To make things easier for humans, programs often display numbers in octal (base-8) or hexadecimal (base-16). For instance, the hex digit F is just a shorthand for the binary value 1111.
Each digit in binary is called a bit.
-
1 bit = either 0 or 1
-
8 bits = 1 byte, which can represent 256 values (00000000 to 11111111)
-
32 bits = 4 bytes, 64 bits = 8 bytes, allowing far more states.
Modern CPUs typically process data in 32-bit or 64-bit chunks, meaning the more bits handled at once, the faster and more powerful the processing.
Converting Between Binary and Decimal
Binary works in powers of two. For example:
1011₂ = (1×2³) + (0×2²) + (1×2¹) + (1×2⁰) = 8 + 0 + 2 + 1 = 11 in decimal.
To go the other way, divide a decimal number repeatedly by 2, then read the remainders backwards to get its binary form.
Basic Binary Operations
-
Addition:
-
0+0 = 0
-
0+1 = 1
-
1+1 = 10 (with a carry)
-
-
Subtraction:
-
0–1 would be negative, so computers use a system called two’s complement.
-
-
Logic operations:
-
AND → 1 only if both inputs are 1
-
OR → 1 if either input is 1
-
XOR → 1 only if the two inputs are different
-
Multiplication and division are usually built by repeating addition, subtraction, and shifts.
Example: Storing “아이폰17” in Binary
Every character we type is stored as numbers. Let’s look at the word “아이폰17”:
Character | Decimal (Unicode) | Hex | Binary |
---|---|---|---|
아 | 50500 | C544 | 1100010101000100 |
이 | 51060 | C774 | 1100011101110100 |
폰 | 54256 | D3F0 | 1101001111110000 |
1 | 49 | 31 | 00110001 |
7 | 55 | 37 | 00110111 |
So even though we see “아이폰17” on the screen, the computer is really storing it as long strings of 0s and 1s.
The Big Picture
When we say computers “calculate with electricity,” it comes down to a simple cycle:
-
Check if electricity is flowing (1) or not (0).
-
Represent that as binary numbers.
-
Perform binary operations.
-
Convert the results back into letters, numbers, images, or sounds we can understand.
Everything we see on screen, the music we hear, or the programs we run are the result of countless 0s and 1s switching on and off at lightning speed.
Wrapping Up
Now you know the simple principle behind how computers calculate using electricity. Though the inner workings look complicated, at the core it’s all just combinations of 0s and 1s.
From the next post on, I’ll stop repeating “works by electricity” and instead just say “binary.”
Thanks for reading, and see you in the next article!
You can view the original Korean blog post at the link below
Comments
Post a Comment