PREVIEW
relay-logic

NOR Gate from Relays: The Universal Gate That Flew to the Moon

DigiSim Relay Team DigiSim Relay Team
9 min read

In the previous post in this series, we built the NAND gate — NOT-AND — and discovered something remarkable: you don’t need a full toolkit of different gates to build any logic circuit you can imagine. You only need NAND, repeated. Any Boolean function, any truth table, any circuit — all of it can be assembled entirely from that one gate. NAND is functionally complete, or “universal” in the vocabulary of digital logic.

That discovery is one of the most important ideas in all of computing. But it has a twin, and the twin came first to the Moon.

This post is about NAND’s perfect logical dual: the NOR gate. It is equally universal — every gate in existence can be built from NOR alone — and it carries a historical distinction unlike anything in the rest of this series. The computer that guided two astronauts from Earth to lunar orbit, landed them safely, and brought them home again was built not from a library of different gates, not from transistors doing different jobs, but almost entirely from a single type of gate: the three-input NOR.

5,600 of them. One gate, replicated and wired together into the most consequential computer ever flown. Let’s understand why that was possible — and build a NOR gate right now, from relays.

What NOR means, from first principles

The name is a compound: N-OR, short for NOT-OR. And exactly like NAND (which is NOT-AND), the construction tells you the entire story.

You already know the OR gate from earlier in this series. Two relay contacts wired in parallel: if either switch closes — if input A or input B is active — current finds a path and the lamp lights. OR asks: is anyone home? If at least one input is 1, the output is 1.

NOR asks the opposite question: is everyone quiet? It outputs 1 only when every input is 0 — when there is complete silence across every line. The moment any input goes to 1, the output collapses to 0. One voice in the crowd, and the result is gone.

Build it physically: wire the OR stage (two contacts in parallel), then follow it with an inverter — the normally-closed relay contact you met as a NOT gate. The OR detects any activity; the NOT flips the result. The output is 1 precisely when the OR sees nothing.

The Boolean expression is Out=A+BOut = \overline{A + B}. The overbar covers the entire OR: “NOT of (A OR B).”

The truth table: silence as signal

ABOut (A+B\overline{A+B})
001
010
100
110

Four rows, and the lamp glows in exactly one of them — the only moment of perfect silence, when both inputs are 0. Compare this to NAND’s truth table: NAND was dark in exactly one row (both inputs 1). NOR is the logical mirror: lit in exactly one row (both inputs 0).

This symmetry is not a coincidence. NAND and NOR are duals of each other under De Morgan’s law — the same algebraic identity we used in the NAND post, this time read from the other direction:

A+B=AˉBˉ\overline{A + B} = \bar{A} \cdot \bar{B}

NOR of A and B equals AND of their complements. Just as NAND could be seen as an OR with inverted inputs, NOR can be seen as an AND with inverted inputs. The two gates are precise reflections, and that reflection runs all the way down to their universality.

5,600 NOR gates and a journey to the Moon

On the morning of July 16, 1969, a Saturn V rocket lifted three astronauts off the ground. Four days later, Neil Armstrong and Buzz Aldrin landed on the Moon. The computer that computed their trajectory, controlled their descent, and responded to Armstrong’s manual corrections during the final sixty seconds above the lunar surface weighed less than 32 kilograms and consumed about 55 watts of power. It was called the Apollo Guidance Computer, and it was a marvel of 1960s engineering.

Its designers at MIT’s Instrumentation Laboratory — working in the early 1960s, when integrated circuits were barely a year old — faced a constraint that no computer designer before them had ever faced in quite the same way: absolute, non-negotiable reliability. A desktop computer can crash and be rebooted. An Apollo computer cannot. Every component choice was made with that constraint at the center.

They settled on a technology from Fairchild Semiconductor: small, flat, three-input NOR gates on integrated circuit chips. Each chip held three gates; the entire computer used roughly 4,100 chips containing about 5,600 individual NOR gates. The logic family was RTL — resistor-transistor logic — not relays, but the NOR gates those transistors formed implement exactly the same Boolean function as the relay NOR you are about to toggle. The logical principle is the same; only the physical substrate has changed.

Why NOR and not a full library of different gate types? Because using a single gate type simplified everything. One component meant one qualification program, one reliability curve, one failure mode to characterize, one spare-parts problem. The designers tested that one gate exhaustively and trusted it implicitly. Then they did what NOR’s universality promised they could: they built every other function they needed — AND gates, OR gates, NOT gates, flip-flops, adders, instruction decoders — entirely from NOR alone.

The software that ran on those NOR gates was written by a team led by Margaret Hamilton, one of computing’s true pioneers. Hamilton coined the phrase “software engineering” precisely because she believed writing code for a spacecraft demanded the same rigor as building its hardware. Her team’s programs — navigation, guidance, display, abort logic — ran flawlessly across eleven crewed Apollo missions. The NOR gates computed; Hamilton’s software told them what to compute.

Think about that. A 70-pound computer built from one repeated gate, running software written without any existing methodology to guide it, navigated human beings a quarter-million miles through space and brought them home. When Armstrong manually took control in the final seconds of the descent, it was the NOR-gate logic that tracked his inputs and kept the lander from tilting. The universality of NOR was not a theoretical claim that day — it was demonstrated, under the harshest possible test conditions, in the Sea of Tranquility.

Charles Petzold tells the story of how gates build computation, beautifully, in CODE: The Hidden Language of Computer Hardware and Software. The AGC is one of the most vivid real-world proofs of everything Petzold’s relay-by-relay argument builds toward.

Try it yourself

Below is a live NOR gate simulation — two relay inputs, one output — running as a genuine DC circuit in your browser. Before you touch anything, the lamp is on: both inputs are 0, and the NOR condition is satisfied. Now try each input in turn.

A relay NOR gate: two inputs in parallel feed an OR stage; a normally-closed contact inverts the result. The lamp glows only when both inputs are 0. Open it in the DigiSim Relay Lab.

A few things to pay attention to as you explore:

  1. Start from silence. The lamp begins on — both inputs are off, NOR is satisfied. Activate either input alone and watch the lamp go out. That click is the OR stage detecting activity; the NOT stage immediately extinguishes the output.

  2. Compare to the NAND post. In the NAND circuit, the lamp was on in three of four states and went dark only when both inputs were active. Here, the lamp is dark in three of four states and glows only in the single moment of total quiet. Same principle — universality — mirrored across the two gates.

  3. Turn the sound on. With two relays, you hear two distinct clicks as inputs change state. Notice when one click is enough to kill the output — the OR stage has already detected activity and the NOT stage is responding instantly.

NOR is universal — building any gate from NOR alone

Just as with NAND, we can demonstrate NOR’s universality by constructing the three fundamental gates — NOT, OR, AND — from NOR alone. The constructions are direct duals of the NAND versions, following exactly the logic the De Morgan identity prescribes.

NOT from NOR. Tie both inputs together: A+A=Aˉ\overline{A + A} = \bar{A}. NOR with a single input repeated is a plain inverter.

NOT(A)=NOR(A,A)\text{NOT}(A) = \text{NOR}(A, A)

OR from NOR. Build OR by inverting a NOR — but you already know how to invert with NOR: feed the NOR output into another NOR with both inputs tied together.

A+B=NOR(NOR(A,B),NOR(A,B))A + B = \text{NOR}(\text{NOR}(A,B),\, \text{NOR}(A,B))

AND from NOR. De Morgan tells us AB=Aˉ+BˉA \cdot B = \overline{\bar{A} + \bar{B}}. First invert each input with a NOR (as above), then combine them in a NOR:

AB=NOR(NOR(A,A),NOR(B,B))A \cdot B = \text{NOR}(\text{NOR}(A,A),\, \text{NOR}(B,B))

Three gates, all reconstructed from nothing but NOR. Since AND, OR, and NOT together are functionally complete — they can express any Boolean function — NOR inherits that completeness. Any circuit, any computer, any piece of logic you can specify by truth table, can be built entirely from NOR gates. The Apollo engineers knew this and built a Moon computer on precisely that fact.

NAND and NOR: the two universal gates

This is a moment to step back and see the shape of what the series has uncovered.

There are only two single-gate-type universal gates in standard Boolean logic: NAND and NOR. Every other common gate — AND, OR, NOT, XOR, XNOR — fails the universality test: you cannot express all Boolean functions using only that gate type. NAND and NOR are the exceptions. They are the two minimal complete primitives of digital logic.

They are also each other’s perfect dual. NAND is dark only when all inputs are 1; NOR is lit only when all inputs are 0. NAND implements AB\overline{A \cdot B}; NOR implements A+B\overline{A + B}. De Morgan’s law connects them: flip every AND to OR and every NOT, and you move from one to the other.

In practice, CMOS silicon favors NAND — for reasons of transistor physics, NAND gates switch faster and occupy less area than NOR gates in the dominant fabrication technology. Modern chips are overwhelmingly NAND-first. But in the 1960s, with RTL logic, the NOR gate was the more favorable choice — and Fairchild’s three-input NOR chip became, with 5,600 repetitions, the computer that flew to the Moon.

Pick one universal gate. Replicate it as many times as you need. Wire them together following logic’s rules. That is how you build a computer.

What you just learned — and what’s next

In this post, the series reached a symmetric summit:

  • NOR is NOT-OR: output 1 only when every input is 0; any active input forces the output to 0.
  • Build it from relays: OR stage (parallel contacts) followed by a NOT stage (normally-closed contact).
  • NOR is functionally complete (universal): NOT, OR, and AND can all be assembled from NOR alone, using the dual of the NAND constructions.
  • NAND and NOR are the only two single-gate universal primitives in Boolean logic — duals of each other, two equal paths to a complete computer.
  • The Apollo Guidance Computer proved NOR universality under the hardest imaginable test: ~5,600 NOR gates, one repeated device, a round trip to the Moon. Margaret Hamilton’s software ran on that hardware.

Next in Building a Computer from Relays — Post 10 — we meet the gate that makes arithmetic possible. While AND, OR, NOT, NAND, and NOR all deal with agreement and disagreement between signals, the XOR gate asks a different question: are these two inputs different? It is the “difference detector” — and once you have it, you have your first step toward a circuit that can actually add numbers. The half-adder, and eventually the full adder, is one post away.

DigiSim Relay Lab