2023-01-12 08:31:10 -08:00
\section { Error Detection}
An ISBN\footnote { International Standard Book Number} is a unique numeric book identifier. It comes in two forms: ISBN-10 and ISBN-13. Naturally, ISBN-10s have ten digits, and ISBN-13s have thirteen. The final digit in both versions is a \textit { check digit} .
\vspace { 3mm}
2023-06-19 15:42:33 -07:00
Say we have a sequence of nine digits, forming a partial ISBN-10: $ n _ 1 n _ 2 ... n _ 9 $ . \par
2023-01-12 08:31:10 -08:00
The final digit, $ n _ { 10 } $ , is calculated as follows:
$$
\Biggr ( \sum _ { i = 1} ^ { 9} i \times n_ i \Biggl ) \text { mod } 11
$$
If $ n _ { 10 } $ is equal to 10, it is written as \texttt { X} .
\problem { }
Which of the following could be valid ISBNs?
\begin { itemize}
\item \texttt { 0-134-54896-2}
\item \texttt { 0-307-29206-3}
\item \texttt { 0-316-00395-6}
\end { itemize}
\begin { solution}
Only the first has an inconsistent check digit.
\end { solution}
\vfill
\pagebreak
\problem { }
2023-06-19 15:42:33 -07:00
Take a valid ISBN-10 and change one digit. Is it possible that you get another valid ISBN-10? \par
2023-01-12 08:31:10 -08:00
Provide an example or a proof.
\begin { solution}
Let $ S $ be the sum $ 10 n _ 1 + 9 n _ 2 + ... + 2 n _ 9 + n _ { 10 } $ , before any digits are changed.
\vspace { 3mm}
2023-06-19 15:42:33 -07:00
If you change one digit of the ISBN, $ S $ changes by $ km $ , where $ k \in \{ 1 , 2 ,..., 10 \} $ and $ |m| \leq 10 $ . \par
2023-01-12 08:31:10 -08:00
$ k $ and $ m $ cannot be divisible by 11, thus $ km $ cannot be divisible by 11.
\vspace { 3mm}
2023-06-19 15:42:33 -07:00
We know that $ S \equiv 0 \text { ( mod 11 ) } $ . \par
2023-01-12 08:31:10 -08:00
After the change, the checksum is $ S + km \equiv km \not \equiv 0 \text { ( mod 11 ) } $ .
\end { solution}
\vfill
\problem { }
2023-06-19 15:42:33 -07:00
Take a valid ISBN-10 and swap two adjacent digits. When will the result be a valid ISBN-10? \par
2023-01-12 08:31:10 -08:00
This is called a \textit { transposition error} .
\begin { solution}
2023-06-19 15:42:33 -07:00
Let $ n _ 1 n _ 2 ...n _ { 10 } $ be a valid ISBN-10. \par
2023-01-12 08:31:10 -08:00
When we swap $ n _ i $ and $ n _ { i + 1 } $ , we subtract $ n _ i $ and add $ n _ { i + 1 } $ to the checksum.
\vspace { 3mm}
2023-06-19 15:42:33 -07:00
If the new ISBN is to be valid, we must have that $ n _ { i + 1 } - n _ i \equiv 0 \text { ( mod 11 ) } $ . \par
2023-01-12 08:31:10 -08:00
This is impossible unless $ n _ i = n _ { i + 1 } $ . Figure out why yourself.
\end { solution}
\vfill
2023-06-20 10:07:35 -07:00
\problem { }
Show that the following sum is divisible by 11 iff $ n _ 1 n _ 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}
$ 10 n _ 1 + 9 n _ 2 + ... + 2 n _ 9 + n _ { 10 } \equiv $ \par
$ ( - n _ 1 ) + ( - 2 n _ 2 ) + ... + ( - 9 n _ 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
2023-01-12 08:31:10 -08:00
\pagebreak
\problem { }
ISBN-13 error checking is slightly different. Given a partial ISBN-13 $ n _ 1 n _ 2 n _ 3 ... n _ { 12 } $ , the final digit is given by
$$
n_ { 13} = \Biggr [ \sum_{i=1}^{12} n_i \times (2 + (-1)^i) \Biggl] \text { mod } 10
$$
2023-06-19 15:42:33 -07:00
What is the last digit of the following ISBN-13? \par
2023-01-12 08:31:10 -08:00
\texttt { 978-0-380-97726-?}
\begin { solution}
The final digit is 0.
\end { solution}
\vfill
\problem { }
2023-06-19 15:42:33 -07:00
Take a valid ISBN-13 and change one digit. Is it possible that you get another valid ISBN-13? \par
If you can, provide an example; if you can't, provide a proof.
2023-01-12 08:31:10 -08:00
\begin { solution}
2023-06-19 15:42:33 -07:00
Let $ n _ 1 n _ 2 ...n _ { 13 } $ be a valid ISBN-13. Choose some $ n _ i $ and change it to $ m _ i $ . \par
2023-01-12 08:31:10 -08:00
\vspace { 3mm}
2023-06-19 15:42:33 -07:00
Since $ n _ i $ , $ m _ i $ $ \in \{ 0 , 1 , 2 , ..., 9 \} $ , $ - 9 \leq n _ i - m _ i \leq 9 $ . \par
2023-01-12 08:31:10 -08:00
\vspace { 2mm}
2023-06-19 15:42:33 -07:00
Case 0: $ i $ is 13 \par
2023-01-12 08:31:10 -08:00
This is trivial.
\vspace { 2mm}
2023-06-19 15:42:33 -07:00
Case 1: $ i $ is odd \par
For the new ISBN to be valid, we need $ n _ i - m _ i \equiv 0 \text { ( mod 10 ) } $ . \par
2023-01-12 08:31:10 -08:00
This cannot happen if $ n _ i \neq m _ i $ .
\vspace { 2mm}
2023-06-19 15:42:33 -07:00
Case 2: $ i $ is even \par
For the new ISBN to be valid, we need $ 3 ( n _ i - m _ i ) \equiv 0 \text { ( mod 10 ) } $ \par
2023-01-12 08:31:10 -08:00
This cannot happen, 10 and 3 are coprime.
\end { solution}
\vfill
\problem { }
2023-06-19 15:42:33 -07:00
Take a valid ISBN-13 and swap two adjacent digits. When will the result be a valid ISBN-13? \par
2023-01-12 08:31:10 -08:00
\hint { The answer here is more interesting than it was last time.}
\begin { solution}
2023-06-19 15:42:33 -07:00
Say we swap $ n _ i $ and $ n _ { i + 1 } $ , where $ i \in \{ 1 , 2 , ..., 11 \} $ . \par
The checksum changes by $ 2 ( n _ { i + 1 } - n _ i ) $ , and will \par
2023-01-12 08:31:10 -08:00
remain the same if this value is $ \equiv 0 \text { ( mod 10 ) } $ .
\end { solution}
\vfill
2023-06-19 15:42:33 -07:00
\problem { } <isbn-nocorrect>
\texttt { 978-0-08-2066-46-6} was a valid ISBN until I changed a single digit. \par
Can you find the digit I changed? Can you recover the original ISBN?
2023-01-12 08:31:10 -08:00
\begin { solution}
2023-06-19 15:42:33 -07:00
Nope, unless you look at the meaning of each digit in the spec. \par
2023-01-12 08:31:10 -08:00
If you're unlucky, maybe not even then.
\end { solution}
\vfill
\pagebreak