Final

Preview:

Citation preview

TAF 3023 - Discrete Mathematic

Pang Kok An 032195

Siti Aminah Bt Ahmad Sahrel 032806

Nurul Fasihah Bt Che Azmi 032220

Hasyazid b Osman 033147

Muhd. Faiz Fahimi Bin Razali 033225

Nurul Nabilah Bt Azman 032236

Roshatul Hidaya Bt Rosdin 032558

Nusaibah Bt Yahaya 032357

GROUP 1

We usually write our sets like this:  

S = { 4, 3, 5 } 

You’re asked to recognise the number 4 in a set. Well, I guess it doesn’t take you a long time on this, right? What if we let a

computer to recognize the number 4 in set.

This is rather a slow process. If it encounters a set with 100 elements or even 1000 elements, the downside of this method

is more obvious.

 

Sets are preferred to be presented in the form of bit string, in which computers recognize certain types of elements in a set

by determining the digit 0 and 1 only. There is no need to force the computers into reading decimals.

Representation of sets in computers

S = { a, b, e, g, h, i, n, o, r, t, u, z } 

Recognise the subset of set S consists of only vowel elements and turn the subset into a bit string.

 Solution:

 We’ll turn all the vowel elements to 1 and all the non-vowel elements into 0. Therefore, the bit string for the subset with

vowel elements is 

101001010010

Example Of Representing Sets By Using Computer

 V = { a, e, i, o, u } 101001010010

 E = { a, b, o, r, t } 110000011100

 

Please write the bit string and the set of V ∪ E.

Solution:

If two binary values, at least one of them is 1, the binary value yielded is 1. Otherwise, the result is 0.

 1 0 1 0 0 1 0 1 0 0 1 0

1 1 0 0 0 0 0 1 1 1 0 0

↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓

1 1 1 0 0 1 0 1 1 1 1 0

The bit string we get is 111001011110. Therefore, from the above working, we can conclude that V ∪ E = { a, b, e, i, o, r, t, u }

Example of representing union sets in computer

 V = { a, e, i, o, u } 101001010010

 E = { a, b, o, r, t } 110000011100

please write the bit string and the set of V ∩ E.

Solution: In this case, we use the logical operator “and” in this situation, where the binary value yielded is 1 if every binary values we put into comparison is 1.

1 0 1 0 0 1 0 1 0 0 1 01 1 0 0 0 0 0 1 1 1 0 0↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓

1 0 0 0 0 0 0 1 0 0 0 0 The bit string we get is 100000010000. Therefore, from the

above working, we can conclude that V ∩ E = { a, o } 

Example of representing intersection sets in computer

S = { a, b, e, g, h, i, n, o, r, t, u, z }

what is the bit string of the subset of set S which consists of only consonant elements?

Solution:

The subset of set S with consonant elements is exactly the complement of the subset with vowel elements.

 bit string of vowel subset = 101001010010

 When dealing with complements, just change all 1’s into 0’s. Therefore we get:

 bit string of consonant subset = 010110101101

Example of representing complement sets in computer

CONCEPT OF RELATIONS BETWEEN TWO SET

A binary relation from A to B is a subset of A X B. Notation that can be use : - a R b - (a, b) ∈ R a is said to be related to b by R

Relation Represented in Matrix

Relation Represented in Digraph

R = { { a, b }, { b, c }, { b, a }, { c, c } }

Each element is relates to itself .(a, a) ∈ R for every Element a ∈ A. If ∀a((a, a) ∈ R),

Example : A = {1, 2, 3, 4}

A x A = {(1,1),(1,2),(1,3),(1,4),(2,1),(2,2),(2,3),(2,4),(3,1),(3,2),(3,3),(3,4),(4,1),(4,2),(4,3),(4,4)}

R1 = {(1, 1)}

R2 = {(2, 3), (1, 1), (2, 2), (3, 3), (4, 4)}

R2 is reflexive because contain all pairs of the form (a, a), namely, (1, 1), (2, 2), (3, 3), and (4, 4).

R1 not reflexive because (2, 2), (3, 3), (4, 4)} is not in any of these relations.

Reflexive

Symmetric If the order of the elements is irrelevant.

∀a∀b ∈ A, (a, b) ∈ R → (b, a) ∈ R.

