Assignment 1- Discrete Mathematics, Assignments of Discrete Mathematics

Assignment 1- Discrete Mathematics

Typology: Assignments

2021/2022

Uploaded on 10/25/2022

nhat-do-long
nhat-do-long 🇻🇳

5

(1)

11 documents

1 / 28

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PROGRAM TITLE: BTEC Computing in Software Engineering
UNIT TITLE: Unit 18: Discrete Maths
ASSIGNMENT NUMBER: 1
ASSIGNMENT NAME: ASSIGNMENT 1- Set theory and functions- Graph theory
SUBMISSION DATE: 24/10/2022
DATE RECEIVED: 24/10/2022
TUTORIAL LECTURER: Lưu Th Hương Giang
WORD COUNT: 5389
STUDENT NAME: Đỗ Long Nht
STUDENT ID: BKC12174
MOBILE NUMBER: 09015699644
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download Assignment 1- Discrete Mathematics and more Assignments Discrete Mathematics in PDF only on Docsity!

PROGRAM TITLE: BTEC Computing in Software Engineering UNIT TITLE: Unit 18: Discrete Maths ASSIGNMENT NUMBER: 1 ASSIGNMENT NAME: ASSIGNMENT 1- Set theory and functions- Graph theory SUBMISSION DATE: 24/10/ DATE RECEIVED: 24/10/ TUTORIAL LECTURER: Lưu Thị Hương Giang WORD COUNT: 5389 STUDENT NAME: Đỗ Long Nhật STUDENT ID: BKC MOBILE NUMBER: 09015699644

Summative Feedback: Internal verification:

List of Figure:

Figure 1: Sets .................................................................................................................................... Figure 2: set A and set B ................................................................................................................... Figure 3: Example(1) ........................................................................................................................ Figure 4: Example(2) ........................................................................................................................ Figure 5: Injective ............................................................................................................................. Figure 6: Surjective ........................................................................................................................... Figure 7: Bijective............................................................................................................................. Figure 8: Example(3) ........................................................................................................................ Figure 9: Example(4) ........................................................................................................................ Figure 10: Binary Tree ......................................................................................................................

I.Set theory 1, Set theory A set is a collection of objects, called elements, in which the order is not important and an object cannot appear twice in the same set Example: Explicit definitions of sets, that is, where each element is listed, are: A = {a, b, c}  a ∈ A means ‘a is an element of A’ or ‘a belongs to A’ A set is a collection of objects, called elements, in which the order is not important and an object cannot appear twice in the same set The universal set is the set of all objects we are interested in and will depend on the problem under consideration. It is represented by E. The empty set (or null set) is the set with no elements. It is represented by ∅ or { }. Sets can be represented diagrammatically – generally as circular shapes. The universal set is represented as a rectangle. These are called Venn diagrams ●Subset Set Operations Set operations is a concept similar to fundamental operations on numbers. Sets in math deal with a finite collection of objects, be it numbers, alphabets, or any real-world objects. Sometimes a necessity arises wherein we need to establish the relationship between two or more sets. There comes the concept of set operations. There are four main set operations which include set union, set intersection, set complement, and set difference. In this article, we will learn the various set operations, notations of representing sets, how to operate on sets, and their usage in real life. What are Set Operations? A set is defined as a collection of objects. Each object inside a set is called an 'Element'. A set can be represented in three forms. They are statement form, roster form, and set builder notation. Set operations are the operations that are applied on two or more sets to develop a relationship between them. There are four main kinds of set operations which are as follows.

  • Union of sets
  • Intersection of sets

