Skip to content
BetterDL

Even function

Also called: even parity function, even-parity function, even detector

A Boolean function that is 1 when an even number of its inputs are 1, counting zero as even. It is the complement of the XOR of all inputs.

The even function of several inputs outputs 1 when an even number of them are 1, including none. For three inputs it is : 1 for zero 1s or two 1s.

It is the complement of the odd function, so in every row exactly one of the two is 1.

Ways to build it:

  • A multi-input XNOR gate, meaning a multi-input XOR with one bubble on its output.
  • A tree of XORs with a single inverter at the end.
  • For two inputs, a single XNOR: is 1 when A and B are both 0 or both 1, which is zero or two 1s.

Be careful with chains of 2-input XNORs. Each XNOR adds an inversion, so the result depends on how many you use:

  • 3 inputs need 2 XNORs. Two inversions cancel, so the chain gives the odd function.
  • 4 inputs need 3 XNORs. Three inversions leave one, so the chain gives the even function.

The even function is what a receiver checks in an even-parity scheme: if all received bits, data plus parity, have an even count of 1s, the data is assumed good.

0001
0010
0100
0111
1000
1011
1101
1110

Worked examples

Example

Evaluating a 3-input XNOR gate

A 3-input XNOR gate has A = 1, B = 1, C = 0. What is Y?

  1. 1.

    Count the 1s: A and B, so two.

  2. 2.

    Two is even, so the even function gives 1.

  3. 3.

    Check with XOR: 1 ⊕ 1 ⊕ 0 = 0, then the output bubble inverts it to 1. ✓

Example

A chain of three XNORs

Chain 2-input XNORs over four inputs: XNOR(A, B), then XNOR with C, then XNOR with D. Which function is it?

  1. 1.

    Each XNOR is an XOR plus one inversion, so the chain is inverted three times.

  2. 2.

    Three inversions leave one, so the chain is , the even function.

  3. 3.

    Check 0001: XNOR(0, 0) = 1, XNOR(1, 0) = 0, XNOR(0, 1) = 0. One 1 is odd, so the even function gives 0. ✓

  4. 4.

    Drop to three inputs and the chain has only two XNORs, whose inversions cancel. That gives the odd function instead.

Common mistakes

  • Forgetting that zero 1s counts as even, so 000 gives 1.

  • Assuming any chain of XNORs gives the even function. It depends on whether the number of XNOR gates is odd or even.

  • Mixing up the even function with an "all inputs equal" detector. 110 is even but its inputs aren't all equal.

Practice Even function

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Even function is taught in Logic Gates.