Jump to content

Parity

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Cyan (talk | contribs) at 22:07, 10 September 2003 (changed link to reflect move). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Parity is the attribute of a value describing whether it is even or odd. For example, the number 7 has odd parity and the number 20 has even parity.


Parity in algebra

The parity of permutations (as defined in abstract algebra) is the parity of the number of transpositions into which the permutation can be decomposed. For example (ABC) to (BCA) is even because it can be done by swapping A and B then C and A (two transpositions).

Parity in quantum mechanics

Particles have a quantum mechanical property of parity. According to quantum mechanics, the conservation of this parity is equivalent to the laws of physics being invariant under mirror reflection. It has been found that parity is not conserved in the weak force and so the weak force is not invariant under mirror reflection.

Parity checking

In computing and telecommunications, parity is often used for error checking. In this usage, the number of '1' bits are counted in the binary value. There are several types of parity: none, marking, even, and odd. 'None' means there is no parity calculated and a zero-bit is usually inserted (that is, the bit is present but unused or ignored). 'Marking' means that the parity bit is always a '1'. 'Even' and 'odd' parity insert '1' or '0' parity bits so that the total number of '1' is even or odd, including the parity bit. The parity bit is 'stripped off' before the data is used, thus a seven-bit character (or data value) requires eight bits to transmit or store - the seven data bits and the parity bit. Parity is considered a near-trivial error-checking algorithm, the main benefit of which is the ease of calculation. Modern error-checking algorithms use CRC or fire codes, for example. These codes are more powerful and can often correct errors, while parity can only detect some errors.

Integer parity tests

An integer is even iff it has 2 as a factor; otherwise it is odd. Another way of stating this is that, for any integer N, if N modulo 2 = 0, then N is even; otherwise, N is odd.

In any integer-base numeral system, here is how to test for parity:

  • If the base is even, the parity of any integer N is the same as the parity of the last digit of N.
  • If the base is odd, the parity of any integer N is the same as that of the sum of the digits of N.

See also