Intersection of Sets For two given sets A and B, A∩B (read as A intersection B) is the set of common elements that belong to set A and B. The number of elements in A∩B is given by n(A∩B) = n(A)+n(B)−n(A∪B), where n(X) is the number of elements in set X. To understand this set operation of the intersection of sets better, let us consider an example: If A = {1, 2, 3, 4} and B = {3, 4, 5, 7}, then the intersection of A and B is given by A ∩ B = {3, 4}. Set Difference The set operation difference between sets implies subtracting the elements from a set which is similar to the concept of the difference between numbers. The difference between sets A and set B denoted as A − B lists all the elements that are in set A but not in set B. To understand this set operation of set difference better, let us consider an example: If A = {1, 2, 3, 4} and B = {3, 4, 5, 7}, then the difference between sets A and B is given by A - B = {1, 2}. Complement of Sets The complement of a set A denoted as A′ or Ac (read as A complement) is defined as the set of all the elements in the given universal set(U) that are not present in set A. To understand this set operation of complement of sets better, let us consider an example: If U = {1, 2, 3, 4, 5, 6, 7, 8, 9} and A = {1, 2, 3, 4}, then the complement of set A is given by A' = {5, 6, 7, 8, 9}. Set Operations The above image shows various set operations with the help of Venn diagrams. When the elements of one set B completely lie in the other set A, then B is said to be a proper subset of A. When two sets have no elements in common, then they are said to be disjoint sets. Now, let us explore the properties of the set operations. Properties of Set Operations The properties of set operations are similar to the properties of fundamental operations on numbers. The important properties on set operations are stated below: Commutative Law - For any two given sets A and B, the commutative property is defined as, A ∪ B = B ∪ A This means that the set operation of union of two sets is commutative. A ∩ B = B ∩ A This means that the set operation of intersection of two sets is commutative.

Associative Law - For any three given sets A, B and C the associative property is defined as, (A ∪ B) ∪ C = A ∪ (B ∪ C) This means the set operation of union of sets is associative. (A ∩ B) ∩ C = A ∩ (B ∩ C) This means the set operation of intersection of sets is associative. De-Morgan's Law - The De Morgan's law states that for any two sets A and B, we have (A ∪ B)' = A' ∩ B' and (A ∩ B)' = A' ∪ B' A ∪ A = A A ∩ A = A A ∩ ∅ = ∅ A ∪ ∅ = A A ∩ B ⊆ A A ⊆ A ∪ B Important Notes on Set Operations Set operation formula for union of sets is n(A∪B) = n(A) + n(B) − n(A∩B) and set operation formula for intersection of sets is n(A∩B) = n(A)+n(B)−n(A∪B). The union of any set with the universal set gives the universal set and the intersection of any set A with the universal set give ●Power Set A power set includes all the subsets of a given set including the empty set. The power set is denoted by the notation P(S) and the number of elements of the power set is given by 2n. A power set can be imagined as a place holder of all the subsets of a given set, or, in other words, the subsets of a set are the members or elements of a power set.

Exercise 1: 1.1.Let A and B be two non-empty finite sets. If cardinalities of the sets A, B, and A ∩ B are 80, 52 and 17 respectively, find the cardinality of the set AB. According to the topic, the intersection of set A and set B is the part with the following slash: Figure 2: set A and set B n(A) = 80 n(B) = 52 n(AB) = 17 n(AB) = n(A) + n(B) – n(AB) <=> n(AB)= 80 + 52 - 17 => n(AB) = 115 1.2. Let A={nN:30 ≤ n < 50} and B={nN : 10 < n ≤ 42}. Suppose C is a set such that CA and CB. What is the largest possible cardinality of C? According to the condition, A = {30, 31, 32, 33, …, 49} B = {11, 12, 13, 14, …, 42} C is a set such that C⊆A and C⊆B Because C belongs to A and B intersections, or in other words, "C is in the intersections of the A and B file". Then C = A ∩ B = {30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42}. =>|C| = 13

