Vous êtes sur la page 1sur 46

2

Published by :
Hastlipi
"Geetanjali Apartment"
1926, Nataniyon ka Rasta
Jaipur-302 003 l Ph. : 0141-2317659


Concept & Copyright :
Biyani Shikshan Samiti
Sector-3, Vidhyadhar Nagar,
Jaipur-302 023 (Rajasthan)
Ph. : 0141-2338371, 2338591-95 l Fax : 0141-2338007
E-mail : acad@biyanicolleges.org
Website : www.biyanithinktank.com; www.biyanicolleges.org



Sole Distributor :
Shyam Prakashan
"Geetanjali Apartment"
1926, Nataniyon ka Rasta
Jaipur-302 003
Ph. : 0141-2317659
website : www.shyamprakashan.com
e-mail : ankit_146@sify.com


First Edition : 2009

Price : 200/-

While every effort is taken to avoid errors or omissions in this Publication, any mistake
or omission that may have crept in is not intentional. It may be taken note of that
neither the publisher nor the author will be responsible for any damage or loss of any
Discrete Mathematics 3

kind arising to anyone in any manner on account of such errors and omissions.

Type Setted by :
Shri Padam Computer Centre, Jaipur

Printed :
Shital Printers, Jaipur





Preface


am glad to present this book, especially designed to serve the needs of the
students. The book has been written keeping in mind the general weakness in
understanding the fundamental concept of the topic. The book is self-explanatory
and adopts the Teach Yourself style. It is based on question-answer pattern. The language
of book is quite easy and understandable based on scientific approach.
I have made a meaningful effort to summarize the complete syllabus. This includes
various topics which are explained in simplest way.
Any further improvement in the contents of the book by making corrections, omission
and inclusion is keen to be achieved based on suggestions from the reader for which the
author shall be obliged.
I acknowledge special thanks to Mr. Rajeev Biyani, Chiarman & Dr. Sanjay Biyani,
Director (Acad.) Biyani Group of Colleges, who is the backbone and main concept provider
and also have been constant source of motivation throughout this endeavour. We also
extend our thanks to M/s. Hastlipi, Omprakash Agarwal/Sunil Kumar Jain, Jaipur, who played
an active role in co-ordinating the various stages of this endeavour and spearheaded the
publishing work.
I look forward to receiving valuable suggestions from professors of various
educational institutions, other faculty members and the students for improvement of the
quality of the book. The reader may feel free to send in their comments and suggestions to
the under mentioned address.
I
4

Author





Syllabus
B.C.A. Part-I
Discrete Mathematics

Number Systems : Natural Numbers, Integers, Rational Numbers, Real Numbers,
Complex Numbers, Arithmetic Modulo a Positive Integer (Binary, Octal, Decimal and
Hexadecimal Number Systems), Radix Representation of Integers, Representing
Negative and Rational Numbers, Floating Point Notation.
Binary Arithmetic, 2s Complement Arithmetic, Conversion of Numbers from One of
Binary / Octal / Decimal / Hexadecimal Number System to other Number System,
Codes (Natural BCD, Excess-3, Gray, Octal, Hexadecimal, Alphanumeric EBCDIC and
ASCII), Error Codes.
Logic and Proofs : Proposition, Conjunction, Disjunction, Negation, Compound
Proposition, Conditional Propositions (Hypothesis, Conclusion, Necessary and
Sufficient Condition) and Logical Equivalence, De Morgans Laws, Quantifiers,
Universally Quantified Statement, Generalized De Morgans Laws for Logic,
Component of Mathematical System (Axiom, Definitions, Undefined Terms, Theorem,
Leema and Corollary), Proofs (Direct Proofs, Indirect Proofs, Proof by Contra-Positive),
Valid Argument, Deductive Reasoning, Modus Ponens (Rules of Inference), Universal
Instantiation, Universal Generalization, Existential Instantiation, Universal
Generalization Resolution, Principle of Mathematical Induction, Structural Induction.
Sets, Venn Diagrams, Ordered Pairs, Sequences and Strings, Relation (Reflexive,
Symmetric, Anti-symmetric, Transitive, Partial Order), Inverse Relation (Injective,
Subjective, bijective), Coposition of Functions, Restriction and Function Overriding,
Function Spaces, Lambda Notation for functions, Lambda Calculus, Equivalence
Relations, Interpretation using Digraphs. Cardinals, Countable and Uncountable Sets,
Infinite Cardinal Numbers, Russells Paradox, Operations on Cardinals, Laws of
Cardinal Arithmetic.
Discrete Mathematics 5

Graph Theory, Undirected Graph, Digraph, Weighted Graph, Similarity Graphs, Paths
and Cycles, Hamiltonian Cycles, Shortest Path Algorithm, Isomorphism of Graphs,
Planar Graphs.
Trees, Characterization of Trees, Spanning Trees, Breadth First Search and Death First
Search Method, Minimal Spanning Trees, Binary Trees, Tree Traversals, Decision Trees
and the Minimum Time for Sorting, Isomorphism of Trees.




Content

S.No. Name of Topic Page No.
1. Graph Theory 7-14
1.1 Simple Graph
1.2 Isomorphism
1.3 Dijekstra Algorithm
1.4 Non-Planarity
1.5 Matrix Representation
1.6 Regular Graph and Complete Graph

2. Trees 15-21
2.1 Definition and Properties of Trees
2.2 Prims Methods
2.3 Tree Transversal
2.4 m-ary and Full m-ary Tree

3. Number System 22-24
3.1 Conversion from Decimal to Binary Number
System

3.2 Sum of Binary Numbers
3.3 Conversion from Decimal to Octal Number
System

3.4 Conversion from Hexadecimal to Decimal Form
6


4. Binary Arithmetics 25-26
4.1 2s Complement
4.2 8-bit 2s Complement
4.3 BCD Code
4.4 Gray Code
4.5 EBCDIC Code

S.No. Name of Topic Page No.
5. Sets 27-30
5.1 Power Set
5.2 Operations on Sets
5.3 Symmetric Difference of Two Sets
5.4 De-Margans Law
5.5 Russells Paradox

6. Relations 31-36

7. Functions 37-42

8. Proportional Calculus 43-46
8.1 Converse, Inverse and Contraposition
8.2 De-Margans Law
8.3 Quantifiers










Discrete Mathematics 7









Chapter-1

Graph Theory

Q.1 Draw simple graphs with one, two, three and four vertices.
Ans.:

- Simple graph with one vertex

V1


- Simple graph with two vertices

V1 V2


- Simple graph with three vertices

V3

V1 V2

8


- Simple graph with four vertices

V4 V3

V1 V2

Q.2 Show that if G = (V, E) is a complete bipartite graph with n vertices then
the total numbers of edges in G cannot exceed
2
4
n
.
Ans.: Let Kp,q be a complete bipartite graph. The total no. of edges in Kp,q is p.q
and total no. of vertices will be (p+q). If we take p = q =
2
n
then in
complete bipartite graph K ,
2 2
n n
no. of edges will be
2
.
2 2 4
n n n
= which is
maximum (If two numbers are equal then their product is maximum).
Hence in a complete bipartite graph of n vertices the no. of edges cannot
exceed
2
4
n
.

Q.3 Show that following two graphs are not isomorphic.
V5 U6


V1 V2 V3 V4 U1 U2 U3 U4 U5
V6
G G

Ans.: In graph G and G we find that
(i) No. of vertices in G = No. of vertices in G = 6.
(ii) No. of edges in G = No. of edges in G = 5.
(iii) No. of vertices of degree one in G and G = 3.
Discrete Mathematics 9

No. of vertices of degree two in G and G = 2
No. of vertices of degree three in G and G = 1
i.e. Number of vertices of equal degree are equal. Although it
satisfies all the three conditions but then also G and G are not
isomorphic because corresponding to vertex V4 in G there should
be a vertex U3 because in both G and G there is only one vertex of
degree three. But two pendent vertices V5 and V6 are incident on
the vertex V4 in G whereas only one pendent vertex U6 is incident
on the vertex U3 in G.
Hence G and G are not isomorphic.

Q.4 Define the followings :-
(i) Walk (ii) Trail (iii) Path (iv) Circuit (v) Cycle
Ans.: (i) Walk : An alternating sequence of vertices and edges is called a
Walk. It is denoted by W.
Example :
a d
e
1
e
4

e
6
b

e
3

e
5
e
2

e c
Figure (1)
Here W = ae1 b e2 c e3 d is a walk.
Walk is of two types :-
(a) Open Walk : If the end vertices of a walk are different then
such a walk is called Open Walk.
Example from fig.(1) : W = a e1 b e2 c e3 d is an open walk.
(b) Closed Walk : If a walk starts and end with same vertex
then such a walk is called closed walk.
10

Example from fig.(1) : W = a e6 e e5 b e1 a is a closed walk as it
starts and end with same vertex a.
(ii) Trail : An open walk in a graph G in which no edge is repeated is
called a Trail.
Example from fig.(1) : W = a e1 b e2 c e3 d is a trail.
(iii) Path : An open walk in which no vertex is repeated except the
initial and terminal vertex is called a Path.
Example for fig.(1) : W = a e1 b e4 d e3 c is a path.
(iv) Circuit : A closed trail is called a Circuit.
Example for fig.(1) : W = a e1 b e5 e e6 a is a circuit.
(v) Cycle : A closed path is called a Cycle.
Example for fig.(1) : W = a e1 b e5 e e6 a is a cycle.

Q.5 Find the shortest path between the vertex a and z in the following
graph.
b 5 d 5 f
4 7
a 2 33 z
3 4
c 6 e 5 g
Ans.: First we label the vertex a by permanent label 0 and rest by .
a b c d e f g h

0 \

0 4 3 \

0 4 \ 3 6 9

0 4 3 6 \ 9

0 4 3 6 7 \ 11


3 1 2



Discrete Mathematics 11

0 4 3 6 7 11 \ 12

0 4 3 6 7 11 12 \ 18

0 4 3 6 7 11 12 16 \
Hence shortest path is a c d e g z = 16
Q.6 Prove that K5 is non-planar.
Ans.: Let the five vertices of K5 be V1, V2, V3, V4 and V5. Since K5 is a complete
graph so every vertex of K5 is joined to every other vertex by means of an
edge. Therefore we must have a circuit going from V1 to V2, to V3, to V4, to
V5 and to V1 i.e. a pentagon.
V2 V2

V1 V3 V1 V3


V5 V4 V5 V4
(a) (b)

V2 V2

V1 V3 V1 V3


V5 V4 V5 V4
(c) (d)
V2

V1 V3
12



