We know that for 3 variables (A=0,B=1,C=1), f$_1$ = (A XNOR B XNOR C) = 1, since the input has even number of 1's.

But if we were to do this step by step, f$_2$ = (A XNOR (B XNOR C)) = (A XNOR (1 XNOR 1))

Now, 1 XNOR 1 = 1. So, f$_2$ = (A XNOR 1) = 0 XNOR 1 = 0.

Why is f$_1 \neq$ f$_2$ ?

Also, which is true : "XNOR operation gives a value of 1 for " : Even number of 1's in the input OR Even number of 0's in the input. (Sorry, but a certain professor implied the later, so have to confirm).


There is no standard definition for the XNOR of more than two inputs (indeed, nor is there a standard definition for less than two inputs). Since XNOR is associative, one possible definition is $$ A_1 \text{ XNOR } A_2 \text{ XNOR } \cdots \text{ XNOR } A_n = A_1 \text{ XNOR } (A_2 \text{ XNOR } (A_3 \cdots )\cdots). $$ Another reasonable definition defines the XNOR of $A_1,\ldots,A_n$ as the negation of the XOR of $A_1,\ldots,A_n$. Both definitions agree with the usual definition of XNOR when $n = 2$, or indeed when $n$ is even, but give complementary results when $n$ is odd.

The XOR of a given number of inputs is $1$ if the number of $1$s in the input is odd. Given that you can work out a similar formula for the XNOR of any number of inputs, under both definitions.

  • 1
    $\begingroup$ Your second definition (i.e. even parity) is AFAIK the only one used in electronics for $n$-input XNOR gates. $\endgroup$ – AProgrammer Jan 13 '16 at 19:23
  • $\begingroup$ But then what is the accepted Value of 0 XNOR 1 XNOR 1?? Is it 1 as in the case of f1 or 0 as in the case of f2?! $\endgroup$ – Somenath Sinha Jan 14 '16 at 5:41
  • $\begingroup$ @SomenathSinha Depends on which definition you use. $\endgroup$ – Yuval Filmus Jan 14 '16 at 5:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.