Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

What is total parity of bits?

  1. Dec 22, 2014 #1
    Below is the extraction from quantum computer book, but I think my question is related to classical computing;

    "Now let us generalize from one to multiple qubits. Figure 1.6 shows five notable multiple bit classical gates, the AND, OR, XOR (exclusive-OR ), NAND and NOR gates. An important theoretical result is that any function on bits can be computed from the composition of NAND gates alone, which is thus known as a universal gate. By contrast, the XOR alone or even together with NOT is not universal. One way of seeing this is to note that applying an XOR gate does not change the total parity of the bits. As a result, any circuit involving only NOT and XOR gates will, if two inputs x and y have the same parity, give outputs with the same parity, restricting the class of functions which may be computed, and thus precluding universality."

    I searched over the dictionary and understood the meaning of universal gate, but I do not get the total parity of the bits.

    What does that mean? and what does that underlined, bold sentence imply?

    I searched, and I found parity bits, but it seems that it's little bit different from what I am looking for.
  2. jcsd
  3. Dec 22, 2014 #2
    If you have N bits and M of them are one, then the "total parity" will depend only on "M". If M is odd, the "total parity" will be 1. If M is even, then "total parity" will be 0. The word "total" is not usually included - but they are probably refering to the fact that an XOR is the same as a modulo 2 addition.

    Stepping back, they are trying to show that there are some gates that cannot be created with only XORs. They are also letting you use NOT - but this is no gift. You can generate a NOT from an XOR by XORing with 1. Starting with A, B, and as many XORs as you wish, these are the symbols you can generate:
    0, A, B, A XOR B, 1, NOT A, NOT B, or NOT(A XOR B)

    XORing any of those with any of the others will not generate anything new.
    What they are getting at can be seen in the table below. The columns are:
    1) Result when A=0, B=0
    2) Result when A=0, B=1
    3) Result when A=1, B=0
    4) Result when A=1, B=1
    5) The XOR operation generating the result.
    0000 0
    0011 A
    0101 B
    0110 A XOR B
    1111 1
    1100 NOT A
    1010 NOT B
    1001 NOT(A XOR B)

    Here's the key. Notice two things:
    1) For each row, the number of 1's in the the table above is always even.
    2) Whenever you XOR two even patterns, you will get an even result.

    Therefore, something like an AND, OR, NAND, or NOR can never be generated from XOR gates only.
    0001 AND (1 is odd)
    0111 OR (3 is odd)
    1110 NAND (3 is odd)
    1000 NOR (1 is odd)
    Last edited: Dec 22, 2014
  4. Dec 23, 2014 #3
    So, I understand that the gate can be viewed as combination of 0 and 1 for 4 binary digits by using 0, A, B, 1.

    But how do you make 1 by XOR??
  5. Dec 26, 2014 #4
    In practice, you can always tie the input to a gate high or low. This is the same as providing a 1 or 0 as the input. So 1 and 0 are always available - unless you make a special rule to exclude them.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook