How Does a Computer Add Two Numbers?
From bits to a working adder
Computers store numbers as patterns of 0s and 1s. Tiny switches combine those patterns one place at a time. Each place makes an answer digit and sometimes passes a carry to the next place.
A computer does not add the way a person does on paper, but the idea is close. It lines up numbers by place value, adds the rightmost place first, and carries when a place gets too large. The difference is that a computer uses only two symbols, 0 and 1. That makes every number a binary number inside the machine. The number 13, for example, can be stored as $1101_2$. Each digit is called a bit. A circuit adds bits using logic gates. These gates follow simple rules from Boolean logic, where every input is either off or on. A helpful review is the Binary cheat sheet or the Boolean Logic cheat sheet. When many tiny adders are chained together, a computer can add large numbers in a few steps.
Why 0s and 1s work
Binary is a place-value system with only two digits.
Logic gates are rules in hardware
A gate is a physical device that follows a Boolean rule.
The half-adder
XOR finds the sum bit, and AND finds the carry bit.
The full-adder
A full-adder is the basic building block for multi-bit addition.
Chaining adders together
Large additions are built from many small one-bit additions.
Vocabulary
- bit
- A single binary digit, either 0 or 1.
- binary
- A base-two number system that uses powers of two for place value.
- logic gate
- A circuit part that takes binary inputs and produces a binary output by following a rule.
- XOR
- A logic rule that outputs 1 when its two inputs are different.
- carry
- A value passed to the next place when a column adds up to two or more.
- full-adder
- A circuit that adds two input bits plus a carry in, then produces a sum bit and a carry out.
In the Classroom
Build a truth table
20 minutes | Grades 9-12
Students list all input pairs for A and B, then fill in the outputs for XOR and AND. They use those results to explain why the two gates form a half-adder.
Act out a ripple-carry adder
25 minutes | Grades 9-12
Give each student group one bit position in a binary addition problem. Each group computes its sum bit, then passes a carry card to the next group if needed.
Trace a full-adder schematic
30 minutes | Grades 10-12
Students follow the path of A, B, and carry in through two half-adders and an OR gate. They test several input cases and check that the final sum and carry out match binary addition.
Key Takeaways
- • Computers represent numbers with bits, which are 0s and 1s.
- • Binary uses powers of two for place value.
- • Logic gates turn simple Boolean rules into electrical behavior.
- • A half-adder adds two bits using XOR for the sum and AND for the carry.
- • A full-adder includes a carry in, so many adders can be chained for larger numbers.