V5 V4
(e)
Since vertex V1 is to be connected to V3 by means of an edge, this edge
may be drawn inside or outside the pentagon (without intersecting the
five edges drawn previously). Suppose we draw a line from V1 to V3
inside the pentagon. Now we have to drawn an edge from V2 to V4 and
another one from V2 to V5. Since neither of these edges can be drawn
inside the pentagon without crossing over the already drawn edge. We
draw both these edges outside the pentagon. Now the edge from V3 to V5
cannot be drawn outside the pentagon without crossing the edge between
V2 to V4. Therefore V3 and V5 have to be connected with an edge inside the
pentagon.
Now we have yet to draw an edge between V1 and V4. This edge cannot
be placed inside or outside the pentagon without a crossover. Hence K5 is
not a planar graph.

Q.7 State and prove Handshaking Theorem.
Ans.: Handshaking Theorem : The sum of degrees of all the vertices in a graph
G is equal to twice the number of edges in the graph.
Mathematically it can be stated as :
deg( ) 2
v V
v e
e
=


Proof : Let G = (V, E) be a graph where V = {v1, v2, . . . . . . . . . .} be the set
of vertices and E = {e1, e2, . . . . . . . . . .} be the set of edges. We know that
every edge lies between two vertices so it provides degree one to each
vertex. Hence each edge contributes degree two for the graph. So sum of
degrees of all vertices is equal to twice the number of edges in G.
Hence deg( ) 2
v V
v e
e
=



Discrete Mathematics 13

Q.8 Explain Matrix Representation of Graphs.
Ans.: Although a pictorial representation of a graph is very convenient for a
visual study, other representations are better for computer processing. A
matrix is convenient and useful way of the representation of a graph to a
computer for a graph. There are different types of matrices :
(i) Incidence Matrix
(ii) Circuit Matrix
(iii) Adjacency Matrix
(iv) Path Matrix etc.

Q.9 How many edges are there with 7 vertices each of degree 4?
Ans.: In graph G, there are 7 vertices and degree of each vertex is 4. So sum of
the degrees of all the vertices of graph G = 7 x 4 = 28.
According to Handshaking Theorem
deg( ) 2
v V
v e
e
=


28 = 2e
e = 14
So, total no. of edges in G = 14.

Q.10 Define Regular and Complete Graph.
Ans.: Regular Graph : A simple graph G = (V, E) is called a Regular Graph if
degree of each of its vertices are equal.
Examples :
1-
V1 V2


Here degree of each
vertex is one. So it is
regular graph.

14


2-

V3

V1 V2


Degree of each vertex is
two.

3-

V4 V3

V1 V2


Degree of each vertex is
two.
Complete Graph : A simple graph G = (V, E) is called a Complete Graph if
there is exactly one edge between every pair of distinct vertices. A
complete graph with n-vertices is denoted by Kn.
K1


K2



K3


K4




K5




K6
In a complete graph Kn total no. of edges =
( 1)
2
n n

i.e. size of Kn =
( 1)
2
n n



Discrete Mathematics 15




Chapter-2

Trees

Q.1 Define a Tree. Prove that there is one path between every pair of
distinct vertices in a Tree T.
Ans.: Tree : A Tree is a connected graph without any circuit i.e Tree is a simple
graph.




Trees with one, two, three, and four vertices.
Proof : Since T is a connected graph. Let a and b be any two vertices of T.
If it is possible let there are two different paths between the vertices a and
b.
P = a u1, u2, . . . . . . . . . . um b
and Q = a v1, v2, . . . . . . . . . . vn b
are those two different paths between a and b.
In both these paths vertices after a can be common also. Let w be the first
common vertex then for any i and j
W = ui = vj
Where i = 1, 2, . . . . . . . . . . m
j = 1, 2, . . . . . . . . . . n
16

Then we get a cycle a u1, u2, . . . . . . . . . . ui-1 , ui , vj-1 , vj-2 , . . . . . . . . . . v2, v1 a
which contradicts our assumption that T is a Tree. Hence there is only one path
between a and b.

Q.2 A Tree with n-vertices has (n-1) edges.
Ans.: Let T be a tree having n vertices. We shall prove the theorem by
mathematical induction.
If n=1 then T contains only one vertex and 1-1=0 edges. Hence the
theorem is true for n=1.
Let it be true for k vertices. Now we shall prove it for (k+1) vertices. Since
T is a connected graph so let P be a path of maximum length in T. P cannot
be a circuit. Hence P contains atleast one vertex of degree one. Let this
vertex be v. Now this vertex v and edge incident on it are eliminated from
T so that we obtain a new tree T* which contains k vertices. According to
our assumption T* contains (k-1) edges. Now if in T* the vertex v and
edge is again included we again get T in which no. of edges are k. Hence
the theorem is true for (k+1) vertices also.
Thus by mathematical induction theorem is true for all neN.
Hence proved.

Q.3 If G is an acyclic graph with n vertices and k connected components
then G has (n-k) edges.
Ans.: Proof : Let G be an acyclic graph. Let G1, G2, . . . . . . . . . . GK be its k
connected components. For every i (1 ) i k s s i
th
component Gi has ni
vertices then clearly -
n1 + n2 + n3 +. . . . . . . . . .+ nK = n
Again since every Gi is a tree. Hence no. of edges in every Gi will be (ni-1)
so total no. of edges in G
= (n1 1) + (n2 1) + . . . . . . . . . . + (nk 1)
= (n1 + n2 + . . . . . . . . . . + nk) k
= n k
Hence proved.
Discrete Mathematics 17

Q.4 Find eccentricity, centre radius and diameter of the following graph.
Ans.: (i) Eccentricity : V1 V2
E(V1) = 2
E(V2) = 2 V3
E(V3) = 1
E(V4) = 2 V4
(ii) Centre : Centre of the given graph is the vertex V3 because it has
minimum eccentricity.
(iii) Radius : Radius (eccentricity of the centre) = 1
(iv) Diameter : Maximum eccentricity = 2
Diameter of the given graph = 2

Q.5 Prove that every tree has either one or two centres.
Ans.: Let T be a tree if T contains only one vertex then this vertex will be centre
of T. If T contains two vertices then both vertices are centre of T. Now let T
contains more than two vertices. The maximum distance max.d (v, vi)
from a given vertex v to any other vertex vi occurs only when vi is a
pendent vertex. Tree T must have two or more pendent vertices. Delete all
pendent vertices form T. The resulting graph T is still a tree in which the
eccentricity of all vertices is reduced by 1. Hence the centre of T will also
be centre of T. From T, we can again remove all pendent vertices and we
get another tree T. We continue this process until we are left with a
vertex or an edge. If a vertex is left then this vertex is the centre and if an
edge is left then both its end vertices are centre of T.
18

Example : f(6) g(6)
e(6) h(6)
d(5)
m(6)

a(6) b(5) c(4) j(3) k(4) l(5)
n(6)
i(5)

Removing all pendent vertices

d(4)


b(4) c(3) j(2) k(3) l(4)

Removing all pendent vertices


c(2) j(1) k(2) j
(centre)

Q.6 Find minimal spanning tree for the following weighted graph (use
Primes Method).
Discrete Mathematics 19

Ans.:









V1
3 1
V2 V6
3 1

V3 V5
1
V4
Minimal Spanning Tree
V1
3 1
V2 3 4 V6
3 4 2
V3 5 1 V5
4 2
V4

V1 V2 V3 V4 V5 V6

V1 3 3 1 4 1

V2 3 3 5

V3 3 3 4 4

V4 1 5 4 2

V5 4 2 2

V6 1 4 2
20

Q.7 Write Pre-order, In-order and Post-order transversal of the following
graph.
Ans.: a
b c d
e f g h i j
k l m

Pre-order : a b e k l m f g c h d i j
In-order : k e l m b f g a c h i d j
Post-order : k l m e f g b h c i j d a

Q.8 Define m-ary and Full m-ary Tree. Gives an example for each.
Ans.: m-ary Tree : A rooted tree is said to be m-ary Tree if every internal vertex
or branch node has not more than m-children.
a
b c
d
e f
g h
2 Ary Tree
Full m-ary Tree : A rooted tree is said to be Full m-ary Tree if every
internal vertex or branch node has exactly m-children.
a1
a3
a2 a4
a8 a9 a10
a5 a6 a7 a11 a12 a13
Full 3 Ary Tree
Discrete Mathematics 21

Q.9 Find the value of following prefix expression.
Ans.:
*235/ 234 + |

3
2 +
*235/ 84 +
8/ 4 +
*2352 +
2 3 x +
*652 +
6 5 +
12 +
1 2 + +
3

Q.10 In any tree with 2 or more vertices there are atleast two pendent vertices.
Ans.: Let T be a tree with n vertices and (n-1) edges. Since all the edges are
connected with 2 vertices at a time. Hence the sum of the degree of all the
vertices is
= 2 x (no. of edges)
= 2 x (n - 1) = 2n 2
Now, we have to prove that in tree T there are atleast two vertices of
degree one and rest of vertices are of degree two or higher. Since no vertex
in T has zero degree so let us assume that there is only one vertex of
degree one and rest (n-1) vertices are of degree two or higher. Then the
sum of the degrees of vertices is 1 + 2(n 1) = 2n 1 which is contradiction
of (2n 2). Hence there is another vertex of degree one.
If we take two vertices of degree 1 and remaining (n - 2) vertices of degree
2 or more than two then sum of the degrees of vertices = 2 + 2(n 2) = 2n
2 which is correct.
Hence proved.

22



Chapter-3

Number System

Q.1 Convert (111001101)2 into decimal form and 96 into binary number.
Ans.:
8 7 6 5 4 3 2 1 8
2
(111001101) 1*2 1*2 1*2 0*2 0*2 1*2 1*2 0*2 1*2 = + + + + + + + +
= 256 128 64 0 0 8 4 0 1 = + + + + + + + +

10
(461) =
For converting 96 into binary number
2 96 Remainders
2 48 . . . . . . . . . . . . . . . 0
2 24 . . . . . . . . . . . . . . . 0
2 12 . . . . . . . . . . . . . . . 0
2 6 . . . . . . . . . . . . . . . 0
2 3 . . . . . . . . . . . . . . . 1
1 . . . . . . . . . . . . . . . 1 (96)10 = (110000) 2

Q.2 Find the value of (195) 10 + (105)10 in binary code.
Ans.: Since (195 + 105) = 300
So, we have to find (300) 10


Discrete Mathematics 23

2 300 Remainders
2 150 . . . . . . . . . . . . 0
2 75 . . . . . . . . . . . . 0
2 37 . . . . . . . . . . . . 1
2 18 . . . . . . . . . . . . 1
2 9 . . . . . . . . . . . . 0
2 4 . . . . . . . . . . . . 1
2 2 . . . . . . . . . . . . 0
1 . . . . . . . . . . . . 0
1 . . . . . . . . . . . . 1 (195)10 +(105)10 = (100101100) 2

Q.3 Convert (175) 10 into hexadecimal number.
Ans.: 16 175 Remainder
16 10 . . . . . . . . . . . . 15 = F
10 . . . . . . . . . . . . 10 = A (175)10 = (AF) 16

Q.4 Find the sum of (1011)2 and (10111)2.
Ans.: 0 1 0 1 1
1 0 1 1 1
1 0 0 0 1 0

So, (1011)2 + (10111)2 = (100010) 2

Q.5 Find fixed point representation for the decimal no. 3.056 E-5.
Ans.: 3.056 E-5 = 3.056 x 10
-5
= 0.00003056

24

Q.6 Convert the decimal number 692.625 into octal form.
Ans.: Integral Part :
8 692 Remainders
8 86 . . . . . . . . . . . . 4
8 10 . . . . . . . . . . . . 6
1 . . . . . . . . . . . . 2
1 . . . . . . . . . . . . 1 (692)10 = (1264)8
Fractional Part :
0 . 6 2 5
x 8
5 . 0 0 0 So, 0.625)10 = (.5)8
Hence, (692.625)10 = (1264.5)8

Q.7 Convert hexadecimal no. ABC.2 into decimal form.
Ans.: (ABC.2)16 = A x 16
2
+ B x 16
1
+ C x 16
0
+ 2 x 16
-1
= 10 x 256 + 11 x 16 + 12 x 1 + 2 x 0.0625
= 2748.125


Discrete Mathematics 25




Chapter-4

Binary Arithmetics

Q.1 Find 2s complement of the binary no. 1101100.
Ans.: 1s complement of 1101100 is 0010011
Adding 1 to this
0 0 1 0 0 1 1
+ 1
0 0 1 0 1 0 0

So, 2s complement is 0010100.

Q.2 Find 8-bit 2s complement of (35)10.
Ans.: (35)10 = (100011)2
= (00100011)2
Let X = 00100011
1s complement of X = 1 1 0 1 1 1 0 0
2s complement of X = 1 1 0 1 1 1 0 0
+ 1
1 1 0 1 1 1 0 1

So, 8-bit 2s complement of (35)10 is 11011101
26

Q.3 Write BCD code for decimal number 12.
Ans.: (12)10 = (0001 0010)BCD

Q.4 Write Gray code of the no. (1111)2.
Ans.: Gray code of (1111)2 is 1000.

Q.5 Represent SHORT in EBCDIC code.
Ans.: 11100010 11001000 11010110 11011001 11100011
S H O R T


Discrete Mathematics 27





Chapter-5

Sets

Q.1 Define Power Set. Write Power Set of A = {1, 2, 3}.
Ans.: Let B be a set then the collection of all subsets of B is called Power Set of B
and is denoted by P(B).
i.e. P(B) = {S : ScB}
If A = {1, 2, 3}
Then P(A) = {, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}

Q.2 Explain the following operations
(a) Union (b) Intersection (c) Difference
Ans.: (a) Union : Let A and B be two sets then union of A and B which is
denoted as A B is a set of elements which belongs either to A or
to B or to both A and B.
So, { : . . } A B x x Aor x B = e e
Example : If A = {1, 2, 3, 4} and B = {3, 4, 5, 6} then A B = {1, 2, 3, 4, 5, 6}





A B
U




A B
28

(b) Intersection : Intersection of A and B which is denoted as A B is
a set which contains those elements that belong to both A and B.
So, { : . . } A B x x Aand x B = e e
Example : If A = {1, 2, 3, 4} and B = {3, 4, 5, 6} then A B = { 3, 4}






A B

(c) Difference : Let A and B be two sets. The difference of A and B
which is written as A - B, is a set of all those elements of A which
do not belongs to B.
So, { : . . } A B x x Aand x B = e e
Similarly, { : . . } B A x x Band x A = e e
Example : If A = {1, 2, 3, 4} and B = {3, 4, 5, 6} then A - B = { 3, 4} and
B A = {5, 6}






A B B - A

U




A B
U




A B
U




A B
Discrete Mathematics 29

Q.3 Define symmetric difference of two sets If A = {2, 3, 4} and B = {3, 4, 5, 6},
Find A B .
Ans.: Let A and B be two sets, the symmetric difference of A and B is the set
( ) ( ) A B B A and is denoted by A B A or A B
Thus, ( ) ( ) A B A B B A A = = { : } x x A B e
A = {2, 3, 4} and B = {3, 4, 5, 6}
A B = {2} and B A = {5, 6}
( ) ( ) {2} {5,6} {2,5,6} A B A B B A A = = =





A B A
Q.4 State De Margans Law.
Ans.: If A and B are any two sets then
(i) ( )' ' ' A B A B = and (ii) ( )' ' ' A B A B =

