You are on page 1of 19

THE UNIVERSITY OF THE WEST INDIES

ASSIGNMENT 1
SEMESTER I, 2022/2023
Code and Name of Course: COMP2201 – Discrete Mathematics

Assignment 1 - Individual Assignment

AREA DESCRIPTION
Objectives To have a student apply the knowledge garnered during the first few weeks of
the course

Title Assignment 1 – Individual Assignment

Deliverable The answers for the questions which follow the instruction pages

Instructions 1. Review Lectures of the first three weeks of the course, the COMP2201
Text and any other related Discrete Mathematics material
2. Read the Assignment 1 Sheet thoroughly
3. Submit the gradable solution by using the
COMP2201 Assignment 1 - Individual located within the
ASSIGNMENTS Section of the OURVLE COMP2201 Course
Environment. This may also be accessed by choosing the Assignments
section below “Activities”

Format The solution for this assignment must be submitted as a Microsoft Word
document.

Your ID number should form part of the Microsoft Word file name. The file
name should take the format “COMP2201 Assignment 1 Semester 1 2022-
2023 XXXXXXXX” where XXXXXXXX represents the student ID number.

Upload The solution for this assignment should be uploaded in the relevant space
Constraint provided in OURVLE (See “Instructions” section above). A message
indicating “File uploaded successfully” will acknowledge that the file has
been sent successfully.

Do NOT assume your project has been received if you do not get this
acknowledgement.

Scoring Rubric Your electronic submission will be evaluated on:


1. Your attempt of the compulsory questions 1, 4 and 7
2. The response submitted for each question (See detail individual
marks below) – Maximum 50 marks
The actual grade of 50 marks will be displayed. The actual grade allocated is
the percentage of the maximum marks (5 points)

Late Late assignments are accepted. These are however graded then 25%
Assignments deducted for each day of late submission.

Expectation It is expected that students will discuss means to a solution. The actual work
written is expected to reflect each student’s uniqueness. Where replication of
work is identified, each paper will be graded. The allocated grade to each
student’s piece of work for where this anomaly is identified will be the grade
divided by the number of replications discovered.

Due Date Sunday, October 2, 2022


Question 1 [10 marks] – COMPULSORY
[The fraction of the marks attained for this question determines the fraction of the
attained marks to be allocated for questions 2 and 3.]
Given a sequence with n objects where there are n1 indistinguishable objects of type 1,
n2 indistinguishable objects of type 2, ..., nt indistinguishable objects of type t

(a) Where the number of repetitions of each object is known as in the word

AEQUEOSALINOCALCALINOCERACEOALUMINOSOCUPREOVITRIOLIC

show why the formula for the number of permutations (orderings) of n objects of
t types is n!
n1 !n 2 !. .. nt !
[2]

 The formula for the number of permutations of n objects of t types is


(n! / n1! x n2! x … x nt!), because the orderings have repetitions and
many objects can be picked in different ways.

(b) Hence, determine the number of words using all the letters that may be formed
from the said word
AEQUEOSALINOCALCALINOCERACEOALUMINOSOCUPREOVITRIOLIC
[1]
52 !
 8 ! 6 ! 6 ! 6 !5 ! 3! 3!2 ! = 6.203212188 x1050
