World's most popular travel blog for travel bloggers.

[Solved]: What is the XNOR of 3 or more inputs?

, , No Comments
Problem Detail: 

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).

Asked By : Somenath Sinha

Answered By : Yuval Filmus

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.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/51798

3.2K people like this

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback