Solutions to exercise sheet 7 File

Discrete Structures
EPFL
Solution to Exercise Sheet 7
Date: 30.10.2015
Fall 2015
Problem 1.
1. We compute
10
X
ixi ≡ 1·0+2·8+3·4+4·9+5·3+6·0+7·1+8·4+9·9+10·10 ≡ 2
mod 11,
i=1
hence it is not a valid ISBN-10 number.
2. We have that
10
X
ixi ≡ 0
mod 11
i=1
9
X
↔
ixi + 10x10 ≡ 0
mod 11
i=1
↔
x10 ≡
9
X
ixi
mod 11.
i=1
Thus we get
x10 ≡ 1 · 3 + 2 · 3 + 3 · 5 + 4 · 1 + 5 · 2 + 6 · 8 + 7 · 4 + 8 · 4 + 9 · 2 ≡ 10
mod 11.
Therefore the complete ISBN-10 number is 335128442X.
3. Let x1 x2 . . . x10 be the correct number and y1 y2 . . . y10 the number where two
consecutive digits are swapped. Then there exists j ∈ {1, . . . , 9} such that
yj+1 = xj , yj = xj+1 and xi = yi for all i ∈ {1, . . . , 10}\{j, j + 1}. Then we get
10
X
ixi ≡ 0
mod 11
i=1
↔
10
X
iyi + (jxj − jyj ) + ((j + 1)xj+1 − (j + 1)yj+1 ) ≡ 0
mod 11
iyi + (jxj − jxj+1 ) + ((j + 1)xj+1 − (j + 1)xj ) ≡ 0
mod 11
i=1
↔
10
X
i=1
↔
10
X
iyi + (xj+1 − xj ) ≡ 0
i=1
1
mod 11
↔
10
X
iyi ≡ xj − xj+1
mod 11
i=1
If we plug in the given (wrong) number we get
↔
10
X
iyi ≡ 2
mod 11.
i=1
Since the number only has one index j such that
yj+1 − yj ≡ xj − xj+1 ≡ 2
mod 11,
namely j = 5, the fifth and sixth digits were swapped. I.e. the correct ISBN-10
number is 0387207333.
4. For example, 121212121X is a valid ISBN-10 number, but any swap in the first
9 digits cannot uniquely be corrected.
Problem 2.
1. We get a15 ≡ 193222543435 ≡ 5 mod 7.
2. When we reduce modulo 7 we get 10133334178901 ≡ 3 mod 7. Since a15 = 3,
the number is a valid airline ticket identification number.
3. Let a1 a2 . . . a15 be a correct airline ticket identification number and b1 b2 . . . b15
the number where two consecutive digits are swapped. To detect an error we
must get that b1 b2 . . . b14 − b15 6≡ 0 mod 7. We can write our 14-digit number
as
14
X
0
1
2
13
b1 b2 . . . b14 = b1 10 + b2 10 + b3 10 + · · · + b14 10 =
bi 10i−1 .
i=1
Assume that there exists j ∈ {1, . . . , 13} such that bj+1 = aj , bj = aj+1 and
ai = bi for all i ∈ {1, . . . , 15}\{j, j + 1} (i.e. the transposition was not in the
last two digits). Then we get
14
X
i−1
ai 10
−a15 ≡
i=1
14
X
bi 10i−1 −b15 +(aj 10j−1 −bj 10j−1 )+(aj+1 10j −bj+1 10j )
i=1
≡
14
X
bi 10i−1 − b15 + (aj 10j−1 − aj+1 10j−1 ) + (aj+1 10j − aj 10j )
i=1
≡
14
X
bi 10i−1 − b15 + 9 · 10j−1 (aj+1 − aj )
mod 7
bi 10i−1 − b15 + 2 · 3j−1 (aj+1 − aj )
mod 7.
i=1
≡
14
X
i=1
2
mod 7
mod 7
P
P
i−1
i−1
Since 14
−a15 ≡ 0 mod 7 we get that 14
−b15 ≡ 2·3j−1 (aj −
i=1 ai 10
i=1 bi 10
aj+1 ) mod 7. This is not equal to zero modulo 7 if and only if aj − aj+1 6≡
mod 7, i.e. if aj − aj+1 is not divisible by 7. This means that we can detect a
transposition of two consecutive digits (in the first 14 positions) if and only if
the difference of the two digits is not divisible by 7.
Problem 3. In both cases we will use that 21 = 20 + 22 + 24 and hence
0
2
4
321 ≡ 32 · 32 · 32
mod 11.
i
1. We consecutively compute the squares of 32 :
0
• 32 ≡ 31 ≡ 3 mod 11
1
• 32 ≡ 32 ≡ 9 mod 11
2
1
3
2
4
3
• 32 ≡ (32 )2 ≡ 92 ≡ 81 ≡ 4 mod 11
• 32 ≡ (32 )2 ≡ 42 ≡ 16 ≡ 5 mod 11
• 32 ≡ (32 )2 ≡ 52 ≡ 25 ≡ 3 mod 11
Then we get
321 ≡ 3 · 4 · 3 ≡ 12 · 3 ≡ 3
mod 11.
2. We can write
4
2
0
321 ≡ 32 · 32 · 32 ≡ (((32 )2 · 3)2 )2 · 3
mod 11
and compute this as
• 32 ≡ 9 mod 11
• (32 )2 ≡ 92 ≡ 81 ≡ 4 mod 11
• ((32 )2 · 3) ≡ 4 · 3 ≡ 12 ≡ 1 mod 11
• ((32 )2 · 3)2 ≡ 12 ≡ 1 mod 11
• (((32 )2 · 3)2 )2 ≡ 12 ≡ 1 mod 11
• (((32 )2 · 3)2 )2 · 3 ≡ 1 · 3 ≡ 3 mod 11
Problem 4.
1. Basis step: The smallest integer for which the statement should be true is n = 7,
hence we check
37 = 2187 < 5040 = 7!.
I.e., the statement is true for n = 7.
Induction step (n → n + 1): We now assume that the statement is true for n,
i.e. 3n < n! (induction hypothesis “IH”), and show that this implies that the
statement is also true for n + 1:
IH
3n+1 = 3 · 3n < 3 · n! < (n + 1) · n! = (n + 1)!.
Note that we use the fact that 3 < n + 1, which is true, since n ≥ 7.
3
2. Basis step: The smallest integer for which the statement should be true is n = 0.
We compute 70+2 + 82·0+1 = 72 + 8 = 57, which is divisible by 57. I.e. the
statement is true for n = 0.
Induction step (n → n + 1): We now assume that the statement is true for n,
i.e., there exists an integer k such that 7n+2 + 82n+1 = 57 · k (IH). Then, for
n + 1, we get:
7(n+1)+2 + 82(n+1)+1 = 7n+3 + 82n+3 = 7 · 7n+2 + 64 · 82n+1
= 7 · 7n+2 + 7 · 82n+1 + 57 · 82n+1 = 7 · (7n+2 + 82n+1 ) + 57 · 82n+1
IH
= 7 · (57 · k) + 57 · 82n+1 = 57 · (7 · k + 82n+1 ),
i.e., 7(n+1)+2 + 82(n+1)+1 is divisible by 57.
4