Parity check is a method used in digital communication and data storage systems to detect errors in transmitted or stored data. It involves adding an extra bit, called a parity bit, to the data being transmitted or stored. The parity bit is calculated based on the number of ones in the data word and is used to ensure that the total number of ones in the word, including the parity bit, is either even (even parity) or odd (odd parity).

There are two main types of parity check:

1. Even Parity: In even parity, the parity bit is chosen such that the total number of ones (including the parity bit) in the data word is an even number. If the data word already has an even number of ones, the parity bit is set to 0. If the data word has an odd number of ones, the parity bit is set to 1. When the data is received or retrieved, the receiver recalculates the parity bit based on the received data and checks whether the total number of ones (including the received parity bit) is even. If the parity check fails, an error is detected.

2. Odd Parity: In odd parity, the parity bit is chosen such that the total number of ones (including the parity bit) in the data word is an odd number. Similar to even parity, the parity bit is set to 1 if the data word has an even number of ones and set to 0 if the data word has an odd number of ones. The receiver recalculates the parity bit based on the received data and checks whether the total number of ones (including the received parity bit) is odd. If the parity check fails, an error is detected.

Parity check is a simple and effective method for detecting single-bit errors in transmitted or stored data. However, it cannot correct errors or detect multiple-bit errors beyond the capability of the parity bit. More advanced error detection and correction techniques, such as cyclic redundancy check (CRC) or Hamming codes, are used for more robust error detection and correction in communication systems and data storage devices.