Uploaded by Litu anam Bochon

Introduction to Theory of Computation (1st part)

advertisement
1
Prepared by –
Litu anam Bochon
E-mail: Lituanam.Bochon@gmail.com
FB: facebook.com/Lituanam.CSEan
ID : 1702013
2018
Theory of computation
and
concrete mathematics
Will be helpful for
CSE 257 course!
2
Chapter - O
Basics of Theory of computation - TOC
Theory of computation is basically based on two type of theory. Those are given below:–
TOC
Set theory
Graph theory
→ We will discuss about set theory in chapter 2 though you read this theory in school, college and discrete
mathematics course.
→ Here, we’ll discuss about theory of computation based on graph theory.
Define Theory.
Simply, Theory is an assumption based in hypothesis or idea or conjecture (অনুমান).
Define computation.
Computation is any kind of arithmetical and non–arithmetical calculation, problem solving or any task that
is done by any machine. Any machine means computer, calculator etc. etc.
Write the formal definition of computation.
Let M = (Q, Σ, δ, q0, F) be a finite automaton and w = w1 w2 . . .wn be a string over Σ; Then M accepts w if
a sequence of states r0,r1, . . . ,rn exist in Q such that the following hold:
➔ r0 = q0
➔ δ(ri , wi +1) = ri +1 for i = 0, 1, . . . , n – 1
➔ rn ∈ F
Define theory of computation or TOC.
The theory of computation is the branch that deals with how efficiently problems can be solved on a model
of computation using an algorithm.
The field of TOC is divided into three major branches.
✓ Automata theory
✓ Computability theory
✓ Complexity theory
What do you know about computability theory, complexity theory and automata theory ?
Or,
Briefly explain the major fields of TOC.
The field of TOC is divided into three major branches.
✓ Computability theory
✓ Automata theory
✓ Complexity theory
Computability theory
Computability theory is the branch of theory of computation that studies whether a problem is solvable or
not using different models of computation and what amount of number crunching is required to solve it.
3
Complexity theory
Computational complexity theory is the branch of Theory of Computation that deals with the efficiency of a
program which a computer can solve. Time and space are considered to be the two vectors responsible for a
problem efficiency. This theory mainly acts a general question about possible algorithm to solve a problem
whereas analysis of algorithm involves analyzing the amount of resources needed to solve a problem.
Automata theory
The term automata or automatons (plural form of automaton) is derived from Greek word. Literally it means
“Something that works automatically”. Theory of automata is the theoretical branch of mathematical and
computer science. It is the study of abstract machine and it deals with definition and properties of different
types of computational model. The abstract machine is called automata.
The main motivation behind developing automata theory was to develop methods to describe and analyze
the dynamic behavior of discrete system. The automata consist of states and transition. The state is
represented by circle and the transition is represented by arrows.
Define automata theory. What are the applications of Automata theory/ TOC ?
Automata theory is the study of abstract machine and it deals with definition and properties of different types
of computation model. The abstract machine is called automata.
Applications :
➔ The importance to study Theory of Computation is to better understand the development of formal
mathematical models of computation.
➔ Automata theory deals with the definitions and properties of different types of computational model.
➔ It’s used in Compiler design, Compiler specifications and String matching.
➔ Another model of its named context-free grammar is used in programming languages and artificial
intelligence.
➔ It’s used in lexical analysis of a compiler.
➔ For recognizing the pattern using regular expressions.
➔ For the designing of the combinational and sequential circuits using Mealy and Moore Machines.
➔ Used in text editors.
➔ For the implementation of spell checkers.
➔ It is used in formal verification of critical software systems.
What are the fundamental capabilities and limitation of a computer ?
Capabilities
✓
✓
✓
✓
✓
✓
✓
Speed
Accuracy
Reliability
Logical operations
Repetitiveness
Provide new time dimensions.
Versatility
Limitations
✓
✓
✓
✓
✓
Lack of common sense.
Zero IQ.
Can’t correct wrong instructions.
Can’t decide.
Can’t express ideas.
4
Some basic terms of TOC
❖ Symbol
Symbol is the basic building block which can be alphabet letter or any picture.
For example :
a, b, c, ……………, z
or 0, 1, 2, ……………, 9 etc. etc.
❖ Alphabet
An alphabet is non-empty finite set of symbols. It is denoted by ‘∑’.
For example :
∑ = { a, b, d, e }, ∑ is an alphabet set where ‘a’, ‘b’, ‘d’ and ‘e’ are symbols.
❖ String
String is the finite sequence of symbols from alphabet. String is generally denoted by ‘w’.
For example :
w = ‘cbadbad’ is a valid string over ∑ = { a, b, c, d }
▪
Length of a String
It is the number of symbols present in a string. Length of string is denoted by |w|.
For example :
If w = ‘cbadbad’ over ∑ = { a, b, c, d } and length of string |w|= 7.
If |w|= 0, it is called an empty string that is denoted by [Epsilon] or γ [Lambda].
▪
Classifications of string
Classifications of string are shown below:
String
Empty string
Finite string
Infinite string
▪ Empty string
Empty string is the string with zero occurrence or member of symbols represented as
[Lambda]
▪ Finite string
Finite string is a finite set of symbols.
For example :
∑ = { 0, 1 },
W = { 10110 },
|w| = 5
▪ Infinite string
Infinite string is an infinite set of symbols.
For example :
∑ = { 0, 1 },
W = { 110110………… }
[Epsilon] or γ
5
Let’s see another basic concept of string!
Reverse string
The reverse of a string w in a language L is denoted by wR is obtained by writing the letters of w in reverse
order even if this backward string is not a word in L.
For example :
If w = ‘abc’ is a string defined over ∑ = { a, b, c }, then wR = ‘cba’
Substring
A substring is a contiguous sequence of characters within a string.
For example :
If w = ‘abc’ then , a, b, c, ab, ac, bc, abc are the substrings of w.
Prefix and suffix
A prefix of a string w is any leading contiguous part of string w and a suffix of a string w is any trailing
contiguous part of string w.
If w = vu, then v is the prefix of string w and u is the suffix of string w.
For example :
If w = ‘abc’
a, ab, abc are the prefix of string w.
c, bc, abc are the suffix of string w.
ab, bc, abc are the substring of string w.
If w = ‘banana’
b, ba, ban, bana, banan, banana are the prefix of string w.
a, na, ana, nana, anana, banana are the suffix of string w.
ban, ana, nana etc. are the substring of string w.
❖ Language
Language is a collection of strings chosen from some alphabet that can be finite or infinite.
For example :
∑ = { a, b }
1) L = Set of all strings odd length defined over ∑.
= { a, aaa, aaaaa, bbb, bbbbb,……..… }
Or,
L (M) = { w|w string of odd length }
= { a, aaa, aaaaa, bbb, bbbbb,……..… }
2) L = Set of all strings even length defined over ∑,
= { aa, bb, aaaa, aaaaaa, bbba, bbbabb,………..… }
Or,
L (M) = { w|w string of even length }
= { aa, bb, aaaa, aaaaaa, bbba, bbbabb,………..… }
3) L = Set of all string that starts with ‘a’ over ∑,
= { a, ab, aab, abb, aaa,……………….. }
Or,
L (M) = { w|w starts with ‘a’ }
= { a, ab, aab, abb, aaa,……………….. }
6
4) L = Set of all string that does not start with ‘a’ over ∑,
= { b, ba, bb, baa, bab, bba, bbb, …………………. }
Or,
L (M) = { w|w does not start with ‘a’ }
= { b, ba, bb, baa, bab, bba, bbb, …………………. }
5) L = Set of all string that start with ‘aa’ over ∑,
= { aa, aab, aabb, aaaba, aabab, aabba, aabbb, …………………. }
Or,
L (M) = { w|w starts with ‘aa’ }
= { aa, aab, aabb, aaaba, aabab, aabba, aabbb, …………………. }
6) L = Set of all string that does not start with ‘aa’ over ∑,
= { b, ba, bb, baa, bab, bba, bbb, ab, aba, abb, abab, ………………… }
Or,
L (M) = { w | w does not start with ‘aa’ }
= { b, ba, bb, baa, bab, bba, ab, aba, abb, abab, ………………… }
7) L = Set of all string that start with ‘aab’ over ∑,
= { aab, aaba, aabb, aabaa, aabab, aabba, aabbb, …………………. }
Or,
L (M) = { w | w starts with ‘aab’ }
= { aab, aaba, aabb, aabaa, aabab, aabba, aabbb, …………………. }
8) L = Set of all string that does not start with ‘aab’ over ∑,
= { b, ba, bb, baa, bab, bba, aaa, aaab, aba, abb, aaaab, …………………. }
Or,
L (M) = { w | w does not start with ‘aab’ }
= { b, ba, bb, baa, bab, aaa, aaab, aba, abb, aaaab,…………………. }
9) L = Set of all string that start with ‘10’ over ∑ = { 0, 1 },
= { 10, 101, 100, 1001, 101111, 1000000, …………………. }
Or,
L (M) = { w | w starts with ‘10’ }
= { 10, 101, 100, 1001, 101111, 1000000, …………………. }
10) L = Set of all string that does not start with ‘10’ over ∑ = { 0, 1 },
= { 01, 11, 001, 0011, 110, 00011111…………………. }
Or,
L (M) = { w | w does not start with ‘10’ }
= { 01, 11, 001, 0011, 110, 00011111…………………. }
11) L = Set of all string that contains ‘a’ over ∑,
= { a, aa, aab, aabb, aaaba, aabab, aabba, aabbb, …………………. }
Or,
L (M) = { w | w contains ‘a’ }
= { a, aa, aab, aabb, aaaba, aabab, aabba, aabbb, …………………. }
7
12) L = Set of all string that contains ‘ab’ over ∑,
= { ab, aab, aba, abb, aaaba, aabab, aabba, aabbb, …………………. }
Or,
L (M) = { w | w contains ‘ab’ }
= { ab, aab, aba, abb, aaaba, aabab, aabba, aabbb,………………. }
13) L = Set of all string that contains ‘001’ over ∑ = { 0, 1 },
= { 001, 0010, 0011, 001000, 0011100101…………………. }
Or,
L (M) = { w | w contains ‘001’ }
= { 001, 0010, 0011, 001000, 0011100101…………………. }
14) L = Set of all string that contains ‘baba’ over ∑,
= { baba, babaaa,babaaab, aabbaba, aaababa,aabbabab,…………………. }
Or,
L (M) = { w | w contains ‘baba’ }
= { baba, babaaa, babaaab, aabbaba, aaababa, aabbabab,………. }
15) L = Set of all string that ends with ‘a’ over ∑,
= { a, aa, aaba, aabba, aaaba, aabbba, …………………. }
Or,
L (M) = { w | w ends with ‘a’ }
= { a, aa, aaba, aabba, aaaba, aabbba, …………………. }
16) L = Set of all string that ends with ‘ab’ over ∑,
= { ab, aab, aabab, aabbab, aaabab, aabbbab, …………………. }
Or,
L (M) = { w | w ends with ‘ab’ }
= { ab, aab, aabab, aabbab, aaabab, aabbbab, …………………. }
17) L = Set of all string that start and end with same symbol over ∑,
= { aba, aba, aabba, bab, bbab, babab, baaab, ………………. }
Or,
L (M) = { w | w starts and end with same symbol }
= { aba, aba, aabba, bab, bbab, babab, baaab, ………………. }
18) L = Set of all string that start and end with different symbol over ∑,
= { ab, aba, aabba, ba, bba, baba, baaa, ………………. }
Or,
L (M) = { w | w starts and end with different symbol }
= { ab, aba, aabba, ba, bba, baba, baaa, ………………. }
19) L = Set of all string in which every ‘a’ is followed by one ‘b’ over ∑,
= { , b, bb, bbb, bab, abb, abbbab, bbbbbabbbb,………………. }
Or,
L (M) = { w | w every ‘a’ is followed by one ‘b’ }
= { , b, bb, bbb, bab, abb, abbbab, bbbbbabbbb,………………. }
8
20) L = Set of all string in which every ‘a’ is never followed by ‘b’ over ∑,
= { , b, bb, bbb, baa, aaaaaaaaaa,………………. }
Or,
L (M) = { w | w every ‘a’ is followed by one ‘b’ }
= { , b, bb, bbb, baa, aaaaaaaaaa,………………. }
21) L = Set of all string in which every ‘a’ is followed by ‘ab’ over ∑,
= { , aab, b, bb, bbaab, bbbbaabaab,………………. }
Or,
L (M) = { w | w every ‘a’ is followed by ‘ab’ }
= { , aab, b, bb, bbaab, bbbbaabaab,………………. }
22) L = Set of all string in which every ‘a’ is never be followed by ‘ab’ over ∑,
= { , b, bb, bbb, bbaa, a, aa, ab, aaa, aaab,………………. }
Or,
L (M) = { w | w every ‘a’ is never be followed by ‘ab’ }
= { , b, bb, bbb, bbaa, a, aa, ab, aaa, aaab,………………. }
23) L = Set of all string in which every ‘0’ is followed by at least one ‘1’ over ∑ = { 0, 1 },
= { , 01, 1, 1111, 1101101, 0101011101,………………. }
Or,
L (M) = { w | w every ‘0’ is followed by at least one ‘1’ }
= { , 01, 1, 1111, 1101101, 0101011101,………………. }
24) L = Set of all string of length at least 2 over ∑,
= { aa, ab, ba, bb, aaa, baa, abaa, bbaab, ……………… }
Or,
L (M) = { w | w every string of length at least 2 }
= { aa, ab, ba, bb, aaa, baa, abaa, bbaab, ……………… }
25) L = Set of all string of length at most 2 over ∑,
= { aa, ab, ba, bb }
Or,
L (M) = { w | w every string of length at most 2 }
= { , a, b, aa, ab, ba, bb }
26) L = Set of all string of length at exactly 2 over ∑,
= { aa, ab, ba, bb }
Or,
L (M) = { w | w every string of length at exactly 2 }
= { aa, ab, ba, bb }
27) L = Set of all string with the number of a’s EQUAl to number of b’s over ∑,
= { , ab, aabb, abab, baba, abba, baab,………….. }
Or,
L (M) = { w | w string with the number of a’s EQUAl to number of b’s }
= { , ab, aabb, abab, baba, abba, baab,………….. }
9
28) L = Set of all string with EVEN-EVEN number of a’s and b’s or EVEN number of a’s and EVEN number
of b’s over ∑,
= { , aa, bb, aaaa, aabb, abab, baab, baba, bbaa, bbbb………….. }
Or,
L (M) = { w | w string with EVEN-EVEN number of a’s and b’s or EVEN number of a’s and
EVEN number of b’s }
= { , aa, bb, aaaa, aabb, abab, baab, baba, bbaa, bbbb………….. }
n
n
n
n n
29) L = Set of all string of a b where n = 1, 2, 3,……. over ∑,
= { ab, aabb, aaabbb, aaaabbbb,………….}
Or,
n n
L (M) = { w|w every string of a b where n = 1, 2, 3,……. }
= { ab, aabb, aaabbb, aaaabbbb,………….}
30) L = Set of all string of a b a where n = 1, 2, 3,……. over ∑,
= { aba, aabbaa, aaabbbaaa, aaaabbbbaaaa,………….}
Or,
n n n
L (M) = { w|w every string of a b a where n = 1, 2, 3,……. }
= { aba, aabbaa, aaabbbaaa, aaaabbbbaaaa,………….}
31) L = Set of all string of FACTORIAL over ∑ = {a}, as {an : n = 1, 2, 3,…….}
= { a, aa, aaaaaa,..……….}
Or,
n
L (M) = { w|w every string of FACTORIAL over ∑ = {a}, as {a : n = 1, 2, 3,.….}
= { a, aa, aaaaaa,..……….}
32) L = Set of all string of DOUBLE_FACTORIAL over ∑ = {a}, as {anbn: n = 1, 2, 3,…….}
= { a, aa, aaaaaa,..……….}
Or,
n n
L (M) = { w|w every string of DOUBLE_FACTORIAL over ∑ = {a}, as { a b : n= 1, 2, 3,.….}
= { ab, aabb, aaaaaabbbbbb,..……….}
33) L = Set of all string of SQUARE over ∑ = {a}, as {(an)2: n = 1, 2, 3,…….}
= { a, aaaa, aaaaaaaaa,..……….}
Or,
n 2
L (M) = { w|w every string of SQUARE over ∑ = {a}, as {(a ) : n = 1, 2, 3,.….}
= { a, aaaa, aaaaaaaaa,..……….}
n 2
n 2
34) L = Set of all string of DOUBLE_SQUARE over ∑ = {a}, as {(a ) (b ) :n = 1, 2, 3,…….}
= { ab, aaaabbbb, aaaaaaaaabbbbbbbbb,..……….}
Or,
n 2
n 2
L (M) = { w|w every string of DOUBLE_SQUARE over ∑ = {a}, as {(a ) (b ) :n = 1, 2, 3,.….}
= { ab, aaaabbbb, aaaaaaaaabbbbbbbbb,..……….}
35) L = Set of all string of PRIME over ∑ = {a}, as {ap: p is prime }
= { aa, aaa, aaaaa, aaaaaaa,..……….}
Or,
p
L (M) = { w|w every string of PRIME over ∑ = {a}, as {a : p is prime }
= { aa, aaa, aaaaa, aaaaaaa,..……….}
10
n
NB : For alphabet { a, b } with finite length n, number of strings can be generated = 2 .
* If the number of ∑ represented by |∑|,
n
then the number of strings of length n, possible over ∑ is |∑|
Where,
∑ = Number of alphabets
n = String length
❖ Power of ‘∑’
Say ∑ = { a, b }; then
∑0 = Set of all string over ∑ of length 0. e.g. { }
∑1 = Set of all string over ∑ of length 1. e.g. { a, b}
∑2 = Set of all string over ∑ of length 2. e.g. { aa, ab, ba, bb }
i.e. |∑2| = 4 and similarly |∑3| = 8
❖ Kleene star or Kleene closure
The Kleene star ∑* is the set of all strings of finite length consisting of symbols in Σ including the
string).
The character ‘*’ means “match the preceding character zero or many times”.
‘a*’ means zero or more a that can be represented as follows:
L* = { Ø, a, aa, aaa, aaaa, aaaaa,……………….. }
Regular expressions
Matches
‘a*’
Zero or more a.
‘ba*’
b, ba, baa, baaa, baaaa,.……………
‘[ab]*’
‘[^0–9]*’
* *’
‘a b
(Empty
Ø, a, ab, aaa, ababb, bbb,………….
Zero or more characters, each character an ‘a’ or ‘b’
Ø, A, ABC, zw$nn,…………….
Zero or more than characters, no characters in a digit.
Ø, a, aaa, aaab, abbb, b, bbb,…………..
Zero or more ‘a’ followed by zero or more ‘b’.
Representation − ∑* = ∑0 ∪ ∑1 ∪ ∑2 ∪ ∑3 ……. where ∑p is the set of all possible strings of length p.
... ∑* = ∑+ ∪ { }
For example : If ∑ = { a, b }, ∑* = { , a, b, aa, ab, ba, bb,……………..}
For more example :
Say ∑ = { a, b }; then
∑0 = Set of all string over ∑ of length 0. For example : { }
∑1 = Set of all string over ∑ of length 1. For example : { a, b}
∑2 = Set of all string over ∑ of length 2. For example : { aa, ab, ba, bb }
0
1
2
∑* = ∑ ∪ ∑ ∪ ∑ ∪………………
∑* = { } ∪ { a, b} ∪ { aa, ab, ba, bb } ∪………………
Hence, ∑* called a universal set. And ∑0, ∑1 and ∑2 is the subset of ∑* . We can write this as below fig:
∑0 ⊆ ∑*
∑1 ⊆ ∑*
1
∑ ⊆ ∑*
Fig: Subset representation.
11
❖ Kleene plus or Positive closure
The Kleene plus ∑+ is the set of all strings of finite length consisting of symbols in Σ, excluding the γ.
The character ‘+’ means “match the preceding character one or more times”.
‘a+’ means one or more a that can be represented as follows:
+
L = { a, aa, aaa, aaaa, aaaaa,……………….. }
Regular expressions
Matches
‘a+’
One or more a.
‘ba+’
b, ba, baa, baaa, baaaa,.……………
a, ab, aaa, ababb, bbb,………….
One or more characters, each character an ‘a’ or ‘b’
A, ABC, zw$nn,…………….
‘[^0–9]+’
One or more than characters, no characters in a digit.
a, aaa, aaab, abbb, b, bbb,…………..
‘a+b+’
One or more ‘a’ followed by zero or more ‘b’.
+
1
2
3
Representation − ∑ = ∑ ∪ ∑ ∪ ∑ ……. where ∑p is the set of all possible strings of length p.
‘[ab]+’
... ∑+ = ∑* – { }
+
For example : If ∑ = { a, b }, ∑ = { a, b, aa, ab, ba, bb,……………..}
For more example : Say ∑ = { a, b }; then
∑1 = Set of all string over ∑ of length 1. For example : { a, b}
∑2 = Set of all string over ∑ of length 2. For example : { aa, ab, ba, bb }
∑+ = ∑1 ∪ ∑2 ∪ ∑3 ………………
∑+ = { a, b} ∪ { aa, ab, ba, bb } ∪………………
∑0, ∑1 and ∑2 is the subset of ∑+ . We can write this as below fig:
∑0 ⊆ ∑+
∑1 ⊆ ∑+
∑1 ⊆ ∑+
Fig: Subset representation.
Set
❖ Set
A set is an unordered collection of well-defined distinct objects(Objects, elements, entities, members are all
synonymous terms). Set must be well defined. This means A that our description of the elements of a set is
clear and unambiguous.
For example :
T = { letters in the English alphabet }
❖ Elements of set
The different objects that form a set are called the elements of a set. The elements of the set are written in
any order and are not repeated. Generally, the elements of a set are written inside a pair of curly (idle) braces
and are represented by commas. The name of the set is always written in capital letter.
For example :
a, b, c, …… , x, y, z.
❖ Properties of set
➢ The pair of curly braces { } denotes a set. The elements of set are written inside a pair of curly
braces separated by commas.
➢ Sets are usually denoted by a capital letter.
For example :
A, B, C, …… , X, Y, Z.
12
➢ The elements of the group are usually represented by small letters enclosed in { } (unless specified
separately).
For example :
a, b, c, …… , x, y, z.
➢ We have to list each element separated by a comma, and then put curly brackets around it.
For example :
These { } are also called "braces". The number of elements are denoted as n(A)=4, as in the above
picture the number of elements are 4.
➢ If there are three dots in a set it means it is an infinite set.
For example :
The three dots here ... are called an ellipsis and it means "continue on". These three dots can be
used in between also for the long listings.
For example :
{1, 2, 3,…, 99,100} It is a definite set as it has 100 natural numbers in it.
➢ If b is an object or element of set B, we read it as “b belongs to B” For which, we use the Greek
symbol ∈ (epsilon), which means ‘belongs to’ or ‘is a member of set B’.
❖
Types of set
✓ Finite Set
A set which contains a definite number of elements is called a finite set.
For example :
S={x | x ∈ N and 70>x>50}
✓ Infinite Set
A set which contains infinite number of elements is called an infinite set.
For example :
S ={x |x ∈ N and x > 10 }
✓ Subset
If A and B are sets and every element of A is also an element of B, then, A is a subset of B, denoted
by A⊆B or equivalently B is a superset of A, denoted by B⊇A.
For example :
A = {1,2,3,4,5} and B = {1,2,3,4,5,6,7,8,9,10}
Here , A is a subset of B or we can say that B is the superset of A.
✓ Proper Subset
If A is a subset of B, but A is not equal to B (i.e. there exist at least one element of B which is not an
element of A), then A is also a proper (or strict) subset of B; this is written as A⊊B.
For example :
A = {1,2,3} and B = {1,2,3,4}
Clearly, A is not equal to B . And element {4} belongs to set B but is absent in set A , so we have one
element in set B which is not an element of set A. Thus, A can be called a proper subset of B.
13
✓ Empty Set or Null Set
An empty set contains no elements. It is denoted by ∅. As the number of elements in an empty set is finite,
empty set is a finite set. The cardinality of empty set or null set is zero.
For example :
S={x | x ∈ N and 7<x<8} = ∅
✓ Singleton Set or Unit Set
Singleton set or unit set contains only one element. A singleton set is denoted by {s}.
For example :
S={x | x ∈ N, 7<x<9} = {8}
Let’s see another basic concepts of set!
❖ Multiset
A Multiset A is a collection of elements, some of which may be repeated. If x ∈A then the Repetition
Number of x is the number of times x appears in A. If x appears an infinite number of times in A then the
repetition number of x is ∞.
For example :
Suppose that we consider the multiset of {x, y, y, z, z, z}. Another way of representing this set is by
writing corresponding repetition for each repeated element. Thus, another way to write the multiset above
is:
{x, y, y, z, z, z}={1x, 2y, 3z}
We could alternatively (but generally will not) use raised powers as the notation indicating the repetition
numbers of each element:
{x, y, y, z, z, z}={x1, y2, z3}
If an element, say z, appears an infinite number of times in a multiset then we use the following notation
for compactness:
{x, y, y, z, z,...}={1x, 2y, ∞z}
❖ Types of Multiset
Like with sets - we can define a multiset to be either a finite multiset or an infinite multiset.
✓ Finites multisets
A multiset A is said to be a Finite Multiset if A has a finite number of distinct elements and the repetition
numbers of the elements in A are all finite. The multiset A is said to be an Infinite Multiset otherwise.
For example :
the multiset {2x,4y,3z} is a finite multiset because this multiset has a finite number of distinct
elements (3) and every repetition number is finite (2, 4, and 3).
✓ Infinite multiset
A multiset A is said to be Infinite Multiset if A has an infinite number of distinct elements and the
repetition numbers of the elements in A are all infinite.
For example :
The multiset {2x1,1x2,...} is an infinite multiset because there are an infinite number of distinct
elements. The multiset {∞x, y} is also an infinite multiset because not every repetition number is
finite.
We can also form what are called sub-multisets from multisets.
❖ Sub-multiset
If A is a multiset then B is said to be a Sub-multiset of A if every element in B is containing in A and for
each element x in B we have that the repetition number of x in B is less than or equal to the repetition number
of x in A.
14
For example :
consider the multiset A={3⋅x,1⋅y,1⋅z}. Then B={2⋅x,1⋅z} is a sub-multiset of A since every element
in B is contained in A and the repetition number of elements in B are less than or equal to corresponding
repetition numbers of those elements in A.
Sequence
❖ Sequence
A sequence is an ordered list of elements, which can be finite or infinite.
For example :
Since order of elements matter, the sequence (1,2,3) is different from the sequence (1,3,2) or from the
(3,2,1) one. You may also have an empty sequence (), and you may also have repeated elements. For
instance, (1,1,1) is a sequence.
❖ Subsequence
A subsequence is found by deleting some (which might be none or all) elements of the sequence, while
keeping the order of the others.
❖ Tuples
A finite number of sequences is called tuple. It is also an ordered list of elements, and it also may include
repeat elements. The only difference between sequences and tuples is that tuples have a finite number of
elements necessarily, while sequences might have finite or infinite elements.
A tuple with n elements is called an n-tuple. It is also called ordered pair. Thus (7, 21, 52) is a 3-tuple. A 2tupple is called ordered pair.
Write the difference between Set and Sequence.
Set
Sequence
A set is an unordered collection of well-defined A sequence is an ordered list of elements, which can
distinct objects.
be finite or infinite.
A set is written within braces.
A sequence is written within parentheses.
For example : {2, 48, 21}
For example : (2, 21, 48)
Order doesn’t important is set.
Order is very important is sequence.
Repetition can be occurred.
There is no chance of repetition.
Elements of set can be finite or infinite.
Elements of sequence also can be finite or infinite.
15
Function and Relation
❖ Relation
A connection between the elements of two or more sets is Relation. The sets must be non-empty. A subset of the
Cartesian product also forms a relation R. A relation may be represented either by Roster method or by Setbuilder method.
For example :
Let A and B be two sets such that A = {2, 5, 7, 8, 10, 13} and B = {1, 2, 3, 4, 5}. Then,
R = {(x, y): x = 4y – 3, x ∈ A and y ∈ B} (Set-builder form)
R = {(5, 2), (10, 3), (13, 4)} (Roster form)
❖ Types of Relations or Relationship
Let us study about the various types of relations.
✓ Empty Relation
If no element of set X is related or mapped to any element of X, then the relation R in A is an empty relation,
i.e., R = Φ. Think of an example of set A consisting of only 100 hens in a poultry farm. Is there any possibility
of finding a relation R of getting any elephant in the farm? No! R is a void or empty relation since there are
only 100 hens and no elephant.
✓ Universal Relation
A relation R in a set, say A is a universal relation if each element of A is related to every element of A, i.e.,
R = A × A. Also called Full relation. Suppose A is a set of all-natural numbers and B is a set of all whole
numbers. The relation between A and B is universal as every element of A is in set B. Empty relation and
Universal relation are sometimes called trivial relation.
✓ Identity Relation
In Identity relation, every element of set A is related to itself only. I = {(a, a), ∈ A}. For example, if we throw
two dice, we get 36 possible outcomes, (1, 1), (1, 2), … , (6, 6). If we define a relation as R: {(1, 1), (2, 2),
(3, 3), (4, 4), (5, 5), (6, 6)}, it is an identity relation.
16
✓ Inverse Relation
Let R be a relation from set A to set B i.e., R ∈ A × B. The relation R-1 is said to be an Inverse relation if
R1 from set B to A is denoted by R-1 = {(b, a): (a, b) ∈ R}. Considering the case of throwing of two dice if R
= {(1, 2), (2, 3)}, R-1 = {(2, 1), (3, 2)}. Here, the domain of R is the range of R-1 and vice-versa.
✓ Reflexive Relation
A relation R is said to be reflexive relation if (a, a) ∈ R for every ‘a’ that ∈ A. Then the relation is called
Reflexive Relation. For.
Example :
R : {1, 2, 3} -> {1, 2, 3} = { (1, 1), (2, 2), (3, 3) } is a reflexive relation.
R : {1, 2, 3} -> {1, 2, 3} = { (1, 1), (2, 2) } is NOT a reflexive relation.
✓ Symmetric Relation
A relation R on a set A is said to be symmetric if (a, b) ∈ R then (b, a) ∈ R, for all a & b ∈ A. The relation
R={(4,5),(5,4),(6,5),(5,6)} on set A={4,5,6} is symmetric.
✓ Transitive Relation
A relation in a set A is transitive if, (a, b) ∈ R, (b, c) ∈ R, then (a, c) ∈ R, for all a, b, c ∈ A. Relation
R={(1,2),(2,3),(1,3)} on set A={1,2,3} is transitive.
✓ Equivalence Relation
A relation is said to be equivalence if and only if it is Reflexive, Symmetric, and Transitive. For example, if
we throw two dices A & B and note down all the possible outcome.
Solved Example for You
Define a relation R= {(a, b): a ∈ A, b ∈ B}, we find that {(1, 1), (2, 2), …, (6, 6) ∈ R} (reflexive). If {(a, b) =
(1, 2) ∈ R} then, {(b, a) = (2, 1) ∈ R} (symmetry). ). If {(a, b) = (1, 2) ∈ R} and {(b, c) = (2, 3) ∈ R} then
{(a, c) = (1, 3) ∈ R} (transitive)
❖ Function
A function is an object that sets up input-output relationship. If f is a function whose output value is b when the
input value is a, we can represent this,
f(a) = b.
A function are sometimes called mapping or transformation. The set of possible input is called its domain
and the outputs of a function from a set called its range.
❖ Types of Functions
There are various types of functions in mathematics which are explained below in detail. The different
functions types covered here are:
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
✓
One – one function (Injective function)
Many – one function
Onto – function (Surjective Function)
Into – function
Polynomial function
Linear Function
Identical Function
Quadratic Function
✓ Even and Odd Function
Rational Function
✓ Periodic Function
Algebraic Functions
✓ Composite Function
Cubic Function
✓ Constant Function
Modulus Function
✓ Identity Function
Signum Function
✓ Fractional Part Function
Greatest Integer Function
17
What is meant by theorem and proof ? Also describe different types of proof technique.
A theorem is a mathematical statement that was proved.
A proof is a way to show that a mathematical theorem is true. One must show that the theorem is true in all
cases.
There are different type of proof techniques. Those are given below:
✓ Proof by Construction
✓ Proof by Contradiction
✓ Proof by Induction
What is meant by Proof by construction ? Prove that, for each even number n greater than 2,
there exists a 3-regular graph with n nodes (Use proof by construction).
Many theorem states that a particular type of object exist. One way to prove is find a way to construct one
such subject. This technique is known as proof by construction.
Proof
Let, n be even number greater than 2. Construct graph G = (V, E) with n nodes as follows. The set of nodes
of G is V = {0, 1, 2, ……………., n-1} and the set of edges of G is the set
E = { {i, i+1{ | for 0 ≤ i ≤ n - 2 } U { {n - 1, 0} } U { { i, i + n/2} } | for 0 ≤ i ≤ n/2 -1}.
Pictures the nodes of this graph written in consecutively around the circumference of a circle. In that case,
the edges described in the top line of E go between adjacent pairs around the circle. The edges described in
the bottom line of E go between nodes on opposite sides of the circle. This mental picture clearly shows that
every node in G has degree 3.
What is meant by Proof by contradiction ? Prove that, √𝟐 is irrational.
Proof by contradiction also known as indirect proof. It is a common proof technique that leads to a
contradiction cannot be true, and if so, the opposite must be true.
Steps
To clarify the process of proof by contradiction further, let's break it down into several steps. When using
proof by contradiction, we follow these steps.
✓ Assume your statement to be true.
✓ Proceed as you would with a direct proof.
✓ Come across a contradiction.
✓ State that because of the contradiction, it can't be the case that the statement is false, so it must be true.
18
Proof
Let's suppose √2 is a rational number. Then we can write it √2 = a/b, then it can be expressed in fraction
form a/b where a, b are whole numbers, b ≠ zero.
Let us assume that our fraction is in lowest term, i.e., their only common divisor is . Then,
Squaring both sides, we have,
2
Multiplying both sides by b yields
2
2
2b = a ………..(i)
2
2
Since a = 2b , we can conclude that a is even because whatever the value of b has to be multiplied
2
by 2. If a is even, then a is also even. Since a is even, no matter what the value of a is, we can always
find an integer that if we divide a by 2, it is equal to that integer. If we let that integer be k, then a/2 =
k which means that a = 2k.
Substituting the value of 2k to a in (i), we have
which means that
. Dividing
both sides by , we have
. That means that the value is even, since whatever the value
of you have to multiply it by . Again, if is even, then is even.
This implies that both and are even, which means that both the numerator and the denominator of
2
2
our fraction are divisible by . This contradicts our assumption that has no common divisor except .
Since we found a contradiction, our assumption is, therefore, false. Hence, the theorem is true.
Step you should remember :
➔
➔
➔
➔
➔
➔
➔
First, assume √2 is a rational number.
Then it should be written as in lowest form, their only common divisor is .
We will get, 2b2 = a2.
Prove, a is even.
Prove, b is even.
It means numerator and denominator are divisible by 2.
So, assumption is wrong.
19
What is meant by Proof by induction ? Prove that, for each t ≥ 0
t
t
𝑴𝒕 − 𝟏
P = PM – Y(
𝑴−𝟏
)
Mathematical Induction is a mathematical technique which is used to prove a statement, a formula or a
theorem is true for every natural number. The technique involves two steps to prove a statement, as stated
below −
Step 1(Base step) − It proves that a statement is true for the initial value.
Step 2(Inductive step) − It proves that if the statement is true for the nth iteration (or number n), then it is also
true for (n+1)th iteration ( or number n+1).
Prove that : 1 + 2 + 3 + ………….+ n = n(n+1)/ 2. (Use proof by induction)
Let P(n) is the given statement :
P(n) = 1 + 2 + 3 + ………….+ n = n(n+1)/ 2………………..(i)
Basis Step : Show it is true for n=1.
.
. . For n = 1,
L.H.S = 1
R.H.S = 1(1+1)/ 2
= 2/2 = 1 = L.H.S
.
. . L.H.S = R.H.S
Inductive hypothesis step : Assume P(k) to be true and then prove P(k+1) is also to be true.
Let, P(k) = 1 + 2 + 3 + ………….+ k = k(k+1)/ 2 be true ………….(ii)
We will prove P(k+1) is to be true.
P(k+1) = 1 + 2 + 3 + ………….+ (k+1) = (k+1) ((k+1)+1)/ 2
.
. . P(k+1) = 1 + 2 + 3 + ………….+ (k+1) = (k+1) ((k+2)/ 2 ……….(iii)
20
We will prove equation (iii) from (ii).
From (ii),
1 + 2 + 3 + ………….+ k = k(k+1)/ 2
Adding (k+1) on both sides,
1+ 2 + 3 + ………….+ k +(k+1) = k(k+1)/ 2 + (k+1)
 1 + 2 + 3 + ………….+ k +(k+1) = k(k+1) + 2(k+1)/ 2
 1 + 2 + 3 + ………….+ k +(k+1) = (k+1) (k+2)/ 2
Which is the same as P(k+1). By the principle of mathematical induction, P(n) is true for all n natural
numbers.
2
2
2
2
Prove that : 1 + 2 + 3 + ………….+ n =
𝐧(𝐧+𝟏)(𝐧+𝟐)
Let P(n) is the given statement :
2
2
. (Use proof by induction)
𝟔
2
2
P(n) = 1 + 2 + 3 + ………….+ n =
𝐧(𝐧+𝟏)(𝐧+𝟐)
𝟔
………………..(i)
Basis Step : Show it is true for n=1.
.
. . For n = 1,
L.H.S = 1
R.H.S =
=
.
𝟏(𝟏+𝟏)(𝟏+𝟐)
𝟐∗𝟑
𝟔
𝟔
𝟔
= = 1 = L.H.S
𝟔
. . L.H.S = R.H.S
Inductive hypothesis step : Assume P(k) to be true and then prove P(k+1) is also to be true.
2
2
2
2
Let, P(k) = 1 + 2 + 3 + ………….+ k =
𝐤(𝐤+𝟏)(𝟐𝐤+𝟏)
be true ………….(ii)
𝟔
We will prove P(k+1) is to be true.
2
2
2
2
(𝐤+𝟏)(𝐤+𝟏+𝟏) {𝟐(𝐤+𝟏)+𝟏}
2
2
2
2
𝟔
(𝐤+𝟏)(𝐤+𝟐) (𝟐𝐤+𝟑)
P(k+1) = 1 + 2 + 3 + ………….+ (k+1) =
.
. . P(k+1) = 1 + 2 + 3 + ………….+ (k+1) =
We will prove equation (iii) from (ii).
From (ii),
12 + 22 + 32 + ………….+ k2 =
2
2
……….(iii)
𝐤(𝐤+𝟏)(𝟐𝐤+𝟏)
𝟔
Adding (k+1)2 on both sides,
2
𝟔
2
2
 1 + 2 + 3 + ………….+ k +(k+1) =
𝐤(𝐤+𝟏)(𝟐𝐤+𝟏)
=
=
=
+(k+1)2
𝟔
𝐤(𝐤+𝟏)(𝟐𝐤+𝟏)+𝟔(𝒌+𝟏)𝟐
𝟔
(𝐤+𝟏) [𝟐((𝟐𝐤+𝟏)+𝟔(𝐤+𝟏)]
𝟔
(𝐤+𝟏) (𝟐𝒌𝟐 +𝟕𝒌+𝟔)
𝟔
(𝐤+𝟏) (𝐤+𝟐)+(𝟐𝐤+𝟑)]
=
𝟔
= R.H.S of (iii)
Which is the same as P(k+1). By the principle of mathematical induction, P(n) is true for all n natural
numbers.
Download