Discrete Mathematics Assignment
Discrete Mathematics Assignment
=ℬ 𝑘+1 = ℬ 𝑘 ℬ
𝑘 1 3
= 1 4 −1
0 4𝑘 0 4
𝑘+1
=ℬ 𝑘 = 1 4 −1
0 4𝑘+1
𝟏 𝟒𝒏 −𝟏
Proving 𝓑𝒏 =
𝟎 𝟒𝒏
c) Suppose that a and b are integers, a ≡ 11 (mod 19), and b ≡ 3 (mod 19). Find the integer
c with 0 ≤ c ≤ 18 such that
e) e) Using the Euclidean algorithm find integers 𝑠 and 𝑡 satisfying that gcd (190, 34) = 𝑠(190) +
𝑡(34).
gcd(190,34) = 5(190) + t(34)
190 = 5*34 + 20
34 = 1*20 + 14
20 = 1*14 + 6
14= 2*6 + 2
6 = 3*2
20 = 190-5*34
14 = 34 = t*20
14 = 34 –(190-5*34)
= 34 -190 + 5*34
=-1(190) + 6*34
2= 14-2*6
2=-1 * 190 + 6*34 -2*6
2=[-1(190) + 6(34) -2(20-14)
=[-1(190) + 6(34) – 2[190-5(34) + 190 -6(34)]
=190 +6(34) – 2[2(190) -11(34)]
=-1(190) + 6(34) – 4(190) + 22(34)
= -5(190) + 28(34)
Therefore s= -5 and t= 28
f) UPCs Retail products are identified by their Universal Product Codes (UPCs). The most common
form of a UPC has 12 decimal digits: the first digit identifies the product category, the next five
digits identify the manufacturer, the following five identify the particular product, and the last
digit is a check digit. The check digit is determined by the congruence 3x1 + x2 + 3x3 + x4 + 3x5 +
x6 + 3x7 + x8 + 3x9 + x10 + 3x11 + x12 ≡ 0 (mod 10)
i) (a)Suppose that the first 11 digits of a UPC are 79357343104. What is the check digit?
3𝑥1 + 𝑥2 + 3𝑥3 + 𝑥4 + 3𝑥5 + 𝑥6 + 3𝑥7 + 𝑥8 + 3𝑥9 + 𝑥10 + 3𝑥11 + 𝑥12
≡ 0(𝑚𝑜𝑑10)
= 46
(Adding positions) = 26 + 46
= 72
(Subtracting the last digit from the previous calculation)
10 – 2 = 8
Therefore 8 is the check digit
ii) Is 041331021641 a valid UPC?
3𝑥1 + 𝑥2 + 3𝑥3 + 𝑥4 + 3𝑥5 + 𝑥6 + 3𝑥7 + 𝑥8 + 3𝑥9 + 𝑥10 + 3𝑥11 + 𝑥12
≡ 0(𝑚𝑜𝑑10)
3(0) + 4 + 3(1) + 3 + 5(3) + 1 = 3(0) + 2 + 3(1) + 6 + 3(4) + 1 ≡ 0 (mod 10)
= 50 ≡0(mod 10)
=10/(50 -0)
Therefore 041331021641 is a valid UPC because 10 is divisible by (50 – 0)
g) Find the memory locations assigned by the hashing function h(k) = k mod 111 to the records of
customers with Social Security numbers 064212848 and 037149212.
h (064212848)
= 064212848 mod 111 = 14
h (037149212)
= 037149212 mod 111 = 65
h) In this question suppose that Alice and Bob have these public keys and corresponding private
keys: (nAlice, eAlice) = (2867, 7) = (61 ・ 47, 7), dAlice = 1183 and (nBob, eBob) = (3127, 21) =
(59 ・ 53, 21), dBob = 1149. First express your answers without carrying out the calculations.
Then, using a computational aid, if available, perform the calculation to get the numerical
answers.
i) Alice wants to send to all her friends, including Bob, the message “SELL EVERYTHING” so that he
knows that she sent it. What should she send to her friends, assuming she signs the message
using the RSA cryptosystem?
Given the message SELL EVERYTHING Let A=0, B=1, C=2, D=3, E=4, F=5 ,G=6, H=7, I=8, J=9, K=10,
L=11, M=12, N=13, O=14, P=15, Q=16, R= 17, S=18, T=19, U=20, V=21, W=22, X=23, Y=24, Z=25
Given the message BUY NOW Let A=0, B=1, C=2, D=3, E=4, F=5 ,G=6, H=7, I=8, J=9, K=10, L=11, M=12,
N=13, O=14, P=15, Q=16, R= 17, S=18, T=19, U=20, V=21, W=22, X=23, Y=24, Z=25
01 20 24 13 14 22
b) Step 1
Alice and Bob should agree on a large prime p and a non-zero integer g modulo p. It is best that they use
g such that its order in 𝔽*p is a large prime.
Step 2
Alice picks a secret integer 𝑎 that she does not share with anyone while Bob picks an integer 𝑏 which he
keeps in secret. They should both use their secret integers such that:
Step 3
After computing these values, Alice and Bob should exchange them. Therefore Alice sends A to Bob and
Bob sends B to Alice.
Step 4
Bob will now take the number that Alice sent and does the exact same operation with it.
Therefore 𝑩𝒂 𝒎𝒐𝒅 𝒑
Step 5
Alice will do the same thing with Bob’s result that he sent to her such that :
𝑨𝒃 𝒎𝒐𝒅 𝒑
Due to the property of modulo exponents, Alice and Bob get their answers in step 4 and 5 and that’s
what they use as their shared secret.
f(x) = 2x+1
g(x) = 3/x-1
𝑓𝑜𝑔 = 2(3/x-1)+1
(6/x-1)+ 1
=x+5/x-1
𝑔𝑜𝑓= 3/(2x+1)-1
= 5/2x
l) Let f : Z → Z be such that 𝑓 (𝑥) = 𝑥 + 1. Is 𝑓 invertible, and if it is, what is its inverse?
Proving for bijection:
if 𝑓(𝑥) = 𝑓(𝑦) then 𝑥 = 𝑦
x + 1 = y+ 1
x = y+1-1
x=y
Therefore: 𝑓(𝑥) is injective
f(x) = (y-1)+1
f(x)=y
Therefore 𝑓(𝑥) is surjective
m) Show that if 𝑎𝑑 − 𝑏𝑐 ≠ 0, then the function 𝑓(𝑥) = 𝑎𝑥+𝑏 /𝑐𝑥+𝑑 is one-to-one and find its inverse
𝑎𝑥+𝑏
Let y = f(x) =
(𝑐𝑥+𝑑)
Thus (𝑦(𝑐𝑥 + 𝑑) = 𝑎𝑥 + 𝑏
cxy + dy = ax+b
cxy-ax=b-dy
𝑥(𝑐𝑦 − 𝑎) = 𝑏 − 𝑑𝑦
(𝑏−𝑑𝑦)
𝑥= (𝑐𝑦−𝑎)
(𝑏−𝑑𝑦)
𝑥 = 𝑓 −1 (𝑦) = 𝑐𝑦−𝑎
𝒃−𝒅𝒙
Therefore, the function 𝑓(𝑥) = 𝑎𝑥+𝑏 /𝑐𝑥+𝑑 if one-to-one is 𝒇−𝟏 (𝒙) = 𝒄𝒙−𝒂
(3𝑥 − 5)(𝑥 + 4) ≥ 0
Therefore, range is (3𝑥 − 5) ≥ 0 𝑜𝑟 (𝑥 + 4) ≥ 0
3x/3 ≥ 5/3 or x ≥ - 4
x ≥ 5/3
x^3 – 16𝑥 ≠ 0
𝑥(𝑥 2 − 16) ≠ 0