Antisymmetric Implies the identity of the respective elements.

∀a∀b ∈ A, (a, b) ∈ R ^ (b, a) ∈ R → a = b

Example :

A = {1, 2, 3, 4}

A x A = {(1,1), (1,2), (1,3), (1,4), (2,1), (2,2), (2,3), (2,4), (3,1), (3,2), (3,3), (3,4), (4,1), (4,2), (4,3), (4,4)}

R1 = {(1, 2), (2, 3)} antisymmetric

R2 = {(1, 1), (2, 2)} symmetric and antisymmetric

R3 = {(1, 2), (2, 1)} symmetric

Symmetric and Antisymmetric

If the middle element of a chain can be removed.

∀a∀b∀c ∈ A, (a, b) ∈ R ^ (b, c) ∈ R → (a, c) ∈ R.

Example :

A = {1, 2, 3, 4}

A x A = {(1,1), (1,2), (1,3), (1,4), (2,1), (2,2), (2,3), (2,4), (3,1), (3,2), (3,3), (3,4), (4,1), (4,2), (4,3), (4,4)}

R1 = {(1, 2), (2, 3), (1, 3)} transitive

R2 = {(1, 2), (2, 3)} not transitive: (1, 3) ∉ R2

R3 = {(1, 1)} transitive

R5 = {(2, 3), (3, 4), (3, 2)} is not transitive (2,2), (3, 3), (2, 4) ∉ R5

Transitive

Function f is from set A to set B, if exactly one element of

B is exactly mapped to each element of A.

Functions

Image of element in set A is the element of set B which has a relationship between them.

Preimage of element in set B is the element of set A which has a relationship between them.

Domain - is what we used to refer to set A,

Codomain - is what we used to refer to set B, if the function f is from A to B.

Range - of the function is a set of elements of B which has relationship between any element in set A

Boolean Functions

Boolean function is a type of function which expresses a boolean expression. It will return a boolean value, either 1 or 0 if any value is passed into the function

Example:

F(x, y) = x + ¬ y.

When F(1, 0), x = 1 and y = 0,

 

x + ¬ y = 1 + ¬ 0 = 1 + 1 = 1

 

The truth value for F(1, 0) is 1.

A function is said to be injective if it is one-to-one.

Example: Function f from {1,2,3} to {a,b,c,d} f(1)=b, f(2)=d, f(3)=a is one to one

Injective

A function is called surjective if it is onto.

Example: Function f from {a,b,c,d} to {I,II,III} f(a)=II, f(b)=I, f(c)= II, f(d)=III is onto.

Surjective

Bijective

Bijective= injective + surjective

It is a bijective as it is one-to-one and onto

Example:

Let f be the function from {a,b,c,d} to {1,2,3,4} with f(a)=4, f(b)=2, f(C) = 1 and

f(d)=3

Answer: the function is bijective as it is one-to-one and onto.

•The inverse of a function is the set of ordered pairs obtained by interchanging the first and second elements of each pair in the

original function.• Should the inverse of function f (x) also be a function, this

inverse function is denoted by f -1(x).

• EXAMPLE:Given function f, find the inverse relation. Is the inverse relation also a function?

f(x)={(3,4),(1,-2),(5,-1),(0,2)}

Answer: Function f is a one-to-one function since the x and y values are used only once. Since function f is a one-to-one function, the inverse relation is also a function.Therefore, the inverse function is: f¯¹(x)={(4,3),(-2,1),(-1,5),(2,0)}

Inverse Function

Definition: Composition function is about a function which acts as a perimeter of another function.

For example, f[g(x)].f[g(x)] means that the function f takes the g(x) as its perimeter.

We usually states f[g(x)] as (f ◦ g)(a).

Composition Function

f(x) = x + 2

g(x) = 3 – x

 

Find (f ◦ g)(a) and the value of (f ◦ g)(2).

 

Solution:

 

f(x) = x + 2

g(x) = 3 – x

 

f[g(x)] = ( 3 – x ) + 2

(f ◦ g)(a) = 5 – x

 

(f ◦ g)(2) = 5 – 2

(f ◦ g)(2) = 3

 • Therefore, (f ◦ g)(2) = 3

Example 1