Uploaded by ronica coorey

427182006 Discrete Mathematics Complete Assignment.pdf

advertisement
1
Higher Nationals
Internal verification of assessment decisions – BTEC (RQF)
INTERNAL VERIFICATION – ASSESSMENT DECISIONS
Programme title
BTEC Higher National Diploma in Computing
Assessor
Unit(s)
Assignment title
Student’s name
Internal Verifier
Unit 18 : Discrete Mathematics
Discrete mathematics in software engineering concepts
S.M Nipuna Madhuranga Samarakoon
List which assessment
criteria the Assessor has
awarded.
Pass
Merit
Distinction
INTERNAL VERIFIER CHECKLIST
Do the assessment criteria awarded match
those shown in the assignment brief?
Is the Pass/Merit/Distinction grade awarded
justified by the assessor’s comments on the
student work?
Has the work been assessed
accurately?
Y/N
Y/N
Y/N
Is the feedback to the student:
Give details:
• Constructive?
• Linked to relevant assessment
criteria?
Y/N
Y/N
• Identifying opportunities for
improved performance?
Y/N
• Agreeing actions?
Y/N
Does the assessment decision need
amending?
Y/N
Assessor signature
Date
Internal Verifier signature
Date
Programme Leader signature (if
required)
Date
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
2
Confirm action completed
Remedial action taken
Give details:
Assessor signature
Date
Internal Verifier
signature
Date
Programme Leader
signature (if required)
Date
Higher Nationals - Summative Assignment Feedback Form
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
3
Student Name/ID
Unit Title
Unit 18 : Discrete Mathematics
Assignment Number
1
Assessor
Submission Date
Date Received 1st
submission
Re-submission Date
Date Received 2nd
submission
Assessor Feedback:
LO1 Examine set theory and functions applicable to software engineering.
Pass, Merit & Distinction
P1
P2
M1
D1
Descripts
LO2 Analyse mathematical structures of objects using graph theory.
Pass, Merit & Distinction
Descripts
P3
P4
M2
D2
LO3 Investigate solutions to problem situations using the application of Boolean algebra.
Pass, Merit & Distinction
P5
P6
M3
D3
Descripts
LO4 Explore applicable concepts within abstract algebra.
Pass, Merit & Distinction
Descripts
Grade:
P7
P8
M4
D4
Assessor Signature:
Date:
Assessor Signature:
Date:
Resubmission Feedback:
Grade:
Internal Verifier’s Comments:
Signature & Date:
* Please note that grade decisions are provisional. They are only confirmed once internal and external moderation has taken place and grades decisions have
been agreed at the assessment board.
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
4
Pearson
Higher Nationals in Computing
Unit 18: Discrete Mathematics
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
5
General Guidelines
1. A Cover page or title page – You should always attach a title page to your assignment. Use previous page as
your cover sheet and make sure all the details are accurately filled.
2. Attach this brief as the first section of your assignment.
3. All the assignments should be prepared using a word processing software.
4. All the assignments should be printed on A4 sized papers. Use single side printing.
5. Allow 1” for top, bottom, right margins and 1.25” for the left margin of each page.
Word Processing Rules
1.
2.
3.
4.
The font size should be 12 point, and should be in the style of Time New Roman.
Use 1.5-line spacing. Left justify all paragraphs.
Ensure that all the headings are consistent in terms of the font size and font style.
Use footer function in the word processor to insert Your Name, Subject, Assignment No, and Page
Number on each page. This is useful if individual sheets become detached for any reason.
5. Use word processing application spell check and grammar check function to help editing your assignment.
Important Points:
1. Carefully check the hand in date and the instructions given in the assignment. Late submissions will not be
accepted.
2. Ensure that you give yourself enough time to complete the assignment by the due date.
3. Excuses of any nature will not be accepted for failure to hand in the work on time.
4. You must take responsibility for managing your own time effectively.
5. If you are unable to hand in your assignment on time and have valid reasons such as illness, you may apply (in
writing) for an extension.
6. Failure to achieve at least PASS criteria will result in a REFERRAL grade.
7. Non-submission of work without valid reasons will lead to an automatic RE FERRAL. You will then be asked
to complete an alternative assignment.
8. If you use other people’s work or ideas in your assignment, reference them properly using HARVARD
referencing system to avoid plagiarism. You have to provide both in-text citation and a reference list.
9. If you are proven to be guilty of plagiarism or any academic misconduct, your grade could be reduced to A
REFERRAL or at worst you could be expelled from the course
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
6
Student Declaration
I hereby, declare that I know what plagiarism entails, namely to use another’s work and to present it as my own without
attributing the sources in the correct way. I further understand what it means to copy another’s work.
1. I know that plagiarism is a punishable offence because it constitutes theft.
2. I understand the plagiarism and copying policy of the Edexcel UK.
3. I know what the consequences will be if I plagiaries or copy another’s work in any of the assignments for this
program.
4. I declare therefore that all work presented by me for every aspect of my program, will be my own, and where I
have made use of another’s work, I will attribute the source in the correct way.
5. I acknowledge that the attachment of this document signed or not, constitutes a binding agreement between
myself and Edexcel UK.
6. I understand that my assignment will not be considered as submitted if this document is not attached to the
attached.
Nipuna2255@gmail.com
Student’s Signature:
(Provide E-mail ID)
S.M Nipuna Madhuranga Samarakoon
Date:
(Provide Submission Date)
HND Batch 29
Discrete Mathematics
7
Assignment Brief
Student Name /ID Number
S.M Nipuna Madhuranga Samarakoon
Unit Number and Title
Unit 18: Discrete Mathematics
Academic Year
Unit Tutor
Assignment Title
Discrete mathematics in Computing
Issue Date
Submission Date
IV Name & Date
Submission Format:
This assignment should be submitted at the end of the module, on the week stated at the front of this brief. The
assignment can either be word-processed or completed in legible handwriting.
If the tasks are completed over multiple pages, ensure that your name and student number are present on each page.
Unit Learning Outcomes:
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
8
LO1
Examine set theory and functions applicable to software engineering
LO2
Analyze mathematical structures of objects using graph theory
LO3
Investigate solutions to problem situations using the application of Boolean algebra
LO4
Explore applicable concepts within abstract algebra.
Assignment Brief and Guidance:
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
9
Activity 01
Part 1
1. Let A and B be two non-empty finite sets. If cardinalities of the sets A, B, and A  B are respectively
72, 28 and 13, then find the cardinality of the set A  B .
2. If n( A  B )=45, n( A  B )=110 and n( A  B )=15, then find n(B).
3. If n(A)=33, n(B)=36 and n(C)=28, find n( A  B  C ).
Part 2
1. Write the multisets of prime factors for the given numbers.
I.
160
II.
120
III.
250
2. Write the multiplicities of each element of multisets in part 2(1-I, ii,iii) separately.
3. Find the cardinalities of each multiset in part 2-1.
Part 3
1. Determine whether the following functions are invertible or not. If it is invertible, then find the rule
of the inverse  f 1  x 
i. f :    
ii. f :     
f ( x)  x 2
iii.
f : 