The cardinality that can be C is 13. 1.3. Let A={1,2,…,10}. Define B2={BA :|B| =2}. Find |B2|? Because |B|=2, and B is A subset so B2= {B⊆ A:|B|=2} = {{1,2},{1,3},…,{8,10},{9,10}} Each element of B2 is a set of 2 random numbers from 1 to 10. Each way to choose 2 out of 10 elements of the set is a combinatorial of 10 choose 2 |B2| = C^210 = 45 1.4. Consider the sets A and B, where A={ 3, |B| } and B={ 1 , |A| , |B|}. What are the sets? Has |B| ≤ 3 Suppose that |B| = 3 A = {3,3} = {3} => |A| = 1 B = {1,1,3} = {1,3} unsatisfactory with |B| = 3. Consider |B| = 2 => A = {3,2} => |A| = 2 B = {1,2,2} = {1,2} => |B| = 2 Result A = {3,2} and B = {1,2} 2 , Multi-sets A multiset (mset, for short) is an unordered collection of objects (called the elements) in which, unlike a standard (Cantorian) set, elements are allowed to repeat. In other words, an mset is a set to which elements may belong more than once, and hence it is a non-Cantorian set. The number of distinct elements in an mset M (which need not be finite) and their multiplicities jointly determine its cardinality, denoted by C(M). In other words, the cardinality of an mset is the sum of multiplicities of all its elements. ●Basic of Mutil-sets •Representations of Multisets •Multiplicative form Following Meyer and McRobbie, the use of square brackets to represent an mset has become almost standard. Thus, an mset containing one occurrence of a, two occurrences of b, and three occurrences of c is notationally written as [[a, b, b, c, c, c]] or [a, b, b, c, c, c] or ["[a, b, c]"]_1,2, or [𝑎^1 , 𝑏^2 , 𝑐^ 3 ] or [a 1 , b 2 , c 3 ], depending on one’s taste and convenience.

Figure 3: Example(1) And here we have the result, as you can see the names John and Gary can be duplicated on the multiset. Figure 4: Example(2) 3.Function A function is a rule that assigns each input exactly one output. We call the output the image of the input. The set of all inputs for a function is called the domain. The set of all allowable outputs is called the codomain. The following, we would write f : X → Y to describe a function with name f , domain X and codomain Y Injection - a function f: X => Y is injective for all a and b ∈ X, if a ≠ b then f(a) ≠ f(b) The contrapositive interpretation is: ∀a, b ∈ X, a ≠ b => f(a) ≠ f(b)

∀a, b ∈ X, f(a) = f(b) => a = b Figure 5: Injective Surjective A function f: X => Y is surjective if for all y ∈ Y, there is an x value such that f(x) = y. ∀ y ∈ Y, ∃x ∈ X: f(x) =y A function is surjective when the range of f , (i.e. f(X)), is identical to the co-domain of f, (i.e. Y). Figure 6: Surjective Bijective A bijective function f: X → Y is a one-to-one (injective) and onto (surjective) mapping of a set X to a set Y.

y =

x ⇒ x =

y  𝑓(𝑥) =

x

⇒ 𝑓-^1 (𝑥) =

