Binary and addition

Half Adder: Truth Table and What Each Input Does

A half adder adds two one-bit inputs, A and B, and outputs a sum S and a carry C. S is A XOR B and C is A AND B. With C on the left and S on the right, they form the two-bit binary result.

The four inputs, one by one

A and B can each be 0 or 1, so there are four possible inputs.

  • A=0, B=0: nothing to add, S=0, C=0, result 00₂.
  • A=0, B=1: one unit, which stays in this column, S=1, C=0, result 01₂.
  • A=1, B=0: also one unit, S=1, C=0, result 01₂.
  • A=1, B=1: two units make a pair, nothing stays, S=0, and C=1 goes to the next column up, result 10₂.
Half adder truth table: S is the sum, C is the carry
ABSC
0000
0110
1010
1101

What XOR and AND each do

XOR outputs 1 when exactly one input is 1, which answers whether one unit is left in this column. AND outputs 1 only when both inputs are 1, which answers whether a pair formed and must be carried.

So XOR gives S and AND gives C. The two outputs have different place values, so they can't be added together as the same kind of unit.

A = 0, B = 0

Sum: S = 0

Carry: C = 0

0 + 0 = 0₂

A = 0, B = 1

Sum: S = 1

Carry: C = 0

0 + 1 = 1₂

A = 1, B = 0

Sum: S = 1

Carry: C = 0

1 + 0 = 1₂

A = 1, B = 1

Sum: S = 0

Carry: C = 1

1 + 1 = 10₂

In input order 00, 01, 10, 11: C is 0 for the first three, and S is 1 for 01 and 10. For 11, S becomes 0 and C becomes 1.

Checking with A+B=2C+S

S counts one unit in this column, and C counts two units in the next column up. So every row should satisfy A+B equals 2 times C plus S.

For A=1 and B=1: A+B=2, C=1 and S=0, and 2×1+0=2. One unit here means one of this column's place value, which in a multi-bit sum isn't always decimal 1.

A half adder has no carry in

A half adder has only two inputs, A and B, and no Cin. In multi-bit addition, every column except the lowest may also get a carry from the right. That makes three inputs in one column, which is too many for a half adder, so a full adder is needed.

Check yourself

  1. What does a half adder output for A=0, B=1?

    Answer

    Exactly one input is 1, so XOR gives 1 and AND gives 0. S=1 and C=0, giving 01₂, which is 1.

  2. For A=1, B=1, S=0. Does that mean the total is 0?

    Answer

    No. The total is 2, shown as C=1 and S=0. C counts two units in the next column, and 2×1+0=2, written 10₂.

  3. Can a half adder add three one-bit inputs directly?

    Answer

    No. It has only A and B and no Cin. Three inputs need a full adder.