Brytalearn.How things workFind something
INTERACTIVE EXPLANATION

How do zeros and ones become a calculation?

Flip real input bits on a little calculator. Build a result from simple rules, and follow a carry as it crosses four columns.

Enable JavaScript to change the conditions and run the interactive experiment.

Make a discovery

Binary uses place values 1, 2, 4, 8 and so on. In one column, 1+1 leaves a sum bit of 0 and carries a 1 to the next column. That is why one plus one is written 10 in binary.

Make a prediction

What is 15 + 15 + carry-in 1 in five-bit binary?

  • 1111
  • 11111
  • 10000
Read the explanation

15+15+1=31. In binary, 16+8+4+2+1=11111. The fifth bit matters.

Understand it

Give a gate a rule

AND outputs 1 only when both inputs are 1. Inclusive OR outputs 1 when either or both inputs are 1. XOR outputs 1 when exactly one input is 1. Flip the inputs and compare every row of the truth table.

Split a sum and a carry

A half-adder uses XOR for its sum and AND for its carry. A full-adder also accepts a carry from the previous column. A full-adder does not need to remember earlier calculations; it depends on its current inputs.

Join four columns

The carry leaving the 1s column enters the 2s column, then the 4s and 8s columns. A fifth bit preserves the final carry. This is a ripple-carry adder: a different kind of ripple from the traffic lesson, with a precisely defined dependency chain.

Look closer at the science

The equations

For inputs A, B and Cᵢₙ: S=A XOR B XOR Cᵢₙ. Cₒᵤₜ=(A AND B) OR (Cᵢₙ AND (A XOR B)). Every one of the eight input combinations is defined.

Keep the width visible

Two unsigned four-bit numbers and one carry-in can sum to 31. That needs five bits: 11111. Silently discarding the fifth bit would wrap the result modulo 16. This lesson keeps it.

A bit is a represented state

A logic 1 is not universally 1 volt. Real devices specify valid voltage ranges, loading and delays. The highlights here show evaluation order, not electrons, wire speed or measured nanoseconds.

Try it yourself: Be a human adder

Supplies

  • Ten small paper cards
  • Pencil
  • Optional partner
  1. Make two-state cards

    Write 0 on one side and 1 on the other. Try all four input pairs for a half-adder. Use separate cards for sum and carry.

  2. Add the incoming carry

    Try three input cards. Count how many ones there are: an odd count makes sum 1; two or more makes carry 1.

  3. Pass it left

    Set up four place-value columns and add 7+1. Pass each carry into the next column, retaining a fifth result bit.

Can simple rules add a number without a calculator?

Paper actions reproduce Boolean rules, not electronic timing. Use folded paper instead of scissors if needed.

Sources and model limits

  • Exact Boolean arithmetic with two unsigned 4-bit operands and one carry-in. No signed numbers, clocks, memory, transistor voltages or propagation-delay simulation.
  • The calculator is an illustrative application. Its visible adder is not a teardown of a particular product.
  • Changing an input restarts the dependency sequence. The settled result remains labeled separately from the revealed columns.

Logic gates implement explicitly testable Boolean functions.

Original course-author gate contracts and truth-table testing.

Nand2Tetris · Boolean logic

A real XOR device has specified electrical conditions.

The SN74HC86 implements four two-input XOR functions. No electrical timing values are imported into the model.

Texas Instruments · XOR datasheet

Independent subject review is pending.

Read the sources and model assumptions