Assignment 1 - Dicrete Math

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

PROGRAM TITLE: HIGHER NATIONAL DIPLOMA IN COMPUTING

UNIT TITLE: DISCRETE MATHS

ASSIGNMENT NUMBER: 1 – SET THEORY AND FUNCTIONS

TUTORIAL LECTURER: LUU THI HUONG GIANG

WORD COUNT: 1686

STUDENT NAME: CAO NGUYEN VU

STUDENT ID: BKC1971

 
Summative Feedback: 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Internal verification: 
 
 
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.

The cardinality of the set A ∪ B can be solve by this equation: 72+28-13 = 87

2. Let A = { n∈N: 20≤n<50 } and B = { n∈N: 10<n≤30 }. Suppose C is a set such that C⊆A
and C⊆B. What is the largest possible cardinality of C ?

C = A ∩ B = { n ∈ N : 20 ≤ n ≤ 30 }
 A = { n∈N: 20≤n<50 }  C = {20,21,22,23,24,25,26,27,28,29,30}
 B = { n∈N: 10<n≤30 }
 The largest possible cardinality of C is 11.
 C⊆A and C⊆B

3. Consider the sets A and B, where A = { 3,|B| }and B = { 1,|A|,|B|}. What are the sets ?

2 ,|B|≠ 3
It follows that |A∣ = {
1,|B|≠ 3
.

Suppose that |A∣=1, then B={1, 1, |B|} = {1, |B|} and we have a contradiction
with |B∣=3. => |A|=2 and thus |B|≠3.
Taking into account that B= {1, |A|, |B|}= {1,2,|B|} and |B∣ < 3, we conclude that
|B|=2.

=> In conclusion, A= {3, 2} and B={1, 2}.

Part 2:

1. Write the multi-sets of prime factors of given numbers.


a. 150 = 2 x 3 x 5 x 5.
b. 450 = 2 x 3 x 3 x 5 x 5.
c. 1250 = 2 x 5 x 5 x 5 x 5.
2. Find the cardinalities of each multiset in part 2-1.
i. A = { 2, 3, 5, 5 } => ∣A∣ = 6
ii. A = { 2, 3, 3, 5, 5 } => ∣A∣ = 5
iii. A = { 2, 5, 5, 5, 5} => ∣A∣ = 5
3. Present the application of set and multisetin software engineering ? Give specific
programming example.

A set is an unordered collection of distinct objects. The objects in a set are called the
elements, or members, of the set. 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.

Set theory is applicable not only in one field or area. Because of its very general or
abstract nature, set theory has many applications in other branches of mathematics e.g. Discrete
structure, Data structure etc. In the branch called analysis of which differential and integral
calculus are important parts, an understanding of limit points and what is meant by continuity of
a function are based on set theory. The algebraic treatment of set operations leads to boolean
algebra, in which the operations of intersection, union and difference are interpreted as
corresponding to the logical operations “and”, “or” and “not” respectively. Boolean algebra is
used extensively in the design of digital electronic circuitry, such as that found in calculators and
personal computers. Set theory provides the basis of topology, the study of sets together with the
properties of various collections of subsets.

A major reason for set theory is that it makes the terminology of other forms of mathematics
easier aside from that of course everyone “uses” set theory every-day, even if they don’t know it
or have never learned set theory.

For example, I will take multiset in C++ Standard Template Library. Multisets are a type
of associative containers similar to set, with an exception that multiple elements can have same
values. Some Basic Functions associated with multiset:

begin() – Returns an iterator to the first element in the multiset

end() – Returns an iterator to the theoretical element that follows last element in the multiset

size() – Returns the number of elements in the multiset

max_size() – Returns the maximum number of elements that the multiset can hold
empty() – Returns whether the multiset is empty

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 : R → R+
f(x) = x^2
The function f(x)=x^2 is not injective in the domain  D(f)=R , since we have an
example:
Replace x = 2 in the equation, we have: (-2) ^2 = 4 = 2^2 but -2 is not = 2.
Conclusion: f : R → R+ ; f(x) = x^2 is no inverse function.
ii. f : R+ → R+
f(x) = 1/x
This function is surjective and injective, therefore the function has an inverse
function.
y = 1/x  x = 1/y  f(x) = 1/x  f^-1(x) = 1/x
Verification  f (f^−1(x) )=1/ 1/x =x
=> f(x) = 1/x  f^−1(x) =1/x
iii. f : R+ → R+
f(x) = x^2
This function is surjective and injective, therefore the function has an inverse
function.
y = x^2  x = √y  f(x) = x^2  f^-1(x) = √x
Verification  f(f^−1(x)) = (√x)^2 = x
=> f(x) = x^2  f^−1(x) = √x
iv. f : [-π/2 , π/2]
f(x) = sinx
The function y = sinx is not monochromatic over all domains. However, if we
consider the segment [-π/2 , π/2] then the function y = sinx is a covariate function,
so there is only an inverted image, and that inverted image is denoted x= arcsiny .
And x ∈ [-π/2 , π/2]; y ∈ [-1, 1].

π/2 y = arcsinx

-1 1

-π/2

So the inverse of y = sinx is y = arcsinx ( y is the arc where sin equals x).
v. f : [0, π]  [-2, 2]
f(x) = 2cosx
Considering the function y = 2cosx on the segment 0 ≤ x ≤ π, then the function y
= 2cosx is a decreasing function, so there is only an inverse, and that inversion is
denoted x = 2arccosy. So y = 2cosx, (0 ≤ x ≤ π; -2 ≤ y ≤ 2) => x = 2arccosy.
π
3

1
y = arccosx

-2 -1 1 2

Hence, the inverse of y = 2cosx is y = 2arccosx ( y is arc cosine equal to x)


2. Function f(x) = 5/9( x-32 ) converts Fahrenheit temperatures into Celsius. What is the
function for opposite conversion?
Let f(x) = y
 y = 5/9(x−32)
 9y = 5x − 160 ⟹ 9y + 160 = 5x
 X = 1/5(9y+160) = 9/5y + 32

Therefore the opposite function ,which convert Celsius to Fahrenheit is 9/5y + 32.
Where y is the temperature in Celsius.

Here is complete equation for this question: x°C = (9/5x+32)°F

3. Present the application of function in software engineering? Give specific programming


example.
The purpose of most software functions is to transform inputs into an output or
product. However, some functions will receive control flow instead of an input.
Examples of functions that receive only control flow include: (1) the action to present
graphical user informational screens, messages, or dialog screens; (2) take action on
global data values; and (3) take action when a state variable has changed or needs to be
assessed.
While functions that do not directly process data may not satisfy computer
language specific or mathematical criteria, they do perform significant actions within the
software engineering field of study.
For example, in many software language, function is a block of organized,
reusable code that is used to perform a single, related action. Functions provide better
modularity for your application and a high degree of code reusing. You have already seen
various functions like printf() and main(). These are called built-in functions provided by
the language itself (C++, HTML,python,…), but we can write our own functions as well.

Part 4:

1. Formulate corresponding proof principles to prove the following properties about defined
sets. A=B⇔A⊆B and B ⊆ A.

Suppose we want to show A = B. If we show A ⊆ B, then every element of A is also in


B, but there is still a possibility that B could have some elements that are not in A, so we can’t
conclude A = B. But if in addition we also show B ⊆ A, then B can’t contain anything that is not
in A, so A = B.

Or in different way we could proof like this:

Let x be arbitrary.

Because A ⊆ B if x ∈ A then x ∈ B

Because B ⊆ A if x ∈ B then x ∈ A

Hence, x ∈ A if x ∈ B, thus A = B.

2. De Morgan's Law by mathematical induction.

Complement of the Intersection Equals the Union of the Complements

Let P = (A ∩ B)' and Q = A' ∪ B'

Let x be an arbitrary element of P then:

x ∈ P⇒ x ∈ (A ∩ B)'⇒ x ∉ (A ∩ B)⇒ x ∉ A or x ∉ B⇒ x ∈ A' or x ∈ B'⇒ x ∈ A' ∪ B'⇒ x ∈ Q 

3. Distributive Laws for three non-empty finite sets A, B, and C.

To prove this distributive Laws for three non-empty finite sets A, B, and C, I would use
the 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 obtain a contradiction --- then the theorem must be true.
Assume A ⊆ B and B ∩ C = ∅ , and A ∩ C ≠ ∅ . To prove that this cannot occur, let x ∈ A∩C.
Therefore, x ∈ A ∩ C ⇒ x ∈ A and x ∈ C ⇒ x ∈ B and x ∈ C ⇒ x ∈ B ∩ C. But this contradicts
the second premise. Hence, the theorem is proven

You might also like