Q.5 Prove the following relation
( ) ( ) ( ) ( ) n A B n A n B n A B = +
Ans.: If A and B are two sets then we know that
( ') ( ) ( ' ) A B A B A B A B =
Hence by sum rule
( ) ( ') ( ) ( ' ) n A B n A B n A B n A B = + + (1)
Again ( ') ( ) A A B A B =
By sum rule
( ) ( ') ( ) n A n A B n A B = + (2)
U




A B
30

Similarly
( ) ( ) ( ' ) n B n A B n A B = + (3)
Now eq^(2) + eq^(3) gives
( ) ( ) ( ) ( ) ( ') ( ' ) n A n B n A B n A B n A B n A B + = + + +
=> ( ) ( ) ( ) ( ) ( ') ( ' ) n A n B n A B n A B n A B n A B + = + +
From eq^(1)
( ) ( ) ( ) ( ) n A n B n A B n A B + =
Hence proved.

Q.6 State and prove Rusells Paradox.
Ans.: See B.C.A. (Discrete Mathematics) CBH Pg. 4.22 Article No. 4.20.


Discrete Mathematics 31




Chapter-6

Relations

Q.1 Prove that
A x B = B x A
Ans.: A = {a, b} and B = {1, 2, 3}
A x B = { (a, 1) (a, 2) (a, 3) (b, 1) (b, 2) (b, 3)}
B x A= { (1, a) (1, b) (2, a) (2, b) (3, a) (3, b)}
Here A x B = B x A

Q.2 Show that the relation is congruent to on the set of all triangles in
plane is an equivalence relation.
Ans.: Proof : Let S be the set of all triangles in a plane and R be the relation on S
defined by
1 2
( , ) R A A e triangle
1
A is congruent to triangle
2
A .
(i) Reflexivity : for each triangle S Ae , we have
( , ) R S A ~ A A A e Ae
R is reflexive on S.
(ii) Symmetry : Let
1
A and
2
S A e such that
1 2
( , ) R A A e , then

1 2
( , ) R A A e
1
2
A ~ A

2 1
A ~ A

2 1
( , ) R A A e
R is symmetric on S.
32

(iii) Transitivity : Let
1 2 3
, , S A A A e such that
1 2
( , ) R A A e and
2 3
( , ) R A A e , then

1 2
( , ) R A A e
1
2
A ~ A

2 3
( , ) R A A e
2 3
A ~ A
Since
1
2
A ~ A and
2 3
A ~ A
1 3
A ~ A
1 3
( ) R A ~ A e
So, R is transitive.
Hence R is on equivalence relation.
Q.3 Let N be the set of all natural numbers and Let R be a relation on Nx N,
defined by (a, b) R (c, d) ad = bc for all (a, b), (c, d) e N x N. Show
that R is an equivalence relation on Nx N.
Ans.: (i) Reflexivity : Let (a, b) be an arbitrary element of N x N, then
( , ) , a b NxN a b N e e
ab ba =
(a, b) R (b, a)
(by commutativity of multiplication on N)
Thus (a, b) R (b, a) for all ( , ) a b NxN e .
So, R is reflexive.
(ii) Symmetry : Let (a, b), (c, d) e N x N be such that (a, b) R (c, d), then
(a, b) R (c, d) ad bc =
cb da =
(by commutativty of multiplication on N)
(c, d) R (a, b)
Thus, (a, b) R (c, d) (c, d) R a, b) for all (a, b), (c, d)
e N x N
So, R is symmetric on N x N.
(iii) Transitivity: Let (a, b), (c, d), (e, f) e N x N be such that (a, b) R (c,
d) and (c, d) R (e, f), then
(a, b) R (c, d) ad bc =
Discrete Mathematics 33

and (c, d) R (e, f) cf de =
( )( ) ( )( ) ad cf bc de =
af be =
(a, b) R (e, f)
Thus (a, b) R (c, d) and (c, d) R (e, f) (a, b) R (e, f)
for all (a, b), (c, d), (e, f) e N x N
So, R is transitive.
Hence, R being reflexive symmetric and transitive is
an equivalence relation on N x N.

Q.4 Prove that the relation congruence modules m on the set z of all
integers is an equivalence relation.
Ans.: (i) Reflexivity : Let a be an arbitrary integer, then
a a = 0 = 0 x m
a a is divisible by m
a a (mod m)
Thus, a a (mod m) for all a e z
So, congruence modules m is reflective.
(ii) Symmetry : Let a, b e z such that
a b (mod m) a b is divisible by m
a b = m for all e z
b a = (- )m [ e z - e z]
(b a ) is divisible by m
b a (mod m)
So, congruence modules m is symmetric on Z.
(iv) Transitivity: Let a, b, c e z such that a b (mod m) and b c
(mod m), then
a b (mod m) a b is divisible by m
34

a b =
1
m for some
1
e z
b c (mod m) b c is divisible by m
b c =
2
m for some
2
e z
(a b) + (b c) =
1
m +
2
m
(a c) =
3
m {
1
+
2
e z} (
3
=
1
+
2
)
a c (mod m)
So, congruence modules m is transitive.
Hence, congruence modules m is an equivalence
relation.

Q.5 If A = {1, 2, 3, 4, 5, 6, 7} which of the following two is a partition giving
rise to an equivalence relation.
(i) A1 = {1, 3, 5} A2 = {2} A3 = {4, 7}
(ii) B1 = {1, 2, 5, 7} B2 = {3} B3 = {4, 6}
Ans.: (i) Since
1
2 3
A A A = {1, 2, 3, 4, 5, 7} = A
So sets A1 , A2 , A3 do not form a partition of A.
(ii) Since
1
2 3
B B B = {1, 2, 3, 4, 5, 7} =A and B1 , B2 , B3 are disjoint sets.
Hence B1 , B2 , B3 form a partition of A.

Q.6 If R and S are two equivalence relations on a set A, then prove that R S
is an equivalence relation.
Ans.: It is given that R and S are equivalence relation on A. We have to show
that R S is an equivalence relation.
(i) Reflexivity : Let a e A then
(a, a)eR and (a, a) eS [ R & S are reflexive]
(a, a) e R S
Thus (a, a) e R S for all aeA, so R S is a reflexive relation on A.
Discrete Mathematics 35

(ii) Symmetry : Let a, b e A such that (a, b) e R S
(a, b) e R S (a, b) e R and (a, b) e S
(b, a) e R and (b, a) e S
[R & S are symmetric]
(b, a) e R S
Thus (a, b) e R S (b, a) e R S
R S is symmetric relation.
(iii) Transitivity: Let a, b, c e A such that (a, b) e R S and (b, c) e R S
(a, b) e R S and (b, c) e R S
(a, b) e R and (a, b) e S and (b, c) e R and (b, c) e S
(a, b) e R and (b, c) e R (a, c) e R [R is transitive]
(a, b) e S and (b, c) e S (a, c) e S [S is transitive]
(a, c) e R and (a, c) e S
(a, c) e R S
Thus (a, b) e R S and (b, c) e R S (a, c) e R S
So, R S is transitive
Hence R S is an equivalence relation on A.

Q.7 Represent the following relation by digraph.
R = {(1, 1), (1, 4), (1, 3), (2, 1), (2, 2), (3, 4), (4, 1)}
Ans.: Digraph is :-






4
1 2
3
36

Q.8 If A = {1, 2, 3} , B = {4, 5, 6} which of the following are relation from A to
B. Give reason in support of your answer.
Ans.: (i) R1 = {(1, 4), (1, 5), (1, 6)}
Clearly R1 _A x B. So, it is a relation from A to B.
(ii) R2 = {(1, 5), (2, 4), (3, 6)}
Clearly R2 _A x B. So, it is a relation from A to B.
(iii) R3 = {(4, 2), (2, 6), (5, 1), (2, 4)}
Since (4, 2)eR4 but (4, 2) eA x B. So, it is not a relation.


Discrete Mathematics 37




Chapter-7

Functions

Q.1 A = {-1, 0, 2, 5, 6, 11} and B = {-2, -1, 0, 18, 28, 108} and f(x) = x
2
x-2 find
f(A). Is f(A) = B?
Ans.: f(-1) = (-1)
2
(-1) 2 = 0
f(0) = 0 0 2 = -2
f(2) = (2)
2
2 2 = 0
f(5) = (5)
2
5 2 = 18
f(6) = (6)
2
6 2 = 28
f(11) = (11)
2
11 2 = 108
f(A) = {f(x) : xeA} = {f(-1), f(0), f(2), f(5), f(6), f(11)}
= {0, -2, 18, 28, 108}
We observe that -1eB but -1ef(A)
So f(A) = B

Q.2 If a, b e{1, 2, 3, 4} then which of the following are functions.
(a) f1 = {x, y : y = x + 1} (b) f2 = {(x, y) : x + y > 4}
Ans.: (a) Here f1 = {(1, 2), (2, 3), (3, 4)}
We observe that an element 4 of the given set has not mapped to
any element of {1, 2, 3, 4}. So f1 is not function.
(b) f2 = {(1, 4), (4,1), (2,3), (3, 2), (2, 4), (4, 2), (3, 4), (4, 3)}
38

Here we observe that 2, 3, 4 are mapped to more than element of
the set {1, 2, 3, 4}. So f2 is not a function.

Q.3 Prove that function f : QQ given by f(x) = 2x - 3 xeQ is a bijection.
Ans.: (i) Injectivity : Let x, y be two arbitrary elements in Q then
f(x) = f(y) 2x 3 = 2y 3
2x = 2y x = y
So f is injective map.
(ii) Surjectivity : Let y be an arbitrary element of Q
f(x) = y 2x 3 = y

3
2
y
x
+
=
Clearly for all y e Q,
3
2
y
x
+
= . Thus for all y e Q (Codomain)
There exist x e Q (domain) given
3
2
y
x
+
= such that
f(x) = f(
3
2
y +
) = 2(
3
2
y +
) 3 = y
Thus every element in the co-domain has its pre-
image in x. So f is surjective.
Hence f : QQ is a bijection.

Q.4 If f : RR such that f(x) = x
2
and g : RR such that g(x) = 2x + 1 then
prove that
gof = fog
Ans.: (gof)(x) = g{f(x)}
= g(x
2
)
= 2(x
2
) + 1 = 2x
2
+ 1
Now (fog)(x) = f{g(x)}
Discrete Mathematics 39

= f(2x + 1)
= (2x + 1)
2

Since 2x
2
+ 1 = (2x + 1)
2
So, gof = fog

Q.5 Define the following functions
(1) Constant Function
(2) Identify Function
(3) Modulus Function
Ans.: Constant Function : A function f : RR is a constant function if f(x) = c for
all xeR where C is a real constant.
y
f(x) = C
x x
y
Identify Function : A function f : RR is known as identify function if f(x)
= x for all x eR
y
f(x) = x

x 0 x


y
Modulus Function : A function f : RR defined by
f(x) = x, x > 0
-x, x < 0
40

is called the modulus function and is denoted by x .
y
y = -x y = x

x x


y

Q.6 Prove that the identity function on a set A is a bijection.
Ans.: The identity function IA : AA is defined as
IA (x) = (x) for all xeA
(i) Injectivity : Let x, y be any two elements of A, then
IA (x) = IA (y)
x = y [By definition of IA]
So IA is an injective map.
(ii) Surjectivity : Let yeA then there exist x = yeA such that
IA (x) = x
= y
So IA is surjective map.
Hence IA is bijection.

Q.7 Show that the function f : RR given by f(x) = Cos x for all x e R is
neither one-one nor onto.
Ans.: Injectivity : We know that f(0) = Cos 0 = 1 and f(2t ) = Cos 2t = 1
So different elements in R may have the same image.
Hence f is not an injective.
Discrete Mathematics 41

Surjectivity : Since the value of Cos x lie between -1 and 1, it follows that
the range of f(x) is not equal to its co-domain so f is not surjection.

Q.8 Show that f : NN defined by
f(x) =
1
2
n +
, if n is odd

2
n
, if n is even
is many one function.
Ans.: We observe that

1 1
(1) 1
2
f
+
= = and
2
(2) 1
2
f = =
Thus 1 = 2 but f(1) = f(2) so f is many-one function.

Q.9 Let f : RR and g : RR be defined by f(x) = x + 1 and g(x) = x 1,
show that
fog = gof = IR
Ans.: Since f : RR such that f(x) = x + 1 and g : RR such that g(x) = x 1
fog (x) = f[g(x)]
= f[x - 1]
= (x 1) + 1
= x (1)
gof(x) = g[f(x)]
= g[x + 1]
= (x + 1) - 1
= x (2)
IR(x) = x (3)
So by equation (1), (2) and (3), we find that
fog = gof = IR
42

Q.10 Check whether the function f(x) = x is injective and surjective or not?
Ans.: Given function f(x) = x
(i) Injectivity : Since 1eR and -1eR
1 = 1 and 1 = 1
So different elements in R may have the same image.
Hence f is not an injection.
(iii) Surjectivity : Since x = x and x = x
So all negative and positive elements are mapped to
positive element.
Hence it follows that range of f(x) is not equal to its
codomain. So f is not bijection.


Discrete Mathematics 43




Chapter-8

Proportional Calculus

Q.1 Write converse, inverse and contraposition of the implication If I am
hungry, then I will eat.
Ans.: Let p = I am hungry
and q = I will eat
Converse : If I will eat then I am hungry.
Inverse : If I am not hungry, then I will not eat.
Contraposition : It I will not eat, then I am not hungry.

Q.2 Complete truth table for
(pq)( q p)
Ans.:
p q pq q p q
p
(pq)( q
p)
T
T
F
F
T
F
T
F
T
F
T
T
F
T
F
T
F
F
T
T
T
F
T
T
T
T
T
T

Q.3 Using the truth table show that
( ) ( ) p q p q q p v . v
44

Ans.:
I II III IV V VI VII VIII
p p q q pq
p q v q p v
( ) ( ) p q q p v . v
T
T
F
F
F
F
T
T
T
F
T
F
F
T
F
T
T
F
F
T
T
F
T
T
T
T
F
T
T
F
F
T
Column (V) and Column (VIII) are identical. Hence the statement is true.

Q.4 Show that ( ) p q p . is a tautology.
Ans.:
p q
p q .
( ) p q p .
T
T
F
F
T
F
T
F
T
F
F
F
T
T
T
T
Hence it is tautology.

Q.5 State and prove De-Margans Law by Proportional Calculus.
Ans.: The following statements are known as De-Margans Law :
(i) ( ) ( ) ( ) p q p q . v
(ii) ( ) ( ) ( ) p q p q v .
(i) ( ) ( ) ( ) p q p q . v
I II III IV V VI VII
p q
p q .
( ) p q . p q ( ) ( ) p q v
T
T
F
F
T
F
T
F
T
F
F
F
F
T
T
T
F
F
T
T
F
T
F
T
F
T
T
T
Column (IV) and (VII) are identical.
Discrete Mathematics 45

(ii) ( ) ( ) ( ) p q p q v .
I II III IV V VI VII
p q
p q v
( ) p q v p q ( ) ( ) p q .
T
T
F
F
T
F
T
F
T
T
T
F
F
F
F
T
F
F
T
T
F
T
F
T
F
F
F
T
Here Column (IV) and (VII) are identical.
Hence Proved.

Q.6 If A = {1, 2, 3, 4, 5, 6, 7, 8}, then examine the truth value of the following
predicates
(i) - x A e , p(x) = x + 3 = 9
(ii) - x A e , p(x) = x + 4 = 13
Ans.: (i) If x = 6 then x + 3 = 9 is true.
Since 6 A e , - x A e for which p(x) is true.
(ii) x + 4 = 13 is true only for x = 9
But 9eA
the given predicate p(x) is false.

Q.7 Using proper logical statement variables and logical connectives answer
the following question
A person got a note about some treasure hidden in the vicinity of his
home. If the statements are taken as true then where is treasure hidden?
(a) If this house is next to lake, then treasure is not in the kitchen.
(b) If there in the front yard is neem, then the treasure is in the
kitchen.
(c) This house is next to a lake.
(d) The tree is in the front yard is neem, or the treasure is buried under
the flagpole.
46

(e) If the tree in the backyard is an oak, then the treasure is in the
garage.
Ans.: We assign symbols to the proportions as given below :-
p : House is next to a lake.
q : Treasure is in the kitchen.
r : Tree in the front yard is neem.
s : Treasure is buried under the flagpole.
t : Tree in the backyard is oak.
u : Treasure is in the garage.
Then the given data can be put as follows :-
(1) p q
(2) r p
(3) p
(4) r s v
(5) t u
(i) p q [by (1)]
p [by (3)]
q [Modulus Ponens]
(ii) r p [by (2)]
q
r [Modulus Tollens]
(iii) r s v [by (4)]
r
s [Disjunctive Syllogism]
Hence treasure is buried under the flagpole.

Vous aimerez peut-être aussi