f ( x)  1

iv.

x

f :   ,    1, 1
2 2
f ( x)  sin x
f ( x)  x 2
v. f : 0 ,     2, 2
f ( x)  2 5
cos x
2. Function f ( x)  ( x  32) converts Fahrenheit temperatures into Celsius. What is the function for
9
opposite conversion?
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
10
Part 4
1.
Formulate corresponding proof principles to prove the following properties about defined sets.
A  B  A  B and B  A
i.
ii. De Morgan’s Law by mathematical induction
iii. Distributive Laws for three non-empty finite sets A, B, and C
Activity 02
Part 1
1. Discuss two examples on binary trees both quantitatively and qualitatively.
Part 2
1. State the Dijkstra’s algorithm for a directed weighted graph with all non-negative edge weights.
2. Find the shortest path spanning tree for the weighted directed graph with vertices A, B, C, D, and
E given using Dijkstra’s algorithm.
Part 3
1. Check whether the following graphs have a Eulerian and/or Hamiltonian circuit.
I.
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
11
II.
III.
Part 4
1. Construct a proof for the five color theorem for every planar graph.
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
12
2. Discuss how efficiently Graph Theory can be used in a route planning project for a vacation trip
from Colombo to Trincomalee by considering most of the practical situations (such as mileage of
the vehicle, etc.) as much as you can. Essentially consider the two fold,
- Routes with the shortest distance (Quick route travelling by own vehicle)
- Route with the lowest cost
3. Determine the minimum number of separate racks needed to store the chemicals given in the table
(1st column) by considering their incompatibility using graph coloring technique. Clearly state you
steps and graphs used.
Chemical
Incompatible with
Ammonia
(anhydrous)
Mercury, chlorine, calcium hypochlorite,
iodine, bromine, hydrofluoric acid (anhydrous)
Chlorine
Ammonia, acetylene, butadiene, butane, methane, propane
, hydrogen, sodium carbide, benzene,
finely divided metals, turpentine
Iodine
Acetylene, ammonia (aqueous or anhydrous), hydrogen
Silver
Acetylene, oxalic acid, tartaric acid, ammonium compounds,
pulmonic acid
Iodine
Acetylene, ammonia (aqueous or anhydrous), hydrogen
Mercury
Acetylene, pulmonic acid, ammonia
Fluorine
All other chemicals
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
13
Activity 03
Part 1
1. Discuss two real world binary problems in two different fields using applications of Boolean Algebra.
Part 2
1. Develop truth tables and its corresponding Boolean equation for the following scenarios.
i. ''If the driver is present AND the driver has NOT buckled up AND the ignition switch is on,
then the warning light should turn ON.''
ii. If it rains and you don't open your umbrella, then you will get wet.
2. Produce truth tables for given Boolean expressions.
i. A B C  AB C  ABC  A BC
ii. ( A  B  C )( A  B  C )( A  B  C )
Part 3
2. Find the simplest form of given Boolean expressions using algebraic methods.
i. A(A+B)+B(B+C)+C(C+A)
ii.
( A  B )( B  C )  ( A  B)(C  A )
iii. ( A  B)( AC  AC )  AB  B
iv. A ( A  B)  ( B  A)( A  B )
Part 4
1. Consider the K-Maps given. For each K- Map
i. Write the appropriate standard form (SOP/POS) of Boolean expression.
ii. Draw the circuit using AND, NOT and OR gates.
iii. Draw the circuit only by using
i. NAND gates if the standard form obtained in part (i) is SOP.
ii. NOR gates if the standard form obtained in pat (i) is POS.
(a)
AB/C
0
1
00
0
0
01
0
1
10
1
0
11
0
1
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
14
(b)
AB/C 00
D
00
1
01
10
11
0
0
1
01
0
1
0
1
10
1
1
1
1
11
1
1
0
1
(c)
AB/C
0
1
00
1
0
01
1
1
10
0
1
11
1
0
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
15
Activity 04
Part 1
1. Describe the characteristics of different binary operations that are performed on the same set.
2. Justify whether the given operations on relevant sets are binary operations or not.
i.
Multiplication and Division on se of Natural numbers
ii.
Subtraction and Addition on Set of Natural numbers
iii.
Exponential operation: ( x, y )  x y on Set of Natural numbers and set of Integers
Part 2
1. Build up the operation tables for group G with orders 1, 2, 3 and 4 using the elements a, b, c, and e as
the identity element in an appropriate way.
2. i. State the Lagrange’s theorem of group theory.
ii. For a subgroup H of a group G, prove the Lagrange’s theorem.
iii. Discuss whether a group H with order 6 can be a subgroup of a group with order 13 or not. Clearly
state the reasons.
Part 3
1. Check whether the set S    {1} is a group under the binary operation ‘*’defined as
a * b  a  b  ab for any two elements a, b  S .
2. i. State the relation between the order of a group and the number of binary operations that can be
defined on that set.
II. How many binary operations can be defined on a set with 4 elements?
3. Discuss the group theory concept behind the Rubik’s cube.
Part 4
1. Prepare a ten minutes presentation that explains an application of group theory in computer
sciences.
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
16
Grading Rubric
Grading Criteria
Achieved
Feedback
LO1 : Examine set theory and functions applicable to software
engineering
P1 Perform algebraic set operations in a formulated mathematical
problem.
P2 Determine the cardinality of a given bag (multiset).
M1 Determine the inverse of a function using appropriate
mathematical technique.
D1 Formulate corresponding proof principles to prove properties about
defined sets.
LO2 Analyse mathematical structures of objects using graph
theory.
P3 Model contextualized problems using trees, both quantitatively and
qualitatively.
P4 Use Dijkstra’s algorithm to find a shortest path spanning tree in a
graph.
M2 Assess whether an Eularian and Hamiltonian circuit exists in an
undirected graph.
D2 Construct a proof of the Five colour theorem.
LO3 Investigate solutions to problem situations using the
application of Boolean algebra.
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
17
P5 Diagram a binary problem in the application of Boolean Algebra.
P6 Produce a truth table and its corresponding Boolean equation from
an applicable scenario.
M3 Simplify a Boolean equation using algebraic methods.
D3 Design a complex system using logic gates.
LO4 Explore applicable concepts within abstract algebra.
P7 Describe the distinguishing characteristics of different binary
operations that are performed on the same set.
P8 Determine the order of a group and the order of a subgroup in
given examples.
M4 Validate whether a given set with a binary operation is indeed a
group.
D4 Prepare a presentation that explains an application of group
theory relevant to your course of study.
S.M Nipuna Madhuranga Samarakoon
HND Batch 29
Discrete Mathematics
18
Contents
Activity 01 ................................................................................................................. 19
Part 1 .................................................................................................................................... 19
Part 2 .................................................................................................................................... 21
Part 3 .................................................................................................................................... 22
Part 4 .................................................................................................................................... 27
Activity 02 .................................................................................................................27
Part 1 .................................................................................................................................... 27
Part 2 .................................................................................................................................... 32
2. ................................................................................................................................................... 33
Part 3 ............................................................................................................................................. 33
Part 4 .................................................................................................................................... 34
Activity 03 .................................................................................................................35
Part 1 .................................................................................................................................... 35
Part 2 .................................................................................................................................... 36
Part 3 .................................................................................................................................... 38
Part 2 .................................................................................................................................... 39
1. ................................................................................................................................................... 39
Part 4 .................................................................................................................................... 40
Activity 04 ................................................................................................................ 42
Part 1 .................................................................................................................................... 42
2. ................................................................................................................................................... 43
Part 2 .................................................................................................................................... 44
1. ................................................................................................................................................... 44
2. ................................................................................................................................................... 45
Part 3 .................................................................................................................................... 47
Part 4 .................................................................................................................................... 47
S.M Nipuna Madhuranga SamarakoonHND Batch 29
Discrete Mathematics
19
Discrete Mathematics Assignment
Activity 01
Part 1
1. Let A and B be two non-empty finite sets. If cardinalities of the sets A, B, and
A  B are 72, 28 and 13 respectively, find the cardinality of the set A  B .
n( A  B ) = n(A) + n(B) - n( A  B )
n( A  B ) = 72 + 28 - 13
n( A  B ) = 87
2. If n( A  B )=45, n( A  B )=110 and n( A  B )=15, then find n(B).
n( A  B ) =45
n( A  B ) =110
n( A  B ) =15
n( A  B ) = n( A  B ) + n( B  A ) + n( A  B )
110 = 45 + n( B  A ) + 15
110 = 60 + n( B  A )
n( B  A ) = 50
n(B) = n( B  A ) + n( A  B )
n(B) = 50 + 15
n(B) = 65
P( A  B  C )= ?
S.M Nipuna Madhuranga SamarakoonHND Batch 29
Discrete Mathematics
20
P(A)= 33
P(B)= 36
P(C)= 28
P( A  B  C )=P(A)+ P(B)+ P(C) - P( A  B ) - P( A C )-P( B  C )
P(A)= 10+ a + 5+b = 33
15+a+b = 33
a + b = 18
1
15+a+5+c = 36
20+ a+ c =36
a + c = 16
2
13+ 5+b+c = 28
b + c= 28 – 18
b + c = 10
3
a + b = 18
1
b + c= 160
2
b + c = 16
3
1+3
a + b – b-c = 8
a - c =8
4
2+4
2a = 24
a= 12
b=6
c=4
P( A  B  C )
= 33+ 36+28- 17-11-9
= 97 – 37
S.M Nipuna Madhuranga SamarakoonHND Batch 29
Discrete Mathematics
21
= 60
Part 2
4. Write the multisets of prime factors for the given numbers.
IV. 160
V.
120
VI. 250
1. 160: - 1,2,4,5,8,10,16,20,32,40,80,160
2. 120: - 1,2,3,4,5,6,8,10,12,15,20,24,30,40,60,120
3. 250: - 1,2,5,10,25,50,125,250
5. Write the multiplicities of each element of multisets in part 2(1-I, ii,iii)
separately.
i.
160 = {2, 2, 2, 2, 2, 5}
Multiplicity of 2 = 5
Multiplicity of 5 = 1
ii.
120 = {2, 2, 2, 2, 3, 5}
Multiplicity of 2 = 3
Multiplicity of 3 = 1
Multiplicity of 5 = 5=1
iii.
250 = {2, 5, 5, 5}
Multiplicity of 2 = 2
Multiplicity of 5 = 3
6. Find the cardinalities of each multiset in part 2-1.
i.
Cardinality of multi set = 5 + 1 = 6
ii.
Cardinality of multi set = 3 + 1 +1 = 5
iii.
Cardinality of multi set = 2 + 3 = 5
S.M Nipuna Madhuranga SamarakoonHND Batch 29
Discrete Mathematics
22
Part 3
4. Determine whether the following functions are invertible or not. If it is
invertible, then find the rule of the inverse  f 1  x 
i.
f :   
ii.
f ( x)  x 2
f :   
f ( x)  1
iii.
f :   
v.
f ( x)  x 2
f : 0 ,     2, 2
f ( x)  2 cos x
iv.

x

f :   ,    1, 1
2 2
f ( x)  sin x
N = {1,2,3,4,5,}
Z = {…. -3, -2, -1,0,1,2,3,4, 5….}
Z+ = {1,2,3,4, 5….}
Z- = {…. -3, -2, -1,}
I.
f ( x)  x 2
f(x) = 2x
f (-3) = 2*(-3) = (-6) →f2 * (-6) = (-12)
f (-2) = 2*(-2) = (-4) →f2 * (-4) = (-8)
f (-1) = 2*(-1) = (-2) →f2 * (-2) = (-4)
f (0) = 2*(0) = (0) →f2 * (0) = (0)
f (1) = 2*(1) = (2) →f2 * (2) = (4)
f (2) = 2*(2) = (4) →f2 * (4) = (8)
f (3) = 2*(3) = (6) →f2 * (6) = (12)
II.
f ( x)  1
x
f (1)  1  1
1
S.M Nipuna Madhuranga SamarakoonHND Batch 29
Discrete Mathematics
23
f (2)  1
2
f (1 )  1  2
2
1
2
f (3)  1
3
f (1 )  1  3
3
1
3
X1, x2 be two different numbers from domain
f ( x1)  1
→①
x1
f ( x 2)  1 →②
x2
①-②
F(x1) = f(x2)
1
1
=
𝑥1 𝑥2
x1=x2
1-1 function
f ( x)  1
x
F(x) = y
Y= 1/x
X=1/y
X→y→x
Y= 1/x (inverse function)
f
III.
1
x  = 𝑥1
f ( x)  x 2
x
X2
Function( f ( x)  x 2 )
1
1
f (1)  12  1
2
4
f (2)  2 2  4
4
16
f (4)  4 2  16
5
25
f (5)  5 2  25
S.M Nipuna Madhuranga SamarakoonHND Batch 29
Discrete Mathematics
24
f (25)  25 2  625
25
625
0.1
0.01
f (0.1)  (0.1) 2  0.01
0.01
0.0001
f (0.01)  (0.01) 2  (0.0001)
X1, x2 be two different numbers from domain
f ( x1)  x1 →①
2
f ( x 2)  x 2 →②
2
①=②
X12= X22
Take the square root
x1 = +x2
x1 = x 2
then 1 – 1 function
inverse exit.
1 
f ( x)   
x 
2
f(x) = y
y = x2
Take the square root
√𝑦 = √𝑥 2
√𝑦 = 𝑥
x=y&y=x
√𝑥 = 𝑦 (inverse)
f
1
x  = √𝑥
IV.
f ( x)  sin x


f :   ,    1, 1
2 2
f(


)  sin(
)
2
2


f ( )  sin( )
2
2


=sin ( ) = 1
= - sin ( ) =(-1)
2
2
sin (-x) = - sin (x)
S.M Nipuna Madhuranga SamarakoonHND Batch 29
Discrete Mathematics
25
f(


)  sin(
)
3
3

= -sin (

3
)  (
3
)
2

f ( )  sin( )
3
3
=sin (

3
) (
3
)
2
S.M Nipuna Madhuranga SamarakoonHND Batch 29
Discrete Mathematics
26
Sin 0 = 0 onto function
X1, x2 be two different numbers
f (x1) = sin (x1) →①
f (x2) = sin (x2) →②
①=②

sin (x1) = sin (x2)  
2
,
2

f (x) = sin (x)
y = f (x)
y = sin (x)
sin -1(y) = x
x→y&y→x
y = sin -1(x)
f
V.
1
x  = sin -1(x)
f ( x)  sin x


f :   ,    1, 1
2 2
f(


)  sin(
)
2
2


f ( )  sin( )
2
2


=sin ( ) = 1
= - sin ( ) =(-1)
2
2
sin (-x) = - sin (x)
f(


)  sin(
)
3
3

= -sin (

3
)  (
3
)
2

f ( )  sin( )
3
3
=sin (

3
) (
3
)
2
S.M Nipuna Madhuranga SamarakoonHND Batch 29
Discrete Mathematics
27
Sin 0 = 0 onto function
X1, x2 be two different numbers
f (x1) = sin (x1) →①
f (x2) = sin (x2) →②
①=②

sin (x1) = sin (x2)  
2
,
2

f (x) = sin (x)
y = f (x)
y = sin (x)
sin -1(y) = x
x→y&y→x
y = sin -1(x)
f
1
x  = sin -1(x)
Part 4
2. Formulate corresponding proof principles to prove the following properties about
defined sets.
A  B  A  B and B  A
iv.
v. De Morgan’s Law by mathematical induction
vi.
Distributive Laws for three non-empty finite sets A, B, and C
Activity 02
Part 1
1. Discuss two examples on binary trees both quantitatively and qualitatively.
Binary Tree Data Structure
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
28
A tree whose elements have at most 2 children is called a binary tree. Since each element in a binary tree
can have only 2 children, we typically name them the left and right child.
A Binary Tree node contains following parts.



Data
Pointer to left child
Pointer to right child
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
29
Following are common types of Binary Trees.
Full Binary Tree: - A Binary Tree is full if every node has 0 or 2 children. Following are examples of a
full binary tree. We can also say a full binary tree is a binary tree in which all nodes except leaves have
two children.
In a Full Binary, number of leaf nodes is number of internal nodes plus 1
L=I+1
Where L = Number of leaf nodes, I = Number of internal nodes
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
30
Complete Binary Tree: - A Binary Tree is complete Binary Tree if all levels are completely filled except
possibly the last level and the last level has all keys as left as possible
Following are examples of Complete Binary Trees
Practical example of Complete Binary Tree is Binary Heap.
Perfect Binary Tree: - A Binary tree is Perfect Binary Tree in which all internal nodes have two children
and all leaves are at the same level.
Following are examples of Perfect Binary Trees.
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
31
A Perfect Binary Tree of height h (where height is the number of nodes on the path from the root to leaf)
has 2h – 1 node.
Example of a Perfect binary tree is ancestors in the family. Keep a person at root, parents as children,
parents of parents as their children.
Balanced Binary Tree
A binary tree is balanced if the height of the tree is O(Log n) where n is the number of nodes. For
Example, AVL tree maintains O(Log n) height by making sure that the difference between heights of left
and right subtrees is 1. Red-Black trees maintain O(Log n) height by making sure that the number of
Black nodes on every root to leaf paths are same and there are no adjacent red nodes. Balanced Binary
Search trees are performance wise good as they provide O(log n) time for search, insert and delete.
A degenerate (or pathological) tree A Tree where every internal node has one child. Such trees are
performance-wise same as linked list.
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
32
Part 2
1. State the Dijkstra’s algorithm for a directed weighted graph with all non-negative
edge weights.
2. Find the shortest path spanning tree for the weighted directed graph with vertices
A, B, C, D, and E given using Dijkstra’s algorithm.
1. Dijkstra’s algorithm, published in 1959 and named after its creator Dutch computer
scientist “Edsger Dijkstra”, can be applied on a weighted graph. The graph can either be
directed or undirected. One stipulation to using the algorithm is that the graph needs to
have a nonnegative weight on every edge.

Create a set sptSet that keeps track of vertices included in shortest path tree.
Example: whose minimum distance from source is calculated and finalized. Initially, this
set is empty.
 Assign a distance value to all vertices in the input graph. Initialize all distance values as
INFINITE. Assign distance value as 0 for the source vertex so that it is picked first.

While sptSet doesn’t include all vertices
i.
Pick a vertex u which is not there in sptSet and has minimum distance value.
ii.
Include u to sptSet.
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
33
iii.
Update distance value of all adjacent vertices of u. To update the distance values, iterate
through all adjacent vertices. For every adjacent vertex v, if sum of distance value of u and
weight of edge u-v, is less than the distance value of v, then update the distance value of v.
V
A
B
C
D
E
A
0
5
3
-
-
C
0
5
3
7
9
B
0
5
3
7
9
D
0
5
3
7
9
2.
A to B = 5 units
A to C = 3 units
A to D = 7units
A to E = 7 units.
Part 3
1. Check whether the following graphs have a Eulerian and/or Hamiltonian circuit.
1
2
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
34
3
Part 4
1. Construct a proof for the five color theorem for every planar graph.
2. Discuss how efficiently Graph Theory can be used in a route planning project for a
vacation trip from Colombo to Trincomalee by considering most of the practical
situations (such as millage of the vehicle, etc.) as much as you can. Essentially
consider the two fold,
- Routes with shortest distance(Quick route travelling by own vehicle)
- Route with the lowest cost
3. Determine the minimum number of separate racks needed to store the chemicals
given in the table (1st column) by considering their incompatibility using graph
coloring technique. Clearly state you steps and graphs used.
Chemical
Incompatible with
Ammonia
(anhydrous)
Mercury, chlorine, calcium hypochlorite,
iodine, bromine, hydrofluoric acid (anhydrous)
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
35
Chlorine
Ammonia, acetylene, butadiene, butane, methane, propane
, hydrogen, sodium carbide, benzene,
finely divided metals, turpentine
Iodine
Acetylene, ammonia (aqueous or anhydrous), hydrogen
Silver
Acetylene, oxalic acid, tartaric acid, ammonium compounds,
pulmonic acid
Iodine
Acetylene, ammonia (aqueous or anhydrous), hydrogen
Mercury
Acetylene, pulmonic acid, ammonia
Fluorine
All other chemicals
Activity 03
Part 1
1. Discuss two real world binary problems in two different fields using applications of
Boolean Algebra.
Each segment of a calculator's display is switched on and off by a series of logic gates that are connected
together. Consider just the bottom lower right segment .need to turn this segment on if we're showing the
numbers 0 (binary 00), 1 (01), 3 (11), 4 (100), 5 (101), 6 (110), 7 (111), 8 (1000), and 9 (1001)
But not if show the number 2 (10). Can make the segment switch on and off correctly for the numbers 1–
10 by rigging up three OR gates and one NOT gate like this.
If feed the patterns of binary numbers into the four inputs on the left, the segment will turn on and off
correctly for each one. (Woodford, 2007)
Representing numbers in binary;
For the last century or so, computers and calculators have been built from a variety of switching devices
that can either be in one position or another.
It has only “one (1)” or “zero (0)”. For that reason, computers and calculators store and process numbers
using what's called binary code, which uses just two symbols (0 and 1) to represent any number.
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
36
So in binary code, the number 18 is written 10010,
Which means; (1 × 16) + (0 × 8) + (0 × 4) + (1 × 2) + (1 × 0)
=16+2
=18
Using logic gates with binary
Someone want to do the sum 3 + 2 = 5.
A calculator tackles a problem like this by turning the two numbers into binary, giving 11 (which is 3 in
binary = 1 × 2 + 1 × 1) plus 10 (2 in binary = 1 × 2 + 0 × 1) makes 101 (5 in binary = 1 × 4 + 0 × 2 + 1 ×
1).So how does the calculator do the actual sum, It uses logic gates to compare the pattern of switches that
are active and come up with a new pattern of switches instead.
A logic gate is really just a simple electrical circuit that compares two numbers and produces a third
number depending on the values of the original numbers.
There are 4 very common types of logic gates.
-
OR
-
AND
-
NOT
-
XOR
An OR gate has two inputs and it produces an output of 1 if either of the inputs is 1; it produces a zero
otherwise.
An AND gate also has two inputs, but it produces an output of 1 only if both inputs are 1.
A NOT gate has a single input and reverses it to make an output. So if feed it a zero, it produces a 1.
An XOR gate gives the same output as an OR gate, but switches off if both its inputs are one.
Part 2
1. Develop truth tables and its corresponding Boolean equation for the following
scenarios.
i. ''If the driver is present AND the driver has NOT buckled up AND the
ignition switch is on, then the warning light should turn ON.''
ii. If it rains and you don't open your umbrella, then you will get wet.
i. ''If the driver is present AND the driver has NOT buckled up AND the ignition
switch is on, then the warning light should turn ON.''
P: - The driver is present
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
37
Q: -The driver has buckled up
R: - The ignition switch is on
S: - The warning light should turn ON
Pᴧ~QᴧR=S
Boolean equalization = P.Ǭ.R
P
Q
R
T
T
T
T
F
F
F
F
T
T
F
F
T
T
F
F
~Q
T
F
T
F
T
F
T
F
F
F
T
T
F
F
T
T
Pᴧ~Q
F
F
T
T
F
F
F
F
Pᴧ~QᴧR=S
F
F
T
F
F
F
F
F
ii. If it rains and you don't open your umbrella, then you will get wet.
P: - It rains
Q: - you open your umbrella
R: - you will get wet
(P ᴧ ~ Q) → R
P
Q
T
T
T
T
F
F
F
F
T
T
F
F
T
T
F
F
R
T
F
T
F
T
F
T
F
~Q
F
F
T
T
F
F
T
T
Pᴧ~Q
F
F
T
T
F
F
F
F
Pᴧ~Q→R
T
T
T
F
T
T
T
T
2. Produce truth tables for given Boolean expressions.
i. A B C  AB C  ABC  A BC
ii. ( A  B  C )( A  B  C )( A  B  C )
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
38
A
B
C
A
B
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1
1
1
1
0
0
0
0
1
1
0
0
1
1
0
0
C
1
0
1
0
1
0
1
0
ABC
1
1
1
1
1
1
0
1
ABC
AB C
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
A BC
1
1
1
1
1
0
1
1
A B C  AB C  ABC  A BC
0
1
1
0
1
0
0
1
ii. ( A  B  C )( A  B  C )( A  B  C )
A
B
C
A
B
C
( A  B  C)
( A  B  C)
(A  B  C )
( A  B  C )( A  B  C )( A  B  C )
0
0
0
1
1
1
1
0
1
0
0
0
1
1
1
0
1
1
1
1
0
1
0
1
0
1
0
1
1
0
0
1
1
1
0
0
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
0
1
0
1
1
0
0
1
1
0
0
0
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
Part 3
1. Find the simplest form of given Boolean expressions using algebraic methods.
i. A(A+B)+B(B+C)+C(C+A)
ii.
( A  B )( B  C )  ( A  B)(C  A )
iii. ( A  B)( AC  AC )  AB  B
iv. A ( A  B)  ( B  A)( A  B )
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
39
Part 2
1.
i.
A- Driver
C – Ignition switch
B- Belt
Table 1: truth table 1
A
B
C
Out
0
0
0
0
0
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
1
1
1
0
0
1
1
1
0
̅. 𝑪
𝑨. 𝑩
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
40
ii.
A – Rain
B – Umbrella open
Table 2: truth table 2
A
B
Out
0
0
0
0
1
0
1
0
1
1
1
0
̅
𝑨. 𝑩
Part 3
1. Find the simplest form of given Boolean expressions using algebraic methods.
i. A(A+B)+B(B+C)+C(C+A)
ii.
( A  B )( B  C )  ( A  B)(C  A )
iii. ( A  B)( AC  AC )  AB  B
iv. A ( A  B)  ( B  A)( A  B )
Part 4
2. Consider the K-Maps given. For each K- Map
i. Write the appropriate standard form (SOP/POS) of Boolean expression.
ii. Draw the circuit using AND, NOT and OR gates.
iii. Draw the circuit only by using
i. NAND gates if the standard form obtained in part (i) is SOP.
ii. NOR gates if the standard form obtained in pat (i) is POS.
(b)
AB/C
0
1
00
0
0
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
41
01
0
1
10
1
0
11
0
1
(b)
AB/C 00
D
00
1
01
10
11
0
0
1
01
0
1
0
1
10
1
1
1
1
11
1
1
0
1
(c)
AB/C
0
1
00
1
0
01
1
1
10
0
1
11
1
0
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
42
Activity 04
Part 1
1
Describe the characteristics of different binary operations that are performed on the same set.
Binary Operation
Just as we get a number when two numbers are either added or subtracted or multiplied or are divided.
The binary operations associate any two elements of a set. The resultant of the two are in the same set.
Binary operations on a set are calculations that combine two elements of the set (called operands) to
produce another element of the same set.
The binary operations * on a non-empty set A are functions from A × A to A. The binary operation, *: A
× A → A. It is an operation of two elements of the set whose domains and co-domain are in the same set.
(toppr, n.d.)
Figure 1: Binary operations (toppr, n.d)
Addition, subtraction, multiplication, division, exponential is some of the binary operations.
(toppr, n.d.)
Types of Binary Operations
Commutative
A binary operation * on a set A is commutative if a * b = b * a, for all (a, b) ∈ A (non-empty set). Let
addition be the operating binary operation for a = 8 and b = 9, a + b = 17 = b + a.
Associative
The associative property of binary operations hold if, for a non-empty set A, we can write (a * b) *c =
a*(b * c). Suppose N be the set of natural numbers and multiplication be the binary operation. Let a = 4, b
= 5 c = 6. We can write (a × b) × c = 120 = a × (b × c).
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
43
Distributive
Let * and o be two binary operations defined on a non-empty set A. The binary operations are distributive
if a*(b o c) = (a * b) o (a * c) or (b o c)*a = (b * a) o (c * a). Consider * to be multiplication and o be
subtraction. And a = 2, b = 5, c = 4. Then, a*(b o c) = a × (b − c) = 2 × (5 − 4) = 2. And (a * b) o (a * c)
= (a × b) − (a × c) = (2 × 5) − (2 × 4) = 10 − 6 = 2.
Identity
If A be the non-empty set and * be the binary operation on A. An element e is the identity element of a
∈ A, if a * e = a = e * a. If the binary operation is addition (+), e = 0 and for * is multiplication (×), e = 1.

Inverse
If a binary operation * on a set A which satisfies a * b = b * a = e, for all a, b ∈ A. a-1 is invertible if for a
* b = b * a= e, a-1 = b. 1 is invertible when * is multiplication.
(toppr, n.d.)
2.
i.
As Properties of Binary Operation, Multiplication is a binary operation on each of the sets
of Natural numbers (N), Integer (Z), Rational numbers (Q), Real Numbers(R), Complex
number(C).
A division is not a binary operation on the set of Natural numbers (N), integer (Z),
Rational numbers (Q), Real Numbers(R), Complex number(C).
ii.
As Properties of Binary Operation Subtraction is not a binary operation on the set of
Natural numbers (N).
Additions are the binary operations on each of the sets of Natural numbers (N), Integer
(Z), Rational numbers (Q), Real Numbers(R), Complex number(C).
iii.
As Properties of Binary Operation Exponential operation (x, y) → xy is a binary operation
on the set of Natural numbers (N) and not on the set of Integers (Z).
2
Justify whether the given operations on relevant sets are binary operations or not.
1 Multiplication and Division on se of Natural numbers
2 Subtraction and Addition on Set of Natural numbers
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
44
3 Exponential operation: ( x, y )  x y on Set of Natural numbers and set of Integers
i.
As Properties of Binary Operation, Multiplication is a binary operation on each of the sets
of Natural numbers (N), Integer (Z), Rational numbers (Q), Real Numbers(R), Complex
number(C).
A division is not a binary operation on the set of Natural numbers (N), integer (Z),
Rational numbers (Q), Real Numbers(R), Complex number(C).
ii.
As Properties of Binary Operation Subtraction is not a binary operation on the set of
Natural numbers (N).
Additions are the binary operations on each of the sets of Natural numbers (N), Integer
(Z), Rational numbers (Q), Real Numbers(R), Complex number(C).
As Properties of Binary Operation Exponential operation (x, y) → xy is a binary operation
iii.
on the set of Natural numbers (N) and not on the set of Integers (Z).
Part 2
1 Build up the operation tables for group G with orders 1, 2, 3 and 4 using the elements
a, b, c, and e as the identity element in an appropriate way.
1.
Table 3: operation table
Group G
?
a
b
c
e
2
identity element
a
b
a
c
a
b
c
c
a
b
c
e
b
b
c
e
a
b
c
e
a ? a=b
a ? b=c
a ? c=e
a ? e=a
b? e=b
1.) . State the Lagrange’s theorem of group theory.
c ? e=c
2.) For a subgroup H of a group G, prove the Lagrange’s theorem.
3.) Discuss whether a group H with order 6 can be a subgroup of a group with order
e ? e=e
13 or not. Clearly state the reasons.
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
45
2.
Lagrange's theorem is a statement in group theory which can be viewed as an extension of the number
theoretical result of Euler's theorem. It is an important lemma for proving more complicated results in
group theory.
Lagrange's Theorem.
i.
If G is a finite group and H is a subgroup of G, then ∣H∣ divides ∣G∣.
As an immediate corollary, we get that if G is a finite group and g ∈ G, then o(g) divides ∣G∣. In
particular, ∣G∣=e for all g ∈ G.
ii.
Before proving Lagrange’s Theorem, state and prove three lemmas.
Lemma 1. If G is a group with subgroup H, then there is a one to one correspondence between H and any
coset of H.
Proof. Let C be a left coset of H in G. Then there is a g ∈ G such that C = g ∗ H. 1 Define f : H → C by
f(x) = g ∗ x.