x c. f: 𝑅+^ → 𝑅+ 𝑓(𝑥)= 𝑥^2 This function is surjective and injective, so the function has an inverse function. y = x^2 - > x = √𝑦  𝑓(𝑥)= 𝑥^2 - > 𝑓-^1 (𝑥)= (^) √𝑥 d. f: [0, 𝜋] → [−2,2] 𝑓(𝑥) = 2 𝑐𝑜𝑠x This function is surjective and injective, so the function has an inverse function. y= 2 𝑐𝑜𝑠x - > x= 𝑐𝑜𝑠-^1 ( y 2

𝑓(𝑥) = 2 𝑐𝑜𝑠x - > 𝑓-^1 (𝑥) = 𝑐𝑜𝑠-^1 ( y 2

3.2. Function 𝑓 ( 𝑥 ) =

(x-32) converts Fahrenheit temperatures into Celsius. What is the function for opposite conversion? Given f(x) =

(x-32) ⇒ y =

(x-32) ⇒ x = (

y) + 32 Hence, Opposite function for the opposite conversion is 𝑓-^1 (𝑥) = (

x) + 32 3.3. Present the application of function in software engineering? Give specific programming example A function is nothing but inputs to the software system, its behavior, and outputs. It can be a calculation, data manipulation, business process, user interaction, or any other specific functionality which defines what function a system is likely to perform. Example: Figure 8: Example(3) Output: Figure 9: Example(4)

Proof of De Morgan’s law: (A ∩ B)' = A' U B' Let M = (A ∩ B)' and N = A' U B' Let x be an arbitrary element of M then x ∈ M ⇒ x ∈ (A ∩ B)' ⇒ x ∉ (A ∩ B) ⇒ x ∉ A or x ∉ B ⇒ x ∈ A' or x ∈ B' ⇒ x ∈ A' U B' ⇒ x ∈ N Therefore, M ⊂ N …………….. (i) Again, let y be an arbitrary element of N then y ∈ N ⇒ y ∈ A' U B' ⇒ y ∈ A' or y ∈ B' ⇒ y ∉ A or y ∉ B ⇒ y ∉ (A ∩ B) ⇒ y ∈ (A ∩ B)' ⇒ y ∈ M Therefore, N ⊂ M …………….. (ii) Now combine (i) and (ii) we get; M = N i.e. (A ∩ B)' = A' U B' 4 .3. Distributive Laws for three non-empty finite sets A, B, and C. Use indirect method Let A, B, C be sets. If A ⊆ B and B ∩ C = then A = C If we assume the conclusion is false and we get a contradiction --- then the theorem must be true. Suppose A ⊆ B and B ∩ C = ∅, and A ∩ C ≠ ∅. Assume A⊆B and NOR = ∅, and A∩C ≠ ∅. To prove that this cannot happen, let x ∈ A∩C. x ∈ A ∩ C ⇒ x ∈ A and x ∈ C ⇒ x ∈ B and x ∈ C ⇒ x ∈ B ∩ C x ∈ A ∩ C ⇒ x ∈ A and x ∈ C ⇒ x ∈ B and x ∈ C⇒x B C But this contradicts the second premise. Therefore, the theorem has been proved. II.Graph theory In graph theory, a path in a graph G = (V, U) is called an Euler path if it passes through all edges of the graph exactly once. An Euler path whose final vertex coincides with the starting vertex is called an Euler cycle.

Theorem 1: An undirected and connected graph G = (V, E) has an Eulerian path where the degrees of all vertices in G are even. Theorem 2: The necessary and sufficient condition for the G connectivity graph to have an open Eulerian path is that the number of the odd degrees in the graph is 2. ● What is Graph? In Mathematics, a graph is a pictorial representation of any data in an organised manner. The graph shows the relationship between variable quantities. In a graph theory, the graph represents the set of objects, that are related in some sense to each other. The objects are basically mathematical concepts, expressed by vertices or nodes and the relation between the pair of nodes, are expressed by edges. History The history of graph theory states it was introduced by the famous Swiss mathematician named Leonhard Euler, to solve many mathematical problems by constructing graphs based on given data or a set of points. The graphical representation shows different types of data in the form of bar graphs, frequency tables, line graphs, circle graphs, line plots, etc. Definition Graph Theory is the study of points and lines. In Mathematics, it is a sub-field that deals with the study of graphs. It is a pictorial representation that represents the Mathematical truth. Graph theory is the study of relationship between the vertices (nodes) and edges (lines). Formally, a graph is denoted as a pair G(V, E). Where V represents the finite set vertices and E represents the finite set edges. Therefore, we can say a graph includes non-empty set of vertices V and set of edges E. Example: Suppose, a Graph G=(V,E), where Vertices, V={a,b,c,d} Edges, E={{a,b},{a,c},{b,c},{c,d}} ● Types of Graph The graphs are basically of two types, directed and undirected. It is best understood by the figure given below. The arrow in the figure indicates the direction. ● Directed Graph