When two variables is logically compared, the logic gate that tests the equivalence .. If XOR please explain Why ? if XNOR Please explain Why?
The answer is XNOR
. As for why, just look at the truth table for 2 inputs:
You see that it returns 1
if either both inputs are 1
or both inputs are 0
, or in different words, when the inputs are of the same value. This can be described as checking for equivalence.
This can also be seen by looking at what XNOR
means: "eXclusive Not OR". That means that it is the opposite of checking whether exactly one input is 1
(since "exclusive OR" means either one of the outputs may be 1
but not both), i.e. checking whether either none or both of the inputs are 1
, i.e. checking whether either both inputs are 1
or both inputs are 0
, i.e. whether both inputs are equivalent.
(It can also be called NXOR
, which in my opinion is clearer. Because an exclusive OR of two inverted values would give the same result as without the negation, but this is the inversion of an exclusive OR.)