Skip to content

Digital Logic

How a 2-out-of-3 majority voter circuit works

A majority voter outputs whatever at least two of its three inputs say. Feed it three sensors that should agree, and if one fails, stuck on or stuck off, the other two still decide the answer. It takes three AND gates and an OR:

VOTE = (A AND B) OR (B AND C) OR (A AND C)

The truth table

ABCVOTE
0000
0010
0100
0111
1000
1011
1101
1111

Four of the eight lines give 1: any two, or all three.

The circuit

One AND gate per pair, A·B, B·C and A·C, then an OR of the three; with 2-input gates that's two ORs in a row. If any pair is both 1, the vote is 1.

Live experiment

Break a sensor, keep the vote

Three smoke sensors feed a majority voter: an AND for each pair, ORed together. Press Smoke to make the truth 1, then tap a sensor to break it, stuck at 0, then stuck at 1. One broken sensor is always outvoted. Break two the same way and the alarm goes wrong.

Try it yourself: free lesson

“Two of three” is lesson 3 of 6 in Nand Narrows, Digital Logic World 2. Free with an account. Lessons unlock in order, so you’ll do the 9 before it first.

Why one fault can't fool it

Say sensor B sticks at 0. The vote becomes A AND C: it says 1 exactly when both good sensors say 1. Stick B at 1 instead, and the vote becomes A OR C: 1 if either good sensor says so, and when they agree on 0, it's 0. Either way, when the two working sensors agree, they win. Only two sensors failing the same way, at the same time, can outvote the truth.

The numbers behind redundancy

If each sensor is wrong 1 % of the time, independently, one sensor alone is wrong 1 time in 100. The voter is wrong only when two or more fail together: about 3 × 0.01², or 0.0003, roughly 1 time in 3,300. That's triple modular redundancy, and it pays wherever a wrong answer is expensive. The voter itself is now a single point of failure, which is why critical systems duplicate the voters too.

Where voters are used

The Space Shuttle flew with four computers voting on every command, plus a fifth as a backup. Airliners compare three air-data sensors. Some chips built for space store each bit in three flip-flops and vote, so a single particle strike can't flip it. And every full adder hides one: its carry-out is the majority of A, B and the carry-in. More inputs work the same way: a two-of-four vote needs an AND for each of the six pairs.

Free lesson

Now build it yourself

Each lesson comes in three short parts: see the idea, try it on a live board, then build it yourself, with quick checks as you go.

Try it yourself: free lesson

“Two of three” is lesson 3 of 6 in Nand Narrows, Digital Logic World 2. Free with an account. Lessons unlock in order, so you’ll do the 9 before it first.

Or start from the very first lesson, no account needed

Practice questions

Three quick questions from the lessons. Pick an answer to check it.

  1. Question 1 of 3With only the A·B and B·C pairs, which setting is wrong?
    Show the answer

    Answer: A = 1, B = 0, C = 1: two say 1 but VOTE stays 0. The A·C pair is the one with B at 0. Without its AND, that majority is missed.

    • Why not “All 0”? All 0 should give 0, and every pair's AND gives 0, so it's still right.
    • Why not “B alone”? B alone should give 0, and both remaining pairs need a second 1, so they give 0 correctly.
    • Why not “All 1”? With all three at 1, A·B is 1, so the vote is still right.
  2. Question 2 of 3With a fourth sensor, a two-of-four vote needs…
    Show the answer

    Answer: Six pair ANDs, one per pair. Four sensors make six pairs. The idea scales; the gate count grows.

    • Why not “One”? One AND checks a single pair and misses every other pair that could agree.
    • Why not “Three”? Three pairs covers only three sensors. A fourth sensor adds three more pairs.
    • Why not “Four”? Four sensors make six different pairs: AB, AC, AD, BC, BD and CD.
  3. Question 3 of 3A majority voter of three outputs 1 when…
    Show the answer

    Answer: Any two or all three inputs are 1. Majority: two of three is enough.

    • Why not “Exactly one is 1”? One of three is a minority, so the vote is 0.
    • Why not “Any input is 1”? That's an OR. A single faulty sensor would trip it.
    • Why not “All three are 1”? That's a three-input AND, a unanimous vote. The majority needs only two.
Keep practising: free lesson

“Two of three” is lesson 3 of 6 in Nand Narrows, Digital Logic World 2. Free with an account. Lessons unlock in order, so you’ll do the 9 before it first.

Questions people ask

What is the Boolean expression for a 3-input majority gate?

MAJ = (A AND B) OR (B AND C) OR (A AND C), often written AB + BC + AC. It's 1 whenever at least two of the three inputs are 1.

What is triple modular redundancy?

Running three copies of a sensor, circuit or computer and taking a majority vote of their outputs. Any single failure is outvoted, so the system keeps giving the right answer. It's used in aircraft, spacecraft and radiation-hardened chips.

How is a majority gate related to a full adder?

A full adder's carry-out is the majority of its three inputs: it carries whenever two or more of A, B and the carry-in are 1. Every adder in every processor contains majority gates.

Can I build a majority voter from NAND gates only?

Yes. An AND-OR circuit becomes NAND-NAND with no other change: three 2-input NANDs for the pairs, feeding one 3-input NAND: four gates in all, by De Morgan's laws.

Every topic