(c) Using your formula in (b), state a simplified formula for the number of unique
codewords, assuming a codeword such as
zibp082AEQUEOSALINOCALCALINOCERACEOALUMINOSOCUPREOVITRIOLIC(*#*$
is made up of 4 lowercase letters of the English alphabet where order is not
important, 3 distinct digits where order is important, the uppercase letters of the
word in (a), and 5 special characters (allowing repeats with order not being
important), all in the same order. For ease of reference, it is accepted that there are
32 special characters. [3]


(d) Develop a question that the third form of the Pigeonhole Principle may be
used to solve. [2]

 Question: Each month one bus travels from UWI Mona to Spanish Town.
In 2020 due to Covid, 6 buses traveled the route. Show that at least one bus
traveled 2 months.

(e) Using the third form of the Pigeonhole Principle, solve the question in (d). [2]

 Assuming X is the number of days in a week – {1, 2, 3……12} and Y is the


number of buses that travels – { c1, c2, c3,…..c6 }.

We have |X| = n = 12 and |Y| = m = 6 and k = ceiling of (n/m),


Which is; ceiling of (12/6) = ceiling of (2) = 2.

By pigeonhole principle, there are at least 2 months b1, b2 that is an


element of X, such that f (a1) = f (a2), i.e. match the same bus.
Therefore, at least 1 bus travels 2 of the months.
Question 2 [6 marks]
Solve the following question using Tree Diagrams.
A five-person committee composed of Paul, Quilston, Rhona, Sashe and Trevion is to
select a Captain, Vice Captain and Operations Officer. How many selections are there
in which either Rhona is Vice Captain or Trevion is Captain, or Quilston is Operations
Officer otherwise he is not an officer? [6]

From the Tree Diagram, the number of selections in which either Rhona is Vice Captain or
Trevion is Captain, or Quilston is Operations Officer otherwise he is not an officer is Forty-Two
(42).
Question 3 [2 marks]
By drawing Pascal’s Triangle and applying Pascal’s Theorem, show that both methods
may be used to determine equivalent values for the row of Pascal’s triangle containing
the following binomial coefficients

(¿¿12k ), 0 ≤ k ≤12 [2]

 To determine the row of Pascal’s triangle containing the following binomial coefficients

( )
¿ 12 , 0 ≤ k ≤12
¿k

1 1

1 2 1

1 3 3 1

1 4 6 4 1

1 5 10 10 5 1

1 6 15 20 15 6 1

1 7 21 35 35 21 7 1

1 8 28 56 70 56 28 8 1

1 9 36 84 126 126 84 36 9 1

1 10 45 120 210 252 210 120 45 10 1

1 11 55 165 330 462 462 330 165 55 11 1

1 12 66 220 495 792 924 792 495 220 66 12 1

Therefore, the row of Pascal’s triangle containing the binomial coefficients

(¿¿12k ), 0 ≤ k ≤12 is
1 12 66 220 495 792 924 792 495 220 66 12 1
Pascal’s Theorem states,

C (n+1, k) = C (n, k+1) + C(n, k) for 1 ≤ k ≤ n

Therefore,

 C (11+1, k) = C(11, k-1) + C(11, k)


C (11+1, 1) = C(11, 1-1) + C(11, 1) = 12

C (11+1, 2) = C(11, 2-1) + C(11, 2) = 66

C (11+1, 3) = C(11, 3-1) + C(11, 3) = 220

C (11+1, 4) = C(11, 4-1) + C(11, 4) = 495

C (11+1, 5) = C(11, 5-1) + C(11, 5) = 792

C (11+1, 6) = C(11, 6-1) + C(11, 6) = 924

C (11+1, 7) = C(11, 7-1) + C(11, 7) = 792

C (11+1, 8) = C(11, 8-1) + C(11, 8) = 495

C (11+1, 9) = C(11, 9-1) + C(11, 9) = 220

C (11+1, 10) = C(11, 10-1) + C(11, 10) = 66

C (11+1, 11) = C(11, 11-1) + C(11, 11) = 12


Question 4 [5 marks] – COMPULSORY
[The fraction of the marks attained for this question determines the fraction of the
attained marks to be allocated for questions 5 and 6.]
(a) Develop a question that may be solved with the principles of Modular
Arithmetic. [1]
 If x is congruent to 13 modulo 17 then 7x - 3 is congruent to which number
modulo 17?

(b) Construct the Addition and Multiplication Tables in Z13. [4]

Addition Table of Z13

+ 0 1 2 3 4 5 6 7 8 9 10 11 12

0 0 1 2 3 4 5 6 7 8 9 10 11 12

1 1 2 3 4 5 6 7 8 9 10 11 12 0

2 2 3 4 5 6 7 8 9 10 11 12 0 1

3 3 4 5 6 7 8 9 10 11 12 0 1 2

4 4 5 6 7 8 9 10 11 12 0 1 2 3

5 5 6 7 8 9 10 11 12 0 1 2 3 4

6 6 7 8 9 10 11 12 0 1 2 3 4 5

7 7 8 9 10 11 12 0 1 2 3 4 5 6

8 8 9 10 11 12 0 1 2 3 4 5 6 7

9 9 10 11 12 0 1 2 3 4 5 6 7 8

10 10 11 12 0 1 2 3 4 5 6 7 8 9

11 11 12 0 1 2 3 4 5 6 7 8 9 10

12 12 0 1 2 3 4 5 6 7 8 9 10 11
Multiplication Table of Z13

* 0 1 2 3 4 5 6 7 8 9 10 11 12

0 0 0 0 0 0 0 0 0 0 0 0 0 0

1 0 1 2 3 4 5 6 7 8 9 10 11 12

2 0 2 4 6 8 10 12 1 3 5 7 9 11

3 0 3 6 9 12 2 5 8 11 1 4 7 10

4 0 4 8 12 3 7 11 2 6 10 1 5 9

5 0 5 10 2 7 12 4 9 1 6 11 3 8

6 0 6 12 5 11 4 10 3 9 2 8 1 7

7 0 7 1 8 2 9 3 10 4 11 5 12 6

8 0 8 3 11 6 1 9 4 12 7 2 10 5

9 0 9 5 1 10 6 2 11 7 3 12 8 4

10 0 10 7 4 1 11 8 5 2 12 9 6 3

11 0 11 9 7 5 3 1 12 10 8 6 4 2

12 0 12 11 10 9 8 7 6 5 4 3 2 1
Question 5 [5 marks]
(a) A computer access password consists of from four to ten letters chosen from
the 22 in the Hebrew alphabet with repetitions not allowed. How many
different passwords are possible? [2]

 The combination formula that should be used in this solution is ( nPr = n! /


(n-r)! ) because the question said no repetitions are allowed.

nPr = n! / (n-r)!

22P4 + 22P5 + 22P6 + 22P7 + 22P8 + 22P9 + 22P10

= 2.5408625 x1012

(b) If any thirteen letters (of the 24-letter Greek alphabet) could be used to form a
password, how many thirteen-letter passwords would have at least one repeated
letter? [3]

 13 letter Greek words with at least one repeated letter


= All 9-letter words less 13 letter words with no repeated letters
= 2413 – 24P13
= 8.609447979 x1017
Question 6 [3 marks]
Expand the following expression using the binomial theorem: ( 3u2 – 2v3 – 4w )4 [3]

 By using the binomial theorem,


n
( a+ b ) =∑ C ( n , k ) an−k b k
n

k=0

(3u2 – 2v3 +4w) 4


[3u2 – (2v3 +4w)] 4
Let a = 3u2, b = – (2v3 +4w), n = 4
¿¿

= C (4,0) a4 b0 + C (4,1) a4-1 b1 + C (4,2) a4-2 b2 + C (4,3) a4-3 b3 + C (4,4) a4-4 b4


= 1 a4 b0 + 4 a3 b1 + 6 a2 b2 + 4 a1 b3 +1 a0 b4

By substitution,

= (3u2)4 (-2v3 + 4w)0 + 4 (3u2)3 (-2v3 + 4w)1 + 6 (3u2)2 (-2v3 + 4w)2 + 4 (3u2)1 (-2v3
+ 4w)3 + (3u2)0 (-2v3 + 4w)4

= 81u8 + 4 (27u6) (-(2v3 + 4w)) + 6 (9u4) (-(4v6 + 16wv3 + 16w2) + 4 (3u2)1 (-(8v9 +
48wv6 + 96v3w2 + 64w3)) + (-(16v12 + 128v9w + 384v6w2 + 512v3w3 + 256w4))

= 81u8 + (108u6)(-(8v3 + 16w)) + (54u4)(-(24v6 + 96wv3 + 96w2)+ 4(12u2)(-(32v9 +


192wv6 + 384v3w2 + 256w3))+ (-(16v12 + 128v9w + 384v6w2 + 512v3w3 + 256w4))

= 81u8 + (108u6)(-(8v3 + 16w)) + (54u4)(-(24v6 + 96wv3 + 96w2) + (12u2)(-(32v9 +


192wv6 + 384v3w2 + 256w3))+ (-(16v12 + 128v9w + 384v6w2 + 512v3w3 + 256w4))

Question 7 [10 marks] – COMPULSORY


[The fraction of the marks attained for this question determines the fraction of the
attained marks to be allocated for questions 8 and 9.]
(a) Johanna Charles was born on a Tuesday and had her first child Jo-Ann on the
same day when she was celebrating her twenty-eighth birthday. Use modular
arithmetic to explain why her first child Jo-Ann that was born on the same day
and month as Johanna was also born on the same day (Tuesday) twenty-eight
years after Johanna’s birthday. [3]

 There are 365 days in a year. So, the number of days in 28 years is (365 × 28 =)
10,220 days.
However, every 4 years is a leap year, therefore assuming we are in a leap year,
during the 28 years, there will be (28 ÷ 4 = ) 7 leap years. Being that each leap
year carries an extra day, there will be 7 additional days. Hence the total number
of days is (10,220 + 7 =) 10,227 days.
10,227 mod 7 = 0
Any multiple of 7 days past a given date will be on the same day of the week.
Given that there were no remainders, it is a multiple of 7 and therefore the same
day.
So, if a date falls on Tuesday 28 years ago,, it will fall on the same day, Tuesday,
28 years after.

(b) The Greek Mathematician Euclid developed an algorithm to determine the


Greatest Common Divisor (GCD) also known as the Highest Common Factor.
Develop an algorithm to determine the Least Common Multiple (LCM). [2]
 function LCM (x, y)
if a is 0 or b is 0
return Error
larger = max(x, y)
if larger mod x == 0 and larger mod y == 0
return larger
else
xprimes = getPrimes(x)
yprimes = getPrimes(y)
lcmprimes = allPrimes(xprimes, yprimes)
return productOfList(lcmprimes)

function getPrimes(n)
return list_of_all_primes_whose_product_is_n

function allPrimes(xlst, ylst)


xlst_power = get_list_of_unique_primes_and_occurrences_from_x lst
ylst_power = get_list_of_unique_primes_and_occurrences_from_y lst

for each prime in (xlst_power, ylst_power)


if occurrence in xlst is greater
allprimeslst = allprimeslst + xlst[xindex]
else
allprimeslst = allprimeslst + ylst[yindex]
return allprimeslst

function productOfList(lst)
if lst is empty
product = 0
else
product = 1
for value in lst
product = product * value[0] ^ value[1]
return product

(c) Using the algorithm provided for section (b) of this question, illustrate how
your algorithm would find the Least Common Multiple of 52668 and 227205. [3]


(d) Using the Euclidean Algorithm, illustrate how the Highest Common Factor of
52668 and 227205. [2]


Question 8 [5 marks]
Using any programming language taught in your first year at the university, write a
function No_Fib_Checker that takes two lists of integers lst1 and lst2, and returns
False if the numbers in any of the two lists are not consecutive numbers within the
Fibonacci sequence. True is returned otherwise. [5]

 def No_Fib_Checker (list1, list2):


def checkStart (n0, n1, x, y, ln):
if x > n0:
return False
elif (ln == 1 and n0 == x) or (ln >= 2 and n0 == x and n1 == y):
return True
else:
return checkStart(n0, n1, y, x+y, ln)
for lst in [list1, list2]:
if len(lst) == 0:
return False
else:
if len(lst) == 1:
if checkStart(lst[0], 0, 0, 1, len(lst)):
continue
else:
return False
elif checkStarter (lst[0], lst[1], 0, 1, len (lst)):
if len (lst) == 2:
continue
for i in range (2,len(lst)):
if lst[i-2]+lst[i-1] != lst[i]:
return False
continue
else:
return False
return True

Question 9 [4 marks + Bonus 5 marks (to an assignment maximum of 50 marks)]


Let f(n) be defined by
f (1)=3 f (n)=125 f ( 5n )+56 n 3

if n > 1 and n = 5m, where m is a positive integer.

(a) By using the principles of Recurrence Relation, find a general formula


for f(n) [4]

 f(n) = 125 f (n/5) + 56n3 …… 1


As f(n/5) = 125f (n/52) + 56(n/5)3
= 125 [125 f(n/52) + 56(n/5)3] + 56n3
f(n) = 1252 f(n/52) + 2 (56n3) …… 2
As f(n/52) = 125f (n/53) + 56(n/52)3
= 1252 [125 f(n/53) + 56(n/52)3] + 2 (56n3)
f(n) = 1253 f(n/53) + 3 (56n3) …… 3
As f(n/53) = 125f (n/54) + 56(n/53)3
= 1253 [125 f(n/53) + 56(n/53)3] + 3 (56n3)
f(n) = 1254 f(n/54) + 4 (56n3) …… 4
As f(n/54) = 125f (n/55) + 56(n/54)3
= 1254 [125 f(n/55) + 56(n/54)3] + 4 (56n3)
f(n) = 1255 f(n/55) + 5 (56n3) …… 5

Restating the equations


f(n) = 125 f (n/5) + 56n3 …… 1
f(n) = 1252 f(n/52) + 2 (56n3) …… 2
f(n) = 1253 f(n/53) + 3 (56n3) …… 3
f(n) = 1254 f(n/54) + 4 (56n3) …… 4
f(n) = 1255 f(n/55) + 5 (56n3) …… 5
f(n) = 125m f(n/5m) + m (56n3) where m  1

(b) Hence show that f(n) = Θ (n3 log 5 n). [Bonus - 5]

 f(n) = 125m f(n/5m) + m (56n3) where m  1


As n = 5m
n/5m = 1 AND log5 n = m
As m = log5 n and n/5m = 1 and f(1) = 3

f(n) = 125m f(n/5m) + m (56n3)


= 125m * f(1) + m (56n3)
= 125 log5 n * 3 + log5 n (56n3)
= (5*5*5) log5 n * 3 + 56n3 log5 n
= 5 log5 n * 5 log5 n * 5 log5 n * 3 + 56n3 log5 n
= n * n * n * 3 * + 56n3 log5 n
= 3n3 + 56n3 log5 n
Therefore,
f(n) = 3n3+ 56n3 log5 n
As log5 n = m AND m > 1, log5 n ≥ 1 AND n3 ≤ n4 log5 n
Given,
f(n) = 3n3+ 56n3 log5 n
f(n) ≤ 3n 3 log5 n + 56n3 log5 n
f(n) ≤ 59n3 log5 n
f(n) = O (n3 log5 n)
Likewise,
f(n) = 3n3+ 56n3 log5 n
f(n) ≥ 56n3 log5 n
f(n) = Ω (n3 log5 n)
As f(n) = O (n3 log5 n) and f(n) = Ω (n3 log5 n)
Hence,
f(n) = ϴ (n3 log5 n)

You might also like