This page is a drill . The parent note built the formulas; here we throw every kind of input at them — even data, odd data, all-zeros, all-ones, single flips, double flips, a real transmission story, and an exam-style twist. Follow along, and by the end there is no parity question that can surprise you.
Before anything, two reminders in plain words:
Every parity question is one cell of this grid. If we work one example per cell, nothing is left uncovered.
Cell
What makes it distinct
Covered by
A. Even parity, data has even 1s
generator must output P = 0
Ex 1
B. Even parity, data has odd 1s
generator must output P = 1
Ex 2
C. Odd parity (complement branch)
P = X , opposite convention
Ex 3
D. Degenerate input: all-zeros
edge: no 1s at all
Ex 4
E. Degenerate input: all-ones
edge: max 1s, count depends on n
Ex 4
F. Checker, no error
E must read "OK"
Ex 5
G. Checker, single flip (detected)
E flips → error
Ex 6
H. Checker, double flip (blind spot)
E unchanged → missed
Ex 7
I. Real-world word problem
keyboard byte over a cable
Ex 8
J. Exam twist: parity of a parity / wider word
n large, mixed convention
Ex 9
The map below shows how a bit-vector flows through the same XOR tree at the sender and receiver — the only difference is one extra input at the receiver.
= 1100 , even-parity generator. Find P and the transmitted word.
Forecast: count the 1s first — how many are there, and will P be 0 or 1?
Count the 1s in the data: 1 , 1 , 0 , 0 → two 1s.
Why this step? Parity is entirely about "odd or even count of 1s", so the count is the whole story.
Compute X = 1 ⊕ 1 ⊕ 0 ⊕ 0 . Left to right: 1 ⊕ 1 = 0 , then 0 ⊕ 0 = 0 , then 0 ⊕ 0 = 0 . So X = 0 .
Why this step? The even-generator formula is P even = X (from the parent). X = 0 says the data 1-count is already even.
P even = X = 0 . Transmitted word = 1100 0 .
Why this step? Even data already satisfies "even total", so we append 0 and change nothing.
Verify: count 1s in 11000 → still two → even ✓. The rule holds.
= 1011 , even-parity generator. Find P .
Forecast: three 1s is odd — do we need to add a 1 or not?
Count: 1 , 0 , 1 , 1 → three 1s (odd).
Why this step? Odd count means the invariant "even total" is currently violated by the data alone.
X = 1 ⊕ 0 ⊕ 1 ⊕ 1 = ( 1 ⊕ 0 ) = 1 , ( 1 ⊕ 1 ) = 0 , ( 0 ⊕ 1 ) = 1 . So X = 1 .
Why this step? X = 1 is XOR's way of announcing "odd number of 1s here".
P even = X = 1 . Word = 1011 1 .
Why this step? We insert one extra 1 so the total becomes even.
Verify: count 1s in 10111 → four → even ✓.
= 1011 , now use the odd -parity generator.
Forecast: the data already has an odd count — so should P stay 0 to keep it odd?
Reuse X = 1 from Ex 2 (the XOR of the data bits doesn't depend on the convention).
Why this step? The convention only changes the last step, not the XOR of the data.
P odd = X = 1 = 0 .
Why this step? Odd parity is the complement (the "N-coat", XNOR). Odd data + P = 0 stays odd.
Word = 1011 0 .
Verify: count 1s in 10110 → three → odd ✓. Notice: the same data gave P = 1 under even parity (Ex 2) and P = 0 under odd — the convention flips the answer.
Worked example Even parity. Find
P for (D) 0000 and (E) 1111 ; also 1111111 (seven ones).
Forecast: all-zeros has no 1s — is zero even? And does all-ones depend on how many bits there are?
(D) 0000 : X = 0 ⊕ 0 ⊕ 0 ⊕ 0 = 0 . Zero 1s, and zero counts as even . So P = 0 , word = 00000 .
Why this step? This is the "empty" edge case — parity treats "no 1s" as an even count, not a special case.
(E) 1111 : four 1s. X = 1 ⊕ 1 ⊕ 1 ⊕ 1 : pairs cancel, ( 1 ⊕ 1 ) ⊕ ( 1 ⊕ 1 ) = 0 ⊕ 0 = 0 . P = 0 , word = 11110 .
Why this step? An even number of 1s XORs to 0 — the identical result as all-zeros, because parity only sees the parity of the count.
1111111 (seven 1s): odd count. X = 1 (seven 1s → odd). P = 1 , word = 11111111 (eight 1s, even).
Why this step? All-ones flips answer with n : even n → P = 0 , odd n → P = 1 . The count's parity, not the value, decides.
Verify: D: 00000 has 0 ones (even) ✓. E: 11110 has 4 (even) ✓. Seven-ones: 11111111 has 8 (even) ✓.
Worked example Even-parity system. Received word
= 10111 (this is the correct Ex 2 output). Compute the error flag E .
Forecast: a clean word should give which value of E in an even system?
XOR everything including P : E = 1 ⊕ 0 ⊕ 1 ⊕ 1 ⊕ 1 .
Why this step? The checker is the same XOR tree as the generator with one more input — it re-asks "is the total count odd?".
Step through: 1 ⊕ 0 = 1 , 1 ⊕ 1 = 0 , 0 ⊕ 1 = 1 , 1 ⊕ 1 = 0 . So E = 0 .
Why this step? An even total XORs to 0 by definition.
Even-parity convention: E = 0 ⇒ OK, no error detected.
Verify: 10111 has four 1s → even → the invariant holds → E = 0 is correct ✓.
Worked example Even-parity system sent
10111 . Noise flips bit position 2 → receiver gets 10 0 11 . Compute E .
Forecast: one flip changes the count by exactly ±1 — will parity notice?
Received = 10011 . XOR all: E = 1 ⊕ 0 ⊕ 0 ⊕ 1 ⊕ 1 .
Why this step? Same checker rule; we don't get to know a flip happened, we just compute E .
1 ⊕ 0 = 1 , 1 ⊕ 0 = 1 , 1 ⊕ 1 = 0 , 0 ⊕ 1 = 1 . So E = 1 .
Why this step? The flip turned a 1 into 0, dropping the count from 4 to 3 (now odd).
Even system, E = 1 ⇒ ERROR flagged ✓.
Verify: 10011 has three 1s → odd → invariant broken → E = 1 correct ✓. Single flips move the count by an odd amount, so they always flip E .
Worked example Even-parity system sent
10111 . TWO bits flip: positions 3 and 1 → receiver gets 1 1 11 0 ? Let's be exact.
Forecast: two flips — the parent warned us. Will E read OK even though the data is wrong?
Original 10111 . Flip the leftmost 0 (position 3) to 1, and flip the rightmost 1 (position 0) to 0: received = 11110 .
Why this step? We deliberately pick two flips: one adds a 1, one removes a 1.
E = 1 ⊕ 1 ⊕ 1 ⊕ 1 ⊕ 0 : 1 ⊕ 1 = 0 , 0 ⊕ 1 = 1 , 1 ⊕ 1 = 0 , 0 ⊕ 0 = 0 . So E = 0 .
Why this step? Two flips changed the count by + 1 − 1 = 0 — an even change — so parity is restored.
Even system, E = 0 ⇒ "OK" — but the received word 11110 = 10111 ! The error is missed .
Verify: 11110 has four 1s → even → E = 0 , yet it's corrupt. Parity detects only an odd number of flips. For stronger detection see Checksums and CRC ; for correction see Hamming Codes .
Worked example A keyboard sends the ASCII byte for
A = 0100 0001 (eight data bits) over a serial cable using odd parity. Build the 9-bit frame, then a lightning strike flips exactly one bit. Show detection.
Forecast: eight bits, odd convention — will the parity bit be 0 or 1?
Count 1s in 01000001 : positions with a 1 are just two of them → two 1s (even).
Why this step? The count decides everything before we even touch the formula.
X = XOR of all eight bits = 0 (even count XORs to 0).
Why this step? Same as Ex 1's logic — even count means X = 0 .
P odd = X = 0 = 1 . Transmitted 9-bit frame = 01000001 1 , which has three 1s (odd).
Why this step? Odd parity needs an odd total; two data 1s → add one → three, odd ✓.
Lightning flips bit 0: receiver gets 010000010 ... wait, careful — appending P we sent 010000011 ; flip its last bit to get 010000010 .
Why this step? We model one physical flip on the wire.
Checker: E = XOR of received 010000010 = (two 1s in it) = 0 .
Why this step? Received word now has an even count (2).
Odd system: a good word has odd 1s → E = 1 for OK; here E = 0 ⇒ ERROR flagged ✓.
Why this step? In odd parity the "good" and "bad" readings of E swap — always re-ask "what count should a correct word have?".
Verify: frame 010000011 has 3 ones (odd) ✓; corrupted 010000010 has 2 (even) → E = 0 → flagged in an odd system ✓.
Worked example A 16-bit data word
D = 1111 0000 1010 1100 uses even parity. (a) Find P . (b) A colleague claims XORing the two 8-bit halves and then XORing those results gives the same P — verify the shortcut.
Forecast: 16 bits is a lot — but you never need to XOR all 16 in one line. Can you split the work?
Split into halves: H 1 = 11110000 , H 2 = 10101100 .
Why this step? XOR is associative — grouping is free, so we can compute each half's parity separately.
Parity of H 1 : four 1s → even → X 1 = 0 . Parity of H 2 : four 1s (1 , 0 , 1 , 0 , 1 , 1 , 0 , 0 ) → even → X 2 = 0 .
Why this step? Count each half; even count ⇒ that half's XOR is 0.
Combine: X = X 1 ⊕ X 2 = 0 ⊕ 0 = 0 . So P even = 0 .
Why this step? The parity of the whole is the XOR of the parts' parities — the shortcut is legitimate.
Full frame = 1111000010101100 0 .
Verify: total 1s in D = 4 + 4 = 8 (even) → P = 0 ✓, matching the split method. The colleague's shortcut is exactly the associativity of XOR, and it's how real hardware builds a wide parity tree from smaller XOR gates.
Recall Which cell does each example prove?
Ex1→A, Ex2→B, Ex3→C, Ex4→D&E, Ex5→F, Ex6→G, Ex7→H, Ex8→I, Ex9→J. Every cell covered.
Recall Odd vs even data under even parity — quick check
Even data → P = 0 ; odd data → P = 1 ::: because P equals X , and X tells you if the data count is odd.
Recall Why does the double-flip fool the checker?
Two flips change the 1-count by an even amount, so the parity (and E ) is unchanged ::: parity sees only odd/even, not the actual number.
XOR and XNOR gates — every step above is chained XOR / one XNOR.
Combinational Circuits — all these examples are memoryless, output depends only on current bits.
Error Detection and Correction — Ex 6–8 are the detection story; Ex 7 is its limit.
Hamming Codes — the fix for "which bit?" that parity can't answer.
Checksums and CRC — stronger successors that catch the double-flip Ex 7 misses.
Multiplexers & Adders — other XOR-heavy blocks built the same associative way (Ex 9).