PowerPoint - Mathematics

advertisement
MAT 1000
Mathematics in Today's World
Winter 2015
Last Time
We looked at ways to add extra digits to a binary code,
allowing us to catch and correct errors.
One example used Venn diagrams to encode four digit
messages.
More generally, we can use “parity check sums.” With
these, we can have messages of any length, and we can
catch or correct more errors
Today
For any parity check sum encoding system, we can
determine how many errors it will correct or detect.
Binary linear codes
A binary linear code is a set of strings of 0’s
and 1’s obtained from all messages of a given
length by using parity check sums to add digits.
The resulting strings of 0’s and 1’s are called
code words.
Binary linear codes
Example
Last class we constructed the following example:
This is a binary linear code. The right column are the code
words. For example: 101 001 is a code word.
Error detection and correction
capacity
For any binary linear code, we can determine how many
errors it will detect or correct.
We call these numbers the “error detection capacity” and
the “error correction capacity.”
These can be determined once we know the “weight” of a
binary linear code.
The weight of a binary code is the smallest number of 1’s
that appear in a code word (except a code word which is all
0’s)
Error detection and correction
capacity
In the example from last class, we had the following code
words:
Code words
Number of 1’s
000 000
0
001 111
4
010 101
3
100 110
3
110 011
4
101 001
3
011 010
3
111 100
4
This binary code has weight 3.
Error detection and correction
capacity
If a binary code has weight 𝑡, then it will detect at most
𝑡 − 1 errors.
In other words, if a binary code has weight 𝑡 and a
message is received with 𝑡 or more errors, they might go
undetected.
The code in the example has weight 3, so it will detect 1 or
2 errors in any message. If there are 3 or more errors, they
may not be detected.
Error detection and correction
capacity
What does “detecting errors at most 2 errors” mean?
We have to decide in advance that we will reject any
message which does not match a code word (that we will
not try to correct errors).
If we do, then as long as a message has 2 or fewer errors,
we will always notice.
Error detection and correction
capacity
For example, if we receive the message
100 110
Incorrectly as
110 100
(two errors: in the second and fifth place), we notice,
because 110 100 isn’t a code word.
On the other hand, if we receive
100 110
incorrectly as
111 100
(three errors, in the second, third and fifth places) we won’t
notice, because 111 100 is a code word.
Error detection and correction
capacity
If a binary code has weight 𝑡, then it can correct at most
𝑡−1
errors.
2
If
𝑡−1
2
is not a whole number, then round it down.
𝑡−1
2
In our example the weight was 𝑡 = 3, and
1. So the code can correct at most 1 error.
=
3−1
.
2
This is
Error detection and correction
capacity
What does “correcting at most 1 error” mean?
We must decide in advance that if a message doesn’t
match any code word, then we will decode it (using nearest
neighbor decoding).
As long as the message received has only 1 error, we will
decode it correctly.
However, if there are 2 or more errors, we may decode it
incorrectly.
Error detection and correction
capacity
Suppose we have decided to attempt to decode all
messages. If we are sent the message
100 110
But we receive it with one error as
100 100
Then it will decode correctly.
Error detection and correction
capacity
Decode 100 100 using nearest neighbor decoding.
Code Words
Distance
000 000
2
001 111
4
010 101
3
100 110
1
110 011
4
101 001
3
011 010
5
111 100
2
The closest message is the correct one: 100 110
Error detection and correction
capacity
On the other hand, if a message has two or more errors, it
may not decode correctly.
For example, suppose we receive the message
100 110
Incorrectly as
110 100
Let’s decode this message
Error detection and correction
capacity
Decode 110 100 using nearest neighbor decoding.
Code Words
Distance
000 000
3
001 111
5
010 101
2
100 110
2
110 011
3
101 001
4
011 010
4
111 100
1
We decode this message incorrectly as 111 100.
The correct message was 100 110
Error detection and correction
capacity
Example
The Venn diagram method (from last class) for four digit
messages 𝑎1 𝑎2 𝑎3 𝑎4 is the same as using the three check
sums:
𝑎1 +𝑎2 + 𝑎3
𝑎1 +𝑎3 + 𝑎4
𝑎2 + 𝑎3 + 𝑎4
Using either these, or Venn diagrams, we can work out the
code words for this system
Error detection and correction
capacity
Example
The code words for the Venn diagram system are:
The smallest number of 1’s in any of these is 3. So this
code also has weight 3.
Error detection and correction
capacity
Example
Since the Venn diagram system has weight 3, it will either:
1. Detect 2 errors
2. Correct 1 error
Error detection and correction
capacity
When designing a binary linear code, the higher the weight,
the more errors can be detected or corrected.
So when we choose which parity check sums to use, we
should pick the ones that give our code the highest weight.
Download