Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2 Parity checks Simple codes Modular arithmetic.

Similar presentations


Presentation on theme: "Chapter 2 Parity checks Simple codes Modular arithmetic."— Presentation transcript:

1 Chapter 2 Parity checks Simple codes Modular arithmetic

2 Simple Block Code Parity Checks Idea:Break a string of bits into blocks of size (n  1) and append (or prepend) an additional bit for even or odd parity (even # of 1’s, odd # of 1’s), to obtain n bit blocks. parity bit Other codes that admit parity checks: 2-out-of-5, 3-out-of-7 (van Duuren code) In general, 2.4

3 Error Probabilities Assume independent error probability p for each bit. The probability of no error = (1 – p) n. The probability of one error = np(1 – p) n-1. In general i 1  n √…√  √…√

4 Burst Code Parity Checks Instead of computing a parity check over contiguous sequences of bit positions, use a “checksum” over words of length L. 2.6 b1b1 …bLbL b L+1 …b2Lb2L ...... c1c1 …cLcL checksum physical noise Assume noise comes in “bursts” of length ≤ L, and is otherwise independently distributed.

5 Modular Arithmetic In mod (modulo) 2 arithmetic, 2 is the base (modulus) and there are no numbers other than 0 and 1. Any higher number mod 2 is obtained by dividing it by 2 and taking the remainder. For instance, 3 ≡ 1 mod 2 and 4 ≡ 0 mod 2. Mod 2 addition Mod 2 multiplication +01 001 110 × 01 000 101 = logical XOR = logical AND The base can be any number (usually a prime) and the rules are similar to those for base 2. Mod 5 additionMod 5 multiplication +01234 001234 112340 223401 334012 440123 ×01234 000000 101234 202413 303142 404321 2.8

6 Fact: If a ≡ m a′ and b ≡ m b′, then a + b ≡ m a′ + b′ and a ∙ b ≡ m a′ ∙ b′. Proof: a ≡ m a′ and b ≡ m b′ means that a = a′ + im and b = b′ + jm, so a + b = a′ + b′ + (i + j)m and a ∙ b = a′ ∙ b′ + a′jm + b′im + ijm 2. QED Multiplicative inverses may not exist for some numbers. Example: 2 × 5 ≡ 0 mod 10. Does 2 have a multiplicative inverse? Suppose it does, then 2 × 2 −1 ≡ 1 mod 10. However, multiplying both sides by 5 yields 0 ≡ 5 mod 10, which is false. Note: If the modulus is a prime, p, then numbers not congruent to p can’t multiply together to be congruent to p, so you don’t have the problem in the above example. Here is a proof that multiplicative inverses (for nonzero) numbers always exist in a prime modulus, p: Let q  , 0 < q < p, then GCD(p, q) = 1. (They are relatively prime). By the Euclidean Algorithm, we can always find k, l   such that kp + lq = 1,  lq ≡ 1 mod p  l = q −1. 2.8 Rules for Modular arithmetic

7 Weighted Codes Deals with transcription errors (i.e. human non-binary error): Example: Assign numerical values 1 … 37 to the symbols consisting of letters, digits, and a space. Take a message of length less than 37 and weight each symbol therein according to its position in the message, appending a final check symbol s 1 chosen so the weighted sum is congruent to zero: transposing adjacent digits [e.g. 67 → 76]: ks k + (k+1)s k+1 becomes (k+1)s k + ks k+1 whose difference is s k+1 − s k ≢ 0 (mod 37) repeating an adjacent digit [e.g. 667 → 677]: difference is ks k − ks k+1 = k(s k − s k+1 ) ≢ 0 provided 0 < k < 37 and s k ≠ s k+1 For n < 37, s n … … s 1

8 10 digit weighted code (mod 11) where X stands for ten in the check (last) digit 10987654321 0  1321  2571  4 messagesumsum of sums highest weight:w → w → w ↓↓ x → w + x → 2w + x ↓↓ y → w + x + y → 3w + 2x + y ↓↓ check digit (weight 1):z → w + x + y + z → 4w + 3x + 2y + z 2.9 ISBN Numbers


Download ppt "Chapter 2 Parity checks Simple codes Modular arithmetic."

Similar presentations


Ads by Google