diff --git a/Advanced/Error-Correcting Codes/main.tex b/Advanced/Error-Correcting Codes/main.tex index f302543..a6b457a 100755 --- a/Advanced/Error-Correcting Codes/main.tex +++ b/Advanced/Error-Correcting Codes/main.tex @@ -5,16 +5,14 @@ singlenumbering ]{../../resources/ormc_handout} +\usepackage{hyperref} \usepackage{tikz} \usetikzlibrary{patterns} \uptitlel{Advanced 2} \uptitler{Fall 2022} \title{Error-Correcting Codes} -\subtitle{ - Based on a handout by Yingkun Li \\ - Revised by Mark on \today -} +\subtitle{Revised by Mark on \today} \begin{document} diff --git a/Advanced/Error-Correcting Codes/parts/00 detection.tex b/Advanced/Error-Correcting Codes/parts/00 detection.tex index e57e681..5c0e646 100755 --- a/Advanced/Error-Correcting Codes/parts/00 detection.tex +++ b/Advanced/Error-Correcting Codes/parts/00 detection.tex @@ -30,29 +30,6 @@ Which of the following could be valid ISBNs? \vfill \pagebreak -\problem{} -Show that the following sum is divisible by 11 iff $n_1n_2...n_{10}$ is a valid ISBN-10. -$$ - \sum_{i = 1}^{10} (11 - i)n_i -$$ - -\begin{solution} - Proof that valid $\implies$ divisible, working in mod 11: - - \vspace{2mm} - - $10n_1 + 9n_2 + ... + 2n_9 + n_{10} \equiv$ \par - $(-n_1) + (-2n_2) + ... + (-9n_9) + n_{10} =$ \par - $-n_{10} + n_{10} \equiv 0$ - - \vspace{2mm} - - Having done this, the rest is easy. Work in reverse, or note that each step above is an iff. - -\end{solution} - -\vfill - \problem{} Take a valid ISBN-10 and change one digit. Is it possible that you get another valid ISBN-10? \par Provide an example or a proof. @@ -89,6 +66,31 @@ This is called a \textit{transposition error}. \end{solution} \vfill + + + +\problem{} +Show that the following sum is divisible by 11 iff $n_1n_2...n_{10}$ is a valid ISBN-10. +$$ + \sum_{i = 1}^{10} (11 - i)n_i +$$ + +\begin{solution} + Proof that valid $\implies$ divisible, working in mod 11: + + \vspace{2mm} + + $10n_1 + 9n_2 + ... + 2n_9 + n_{10} \equiv$ \par + $(-n_1) + (-2n_2) + ... + (-9n_9) + n_{10} =$ \par + $-n_{10} + n_{10} \equiv 0$ + + \vspace{2mm} + + Having done this, the rest is easy. Work in reverse, or note that each step above is an iff. + +\end{solution} + +\vfill \pagebreak \problem{} diff --git a/Advanced/Error-Correcting Codes/parts/01 correction.tex b/Advanced/Error-Correcting Codes/parts/01 correction.tex index 98002c2..72d183b 100644 --- a/Advanced/Error-Correcting Codes/parts/01 correction.tex +++ b/Advanced/Error-Correcting Codes/parts/01 correction.tex @@ -8,7 +8,7 @@ QR codes feature a system that does. \par Odds are, you've seen a QR code with an image in the center. Such codes aren't \say{special}---they're simply missing their central pixels. The error-correcting algorithm in the QR specification allows us to read the code despite this damage. \begin{figure}[h] \centering - \includegraphics[width = 3cm]{qr} + \href{https://youtube.com/watch?v=dQw4w9WgXcQ}{\includegraphics[width = 3cm]{qr}} \end{figure} \definition{Repeating codes} @@ -24,7 +24,7 @@ $$ If we flip any one bit, we can easily find and fix the error. -\problem{} +\problem{} How many repeated digits do you need to... \begin{itemize} \item[-] detect a transposition error? @@ -42,90 +42,93 @@ $$ For example, the efficiency of the three-repeat code above is $\frac{3}{9} = \frac{1}{3} \approx 0.33$ -\problem{} +\problem{} What is the efficiency of a $k$-repeat code? \vfill + +As you just saw, repeat codes are not a good solution. You need many extra bits for even a small amount of redundancy. We need a better system. + \pagebreak -\definition{Hamming's Square Code} -We will now analyze a more efficient coding scheme: \par - -\vspace{1mm} - -Take a four-bit message and arrange it in a $2 \times 2$ square. \par -Compute the pairity of each row and write it at the right. \par -Compute the pairity of each column and write it at the bottom. \par -Finally, compute the pairity of the entire message write it in the lower right corner. -This ensures that the total number of ones in the message is even. - -\vspace{2mm} - -Reading the result row by row to get the encoded message. \par -For example, the message 1011 generates the sequence 101110011: - -$$ -1011 -\longrightarrow -\begin{array}{cc|} - 1 & 0 \\ - 1 & 1 \\ - \hline -\end{array} -\longrightarrow -\begin{array}{cc|c} - 1 & 0 & 1 \\ - 1 & 1 & 0 \\ \hline - 0 & 1 & -\end{array} -\longrightarrow -\begin{array}{cc|c} - 1 & 0 & 1 \\ - 1 & 1 & 0 \\ \hline - 0 & 1 & 1 -\end{array} -\longrightarrow -101110011 -$$ - -\problem{} -The following messages are encoded using the method above. -Find and correct any single-digit or transposition errors. -\begin{enumerate} - \item \texttt{110 110 011} %101110011 - \item \texttt{100 101 011} %110101011 - \item \texttt{001 010 110} %000110110 -\end{enumerate} - -\begin{solution} - \begin{enumerate} - \item \texttt{101 110 011} or \texttt{110 101 011} - \item \texttt{110 101 011} - \item \texttt{000 110 110} - \end{enumerate} -\end{solution} - -\vfill - -\problem{} -What is the efficiency of this coding scheme? - -\vfill - -\problem{} -Can we correct a single-digit error in the encoded message? \par -Can we correct a transposition error in the encoded message? - -\vfill - -\problem{} -Let's generalize this coding scheme to a non-square table: \par -Given a message of length $ab$, construct a rectangle with dimensions $a \times b$ as described above. -\begin{itemize} - \item What is the efficiency of a $a \times b$ rectangle code? - \item Can the $a \times b$ rectangle code detect and fix single-bit errors? - \item Can the $a \times b$ rectangle code detect and fix two-bit errors? -\end{itemize} - -\vfill -\pagebreak +%\definition{Hamming's Square Code} +%We will now analyze a more efficient coding scheme: \par +% +%\vspace{1mm} +% +%Take a four-bit message and arrange it in a $2 \times 2$ square. \par +%Compute the pairity of each row and write it at the right. \par +%Compute the pairity of each column and write it at the bottom. \par +%Finally, compute the pairity of the entire message write it in the lower right corner. +%This ensures that the total number of ones in the message is even. +% +%\vspace{2mm} +% +%Reading the result row by row to get the encoded message. \par +%For example, the message 1011 generates the sequence 101110011: +% +%$$ +%1011 +%\longrightarrow +%\begin{array}{cc|} +% 1 & 0 \\ +% 1 & 1 \\ +% \hline +%\end{array} +%\longrightarrow +%\begin{array}{cc|c} +% 1 & 0 & 1 \\ +% 1 & 1 & 0 \\ \hline +% 0 & 1 & +%\end{array} +%\longrightarrow +%\begin{array}{cc|c} +% 1 & 0 & 1 \\ +% 1 & 1 & 0 \\ \hline +% 0 & 1 & 1 +%\end{array} +%\longrightarrow +%101110011 +%$$ +% +%\problem{} +%The following messages are encoded using the method above. +%Find and correct any single-digit or transposition errors. +%\begin{enumerate} +% \item \texttt{110 110 011} %101110011 +% \item \texttt{100 101 011} %110101011 +% \item \texttt{001 010 110} %000110110 +%\end{enumerate} +% +%\begin{solution} +% \begin{enumerate} +% \item \texttt{101 110 011} or \texttt{110 101 011} +% \item \texttt{110 101 011} +% \item \texttt{000 110 110} +% \end{enumerate} +%\end{solution} +% +%\vfill +% +%\problem{} +%What is the efficiency of this coding scheme? +% +%\vfill +% +%\problem{} +%Can we correct a single-digit error in the encoded message? \par +%Can we correct a transposition error in the encoded message? +% +%\vfill +% +%\problem{} +%Let's generalize this coding scheme to a non-square table: \par +%Given a message of length $ab$, construct a rectangle with dimensions $a \times b$ as described above. +%\begin{itemize} +% \item What is the efficiency of a $a \times b$ rectangle code? +% \item Can the $a \times b$ rectangle code detect and fix single-bit errors? +% \item Can the $a \times b$ rectangle code detect and fix two-bit errors? +%\end{itemize} +% +%\vfill +%\pagebreak diff --git a/Advanced/Error-Correcting Codes/parts/02 hamming.tex b/Advanced/Error-Correcting Codes/parts/02 hamming.tex index e885f3b..501b56c 100644 --- a/Advanced/Error-Correcting Codes/parts/02 hamming.tex +++ b/Advanced/Error-Correcting Codes/parts/02 hamming.tex @@ -519,6 +519,23 @@ Does this correlate with that message bit's index? Say we have a message with exactly one single-bit error. \par If we know which parity bits are inconsistent, how can we find where the error is? +\vfill +\pagebreak + +\problem{} +How efficient is the 16-bit hamming code? + +\vfill + +\problem{} +Can you generalize this system for messages of 4, 64, or 256 bits? + +\vfill + +\problem{} +How efficient is each code in \ref{generalize-hamming}? \par +What do we sacrifice for this efficiency gain? + \vfill \pagebreak \ No newline at end of file