Skip to content

The Half Adder

Adding two bits needs two answers. One of them is XOR and the other is AND, which means you have already built it.

  • Foundations

Add two bits together. There are only four sums to do, so do all of them:

Code
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10

Three of those fit in one bit. The last one does not.

1 + 1 is two, and two in binary is 10. It needs two bits: a 0 in the ones place and a 1 in the twos place. Exactly what happens on paper when a column overflows and you carry one.

The result has two output bits. The sum bit stays in the current column; the carry bit has twice its place value. Read the complete numeric result as SUM + 2 * CARRY. For 1 + 1, that is 0 + 2 × 1 = 2.

Two answers, two columns

Write those four sums as a table, with a column for each answer:

ABSUMCARRY
0000
0110
1010
1101
Read the bottom row as 1 + 1: sum 0, carry 1, which written out is binary 10.

Now look at those two columns and do not think about arithmetic for a moment. Think about where you have seen them.

0 1 1 0. That is XOR.

0 0 0 1. That is AND.

Not similar to them. Identical. The sum of two bits is A XOR B, and the carry is A AND B.

So the circuit is already built

If the two answers are XOR and AND, then adding two bits needs one XOR gate and one AND gate, both fed from the same pair of wires.

That is the whole thing:

A0B0XORANDSUM0CARRY0

Click an input to turn it on or off, and watch the wires.

A half adder: XOR gives the sum bit and AND gives the carry bit.
ABSUMCARRY
0000
0110
1010
1101
Set both inputs on. The sum goes dark and the carry lights: 1 + 1 is 0 carry 1.

Turn both inputs on and watch. The sum drops to 0 and the carry comes up. The circuit is doing arithmetic, and nothing in it knows that. It is two truth tables wired to the same inputs.

This is called a half adder, and it is the first machine most people ever understand completely.

Why only half

It has a gap. It produces a carry and it has nowhere to accept one.

That is fine for the rightmost column of a sum, where nothing has come before. It cannot handle every case in a higher column, because an incoming carry may need adding too. Add 3 and 1 in binary:

Code
  11
+ 01

The right-hand column gives sum 0, carry 1. The left-hand column now has three bits to add: its own two, plus the carry that arrived. A half adder has two inputs. It cannot take a third.

For A = 1 and B = 1, is a dark SUM output evidence that the answer is zero?

No. SUM is 0 but CARRY is 1. Together they represent binary 10, which is two. Reading only the sum bit discards part of the answer.

When it’s wrong, see why

  • Your sum is 1 when both inputs are 1. You have wired OR where you need XOR. They differ in exactly that row.
  • The carry never lights. Check the AND. It is the only gate that fires on the bottom row alone.
  • You expected one answer and got two. Two is correct. A single bit cannot hold the answer to 1 + 1, which is the reason a carry exists at all.

What you’ve learnt

  • Adding two bits gives two answers: a sum and a carry.
  • The sum column is XOR and the carry column is AND.
  • A half adder is those two gates on the same inputs.
  • It cannot accept a carry, only produce one, which is why it is half of something.

What’s next

In Unit 3 we give it the third input it is missing, and then chain the result together to add numbers of any size.