Sample
Sample
Sample
AND STRUCTURES
DISCRETE
MATHEMATICS
AND
STRUCTURES
[For B.E./B.Tech. (Computer Science), B.C.A., M.C.A., M.Sc. (Computer Science)]
By
CHENNAI
JALANDHAR N
KOLKATA N
COCHIN
GUWAHATI
HYDERABAD
LUCKNOW
MUMBAI
RANCHI
NEW DELHI
BOSTON, USA
Copyright 2013 by Laxmi Publications Pvt. Ltd. All rights reserved with the
Publishers. No part of this publication may be reproduced, stored in a retrieval system,
or transmitted in any form or by any means, electronic, mechanical, photocopying,
recording or otherwise without the prior written permission of the publisher.
Published by :
Bangalore
Chennai
Cochin
Guwahati
Ranchi
080-26 75 69 30
044-24 34 47 26
0484-237 70 04, 405 13 03
0361-251 36 69, 251 38 81
0651-221 47 64
Kolkata
Lucknow
Mumbai
Hyderabad
Jalandhar
033-22 27 43 84
0522-220 99 16
022-24 91 54 15, 24 92 78 69
040-24 65 23 33
0181-222 12 72
C16452/08/09
Printed at :
To My
Little Daughter
ARSHITA
PREFACE
It gives me a great pleasure in bringing out the Sixth Edition of the book Discrete
Mathematics and Structures. The necessity for Discrete Structure in Computer Science arises
due to selection of certain applications from various areas of the field. As the subject Discrete
Mathematics or Discrete Structures is taught in most Engineering Institutions, the students face
a lot of problems in this subject as no book covers the whole syllabi and also due to lack of solved
problems in the various books. This book is based on the experience gained in teaching a course on
the subject. My intention is to cover all topics in the book with a number of solved problems and
solutions of the questions from the previous question papers of different universities and other
competitive examinations. I am sure that this book will help a student to grip each topic without
any difficulty.
What is New in the Sixth Edition
Many changes have been made in the sixth edition as the goal is to expand the coverage of
topics and more examples.
New chapters has been added on series and sequences, Automation and languages, Boolean
algebra etc.
Many new sections in every chapter.
Additional problems in every chapter.
Multiple choice questions and unsolved exercises.
I would seek the indulgence of my readers in intimating me about any error or shortcomings
noticed by them in the book.
AUTHOR
ACKNOWLEDGMENTS
It is difficult to acknowledge adequately the help & encouragement, I have received in
completion and final publication of this work which has been exercising my mind since long. First,
I must express my gratitude to the Professors & Lecturers of the Sant Longowal Institute of
Engg. & Technology, Longowal (Punjab) where I learnt the elements of Discrete Mathematics and
Structures during the course of my various assignments on the subject.
I also owe a debt of gratitude to the Esteemed Management of Vaish College of Engg.,
Rohtak who has been a source of inspiration to me in attempting this work. I should also express
my grateful thanks to my associates with whom I had occasions to discuss the work of my book at
length which are in large numbers. I must express my indebtness to the students who have helped
me in fixing the pattern of emphasis & in correction of proofs, to mention the least are Manish
Goel, Ashish Goel & Manish Kansal.
Last, but not the least, I express my appreciation to my wife, Monika Gupta for her assistance
and constant encouragement without which the venture would have failed.
AUTHOR
CONTENTS
Chapters
1.
Page No.
SETS
135
1.1
Definition .................................................................................................................. 1
1.2
Set Formation .......................................................................................................... 1
1.3
Standard Notations .................................................................................................. 1
1.4
Various Types of Sets .............................................................................................. 2
1.5
Operations on Sets ................................................................................................... 7
1.6
Algebra of Sets ......................................................................................................... 8
1.7
Cardinality of a Set ............................................................................................... 12
1.8
Venn Diagrams ...................................................................................................... 13
1.9
Multisets ................................................................................................................. 14
1.10 Ordered Pairs ......................................................................................................... 15
1.11 Cartesian Product of Two Sets ............................................................................. 15
Solved Problems ............................................................................................................... 17
Multiple Choice Questions ............................................................................................... 26
Exercises ........................................................................................................................... 27
2.
3647
2.1
First Principle ........................................................................................................ 36
2.2
Inclusion-Exclusion Principle in General ............................................................. 37
Solved Problems ............................................................................................................... 37
Multiple Choice Questions ............................................................................................... 42
Exercises ........................................................................................................................... 42
3.
MATHEMATICAL INDUCTION
3.1
3.2
3.3
4864
Principle ................................................................................................................. 48
Working Rule ......................................................................................................... 48
Peanos Axioms ...................................................................................................... 48
Chapters
Page No.
4.
RELATIONS
65119
4.1
Binary Relation ...................................................................................................... 65
4.2
Complement of a Relation ..................................................................................... 66
4.3
Inverse of a Relation ............................................................................................. 66
4.4
Representation of Relations ................................................................................... 67
4.5
Composition of Relations ........................................................................................ 69
4.6
Path in Relations ................................................................................................... 71
4.7
Composition of Paths ............................................................................................. 76
4.8
Computer Representation of Relations .................................................................. 77
4.9
Representation of Relation in Computer ............................................................... 78
4.10 Properties of Relations ........................................................................................... 82
4.11 Closure Properties of Relations ............................................................................. 85
4.12 Warshalls Algorithm to Find Transitive Closure ............................................... 87
4.13 Equivalence Relations ............................................................................................ 88
4.14 Partial Order Relation ........................................................................................... 89
4.15 Total Order Relation .............................................................................................. 90
4.16 Partition ................................................................................................................. 90
4.17 Equivalence Class .................................................................................................. 91
4.18 Circular Relation .................................................................................................... 91
Solved Problems ............................................................................................................... 92
Multiple Choice Questions ............................................................................................. 103
Exercises ......................................................................................................................... 106
5.
FUNCTIONS
5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
120158
Chapters
Page No.
5.9
Types of Functions .............................................................................................. 123
5.10 Equal Functions ................................................................................................... 126
5.11 Identity Functions ............................................................................................... 126
5.12 Invertible (Inverse) Functions ............................................................................. 127
5.13 Composition of Functions .................................................................................... 127
5.14 Functions Applicable in Computer Science ........................................................ 129
5.15 Permutation Functions ........................................................................................ 133
Solved Problems ............................................................................................................. 139
Multiple Choice Questions ............................................................................................. 148
Exercises ......................................................................................................................... 150
6.
ALGORITHMS
159181
6.1
Algorithm ............................................................................................................. 159
6.2
Characteristics of Algorithms ............................................................................. 159
6.3
Trace of the Algorithm ........................................................................................ 160
6.4
Pseudo Code ......................................................................................................... 160
6.5
Analysis (complexity) of Algorithms ................................................................... 160
6.6
Asymptotic Notations ........................................................................................... 161
6.7
Big-oh (O) Notation .............................................................................................. 161
6.8
Omega () Notation ............................................................................................ 162
6.9
Theta () Notation ............................................................................................... 162
6.10 Recursive Algorithms ........................................................................................... 163
Solved Problems ............................................................................................................. 164
Multiple Choice Questions ............................................................................................. 170
Exercises ......................................................................................................................... 171
7.
GRAPHS
7.1
7.2
7.3
7.4
7.5
7.6
7.7
7.8
7.9
182244
Chapters
Page No.
8.
TREES
245300
8.1
General Trees ....................................................................................................... 245
8.2
Directed Trees ...................................................................................................... 245
8.3
Ordered Trees ...................................................................................................... 246
8.4
Rooted Trees ......................................................................................................... 246
8.5
Path Length of a Vertex ..................................................................................... 247
8.6
Forest .................................................................................................................... 248
8.7
Binary Tree .......................................................................................................... 248
8.8
Infix, Prefix and Postfix Notations ..................................................................... 251
8.9
Complete Binary Tree .......................................................................................... 258
8.10 Full Binary Tree .................................................................................................. 258
8.11 Traversing Binary Trees ..................................................................................... 261
8.12 Algorithms to Draw Binary Trees ...................................................................... 262
8.13 Binary Search Trees ............................................................................................ 267
8.14 Spanning Tree ...................................................................................................... 269
8.15 Game Trees .......................................................................................................... 272
Solved Problems ............................................................................................................. 276
Multiple Choice Questions ............................................................................................. 288
Exercises ......................................................................................................................... 291
9.
PROPOSITIONAL CALCULUS
9.1
9.2
9.3
9.4
301341
Chapters
Page No.
9.5
Tautologies ........................................................................................................... 308
9.6
Contradiction ........................................................................................................ 309
9.7
Contingency .......................................................................................................... 309
9.8
Functionally Complete Sets of Connectives ........................................................ 311
9.9
Argument ............................................................................................................. 312
9.10 Existential Quantifier .......................................................................................... 321
9.11 Universal Quantifier ............................................................................................ 321
9.12 Negation of Quantified Propositions ................................................................... 322
9.13 Propositions with Multiple Quantifiers .............................................................. 323
Solved Problems ............................................................................................................. 323
Multiple Choice Questions ............................................................................................. 333
Exercises ......................................................................................................................... 335
342361
362391
Chapters
Page No.
392416
417447
448482