Solution

CS/Math 320 Discrete Mathematics
Summer 2016
Solution to Test 3 - Thu 7/7, 5PM-6:30PM
Problem 1 (20 points).
Express gcd(84, 119) as a linear combination of 84 and 119.
Answer:
119 =
84
=
35
=
14
=
1x84+35
2x35+14
2x14+7
2x7
So, gcd(84,119)=7. Going the opposite directions of the above divisions, we
have,
7 = 35 – 2x14 = 35 – 2x(84-2x35) = (-2)x84 + 5x35 = (-2)x84+5x(119-1x84) =
5x119-7x84.
The linear combination is 7 = 5 x 119 – 7 x 84
Problem 2 (20 points). Use the Chinese remainder theorem to find all solutions to the
system of congruencies: x ≡ 2 (mod 3), x ≡ 1 (mod 4), and x ≡ 3 (mod 5). Show the steps
to explain how you obtain these solutions.
Answer:
M=3x4x5=60
M1=4x5=20; its inverse modulo 3 is y1=2 because 20x2=40 ≡ 1 (mod 3)
M2=3x5=15; its inverse modulo 4 is y2=3 because 15x3=45 ≡ 1 (mod 4)
M3=3x4=12; its inverse modulo 5 is y3=3 because 12x3=36 ≡ 1 (mod 5)
So, all solutions will be any integer x such that
x
≡
≡
≡
≡
≡
a1 x M1 x y1 + a2 x M2 x y2 + a3 x M3 x y3
2x20x2+1x15x3+3x12x3
80+45 +108
233
53 (mod 60)
(any integer that is congruent to 53 modulo 60)
Problem 3 (20 points).
What is the original message encrypted using the RSA system with n = 53 · 61 and e = 17
if the encrypted message is 3185? How do you obtain this original message?
Answer:
n = 53*61= 3233
(p-1)*(q-1) = 52*60=3120
d is an inverse of e modulo 3120 = inverse of 17 modulo 3120. So, we can choose
d=2753.
m: original message
the encrypted message c = 3185.
According to RSA,
m
=
cd mod n
=
31852753 mod 3233
= (-48) 2753 mod 3233
= 482752 * (-48) mod 3233
You now can apply Fast Modulo Exponentiation (as in Problem 4 below) to find
this m. The answer is m=1816.
Problem 4 (20 points).
Find 1231003 mod 101. Don’t just provide an answer; show the steps during the solution
process.
Answer:
Using Little Ferma theorem is one easy way to find the remainder:
Because gcd(123, 101)=1, we have 123101-1 mod 101 = 1 or 123100 mod 101 = 1
Therefore, 1231003 mod 101 = 1233*(123100)10 mod 101 = 1233 * 1 mod 101 = 1233 mod
101 = 43.
A solution without using Little Ferma Theorem:
1003 =
1231003 =
1231
1232
1234
1238
12316
12332
12364
123128
123256
123512
512 + 256 + 128 + 64 + 32 + 8 + 2 + 1
123512 123256 123128 123641233212316123812321231
mod 101 = 22
mod 101 = 222 mod 101 = 80
mod 101 = 802 mod 101 = 37
mod 101 = 372 mod 101 = 56
mod 101 = 562 mod 101 = 5
mod 101 = 52 mod 101 = 25
mod 101 = 252 mod 101 = 19
mod 101 = 192 mod 101 = 58
mod 101 = 582 mod 101 = 31
mod 101 = 312 mod 101 = 52
So, 1231003 mod 101 = (22*80*56*25*19*58*31*52) mod 101 = 43
Problem 5 (20 points).
Find all solutions of the recurrence relation an = −5an−1 − 6an−2 + 42 · 4n with a1 = 56 and
a2 = 278.
Answer:
The homogeneous linear recurrence relation is an = −5an−1 − 6an−2
Its corresponding characteristic equation x2+5x+6=0 has 2 roots x1=-1 and x2=-5. And
so,
an(h) = a(-1)n + b(-5)n for some a and b to be found later
F(n) = 42*4n, and s=4 is not a root of the characteristic equation above. Therefore, there
is a particular solution as follows
an(p) = c4n for some c to be found below.
Plug this particular solution into the original equation we have
c4n = -5* c4n-1-6* c4n-2+42*4n
Dividing both sides of this equality by 4n-2, we have
16c = -20c -6c+42*16
è 42c = 42*16
è c = 16
è an(p) = c4n = 4n+2
The solution to the original recurrence relation is
an
=
=
an(h) + an(p)
a(-1)n + b(-5)n + 4n+2
To find a and b, we know that a1= 56 and a2=278
56 = a1 = -a -5b+64 è a+5b=8
278 = a2 = a+25b+256 è a+25b = 22
We can easily find that a = 4, b = 0.8. Thus
an = 4(-1)n+0.8(-5)n+4n+2