f is one to one.

If x1 6= x2, then as G has cancellation, g ∗ x1 6= g ∗ x2. Hence, f(x1) 6= f(x2).
f is onto.
If y ∈ C, then since C = g ∗ H, there is an h ∈ H such that y = g ∗ h. It follows that f(h) =
y and as y was arbitrary, f is onto.
This completes the proof of Lemma 1.
Lemma 2. If G is a group with subgroup H, then the left coset relation, g1 ∼ g2 if and only if g1 ∗ H =
g2 ∗ H is an equivalence relation.
Proof. The essence of this proof is that ∼ is an equivalence relation because it is defined in terms of set
equality and equality for sets is an equivalence relation. The details are below.
• ∼ is reflexive. Let g ∈ G be given. Then, g ∗H = {g ∗h : h ∈ H} and as this set is well defined, g ∗H = g
∗H.
1We use “∗” to represent the binary operation in G.
• ∼ is symmetric.
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
46
Let g1, g2 ∈ G with g1 ∼ g2. Then by the definition of ∼, g1 ∗H = g2 ∗H. That is, {g1 ∗h : h ∈ H} = {g2
∗ h : h ∈ H} and as set equality is symmetric, {g2 ∗ h : h ∈ H} = {g1 ∗ h : h ∈ H}. Hence, g2 ∼ g1 and as
g1 and g2 were arbitrary, ∼ is symmetric.
• ∼ is transitive.
Let g1, g2, g3 ∈ G with g1 ∼ g2 and g2 ∼ g3. Then, g1 ∗ H = {g1 ∗ h : h ∈ H} = {g2 ∗ h : h ∈ H} = g2 ∗
H
And
g2 ∗ H = {g2 ∗ h : h ∈ H} = {g3 ∗ h : h ∈ H} = g3 ∗ H.
As set equality is transitive, it follows that
g1 ∗ H = {g1 ∗ h : h ∈ H} = {g3 ∗ h : h ∈ H} = g3 ∗ H, or g1 ∗ H = g3 ∗ H. That is, g1 ∼ g3, and as g1,
g2, g3 ∈ G are arbitrary, ∼ is transitive.
This complete the proof of the lemma.
Lemma 3. Let S be a set and ∼ be an equivalence relation on S. If A and B are two equivalence classes
with A ∩ B 6= ∅, then A = B.
Proof. To prove the lemma, we show that A ⊂ B and B ⊂ A. As A and B are arbitrarily labeled, it
suffices to show the former.
Let a ∈ A. As A ∩ B 6= ∅, there is a c ∈ A ∩ B. As A is an equivalence class of ∼ and both a and a c are
in A, it follows that a ∼ c. But as a ∼ c, c ∈ B and B is an equivalence class of ∼, it follows that a ∈ B.
Armed with these three lemmas we proceed to the main result.
Theorem 1. [Lagrange’s Theorem] If G is a finite group of order n and H is a subgroup of G of order k,
then k|n and n k is the number of distinct cosets of H in G.
Proof. Let ∼ be the left coset equivalence relation defined in Lemma 2. It follows from Lemma 2 that ∼
is an equivalence relation and by Lemma 3 any two distinct cosets of ∼ are disjoint. Hence, we can write
G = (g1 ∗ H) ∪ (g2 ∗ H) ∪ · · · ∪ (g` ∗ H)
Where the gi ∗ H, i = 1, 2, . . . , ` are the disjoint left cosets of H guaranteed by Lemma 3.
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
47
By Lemma 1, the cardinality of each of these cosets is the same as the order of H, and so
This completes the proof.
iii.
A consequence of Lagrange's Theorem would be,
Group H with order 6 can be a subgroup of a group with order 13 or not,
That a group with Oder 13 elements couldn't have a subgroup of 6 elements since 6 does not divide 13. It
could have subgroups with 13 elements since only this number is divisors of 13.
Part 3
1 Check whether the set S    {1} is a group under the binary operation
‘*’defined as a * b  a  b  ab for any two elements a, b  S .
2 i. State the relation between the order of a group and the number of binary
operations that can be defined on that set.
How many binary operations can be defined on a set with 4 elements?
3 Discuss the group theory concept behind the Rubik’s cube.
Part 4
Prepare a ten minutes presentation that explains an application of group theory in computer
sciences.
S.M Nipuna Madhuranga Samarakoon HND Batch 29
Discrete Mathematics
Download