Week 3 Notes
Week 3 Notes
COMPUTATION (ICS3253)
Week 3 – Introduction #2
CLASS 2
RELATIONS AND FUNCTIONS 2
Q: Find whether from the set of integers to the set of integers is one-to-one
Solution: The function is not one-to-one as, for example f(1)=f(-1)=1 but 1 -1
Q: Given f is a function where A={a,b,c,d} and B={1,2,3} with f(a)=3, f(b)=2,
f(c)=1 and f(d)=3. Is the function f an onto function?
Solution: Hint: draw the oval, map the elements
in this case you will see that all three elements of the codomain (range) are
images of elements in the domain, therefore, we have f as on “onto” function
>>> COMPOSITION OF FUNCTION 8
Given f(x) = 2x+3 and g(x)=3x+2, check if commutative law holds good for
composition of functions
>>> 9
Check whether the mapping f: where defined by is one to one and onto
Solution: x=set of all non-zero real numbers. Let . Then
Hence, f is one to one
For every non-zero real number there exists a non-zero real number such that
Hence, every element is an image of . Therefore f is onto. Therefore f is one-
to-one and onto
GRAPHS AND TREES 10
Connected graphs:
>>> 15
Disconnected graphs:
>>> 16
A walk is a sequence of edges, where the finish vertex of each edge is the start
vertex of the next edge
Tree: A graph if it is connected and has no simple cycle
A path is a cycle if it starts and ends in the same node – a simple cycle is one
that does not repeat any nodes except for the first and last
Directed graph: A graph that has arrows instead of lines
Outdegree: The number of arrows pointing from a particular node is
outdegree of that node
Indegree: The number of arrows pointing to a particular node
STRINGS AND LANGUAGES 17
Alphabet: Defined as a finite set of symbols
Roman Alphabet: {a,b,c, … , z}
Binary Alphabet: {0,1}
String: A string over an alphabet is a finite sequence of symbols from that
alphabet, which is usually written next to one another and not separated by
commas
If = {0,1}, then 001001 is a string over
If = {a,b,c,…,z} then axyrpqstcd is a string over
Length of String: Length as a sequence, written as |w|
|100010| = 6
Empty string: String with zero length
>>> 18
Let L = {ab, aa, baa}. Which of the following strings are in L*?
abaabaaabaa
aaaabaaaa
baaaaabaaaab
baaaaabaa
baaaaabaaaaabbb
babaaaabaaaab
ENOUGH?
See you next week