ASSIGNMENT COVER SHEET STUDENT DETAILS Student ID Reg No. Family Name Given Name Sumit Pun Magar Enrolment Year 2019 Section P3 Semester 4th Email sumitmagar@ismt.edu.np UNIT DETAILS Unit Title D/615/1618 Assessor Name Issued Date Assignment Title Programming Assignment No 4th Qualification Unit Code Submission Date 12/23/2021 Campus ISMT STUDENT ASSESSMENT SUBMISSION AND DECLARATION When submitting evidence for assessment, each student must sign a declaration confirming that the work is their own. Student Name Sumit Pun Magar Issue Date Programming Assessor Name Submission Date 12/23/2021 BTEC HND Unit Name Assignment Title Programming Plagiarism Plagiarism is a particular form of cheating. Plagiarism must be avoided at all costs and students who break the rules, however innocently, may be penalized. It is your responsibility to ensure that you understand correct referencing practices. As a university level student, you are expected to use appropriate references throughout and keep carefully detailed notes of all your sources of materials for material you have used in your work, including any material downloaded from the Internet. Please consult the relevant unit lecturer or your course tutor if you need any further advice. Student Declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student signature: sumit Date:12/23/2021 Pearson Education 2018 Higher Education Qualifications [Task1/P1] Perform algebraic set operations in a formulated mathematical problem. Introduction In this task, the learner is going to explain about the algebraic set operations in a formulated mathematical problem. A modern study of set theory was started in the 1870s by the German mathematicians Richard Dedekind and Georg Cantor. Georg Cantor, in a particular, is generally regarded as the founder of set theory. In mathematics, a set is a collection of elements or numbers or objects represented by curly braces {}. For example: {1,2,3,4} is a set of numbers. In discrete mathematics, a set is an unordered collection of individual elements. A set can be explicitly described by listing its elements in a set bracket. If the order of the elements is changed or any element of the set is repeated, the set will not be changed. Set theory does not apply to just one discipline or domain. Due to its very general or abstract nature, set theory has many uses in other areas of mathematics. B. Discrete structure, data structure, etc. In a field called analysis, where calculus is an important part, the understanding of what limit points and function continuity mean is based on set theory. The algebraic processing of set operations leads to Boolean algebra. In Boolean algebra, intersections, unions, and difference operations are interpreted as corresponding to the logical operations "and", "or", and "not". Types of set Sets can be classified into many types. Some of which are: • Unit or singleton set: Singleton set or unit set contains only one element. A singleton set is denoted by {s}. Example − S = {x: x ∈ N, 5 < x < 7} = {6} • Empty or Null set: An empty set contains no elements. It is denoted by ∅. Example − S = {x: x ∈ N and 5 < x < 6} = ∅ • Universal set: It is a collection of all elements in a particular context or application. All the sets in that context or application are essentially subsets of this universal set. Universal sets are represented as U. Example − We may define U as the set of all animals on earth. In this case, set of all mammals is a subset of U, set of all fishes is a subset of U, set of all insects is a subset of U. • Finite set: A set which contains a definite number of elements is called a finite set. Example –The set of all persons in America is a finite set. • Infinite set: A set which contains infinite number of elements is called an infinite set. Example – Z = {……… -2, -1, 0, 1, 2, ……….} i.e. set of all integers is an infinite set. • Subset: A set A is a subset of set B (Written as A ⊆ B) if every element of A is an element of set B. Example – For example, A is the set of natural numbers, and B is the set of all whole numbers, then A is a subset of B because all natural numbers are present in the set of whole numbers). We can understand it this way: A = Set of natural numbers = {1, 2, 3, ....} B = Set of whole numbers = {0, 1, 2, 3, ...} Since every element of A is in B, A ⊆ B. • Proper Subset: The term “proper subset” can be defined as “subset of but not equal to”. A Set B is a proper subset of set A (Written as B ⊂ A) if every element of B is an element of set A and |B| < |A|. Example – For example, if A = {1, 2, 3}, then its proper subsets are {}, {1}, {2}, {3}, {1, 2}, {2, 3}, and {3, 1}, but the set itself {1, 2, 3} is NOT a proper subset of A. • Equal set: If two sets contain the same elements, they are said to be equal. Example − If A = {9, 2, 4} and B = {4, 2, 9}, they are equal as every element of set A is an element of set B and every element of set B is an element of set A. • Equivalent set: If the cardinalities of two sets are same, they are called equivalent sets. Example – If Set G: {Sweater, Mittens, Scarf, Jacket} and Set H: {Apples, Bananas, Peaches, Grapes}, it can be noted that both Set G and Set H comprise word elements in different categories and have the same number of elements i.e. four. • Disjoint set: Two sets A and B are called disjoint sets if they do not have even one element in common. Example − Let, A = {5, 2, 6} and B = {7, 9, 15}, there is not a single common elements, Hence, these sets are disjoint sets. Disjoint sets have the following properties − 1. n (A ∩ B) = ∅ 2. n (A ∪ B) = n(A) + n(B) • Joint sets or Overlapping set: Two sets that have at least one common element are called overlapping sets. Example − Let, A = {16, 2, 9} and B = {8, 3, 9}. There is a common element ‘9’, hence these sets are overlapping sets. Set Operations • Union of sets The union of two sets is a set containing all elements that are in A or in B (possibly both). For example, {1,2} ∪ {2, 3} = {1,2,3}. Thus, we can write x∈(A∪B) x∈(A∪B) if and only if (x ∈ A) or (x ∈ B). And also, A ∪ B = B ∪ A. In Venn-diagram; • Intersection of sets The intersection of two sets A and B, denoted by A∩B, consists of all elements that are both in A and B. For example, {1,2} ∩ {2,3} = {2} In Venn-diagram; • Complement of a set: The complement of a set A, denoted by (A′ or A¯), is the set of all elements that are in the universal set S or U but are not in A. • Difference of sets The difference (subtraction) is defined as follows. The set A−B consists of elements that are in A but not in B. For example, if A= {1,2,3} and B= {3,5}, then A−B= {1,2}. In Venn-diagram; # Mathematical problems of set. Each student in a class of 40 plays at least one indoor game chess, carrom and scrabble. 18 play chess, 20 play scrabble and 27 play carrom. 7 play chess and scrabble, 12 play scrabble and carrom and 4 play chess, carrom and scrabble. Find the number of students who play (i) chess and carrom. (ii) chess, carrom but not scrabble. Solution: Let A be the set of students who play chess B be the set of students who play scrabble C be the set of students who play carrom Therefore, We are given n(A ∪ B ∪ C) = 40, n(A) = 18, n(A ∩ B) = 7, n(B) = 20 n(C) = 27, n(C ∩ B) = 12 n(A ∩ B ∩ C) = 4 We have n(A ∪ B ∪ C) = n(A) + n(B) + n(C) - n(A ∩ B) - n(B ∩ C) - n(C ∩ A) + n(A ∩ B ∩ C) Therefore, 40 = 18 + 20 + 27 - 7 - 12 - n(C ∩ A) + 4 40 = 69 – 19 - n(C ∩ A) 40 = 50 - n(C ∩ A) n(C ∩ A) = 50 - 40 n(C ∩ A) = 10 Therefore, Number of students who play chess and carrom are 10. Also, number of students who play chess, carrom and not scrabble. = n(C ∩ A) - n(A ∩ B ∩ C) = 10 – 4 =6 P2 Determine the cardinality of a given bag (multi set). In this task, the learner is going to explain about the cardinality of a given bag (multi set). Introduction A set's cardinality is a measurement of its size, or the number of elements in the set. The cardinality of a set is expressed by vertical bars, similar to absolute value signs. For Example, the set A= {1,2,4,5,6} has a cardinality of 5 for the five elements that are in it, i.e., |A|=5 When A is finite, ∣A∣ is simply the number of elements in A. When A is infinite, A∣ is represented by a cardinal number. Let’s look at another example; If B= {5,6,7,8,9,1,3} the cardinality of a given set will be |B|=7. Multi set: Multi-Sets are an unordered collection of objects whose multiplicity can be more than one. The major difference between the set and the multiset is that in a set the keys must be unique, while a multiset has duplicate keys. ... In both sets and multisets, the sort order of components is the sort order of the keys, so the components in a multiset that have duplicate keys may appear in any order. Operation on multi-sets: Union (A U B) It gives a multiset such that multiplicity of an element is equal to the maximum of the multiplicity of an element in either A or B. Example – • If A= {4, 4, 4, 6, 6, 7, 7, 7} B= {5, 6, 7, 8,9} then, (A U B) is given by {4,4,4,5,6,6,7,7,7,8,9} • If A= {3,5,7} B= {2, 2, 2, 4, 4, 4, 4, 6, 6, 6} (A U B) is given by {3,2, 2, 2, 4, 4, 4, 4,5, 6, 6, 6,7} Intersection (A ∩ B) It gives a multi-set such that multiplicity of common element is minimum in either of two given set. Example – • If A= {4, 4, 4, 6, 6, 7, 7, 7} B= {5, 6, 7, 8,9} then, (A ꓵ B) is given by {6,7} • If A= {3,5,6,7} B= {2, 2, 2, 4, 4, 4, 4, 6, 6, 7} (A ꓵ B) is given by {6,7} Sum of Multi-set It gives a multi-set in which the multiplicity of an element is equal to the sum of multiplicity of an element in both. Example – • If A= {4, 4, 4, 6, 6, 7, 7, 7} B= {5, 6, 7, 8,9} then, (A + B) is given by {4,4,4,5,6,6,6,7,7,7,7,8,9} • If A= {3,5,7} B= {2, 2, 2, 4, 4, 4, 4, 6, 6, 6} (A + B) is given by {3,2, 2, 2, 4, 4, 4, 4,5, 6, 6, 6,7} Difference of Multi-set (A-B) The difference of two multisets A and B, is a multi-set such that the multiplicity of an element is equal to the multiplicity of the element in A minus the multiplicity of the element in B. Example – • If A= {4, 4, 4, 6, 6, 7, 7, 7,8,8} B= {4,4, 6, 7, 8,} then, (A - B) is given by {4,6,7,7,8} • If A= {2, 2, 2, 4, 4, 4, 4, 6, 6, 6} B= {2,4,4,6} (A - B) is given by {2,2,4,4,6} Cardinality of Multi-sets: A multiset's cardinality is the number of distinct elements in the set, ignoring the multiplicity of each element. For example; • If A = {1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5} The cardinality of the multiset A is 5. • If B = {a, a, a, a, d, d, d, v, v, v, b, b, b, b} The cardinality of the multiset B is 4. M1 Determine the inverse of a function using appropriate mathematical techniques: An inverse function or an anti function is defined as a function, which can reverse into another function. In simple words, if any function “f” takes x to y then, the inverse of “f” will take y to x. If the function is denoted by ‘f’ or ‘F’, then the inverse function is denoted by f-1 or F-1. One should not confuse (-1) with exponent or reciprocal here. If f and g are inverse functions, then f(x) = y if and only if g(y) = x In trigonometry, the inverse sine function is used to find the measure of angle for which sine function generated the value. For example, sin-1(1) = sin-1(sin 90) = 90 degrees. Hence, sin 90 degrees is equal to 1. A function accepts values, performs particular operations on these values and generates an output. The inverse function agrees with the resultant, operates and reaches back to the original function. The inverse function returns the original value for which a function gave the output. If you consider functions, f and g are inverse, f(g(x)) = g(f(x)) = x. A function that consists of its inverse fetches the original value. Example: f(x) = 2x + 5 = y Then, g(y) = (y-5)/2 = x is the inverse of f(x). Note: The relation, developed when the independent variable is interchanged with the variable which is dependent on a specified equation and this inverse may or may not be a function. If the inverse of a function is itself, then it is known as inverse function, denoted by f1(x). Inverse Function Graph: The graph of the inverse of a function reflects two things, one is the function and second is the inverse of the function, over the line y = x. This line in the graph passes through the origin and has slope value 1. It can be represented as; y = f-1(x) which is equal to; x = f(y) This relation is somewhat similar to y = f(x), which defines the graph of f but the part of x and y are reversed here. So if we have to draw the graph of f-1, then we have to switch the positions of x and y in axes. To find the inverse of the function: Generally, the method of calculating an inverse is swapping of coordinates x and y. This newly created inverse is a relation but not necessarily a function. The original function has to be a one-to-one function to assure that its inverse will also be a function. A function is said to be a one to one function only if every second element corresponds to the first value (values of x and y are used only once). You can apply on the horizontal line test to verify whether a function is a one-to-one function. If a horizontal line intersects the original function in a single region, the function is a one-to-one function and inverse is also a function. Types of Inverse Function There are various types of inverse functions like the inverse of trigonometric functions, rational functions, hyperbolic functions and log functions. The inverses of some of the most common functions are given below. Function Inverse of the Function Comment + – × / Don’t divide by 0 1/x 1/y x and y not equal to 0 x2 √y x and y ≥ 0 xn y1/n n is not equal to 0 ex ln(y) y>0 ax log a(y) y and a > 0 Sin (x) Sin-1 (y) – π/2 to + π/2 Cos (x) Cos-1 (y) 0 to π Tan (x) Tan-1 (y) – π/2 to + π/2 Inverse Trigonometric Functions The inverse trigonometric functions are also known as arc function as they produce the length of the arc, which is required to obtain that particular value. There are six inverse trigonometric functions which include arcsine (sin-1), arccosine (cos-1), arctangent (tan-1), arcsecant (sec-1), arccosecant (cosec-1), and arccotangent (cot-1). Inverse Rational Function A rational function is a function of form f(x) = P(x)/Q(x) where Q(x) ≠ 0. To find the inverse of a rational function, follow the following steps. An example is also given below which can help you to understand the concept better. Step 1: Replace f(x) = y Step 2: Interchange x and y Step 3: Solve for y in terms of x Step 4: Replace y with f-1(x) and the inverse of the function is obtained. Inverse Hyperbolic Functions Just like inverse trigonometric functions, the inverse hyperbolic functions are the inverses of the hyperbolic functions. There are mainly 6 inverse hyperbolic functions exist which include sinh-1, cosh-1, tanh-1, csch-1, coth-1, and sech-1. Check out inverse hyperbolic functions formula to learn more about these functions in detail. Inverse Logarithmic Functions and Inverse Exponential Function The natural log functions are inverse of the exponential functions. Check the following example to understand the inverse exponential function and logarithmic function in detail. Also, get more insights of how to solve similar questions and thus, develop problem-solving skills. Finding Inverse Function Using Algebra Put “y” for “f(x)” and solve for x: The function: f(x) = 2x+3 Put “y” for “f(x)”: y = 2x+3 Subtract 3 from both sides: y-3 = 2x Divide both sides by 2: (y-3)/2 = x Swap sides: x = (y-3)/2 Solution (put “f-1(y)” for “x”) : f-1(y) = (y-3)/2 Inverse Functions Example Example 1: Find the inverse of the function f(x) = ln(x – 2) Solution: First, replace f(x) with y So, y = ln(x – 2) Replace the equation in exponential way , x – 2 = ey Now, solving for x, x = 2 + ey Now, replace x with y and thus, f-1(x) = y = 2 + ey Example 2: Solve: f(x) = 2x + 3, at x = 4 Solution: We have, f(4) = 2 × 4 + 3 f(4) = 11 Now, let’s apply for reverse on 11. f-1(11) = (11 – 3) / 2 f-1(11) = 4 Magically we get 4 again. Therefore, f-1(f(4)) = 4 So, when we apply function f and its reverse f-1 gives the original value back again, i.e, f-1(f(x)) = x. Example 3: Find the inverse for the function f(x) = (3x+2)/(x-1) Solution: First, replace f(x) with y and the function becomes, y = (3x+2)/(x-1) By replacing x with y we get, x = (3y+2)/(y-1) Now, solve y in terms of x : x (y – 1) = 3y + 2 => xy – x = 3y +2 => xy – 3y = 2 + x => y (x – 3) = 2 + x => y = (2 + x) / (x – 3) So, y = f-1(x) = (x+2)/(x-3) D1 Formulate corresponding proof principles to prove properties about defined sets: The algebra of sets is the set-theoretic analogue of the algebra of numbers. It is the algebra of the set-theoretic operations of union, intersection and complementation, and the relations of equality and inclusion. There is total 7 laws of algebra which is discussed and proved below: • Idempotent law: According to the law; Intersection and union of any set with itself revert the same set. Mathematically, • A⋂A = A and • A⋃A = A Where A is any random set. For, I. A ⋃A = A Let A= {8,9,3} Taking L.H.S. A⋃A {8,9,3} ⋃ {8,9,3} = {8,9,3} which is equal to R.H.S. where, R.H.S. = A = {8,9,3} Therefore, L.H.S = R.H.S. Hence, proved. For, II. A⋂A = A, Let, A= {5,7,9} Taking, L.H.S A⋂A {5,7,9} ⋂ {5,7,9} = {5,7,9} Which is equal to R.H.S. where, R.H.S = A= {5,7,9} Therefore, L.H.S = R.H.S Hence, proved. • Associative law: Associative Law states that the grouping of set operation does not change the result of next grouping of sets. If we have three sets A, B and C, then, 1. Associative Law of Intersection: (A ∩ B) ∩ C = A ∩ (B ∩ C) 2. Associative Law of Union: (A U B) U C = A U (B U C) For 1, (A ∩ B) ∩ C = A ∩ (B ∩ C) Let A= {4,5,6,7}, B = {5,6,7,8}, C= {1,6,7,9} Taking L.H.S (A ∩ B) ∩ C ({4,5,6,7} ∩ {5,6,7,8}) ∩ {1,6,7,9} = {6,7} ∩ {1,6,7,9} = {6,7} Now, taking R.H.S., A ∩ (B ∩ C) {1, 2, 3, 4} ∩ ({2, 3, 4, 5} ∩ {3, 4, 5, 6}) = {1, 2, 3, 4} ∩ {3, 4,5} = {3, 4} Hence, both the R.H.S and L.H.S gave us the exact answer therefore R.H.S = L.H.S, proved. For 2., (A U B) U C = A U (B U C) Let, A= {1, 2}, B= {2, 3}, C= {3, 4} Taking, L.H.S. (A U B) U C ({1, 2} U {2, 3}) U {3, 4} = {1, 2, 3} U {3, 4} = {1, 2, 3, 4} Now, Taking R.H.S, A U (B U C) {1, 2} U ({2, 3} U {3, 4}) = {1, 2} U {2, 3, 4} = {1, 2, 3 ,4} Hence, both the R.H.S and L.H.S gave us the exact answer therefore R.H.S = L.H.S, proved. • Commutative law: It states that the union or the intersection of two sets is the same no matter what the order is in the equation. i.e., • A∪B=B∪A • A∩B=B∩A For, a. A ∪ B = B ∪ A Let, A= {3,4}, B= {7, 8} Taking L.H.S A ∪ B {3,4} ∪ {7, 8} = {3,4, 7, 8} Now, taking R.H.S. B ∪ A {7, 8} ∪ {3,4} = {3,4,7,8} Hence, both the R.H.S and L.H.S gave us the exact answer therefore R.H.S = L.H.S, proved. For b. A ∩ B = B ∩ A Let, A= {1, 2, 3}, B= {6,7,8} Taking L.H.S. A ∩ B {1, 2, 3,8} ∩ {6,7,8} = {8} Now, taking R.H.S B ∩ A {6,7,8} ∩ {1, 2, 3,8} = {8} Hence, both the R.H.S and L.H.S gave us the exact answer therefore R.H.S = L.H.S, proved. • Distributive Law: Distributive Law states that, the sum and product remain the same value even when the order of the elements is altered. I. A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) II. A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) For I. A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) Let, A= {a, b, c, e} B= {b, d, e} C= {e, f, g} Taking L.H.S A ∪ (B ∩ C) {a, b, c, e} ∪ ({b, d, e} ∩ {e, f, g}) = {a, b, c, e} ∪ {e} = {e} Now, taking R.H.S. (A ∪ B) ∩ (A ∪ C) ({a, b, c, e} ∪ {b, d, e}) ∩ ({a, b, c, e} ∪ {e, f, g}) = {a, b, c, d, e} ∩ {a, b, c, e, f, g} = {e} Hence, both the R.H.S and L.H.S gave us the exact answer therefore first law of distributive is proved. For II. A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) Let, A= {1, 2, 3} B= {3, 4, 5} C= {5, 6 ,7} Taking L.H.S., A ∩ (B ∪ C) {1, 2, 3} ∩ ({3, 4, 5} ∪ {5, 6, 7}) = {1, 2, 3} ∩ {3, 4, 5, 6, 7} = {3} Now, Taking R.H.S., (A ∩ B) ∪ (A ∩ C) ({1, 2, 3} ∩ {3, 4, 5}) ∪ ({1, 2, 3} ∩ {5, 6, 7}) = {3} ∪ {} = {3} Hence, both the R.H.S and L.H.S gave us the exact answer therefore Second law of distributive is proved. • Compliment law The union of a set A and its complement A’ gives the universal set U of which, A and A’ are a subset. i.e. A ∪ A’ = universal set (U) OR A’’ For Example: If U = {1, 2, 3, 4, 5} and A = {1, 2, 3} then A’ = {4, 5} So, A ∪ A’= {1, 2, 3} ∪ {4, 5} = {1, 2, 3, 4, 5} From this it can be seen that, A ∪ A’ = U = {1, 2, 3, 4, 5} Hence, the law of compliment is proved. • Identity law: The identity laws establish the basic rules for taking the union and intersection of sets including the empty set. They apply to all sets including the set of real numbers. Where A is any set of numbers: 1) A union A equals A (A U A=A) This law states that the union of two identical sets is the same as the original set. If A= {5, 6, 7, 8, 9} then, (A U A) = {5, 6, 7, 8, 9} U {5, 6, 7, 8, 9} = {5, 6, 7, 8, 9} which is A. so hence, the law is proved. 2) An intersection A equals A (A ∩ A=A) This law states that the intersection of two identical sets is the same as the original set. If A= {5, 6, 7, 8, 9} then, (A ∩ A) = {a, b, c, d, e} ∩ {a, b, c, d, e} = {a, b, c, d, e} which is A. so hence, the law is proved. 3) A union empty set equals A (A U {} = A) This law states that the union of a set and the empty set is the same as the original set. If A= {f, g, b, n, e} then, (A U {}) = {f, g, b, n, e} U {} = {f, g, b, n, e} which is A. so hence, the law is proved. 4) An intersection empty set equals empty set (A ∩ {} =A) This law states that the intersection of a set and the empty set is the same as the empty set. If A= {10, 11, 12, 13, 14} then, (A ∩ {}) = {10, 11, 12, 13, 14} ∩ {} = {10, 11, 12, 13, 14} which is A. so hence, the law is proved. • De-Morgan's Law: De Morgan’s law states that ‘The complement of the union of two sets A and B is equal to the intersection of the complement of the sets (A’) and B’. Also, according to De Morgan’s law, the complement of the intersection of two sets A and B is equal to the union of the complement of the sets A and B i.e., • (A∪B)’ = A’ ∩ B’ and • (A ∩ B)’ = A’ ∪ B’ For I. (A∪B)’ = A’ ∩ B’ Let U= {a, b, c, d, e, f, g, h} A= {a, b, c} B= {c, d, e, f} Taking L.H.S., (A∪B)’ ({a, b, c} U {c, d, e, f})’ = {g, h} Now, Taking R.H.S. A’ ∩ B’ A’ = {d, e, f, g, h} B’ = {a, b, g, h} so, A’ ∩ B’ = {d, e, f, g, h} ∩ {a, b, g, h} = {g, h} Hence, R.H.S. = L.H.S. the law is proved. For II. (A ∩ B)’ = A’ ∪ B’ Let U= {1, 2, 3, 4, 5, 6, 7, 8, 9} A= {1, 2, 3, 4, 5} B= {4, 5, 6, 7} Taking L.H.S., (A ∩ B)’ ({1, 2, 3, 4, 5} ∩ {4, 5, 6, 7})’ = {1, 2, 3, 6, 7, 8, 9} Now, Taking R.H.S., A’ ∪ B’ A’ = {6, 7, 8, 9} B’ = {1, 2, 3, 8, 9} so, A’ U B’ = {6, 7, 8, 9} U {1, 2, 3, 8, 9} = {1, 2, 3, 6, 7, 8, 9} Since, R.H.S. = L.H.S. the law is proved. P3 Model contextualized problems using trees, both quantitatively and qualitatively.