c2004 study guide

181
Discrete Mathematics - CS218 4th Edition Study Guide

Upload: souchie

Post on 16-Nov-2014

401 views

Category:

Documents


0 download

DESCRIPTION

discrete mahs guide book

TRANSCRIPT

Page 1: C2004 Study Guide

DiscreteMathematics -

CS218

4th Edition

Study Guide

Page 2: C2004 Study Guide

1998 by International DivisionInformatics Holdings LtdA Member of Informatics GroupInformatics Building5 International Business ParkSingapore 609914

Discrete Mathematics - CS218

1st Edition - Completed in December 19942nd Edition - Completed in December 19973rd Edition - Completed in July 19984th Edition - Completed in December 1998

First Printing - 1994Second Printing - 1997Third Printing - 1998Fourth Printing -1998

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted by any forms or means, electronic, mechanical, photocopying, recording, orotherwise, without prior written permission of the publisher.

Every precaution has been taken by the publisher and author(s) in the preparation of thisstudy guide. The publisher offers no warranties or representations, nor does it accept anyliabilities with respect to the use of any information or examples contained herein.

All brands names and company names mentioned in this study guide are protected by theirrespective trademarks and are hereby acknowledged.

The developer is wholly responsible for the contents, errors and omission.

Published by Informatics International(Printing & Publishing Division)Printed in Singapore

Page 3: C2004 Study Guide

Foreword to students:

As there is no assignment for Discrete Mathematics, you will need to do some problems onyour own. The exercises provided at the end of each chapter for you are there for you to develop your skills. These problems have been selected as they give a fair representation of the type ofproblems you will be facing on both the progress tests and the exam paper.

As you work on the problems for each chapter please remember to follow the concepts youhave learned in class, in some cases there are alternative ways to construct or even do theproblems; however, they may not be acceptable on the exam paper. Follow the methods usedin this study guide as they will be always be acceptable.

Show all your work, as the only representative of your work is what you have written. You willnot have an opportunity to explain what you meant, you will be graded on what you havewritten on the exam paper only, if you fail to write it you will not receive the marks. If what you write as an answer is not clear, you will not receive the marks.

Understand there is a lot of material now in this study guide. The reason for this is so you willnot have to go source for material outside this guide. It is very difficult to learn mathematicsand apply it correctly if you don’t have a good foundation. This guide will now provide you with that foundation.

It is important that you attend every class, as each class covers a new topic, and all topics willbe covered in depth on the progress tests and exam paper. Each topic is separate from theother topics, learning one chapter does not mean you will have a better understanding ofanother chapter. Most chapters have little if anything to do with one another, however, all theconcepts presented here are relevant to computer science.

As you start your study of Discrete Mathematics please use the following conventions for eachchapter:

Chap ter 1:

When constructing a truth table, use only T for true and F for false. You must start the truthtable (start of the columns) with T’s. When constructing arguments, If . . . means implies allthe time, at times it is not clear if you should be using and or implies in constructing theargument, try to remember this, if you can insert the word ‘and’ in the sentence and notchange the meaning of the sentence (still have a sentence that makes sense) then use andotherwise use implies (→).

Chap ter 2:

Follow the notation used in this study guide only. Do not make up your own or use somenotation you learned in your previous studies. Use only the symbols that in the table on pg.2-14, other symbols may be acceptable in other places but will not be acceptable on the exampaper.

Chap ter 3:

It is important you understand the concepts presented here. Be careful to prove somethingfully. For example graphing a relation to show it is a function, does not in itself prove that it i s,you must state why it is, or is not a function after graphing it. The same applies to determiningif a function is 1 1− or onto, graphing them does not prove they are 1 1− or onto, you must state ifthey are and why.

Page 4: C2004 Study Guide

Chap ter 4:

There is a lot of material in this chapter. With summation follow the notation. Practice all thedifferent types of proofing methods. Induction is a very important proofing method and somake sure you understand it very well. Follow the examples in the study guide when youattempt to prove a problem using induction, as this is the format that will be looked for on theexam. When proving something do not attempt to prove the right side half way and then provethe left side to that point. Doing this will only get you only the marks for the first part of yourproof (provided the first part of your proof is correct).

Chap ter 5:

With combinatorics you need to determine what type of formula should be used. Try to befamiliar with all the different types.

Chap ter 6:

Probability is an important concept, and it does require practice as many of the concepts canbe confusing.

Chap ter 7:

Graph theory is another important concept. When labelling bipartite graphs, use the labelling convention stated on page 7-11, other type of labelling will not be accepted.

Chap ter 8:

This chapter finishes up your study of Discrete Mathematics, covering in more depthmatrices. This is just a brief introduction to matrices, more of a review of the basic concepts ofmatrices that you may use in discrete mathematics.

Page 5: C2004 Study Guide

Table of Contents

CHAPTER 1: INTRODUCTION TO LOGIC . . . . . . . . . . . . . 1-1

Chapter Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1

1.1 WHAT IS LOGIC? . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2

1.1.1 SIMPLE STATEMENTS . . . . . . . . . . . . . . . . . 1-2

1.1.2 TRUTH TABLES . . . . . . . . . . . . . . . . . . . . . 1-2

1.1.3 COMPOUND STATEMENTS . . . . . . . . . . . . . . 1-3

1.2 BASIC LOGIC CONNECTIVES. . . . . . . . . . . . . . . . . . . 1-3

1.2.1 CONJUNCTION. . . . . . . . . . . . . . . . . . . . . . 1-3

1.2.2 DISJUNCTION . . . . . . . . . . . . . . . . . . . . . . 1-4

1.2.3 NEGATION . . . . . . . . . . . . . . . . . . . . . . . . 1-4

1.2.4 CONDITIONAL . . . . . . . . . . . . . . . . . . . . . . 1-5

1.2.5 BICONDITIONAL. . . . . . . . . . . . . . . . . . . . . 1-6

1.3 PROPOSITIONS AND TRUTH TABLES . . . . . . . . . . . . . 1-6

1.3.1 EXCLUSIVE DISJUNCTION. . . . . . . . . . . . . . . 1-7

1.4 TAUTOLOGIES AND CONTRADICTIONS . . . . . . . . . . . . 1-8

1.4.1 TAUTOLOGY . . . . . . . . . . . . . . . . . . . . . . . 1-8

1.4.2 CONTRADICTION . . . . . . . . . . . . . . . . . . . . 1-8

1.4.3 PRINCIPLE OF SUBSTITUTION . . . . . . . . . . . . 1-9

1.4.4 LAW OF SYLLOGISM. . . . . . . . . . . . . . . . . . . 1-9

1.5 LOGICAL EQUIVALENCE . . . . . . . . . . . . . . . . . . . . . 1-9

1.5.1 DeMORGAN’S LAWS . . . . . . . . . . . . . . . . . . 1-10

1.5.2 LOGICALLY TRUE STATEMENTS . . . . . . . . . . 1-10

1.5.3 LOGICALLY EQUIVALENT STATEMENTS . . . . . 1-10

1.5.4 LAWS OF THE ALGEBRA OF PROPOSITIONS . . . 1-11

1.6 ARGUMENTS. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12

1.7 LOGICAL IMPLICATION . . . . . . . . . . . . . . . . . . . . . 1-14

1.8 SUMMARY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-15

1.8.1 BASIC LOGIC CONNECTIVES . . . . . . . . . . . . . 1-15

1.8.2 REMARKS . . . . . . . . . . . . . . . . . . . . . . . . 1-15

1.9 LOGIC EXERCISES . . . . . . . . . . . . . . . . . . . . . . . . 1-16

CHAPTER 2: SET THEORY . . . . . . . . . . . . . . . . . . . . . . 2-1

Chapter Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1

i

Page 6: C2004 Study Guide

2.1 SETS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2

2.1.1 NOTATION . . . . . . . . . . . . . . . . . . . . . . . . 2-2

2.2 TYPES OF SETS . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3

2.2.1 FINITE AND INFINITE SETS. . . . . . . . . . . . . . 2-3

2.2.2 UNIVERSAL SET . . . . . . . . . . . . . . . . . . . . . 2-3

2.2.3 SUBSETS . . . . . . . . . . . . . . . . . . . . . . . . . 2-4

2.2.4 PROPER SUBSET. . . . . . . . . . . . . . . . . . . . . 2-4

2.2.5 NULL SETS . . . . . . . . . . . . . . . . . . . . . . . . 2-4

2.2.6 DISJOINT SETS. . . . . . . . . . . . . . . . . . . . . . 2-4

2.2.7 SETS OF SETS . . . . . . . . . . . . . . . . . . . . . . 2-5

2.2.8 POWER SETS . . . . . . . . . . . . . . . . . . . . . . . 2-5

2.3 OPERATIONS ON SETS . . . . . . . . . . . . . . . . . . . . . . 2-5

2.3.1 VENN DIAGRAMS . . . . . . . . . . . . . . . . . . . . 2-5

2.3.2 UNION . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6

2.3.3 INTERSECTION . . . . . . . . . . . . . . . . . . . . . 2-6

2.3.4 DIFFERENCE . . . . . . . . . . . . . . . . . . . . . . . 2-7

2.3.5 COMPLEMENT . . . . . . . . . . . . . . . . . . . . . . 2-7

2.4 ATTRIBUTES OF SETS. . . . . . . . . . . . . . . . . . . . . . . 2-8

2.4.1 EQUALITY OF SETS . . . . . . . . . . . . . . . . . . . 2-8

2.4.2 COMPARABILITY. . . . . . . . . . . . . . . . . . . . . 2-8

2.4.3 CARDINALITY . . . . . . . . . . . . . . . . . . . . . . 2-8

2.4.4 THE PRINCIPLE OF INCLUSION AND

EXCLUSION. . . . . . . . . . . . . . . . . . . . . . . . 2-8

2.5 PROOFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9

2.5.1 USING VENN DIAGRAMS . . . . . . . . . . . . . . . . 2-9

2.5.2 PROOFS USING ALGEBRAIC LAWS . . . . . . . . . 2-11

2.6 SET THEORY TRUTH TABLES . . . . . . . . . . . . . . . . . 2-11

2.7 THREE SET VENN DIAGRAMS . . . . . . . . . . . . . . . . . 2-12

2.8 VENN DIAGRAMS USING REGIONS . . . . . . . . . . . . . . 2-12

2.9 SUMMARY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13

2.9.1 LAWS OF THE ALGEBRA OF SETS . . . . . . . . . . 2-13

2.9.2 COMMON SYMBOLS AND THEIR MEANINGS . . . 2-14

2.9.3 REMARKS . . . . . . . . . . . . . . . . . . . . . . . . 2-14

2.10 SET THEORY EXERCISES . . . . . . . . . . . . . . . . . . . . 2-15

CHAPTER 3: RELATIONS AND FUNCTIONS. . . . . . . . . . . . 3-1

Chapter Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1

ii

Ta ble of Con tents CS218

Page 7: C2004 Study Guide

3.1 INTRODUCTION TO RELATIONS . . . . . . . . . . . . . . . . 3-2

3.1.1 ORDERED PAIRS AND PRODUCT SETS . . . . . . . 3-2

3.1.2 SOME SPECIAL SETS . . . . . . . . . . . . . . . . . . 3-2

3.1.3 DEFINITION OF RELATION . . . . . . . . . . . . . . 3-3

3.2 REPRESENTING RELATIONS . . . . . . . . . . . . . . . . . . 3-4

3.2.1 PICTORIAL REPRESENTATION OF RELATIONS . . 3-4

3.2.2 GRAPHICAL REPRESENTATION OF RELATIONS . 3-4

3.2.3 MATRIX REPRESENTATION OF A RELATION. . . . 3-6

3.3 PROPERTIES OF RELATIONS . . . . . . . . . . . . . . . . . . 3-7

3.3.1 REFLEXIVE . . . . . . . . . . . . . . . . . . . . . . . . 3-7

3.3.2 SYMMETRIC . . . . . . . . . . . . . . . . . . . . . . . 3-7

3.3.3 TRANSITIVE . . . . . . . . . . . . . . . . . . . . . . . 3-8

3.3.4 IRREFLEXIVE. . . . . . . . . . . . . . . . . . . . . . . 3-9

3.3.5 ANTISYMMETRIC . . . . . . . . . . . . . . . . . . . . 3-9

3.4 TYPES OF RELATIONS . . . . . . . . . . . . . . . . . . . . . . 3-9

3.4.1 EQUIVALENCE RELATIONS . . . . . . . . . . . . . . 3-9

3.4.2 PARTIALLY ORDERED RELATIONS . . . . . . . . . 3-10

3.4.3 UNIVERSAL RELATIONS . . . . . . . . . . . . . . . 3-10

3.4.4 EMPTY RELATIONS . . . . . . . . . . . . . . . . . . 3-10

3.4.5 INVERSE RELATIONS . . . . . . . . . . . . . . . . . 3-10

3.4.6 COMPOSITE RELATIONS . . . . . . . . . . . . . . . 3-11

3.5 INTRODUCTION TO FUNCTIONS . . . . . . . . . . . . . . . 3-12

3.5.1 ELEMENTS OF A FUNCTION . . . . . . . . . . . . . 3-13

3.6 GRAPHING FUNCTIONS . . . . . . . . . . . . . . . . . . . . . 3-14

3.6.1 COORDINATE GRAPHS . . . . . . . . . . . . . . . . 3-14

3.7 TYPES OF FUNCTIONS. . . . . . . . . . . . . . . . . . . . . . 3-15

3.7.1 INJECTIONS. . . . . . . . . . . . . . . . . . . . . . . 3-15

3.7.2 SURJECTIONS. . . . . . . . . . . . . . . . . . . . . . 3-15

3.7.3 BIJECTIONS . . . . . . . . . . . . . . . . . . . . . . . 3-15

3.8 CLASSES OF FUNCTIONS . . . . . . . . . . . . . . . . . . . . 3-16

3.8.1 LIMITS . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16

3.8.2 BINARY OPERATIONS . . . . . . . . . . . . . . . . . 3-17

3.9 OPERATIONS ON FUNCTIONS . . . . . . . . . . . . . . . . . 3-17

3.9.1 EQUAL FUNCTIONS . . . . . . . . . . . . . . . . . . 3-17

3.9.2 SUM OF FUNCTIONS. . . . . . . . . . . . . . . . . . 3-18

3.9.3 DIFFERENCE OF FUNCTIONS . . . . . . . . . . . . 3-18

3.9.4 PRODUCT OF FUNCTIONS . . . . . . . . . . . . . . 3-18

iii

MA214 Ta ble of Con tents

Page 8: C2004 Study Guide

3.9.5 QUOTIENT OF FUNCTIONS . . . . . . . . . . . . . 3-18

3.9.6 COMPOSITE FUNCTIONS . . . . . . . . . . . . . . . 3-18

3.9.7 INVERTABLE FUNCTIONS . . . . . . . . . . . . . . 3-19

3.10 SUMMARY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20

3.10.1 THEOREMS . . . . . . . . . . . . . . . . . . . . . . . 3-20

3.10.2 REMARKS . . . . . . . . . . . . . . . . . . . . . . . . 3-20

3.11 RELATIONS AND FUNCTIONS EXERCISES . . . . . . . . . . 3-21

CHAPTER 4: METHODS OF PROOFS . . . . . . . . . . . . . . . . 4-1

Chapter Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1

4.1 MATHEMATICAL FACTS . . . . . . . . . . . . . . . . . . . . . 4-2

4.1.1 PREDICATE LOGIC . . . . . . . . . . . . . . . . . . . 4-2

4.1.2 ODD AND EVEN NUMBERS. . . . . . . . . . . . . . . 4-2

4.1.3 ABSOLUTE VALUE. . . . . . . . . . . . . . . . . . . . 4-2

4.1.4 DIVISIBILITY . . . . . . . . . . . . . . . . . . . . . . . 4-2

4.1.5 TYPES OF NUMBERS . . . . . . . . . . . . . . . . . . 4-3

4.1.6 RECURRENCE RELATION . . . . . . . . . . . . . . . 4-3

4.1.7 SEQUENCES . . . . . . . . . . . . . . . . . . . . . . . 4-3

4.1.8 SERIES. . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4

4.1.9 EXPONENTS . . . . . . . . . . . . . . . . . . . . . . . 4-5

4.1.10 LOGIC . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6

4.2 PROOFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6

4.2.1 DIRECT PROOFS . . . . . . . . . . . . . . . . . . . . . 4-6

4.2.2 CONTRAPOSITIVE PROOFS . . . . . . . . . . . . . . 4-7

4.2.3 PROOFS BY CONTRADICTION . . . . . . . . . . . . . 4-7

4.2.4 COUNTEREXAMPLES . . . . . . . . . . . . . . . . . . 4-8

4.2.5 MATHEMATICAL INDUCTION . . . . . . . . . . . . . 4-8

4.3 SUMMARY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12

4.3.1 REMARKS . . . . . . . . . . . . . . . . . . . . . . . . 4-12

4.3.2 PRINCIPLE OF MATHEMATICAL INDUCTION. . . 4-12

4.4 METHODS OF PROOFS EXERCISES . . . . . . . . . . . . . . 4-13

CHAPTER 5: COMBINATORICS . . . . . . . . . . . . . . . . . . . 5-1

Chapter Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1

5.1 BASIC COUNTING RULES. . . . . . . . . . . . . . . . . . . . . 5-2

5.1.1 THE SUM RULE . . . . . . . . . . . . . . . . . . . . . 5-2

5.1.2 THE PRODUCT RULE . . . . . . . . . . . . . . . . . . 5-2

iv

Ta ble of Con tents CS218

Page 9: C2004 Study Guide

5.2 FACTORIAL NOTATION. . . . . . . . . . . . . . . . . . . . . . 5-3

5.3 COUNTING FORMULAS . . . . . . . . . . . . . . . . . . . . . . 5-3

5.3.1 k-SAMPLES . . . . . . . . . . . . . . . . . . . . . . . . 5-4

5.3.2 k-PERMUTATIONS . . . . . . . . . . . . . . . . . . . . 5-4

5.3.3 k-COMBINATIONS . . . . . . . . . . . . . . . . . . . . 5-5

5.3.4 k-SELECTIONS . . . . . . . . . . . . . . . . . . . . . . 5-6

5.4 PIGEONHOLE PRINCIPLE . . . . . . . . . . . . . . . . . . . . 5-6

5.5 THE INCLUSIONEXCLUSION PRINCIPLE . . . . . . . . . . 5-7

5.6 PARTITION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7

5.6.1 ORDERED PARTITIONS. . . . . . . . . . . . . . . . . 5-7

5.6.2 PERMUTATIONS WITH REPETITIONS . . . . . . . . 5-8

5.6.3 UNORDERED PARTITONS . . . . . . . . . . . . . . . 5-8

5.6.4 NUMBER OF PARTITIONS . . . . . . . . . . . . . . . 5-9

5.7 SUMMARY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-10

5.7.1 FORMULAS

5.7.2 THEOREMS . . . . . . . . . . . . . . . . . . . . . . . 5-10

5.7.3 REMARKS . . . . . . . . . . . . . . . . . . . . . . . . 5-11

5.7.4 TABLE . . . . . . . . . . . . . . . . . . . . . . . . . . 5-11

5.8 COMBINATORICS EXERCISES . . . . . . . . . . . . . . . . . 5-12

CHAPTER 6: PROBABILITY . . . . . . . . . . . . . . . . . . . . . 6-1

Chapter Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1

6.1 INTRODUCTION TO PROBABILITY . . . . . . . . . . . . . . . 6-2

6.1.1 SAMPLE SPACES AND EVENTS . . . . . . . . . . . . 6-2

6.1.2 THEOREMS OF PROBABILITY . . . . . . . . . . . . . 6-3

6.2 TYPES OF SAMPLE SPACES . . . . . . . . . . . . . . . . . . . 6-3

6.2.1 FINITE PROBABILITY SPACES . . . . . . . . . . . . 6-3

6.2.2 FINITE EQUIPROBABLE SPACES . . . . . . . . . . . 6-4

6.3 CONDITIONAL PROBABILITY . . . . . . . . . . . . . . . . . . 6-5

6.3.1 MULTIPLICATION THEOREM . . . . . . . . . . . . . 6-6

6.3.2 STOCHASTIC PROCESSES & TREE DIAGRAMS . . . 6-6

6.4 INDEPENDENCE . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7

6.5 REPEATED TRIALS. . . . . . . . . . . . . . . . . . . . . . . . . 6-9

6.6 RANDOM VARIABLES . . . . . . . . . . . . . . . . . . . . . . . 6-9

6.6.1 DISTRIBUTION AND EXPECTATION . . . . . . . . . 6-9

6.6.2 VARIANCE AND STANDARD DEVIATION. . . . . . 6-12

6.7 BINOMIAL DISTRIBUTIONS . . . . . . . . . . . . . . . . . . . 6-13

v

CS218 Ta ble of Con tents

Page 10: C2004 Study Guide

6.8 SUMMARY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15

6.8.1 THEOREMS . . . . . . . . . . . . . . . . . . . . . . . 6-15

6.8.2 REMARKS . . . . . . . . . . . . . . . . . . . . . . . . 6-15

6.9 PROBABILITY EXERCISES . . . . . . . . . . . . . . . . . . . . 6-16

CHAPTER 7: GRAPH THEORY . . . . . . . . . . . . . . . . . . . . 7-1

Chapter Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1

7.1 GRAPHS AND DIGRAPHS . . . . . . . . . . . . . . . . . . . . . 7-2

7.1.1 GRAPHS . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2

7.1.2 MULTIGRAPHS AND PSEUDOGRAPHS. . . . . . . . 7-3

7.1.3 DIGRAPHS . . . . . . . . . . . . . . . . . . . . . . . . 7-3

7.2 BASIC DEFINITIONS . . . . . . . . . . . . . . . . . . . . . . . . 7-4

7.2.1 SUBGRAPHS . . . . . . . . . . . . . . . . . . . . . . . 7-5

7.2.2 ISOMORPHIC GRAPHS . . . . . . . . . . . . . . . . . 7-5

7.3 CLASSES OF GRAPHS . . . . . . . . . . . . . . . . . . . . . . . 7-7

7.3.1 TREES . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7

7.3.2 BIPARTITE GRAPHS. . . . . . . . . . . . . . . . . . . 7-8

7.3.3 COMPLETE GRAPHS . . . . . . . . . . . . . . . . . . 7-9

7.3.4 REGULAR GRAPHS . . . . . . . . . . . . . . . . . . . 7-9

7.3.5 PLANAR GRAPHS . . . . . . . . . . . . . . . . . . . . 7-10

7.4 MATRICES ASSOCIATED WITH GRAPHS . . . . . . . . . . . 7-10

7.4.1 THE ADJACENCY MATRIX . . . . . . . . . . . . . . 7-10

7.4.2 THE INCIDENCE MATRIX . . . . . . . . . . . . . . . 7-12

7.4.3 THE DISTANCE MATRIX . . . . . . . . . . . . . . . 7-12

7.5 TRAVERSING GRAPHS . . . . . . . . . . . . . . . . . . . . . . 7-13

7.5.1 EULERIAN GRAPHS . . . . . . . . . . . . . . . . . . 7-13

7.5.2 HAMILTONIAN GRAPHS . . . . . . . . . . . . . . . 7-14

7.5.3 THE TRAVELLING SALESMAN PROBLEM . . . . . 7-16

7.6 SUMMARY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-17

7.6.1 THEOREMS . . . . . . . . . . . . . . . . . . . . . . . 7-17

7.6.2 REMARKS . . . . . . . . . . . . . . . . . . . . . . . . 7-17

7.7 GRAPH THEORY EXERCISES . . . . . . . . . . . . . . . . . . 7-19

CHAPTER 8: MATRICES . . . . . . . . . . . . . . . . . . . . . . . 8-1

Chapter Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1

8.1 MATRICES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2

8.1.1 MATRIX OPERATIONS . . . . . . . . . . . . . . . . . 8-2

vi

Ta ble of Con tents CS218

Page 11: C2004 Study Guide

8.1.2 TYPES OF MATRICES . . . . . . . . . . . . . . . . . . 8-4

8.1.3 MATRIX MULTIPLICATION . . . . . . . . . . . . . . 8-5

8.1.4 TRANSFORMING MATRICES. . . . . . . . . . . . . . 8-7

8.2 SUMMARY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8

8.2.1 REMARKS . . . . . . . . . . . . . . . . . . . . . . . . . 8-8

8.3 MATRICES EXERCISES . . . . . . . . . . . . . . . . . . . . . . 8-9

GLOSSARY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1

vii

CS218 Ta ble of Con tents

Page 12: C2004 Study Guide

CHAPTER 1: INTRODUCTION TO LOGIC

Chapter Objectives

In this chapter you will learn:

§ what logic is;

§ about the basis of logic: the simple statement;

§ how to construct a truth table;

§ about the five basic logic connectives and there truth tables;

§ the rules of logic;

§ what makes a statement a tautology;

§ what makes a statement a contradiction;

§ what logical equivalence is;

§ what a proposition is;

§ what makes an argument valid;

1 - 1

Page 13: C2004 Study Guide

1.1 WHAT IS LOGIC?

u Logic is the study of the principles and methods used in distinguishing validarguments from those that are invalid. Logic is also known as propositionalcalculus.

1.1.1 SIM PLE STATE MENTS

u The basic building block in logic is the statement, also referred to as a proposition. A statement is a declarative sentence which can only be either true or false.

u Statements are represented by letters such as p, q, r, . . .

u The following are simple statements:

Example 1: Jakarta is a city in Indonesia.

Example 2: 2 + 1 = 5

Example 3: The digit in the 105th decimal place expansion of 37 is 8

Example 4: The moon is made of blue cheese.

Example 5: There is no intelligent life on Mars.

Example 6: It is raining.

u Clearly example 1 is true, while examples 2, and 4 are clearly false. Whether examples 3, 5 are true is not certain, but only because of our lack of knowledge, while whetherexample 6 is true or false depends on the time the statement is made.

u The following are not statements:

Example 7: Come to our party!

Example 8: The sky is rich.

Example 9: How are you today lah?

1.1.2 TRUTH TA BLES

u Since a statement can only be true or false, the values of a statement can berepresented by a truth table. Using the variables p and q to represent statements, and letting T and F stand for true and false respectively yields table 1, a truth table.

Table 1

p ~p

T F

F T

l Remark 1: The number of truth values (rows) is 2n, where n is the number of basic statements (variables)

1 - 2

CHAPTER 1: INTRODUCTION TO LOGIC CS218

Page 14: C2004 Study Guide

1.1.3 COM POUND STATE MENTS

u The combination of two or more simple statements is a compound statement, orcompound proposition.

Example 10: “2 + 1 = 5” and “6 + 2 = 8”

Example 11: “The sky is clear” or “It is raining today”

u The variables p, q, r, . . . denote simple statements in the compound proposition ( )P p q r, , ,... , where P is a proposition.

1.2 BASIC LOGIC CONNECTIVES

u Compound statements are connected using mainly five basic connectives:conjunction, disjunction, negation, conditional, and biconditional.

1.2.1 CON JUNC TION

u Any two statements can be combined by the word “and” to form a compositestatement which is called the conjunction of the original statements.

- The connection of the statements p and q is symbolically represented byp ∧ q

- The truth values of p ∧ q can be represented in a truth table:

p q p ∧ q

T T T

T F F

F T F

F F F

u If p is true and q is true then p ∧ q is true; otherwise p ∧ q is false. In other words, theconjunction of two statements is true only if each component is true.

Example 12: Sidney is in Australia and 2 + 2 = 4

Example 13: Sidney is in Australia and 2 + 2 = 5

Example 14: Sidney is in Malaysia and 2 + 2 = 4

Example 15: Sidney is in Malaysia and 2 + 2 = 5

u Since only example 12 contains two simple statements that are true, and the othersall contain simple statements in which at least one of them is false only example 12 istrue.

1 - 3

CS218 CHAPTER 1: INTRODUCTION TO LOGIC

Page 15: C2004 Study Guide

1.2.2 DIS JUNC TION

u Any two statements can be combined by the word “or” (in the sense of “and/or”,called the “inclusive or”), to form a new statement which is called the disjunctionof the original two statements.

- The connection of the statements p or q is symbolically represented by p ∨ q.

- The truth values of p ∨ q can be represented in a truth table:

p q p ∨ q

T T T

T F T

F T T

F F F

u If p is true or q is true or both p and q are true, then p ∨ q is true; otherwise p ∨ q isfalse. In other words, the disjunction of two statements is false only if eachcomponent is false.

Example 16: Sidney is in Australia or 2 + 2 = 4

Example 17: Sidney is in Australia or 2 + 2 = 5

Example 18: Sidney is in Malaysia or 2 + 2 = 4

Example 19: Sidney is in Malaysia or 2 + 2 = 5

u Only example 19 is false. Each of the other compound statements is true since at least one of its simple statements is true.

1.2.3 NE GA TION

u Given any statement p, another statement, called the negation of p, can be formedby writing “It is false that . . .” before p or, if possible, by inserting in p the word “not”.

- Negation can be symbolically represented by ~p, or ¬p

- The truth values of ~p can be represented in a truth table:

p ~p

T F

F T

u If p is true then ~p is false; if p is false, then ~ p is true. In other words, the truth value of the negation of a statement is always the opposite of the truth value of the originalstatement.

Example 20: If p is ‘Sidney is in Australia’, then ‘Sidney is not in Australia’ is the negation ~p

Example 21: If p is ‘2 + 2 = x’, then ‘2 + 2 ≠ x’ is the negation ~p

1 - 4

CHAPTER 1: INTRODUCTION TO LOGIC CS218

Page 16: C2004 Study Guide

1.2.4 CON DI TIONAL

u Many statements, especially in mathematics, are of the form “If p then q” or “pimplies q”. Such statements are called conditional statements.

- Conditional statements are symbolically represented as p → q

- The truth values of p → q can be represented in a truth table:

p q p → q

T T T

T F F

F T T

F F T

u The conditional p → q is true unless p is true and q is false. In other words p → q states that a true statement cannot imply a false statement.

Example 22: If Sidney is in Australia then 2 + 2 = 4

Example 23: If Sidney is in Australia then 2 + 2 = 5

Example 24: If Sidney is in Malaysia then 2 + 2 = 4

Example 25: If Sidney is in Malaysia then 2 + 2 = 5

u By the conditional p → q only example 23 is false. But how can this be as clearly ‘2 +2 = 4’ is true and ‘2 + 2 = 5’ is clearly false? This is the case as once we know that the “if” is false we no longer care if the “that” is true or not; hence we willing acceptthat the proposition is vacuously true.

Exercise 1: Construct the truth table for ~p ∧ q

Exercise 2: Construct the truth table for (p ∨ q) → (p ∧ q)

1 - 5

CS218 CHAPTER 1: INTRODUCTION TO LOGIC

Page 17: C2004 Study Guide

1.2.5 BI CON DI TIONAL

u Another common statement called a biconditional statement is of the form “p if and only if q” or, simply, “p iff q”

- Biconditional statements are symbolically represented as p ↔ q

- The truth values of p ↔ q can be represented in a truth table:

p q p ↔ q

T T T

T F F

F T F

F F T

u If p and q have the same truth value, then p ↔ q is true; if p and q have opposite truthvalues, then p ↔ q is false.

Example 26: Sidney is in Australia iff 2 + 2 = 4

Example 27: Sidney is in Australia iff 2 + 2 = 5

Example 28: Sidney is in Malaysia iff 2 + 2 = 4

Example 29: Sidney is in Malaysia iff 2 + 2 = 5

u By the conditional p ↔ q examples 26 and 29 are true, while examples 27 and 28 arefalse.

l Remark 2: The biconditional statement can be defined as ( ) ( )p q q p→ ∧ →

1.3 PROPOSITIONS AND TRUTH TABLES

u By repetitive use of the logical connectives (∧, ∨, ~, →, and, ↔), we can constructcompound statements that are more involved. In the case where the substatementsp, q, . . . of a compound statement ( )P p q, ,... , are variables, the compound statement is called a proposition.

u The truth value of a proposition depends exclusively upon the truth values of itsvariables, that is, the truth value of a proposition is known once the truth values of its variables are known. A simple concise way to show this relationship is through atruth table.

Example 30: The truth table of the proposition ( )~ ~p q∧ , is:

p q ~q p ∧ ~q ~(p ∧ ~q)

T T F F T

T F T T F

F T F F T

F F T F T

1 - 6

CHAPTER 1: INTRODUCTION TO LOGIC CS218

Page 18: C2004 Study Guide

u Observe that the first columns of the table are for the variables p, q, . . . and there areenough rows in the table to allow for all possible combinations of T and F for thesevariables, i.e., the number of rows = 2n

u There is then a column for each “elementary” stage of the construction of theproposition, the truth value at each step being determined from the previous stagesby the definitions of the connectives ∧, ∨, ~

u Finally we obtain truth value of the proposition, which appears in the last column.

l Remark 3: The truth table of a proposition consists precisely of the columns under the variables and the column under the proposition.

u The truth table of the proposition in example 30 is precisely:

p q ~(p ∧ ~q)

T T T

T F F

F T T

F F T

The other columns in example 30 are used only to construct the truth table.

Example 31: Construct the truth table for ( ) ( )p q q p→ ∧ →

p q p → q q → p (p → q) ∧ (q → p)

T T T T T

T F F T F

F T T F F

F F T T T

Example 32: Construct the truth table for ( ) ( )~ ~p q q p∧ ∨ ↔

p q p ∧ q q ↔ p ~(p ∧ q) ~(q ↔ p) ~(p ∧ q) ∨ ~(q ↔ p)

T T T T F F F

T F F F T T T

F T F F T T T

F F F T T F T

1.3.1 EX CLU SIVE DIS JUNC TION

u In addition to the “inclusive or” (see Disjunction section 2.2.2) there is anothermeaning for “or” in English called the ‘exclusive or’, which means “either one or theother, but not both.” In Logic exclusive or is referred to as exclusive disjunction.

1 - 7

CS218 CHAPTER 1: INTRODUCTION TO LOGIC

Page 19: C2004 Study Guide

u In mathematics or in logic, “or” always means “inclusive or” i.e., “or” always refersto the disjunction connective.

- Exclusive or can be expressed using the basic connectives ( )~ p q↔

Exercise 3: Complete the truth table for ( )~ p q↔

1.4 TAUTOLOGIES AND CONTRADICTIONS

1.4.1 TAUTOLOGY

u A compound proposition that is always TRUE is called a tautology.

Example 33: p p∨ ~ is a tautology as all entries in the last column are T’s

p ~p p ∨ ~p

T F T

F T T

1.4.2 CON TRA DIC TION

u A compound proposition that is always FALSE is called a contradiction.

Example 34: p p∧ ~ is a contradiction as all entries in the last column are F’s

p ~p p ∧ ~p

T F F

F T F

l Remark 4: If ( )P p q, ,... is a tautology then ~ ( , ,... )P p q is a contradiction, and if ( )~ , , ,...P p q r is a tautology then ( )P p q r, , ... is a contradiction.

1 - 8

CHAPTER 1: INTRODUCTION TO LOGIC CS218

Page 20: C2004 Study Guide

1.4.3 PRIN CI PLE OF SUB STI TU TION

u If ( )P p q, ,... is a tautology, then ( )P P P1 2, ,... is also a tautology.

Example 35: We have shown that p p∨ ~ is a tautology so by the principle of substitution, substituting q r∧ for p we obtain the proposition ( ) ( )q r q r∧ ∨ ∧~ , which is also a tautology.

q r q ∧ r ~(q ∧ r) (q ∧ r) ∨ ~(q ∧ r)

T T T F T

T F F T T

F T F T T

F F F T T

1.4.4 LAW OF SYL LO GISM

u A fundamental principle of logical reasoning, called the Law of Syllogism ,states: “If p implies q and q implies r, then p implies r.” In other words theproposition ( ) ( )[ ] ( )p q q r p r→ ∧ → → → is a tautology.

Example 36: Show that ( ) ( )[ ] ( )p q q r p r→ ∧ → → → is a tautology.

p q r p → q q → r (p → q) ∧ (q → r) p → r [(p → q) ∧ (q → r)] → (p → r)

T T T T T T T T

T T F T F F F T

T F T F T F T T

T F F F T F F T

F T T T T T T T

F T F T F F T T

F F T T T T T T

F F F T T T T T

1.5 LOGICAL EQUIVALENCE

u Two propositions ( )P p q, ,... and ( )Q p q r, , ,... are said to be logically equivalent if the final columns in their truth tables are the same.

- logical equivalence is denoted with ≡

Exercise 4: Show that p q→ and ~ ~q p→ are logically equivalent.

1 - 9

CS218 CHAPTER 1: INTRODUCTION TO LOGIC

Page 21: C2004 Study Guide

Exercise 5: Show that ( ) ( )[ ]p q q p p q→ ∧ → ≡ ↔

u Since the last two columns in the truth tables are the same the statements arelogically equivalent.

1.5.1 De MOR GAN’S LAWS

u DeMorgan’s Laws are simply:

a. ( )~ ~ ~p q p q∧ ≡ ∨ b. ( )~ ~ ~p q p q∨ ≡ ∧

u DeMorgan’s Laws are an important both in logic and in set theory. The constructionof the truth tables is left as exercises.

1.5.2 LOGICALLY TRUE STATE MENTS

u A statement is said to be logically true if it is derivable from a tautology.

Example 37: It is raining or it is not raining.

u Example 37 is logically true since it is derivable from the tautology p ∨ ~p, where p is‘It is raining.’

1.5.3 LOGI CALLY EQUIVA LENT STATE MENTS

u Statements of the form ( )P p q0 0, ,... and ( )Q p q0 0, ,... are said to be logically equivalent if the propositions ( )P p q, ,... and ( )Q p q, ,... are logically equivalent.

Example 38: Since ( )~ ~ ~p q p q∧ ≡ ∨ , the statement “It is not true that roses are red and violets are blue” is logically equivalent to the statement

“Roses are not red or violets are not blue.” Where p is ‘roses are red’, and q is ‘violets are blue.’

1 - 10

CHAPTER 1: INTRODUCTION TO LOGIC CS218

Page 22: C2004 Study Guide

1.5.4 LAWS OF THE AL GE BRA OF PROP O SI TIONS

Idempotent Laws1a. p p p∨ ≡ 1b. p p p∧ ≡

Associative Laws

2a. ( ) ( )p q r p q r∨ ∨ ≡ ∨ ∨ 2b. ( ) ( )p q r p q r∧ ∧ ≡ ∧ ∧

Commutative Laws3a. p q q p∨ ≡ ∨ 3b. p q q p∧ ≡ ∧

4a. ( ) ( )p q q p↔ ≡ ↔

Distributive Laws

5a. ( ) ( ) ( )p q r p q p r∨ ∧ ≡ ∨ ∧ ∨ 5b. ( ) ( ) ( )p q r p q p r∧ ∨ ≡ ∧ ∨ ∧

Identity Laws6a. p c p∨ ≡ 6b. p t p∧ ≡7a. p t t∨ ≡ 7b. p c c∧ ≡

Complement Laws8a. p p t∨ ≡~ 8b. p p f∧ ≡~

9a. ~ t c≡ 9b. ~ c t≡

Involution Law10a. ~ ~ p p≡

DeMorgan’s Laws

11a. ( )~ ~ ~p q p q∨ ≡ ∧ 11b. ( )~ ~ ~p q p q∧ ≡ ∨

12a. ( ) ( )p q p q∨ ≡ ∧~ ~ ~ 12b. ( ) ( )p q p q∧ ≡ ∨~ ~ ~

Contrapositive

13a. ( ) ( )p q q p→ ≡ →~ ~

Implication

14a. ( ) ( )p q p q→ ≡ ∨~ 14b. ( ) ( )p q p q→ ≡ ∧~ ~

15a. ( ) ( )p q p q∨ ≡ →~ 15b. ( ) ( )p q p q∧ ≡ →~ ~

16a. ( ) ( )[ ] ( )[ ]p r q r p q r→ ∧ → ≡ ∨ → 16b. ( ) ( )[ ] ( )[ ]p q p r p q r→ ∧ → ≡ → ∧

Equivalence

17a. ( ) ( ) ( )[ ]p q p q q p↔ ≡ → ∧ →

Exportation Law

18a. [ ] ( )[ ]( )p q r p q r∧ → ≡ → →

Absorbtion Law

19a. ( ) ( )p q p q p q∨ ∧ ∧ ≡ ∨ 19b. ( ) ( )p q p q p q∧ ∧ ∨ ≡ ∨

Reductio ad absurdum

20a. ( ) ( )[ ]p q p q c→ ≡ ∧ →~

Note: In the table t represents a tautology and c represents a contradiction.

1 - 11

CS218 CHAPTER 1: INTRODUCTION TO LOGIC

Page 23: C2004 Study Guide

1.6 ARGUMENTS

u An argument is a relationship between a set of propositions, P P Pn1 2, ,... , , calledpremises, and another proposition Q, called the conclusion.

- An argument is denoted by P P Pn1 2, ,... Q

u An argument is said to be valid if the premises yield (have as a consequence) theconclusion.

l Remark 5: An argument P P Pn1 2, ,... Q is valid if Q is true whenever all the premises P P Pn1 2, ,... are true.

u An argument that is not valid is called a fallacy.

l Remark 6: The argument P P Pn1 2, ,... Q is valid iff ( )P P P Qn1 2∧ ∧ →... is a tautology.

Example 39: The argument p, p → q q is valid, since [p ∧ (p → q)] → q is a tautology.

p q p → q p ∧ (p → q) [p ∧ (p → q)] → q

T T T T T

T F F F T

F T T F T

F F T F T

Example 40: The argument p → q, q p is a fallacy, since [(p → q) ∧ q] → p is not a tautology.

p q p → q (p → q) ∧ q [(p → q) ∧ q] → p

T T T T T

T F F F T

F T T T F

F F T F T

u It should be emphasized that the validity of an argument does not depend upon thetruth values or the content of the statements appearing in the argument, but only onthe formal structure of the argument. One way to present an argument is:

Example 41: Analyse the following argument.

S 1: If a man is a bachelor, he is unhappy.

S 2: If a man is unhappy, he dies young.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

S : Bachelors die young.

l Note: The statement S below the line denotes the conclusion of the argument, and the statements S S1 2, above the line denote the premises.

1 - 12

CHAPTER 1: INTRODUCTION TO LOGIC CS218

Page 24: C2004 Study Guide

In order to analyse the argument we must define our terms:

p: he is a bachelor q: he is unhappy r: he dies young

and the argument is p → q, q → r p → r

We need to show that ( ) ( )[ ] ( )p q q r p r→ ∧ → → → is a tautology.

p q r p → q q → r [(p → q) ∧ (q → r)] p → r [(p → q) ∧ (q → r)] → (p →r)

T T T T T T T T

T T F T F F F T

T F T F T F T T

T F F F T F F T

F T T T T T T T

F T F T F F T T

F F T T T T T T

F F F T T T T T

Since ( ) ( )[ ] ( )p q q r p r→ ∧ → → → is a tautology the argument is valid.

u Another type of argument does not differentiate between the statements and theconclusion by the use of a line; however, you can still determine the conclusion.(Usually it contains the word therefore, but not always).

Example 42: Is this argument valid? An interesting teacher keeps me awake. I stay awake in MA214 class. Therefore, my MA214 teacher is interesting.

First define the terms:

t: my teacher is interesting a: I stay awake m: I am in MA214 class

and the argument is: t a a m→ ∧, m t∧

We need to show that ( ) ( )[ ] ( )t a a m m t→ ∧ ∧ → ∧ is a tautology.

t a m t → a a ∧ m (t → a) ∧ (a ∧ m) m ∧ t [(t → a) ∧ (a ∧ m)] → (m ∧ t)

T T T T T T T T

T T F T F F F T

T F T F F F T T

T F F F F F F T

F T T T T T F F

F T F T F F F T

F F T T F F F T

F F F T F F F T

Since ( ) ( )[ ] ( )t a a m m t→ ∧ ∧ → ∧ is not a tautology, the argument is not a valid argument.

1 - 13

CS218 CHAPTER 1: INTRODUCTION TO LOGIC

Page 25: C2004 Study Guide

Example 43: Is this argument valid? Sean is either a carpenter or a plumber (but not both). If he carries a wrench, he’s a plumber. Sean is a carpenter. Therefore, he does not carry a wrench.

First define the terms:

c: Sean is a carpenter p: Sean is a plumber w: Sean carries a wrench

and the argument is ( )~ , ,c p w p c↔ → ~ w

So we need to show that ( ) ( )[ ]~ ~c p w p c w↔ ∧ → ∧ → is a tautology.

c p w ~(c ↔ p) w → p ~(c ↔ p) ∧ (w → p) ∧ c ~w [~(c ↔ p) ∧ (w → p) ∧ c] → ~w

T T T F T F F T

T T F F T F T T

T F T T F F F T

T F F T T T T T

F T T T T F F T

F T F T T F T T

F F T F F F F T

F F F F T F T T

Since ( ) ( )[ ]~ ~c p w p c w↔ ∧ → ∧ → is a tautology, the argument is valid.

1.7 LOGICAL IMPLICATION

u A proposition P(p, q, . . .) is said to logically imply a proposition Q(p, q, . . .), writtenP(p, q, . . .) ⇒ Q(p, q, . . .) if Q(p, q, . . .) is true whenever P(p, q, . . .) is true.

Example 44: Consider the truth table below. Observe that p is true in cases (lines) 1 and 2, and in these cases p ∨ q is also true. In other words, p logically implies p ∨ q

p q p ∨ q

T T T

T F T

F T T

F F F

l Remark 7: For any propositions ( )P p q, ,... and ( )Q p q, ,... , the following statements are equivalent:

i) ( )P p q, ,... logically implies ( )Q p q, ,...

ii) The argument ( )P p q, ,... ( )Q p q, ,... is valid.

iii) The proposition ( ) ( )P p q Q p q, ,... , ,...→ is a tautology.

1 - 14

CHAPTER 1: INTRODUCTION TO LOGIC CS218

Page 26: C2004 Study Guide

1.8 SUMMARY

1.8.1 BA SIC LOGIC CON NEC TIVES

Connective Meaning Symbolized by

conjunction and ∧

disjunction or ∨

negation not ¬, ~

conditional If ... then ..., Implies →

biconditional If and only if ↔

1.8.2 RE MARKS

l The number of truth values (rows) is 2n, where n is the number of basicstatements (variables).

l The biconditional statement can be defined as ( ) ( )p q q p→ ∧ →

l The truth table of a proposition consists precisely of the columns under thevariables and the column under the proposition.

l If ( )P p q, ,... is a tautology then ~ ( , ,... )P p q is a contradiction, and if ( )~ , , ,...P p q r is a tautology then ( )P p q r, , ... is a contradiction.

l An argument P P Pn1 2, ,... Q is valid if Q is true whenever all the premises P P Pn1 2, ,... are true.

l The argument P P Pn1 2, ,... Q is valid iff ( )P P P Qn1 2∧ ∧ →... is a tautology.

l For any propositions ( )P p q, ,... and ( )Q p q, ,... , the following statements areequivalent: i) ( )P p q, ,... logically implies ( )Q p q, ,... ii) The argument ( )P p q, ,... ( )Q p q, ,... is valid iii) The proposition ( ) ( )P p q Q p q, ,... , ,...→ is a

tautology.

1 - 15

CS218 CHAPTER 1: INTRODUCTION TO LOGIC

Page 27: C2004 Study Guide

1.9 LOGIC EXERCISES

u Write out the truth tables for :

1. ~(p ∨ ~q)

2. p ∧ (q ∨ s)

3. (p ∧ q) ∨ (p ∧ s)

4. Compare (2) and (3) and draw a conclusion.

5. If P is the statement “It is raining ”Q is the statement “ It is sunny ”R is the statement “ It is cold ”

Represent the following using symbols :

a. It is raining and it is cold.b. It is sunny and cold but not raining.c. It is not cold but it is raining.

u Construct a truth table for the following:

6. (a ∧ ~b) ↔ (a ∧ b)

7. (a ∨ b) ↔ ~c

8. (a ∨ b) ∧ (a ∨ ~c) → a ∨ (b ∧ ~c)

9. (a → ~b) ↔ (b→ a ∧ b)

u Show that the following are tautologies :

10. (p ∧ q) → (p ∨ ~q)

11. p ∨ ~q ↔ ~( ~p ∧ q)

12. p ∨ ~(p ∧ q)

13. [(p ↔ q) ∧ ~p] → ~q

14. (p ∧ q) → (p ∨ ~q)

15. (p ∨ ~q) ↔ ~(~p ∧ q)

u Show that the following are contradictions:

16. p ∧ (~p ∧ q)

17. (p → q) ∧ ( ~q ∧ p)

18. (p ∧ q) ∧ ~ (p ∨ q)

19. (p → q) ∧ (~q ∧ p)

1 - 16

CHAPTER 1: INTRODUCTION TO LOGIC CS218

Page 28: C2004 Study Guide

u Prove the following :

20. p → q ≡ (~p ∨ q)

21. (p ∧ q) ∨ ~p ≡ ~p ∨ q

22. (p → q) ≡ ~(p ∧ ~q)

23. (p → q) ∨ ~p ≡ ~p ∨ q

u Construct the truth tables for DeMorgan’s Laws.

24. ~(p ∧ q) ≡ ~p ∨ ~q

25. ~(p ∨ q) ≡ ~p ∧ ~q

u Determine the validity of the following arguments:

26. p ∨ q , ~p q

27. p → q , q → r , ~r ~p

28. p → ~q , ~p → q ~p → r

u Analyse the following arguments:

29. If you do not study you will fail your examination. You failed therefore you did not study.

30. If you do not get a degree, you will not get a job. You got a job therefore you must have got a degree.

31. Tanya is either a singer or a ballerina. If she is a singer then she has a lovely voice. If she is a ballerina then she has long legs. Tanya has lovely voice and long legs so she is both.

32. If he does not have an explanation then he will be found guilty. He either has an explanation or he has been framed. Therefore, if he has been framed he will be found guilty.

33. If I am not in Malaysia, then I am not happy; if I am happy, then I am singing; I am into singing; therefore, I am not in Mayalsia.

u Miscellaneous Problems

34. If the statement r is a tautology, what can we say about the statement ~r?

35. Simplify the follwowing argument ~ ((~ ~ ) (~ ~ ))p q p q p q∨ ∨ ∧ ∨

36. Consider the following propositions:

a: The road is narrow

b: The road is meandering

c: The road is an accident zone

i) Represent the following statement using logical symbols:If the road is narrow and meandering then it is an accident zone.

ii) Translate ~ ~ ~a b c∧ ↔ into English

1 - 17

CS218 CHAPTER 1: INTRODUCTION TO LOGIC

Page 29: C2004 Study Guide
Page 30: C2004 Study Guide

CHAPTER 2: SET THEORY

Chapter Objectives

In this chapter, you will learn:

§ what a set is;

§ how to construct a set;

§ about the different types of sets;

§ about the operations that can be performed on sets;

§ about the attributes of sets;

§ how to prove something using sets;

§ what a Venn diagram is and how to construct one;

2 - 1

Page 31: C2004 Study Guide

2.1 SETS

u A set is any well-defined list, collection, or class of objects. The objects in sets can beanything: numbers, people, letters, cities, etc. These objects are called the elementsor members of the set.

u The following are examples of sets:

Example 1: The numbers 2, 4, 5, 8, and 19.

Example 2: The solutions of the equation 2 4 8 02x x− − =Example 3: The first five letters of the alphabet: a, b, c, d, and e.

Example 4: The citizens of Singapore.Example 5: The days: Monday, Tuesday, Wednesday, Thursday, and Friday.

Example 6: The students in MA214.

Example 7: The countries Singapore, Malaysia, Indonesia, and Thailand.Example 8: The cities of Australia.

Example 9: The numbers 1, 3, 5, 7, 9, . . .Example 10: The streets of Singapore.

u Notice that the sets in the odd numbered examples are defined, or are actual listingsof the members of the sets; and that the sets in the even numbered examples aredefined by stating properties, or rules which state whether or not a particular objectis a member of the set.

2.1.1 NO TA TION

u Sets will usually be denoted by capital letters

A, B, C, X, . . .

u The elements of a set will usually be represented by lower case letters

a, b, c, x, . . .

u If a set is defined by actually listing its elements then the elements are separated bycommas and enclosed in brackets { }.

- This is called the tabular form of a set.

Example 11: If the elements of set A are the letters a, e, i, o, and u then we write A= {a, e, i, o, u}

u If we define a particular set by stating the properties which its elements must satisfythen we use a letter, usually x, to represent an arbitrary element, i.e., B = {x | x isodd}

- This is read “B is the set of numbers x such that x is odd”

- This is called the set-builder form of a set.

- Notice the vertical line “|” is read “such that”

2 - 2

CHAP TER 2: SET THEORY CS218

Page 32: C2004 Study Guide

u If an object x is a member of a set A, i.e., A contains x as one of its elements, then wewrite x A∈ . Which is read “ x is an element of A” or as “x belongs to A” or “ x is in A”.

u If on the other hand an object x is not a member of a set A, i.e., A does not contain x asone of its elements, then we write x A∉ . Which is read “x is not an element of A”.

Example 12: Let A = {a, b, c, d, e}. Then a A∈ , f A∉ , e A∈ and t A∉

Example 13: Let B = {x | x is odd}. Then 1∈ B, 2 ∉ B, 3 ∈ B, and 4 ∉ B

Rewrite examples 1-10 in tabular form or set-builder form.

Ex er cise 1:

Ex er cise 2:

Ex er cise 3:

Ex er cise 4:

Exercise 5:

Exercise 6:

Exercise 7:

Exercise 8:

Exercise 9:

Exercise 10:

2.2 TYPES OF SETS

2.2.1 FI NITE AND IN FI NITE SETS

u A set can be finite or infinite. A set is finite if it consists of a specific number ofdifferent elements, i.e., if when you count the different elements of a set countingeventually comes to an end. Otherwise the set is infinite.

Example 14: Let X be the number of days in a year. Then X is finite.

Example 15: Let N = {1, 3, 5, 7, 9, ...}. Then N is infinite.Example 16: Let M = {1, 2, 3, 4, 5,...,10,000,000,000}. Then M is finite.

Example 17: Let Y = {y | y is a street in Singapore}. Then y is finite.

2.2.2 UNI VER SAL SET

u All the sets under consideration can thought of as subsets of another set called theuniversal set. The universal set is denoted by U.

Example 18: The universal set U = the lowercase English alphabet.

Example 19: In human population studies, the universal set consists of all the people in the world.

2 - 3

CS218 CHAP TER 2: SET THEORY

Page 33: C2004 Study Guide

2.2.3 SUB SETS

u A is a subset of B, written A B⊆ , if every element of A is also an element of B. Morespecifically, A is a subset of B if x A∈ implies x B∈ .

u If A is a subset of B, then we can also write B ⊇ A, which reads “B is a superset of A”or “B contains A.

u If on the other hand A is not a subset of B, we write instead A B⊄ .

Example 20: {1, 2, 3} ⊆ {1, 2, 3, 4}

Example 21: {1, 2, 3} ⊆ {1, 2, 3}

Example 22: {1, 2, 3} ⊄ {2, 3, 4} Α Β⊆

l Remark 1: If A is not a subset of B, that is, if A B⊄ then, there is at least one element in A that is not a member of B.

l Remark 2: Every set is a subset of itself, since every element in a set is in itself.

2.2.4 PROPER SUB SET

u We call B a proper subset of A if, first B is a subset of A and, secondly if B is not equal to A. We denote B is a proper subset of A as B A⊂

- B A⊆ Means B is a subset of A, where B may be equal to A

- B A⊂ Means B is a proper subset of A, since B A≠

Example 23: Let A = {1, 2, 3}, B = {1, 2, 3, 4}, then A B⊂ . This can also be writtenas A B⊆

Example 24: Let A = {1, 2, 3}, B = {3, 2, 1}, then A B⊆ and B A⊆ . This cannot bewritten as A B⊂ as A B=

2.2.5 NULL SETS

u A set which contains no elements is called an empty set, or a null set. It is denotedby the symbol ∅.

Example 25: Let A be the set of people in the world who are older than 200 years. Asthere are no people in the known world older than 200 the set A is empty. A = ∅

Example 26: Let B = { }x x x| ,2 4= is odd . Then B = ∅

l Remark 3: The null set ∅ is considered to be a subset of every set.

2.2.6 DIS JOINT SETS

u Two sets A and B are said to be disjoint if they have nothing in common.

Example 27: Let A = {a, b}, and B = {1, 2}, then A and B are disjoint sets.

Example 28: Let X = {a, b, c, 1}, and Y = {1, 2, 3, 4, 5}, then X and Y are not disjoint as 1 ∈ X and 1 ∈ Y

2 - 4

CHAP TER 2: SET THEORY CS218

Page 34: C2004 Study Guide

2.2.7 SETS OF SETS

u At times sets can be the elements of another set. It is common practice to refer tothese “sets of sets” as “family of sets” or “class of sets”. Under these circumstances,and in order to avoid confusion, families or classes of sets are denoted with scriptletters A, B, C, . . .

Example 29: The set A = {{2, 3}, {2}, {5, 6}} is a family of sets. Its members are the sets{2, 3}, {2}, and {5, 6}

2.2.8 POWER SETS

u The power set of a set X, denoted by P(X), is the set of all subsets of X.

u If a set X is finite, say X has n elements, then the power set of X can be shown to have 2n elements.

Example 30: Let X = {0, 1}, then P(X) = {∅, {0}, {1}, {0, 1}}. Note: 2 4n = .Example 31: Let Y = {a, b, c}, then P(Y) = {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c},

{a, b, c}}. Note: 2 8n = .

2.3 OPERATIONS ON SETS

2.3.1 VENN DIA GRAMS

u A Venn diagram is a pictorial representation of sets by sets of points in the plane.The universal set U is represented by the interior of a rectangle, and the other setsare represented by disks lying within the rectangle.

u If A B⊂ , then the disk representing A will be entirely within the disk representing Bas in Fig 1.3.1.

u If A and B are disjoint, i.e. have no elements in common, then the disk representing Awill be separated from the disk representing B as in Figure 1.3.2.

u If A and B are two arbitrary sets, it is possible that some objects are in A but not B,some are in B but not A, some are in both A and B, and some are in neither A nor B;hence in general we represent A and B as in Fig 1.3.3.

2 - 5

CS218 CHAP TER 2: SET THEORY

Page 35: C2004 Study Guide

2.3.2 UN ION

u The union of sets A and B is the set of all elements which belong to A or to B or toboth.

- Union of A and B is denoted A B∪ . Which is read “ A union B”

- Union of A and B may also be defined by { }A B x x A x B∪ = ∈ ∈| or

Example 37: Let X = {a, b, c, d} and Y = {f, b, d, g}. Then X Y∪ = {a, b, c, d, f, g}

l Remark 4: From the definition of union it follows that A B∪ and B A∪ are the same set, i.e. A B∪ = B A∪ .

l Remark 5: Both A and B are always subsets of A B∪ , that is ( )A A B⊆ ∪ and ( )B A B⊆ ∪

A B∪ is shaded

2.3.3 IN TER SEC TION

u The intersection of sets A and B is the set of elements which are common to A and B, that is, those elements which belong to A and which also belong to B.

- Intersection of A and B is denoted A B∩ . Which is read “A intersection B”

- Intersection of A and B may also be defined by { }A B x x A x B∩ = ∈ ∈| , .

Example 38: Let X = {a, b, c, d}, and Y = {f, b, d, g}. Then X Y∩ = {b, d}

l Remark 6: From the definition of intersection of two sets it follows that A B B A∩ = ∩

l Remark 7: Each of the sets A and B contains A B∩ as a subset, i.e., ( ) ( )A B A A B B∩ ⊆ ∩ ⊆and

l Remark 8: If sets A and B have no elements in common, i.e., if A and B are disjoint, then the intersection of A and B is the null set, i.e. A B∩ = ∅

A B∩ is shaded

2 - 6

CHAP TER 2: SET THEORY CS218

Page 36: C2004 Study Guide

2.3.4 DIF FER ENCE

u The difference of sets A and B is the set of elements which belong to A but don’tbelong to B.

- Difference is denoted A B− , A B\ or A ~ B. Which are read “A minus B”.

- The difference of A and B may also be defined by { }A B x x A x B− = ∈ ∉| ,

Example 39: Let X = {a, b, c, d} and Y = {f, b, d, g}. Then X Y− = {a, c}

l Remark 9: Set A contains A B− as a subset, i.e., ( )A B A− ⊆

l Remark 10: The sets ( ) ( )A B A B B A− ∩ −, , and are mutually disjoint, that is, the intersection of any two sets is the empty set.

A B− is shaded

2.3.5 COM PLE MENT

u The complement of a set A is the set of elements which do not belong to A, that is,the difference of the universal set U and A

- The complement of A is denoted A’, A or A c

- The complement of A may also be defined as { }A x x U x Ac = ∈ ∉| , orsimply { }A x x Ac = ∉|

( )A B c∪ is shaded

Example 40: Let the universal set U be the lower case English alphabet and let X = {a, b}. Then X c = {c, d, e, f, g, . . . y, z}

l Remark 11: A B A B c\ = ∩ or A B A B c− = ∩

Let A = {1, 2, 4, 8, 16}, B = {2, 4, 6, 8, 10} and C = {1, 3, 7, 15}. Find the following sets:

Ex er cise 11: A B∪

Ex er cise 12: A B∩

Ex er cise 13: A C−

Exercise 14: ( )A B C∪ ∩

Exercise 15: ( ) ( )A B A C∩ ∪ ∩

Exercise 16: ( )C B A− −

2 - 7

CS218 CHAP TER 2: SET THEORY

Page 37: C2004 Study Guide

2.4 ATTRIBUTES OF SETS

2.4.1 EQUAL ITY OF SETS

u Set A is equal to set B if they both contain the same elements, i.e., if every element inA is in B and every element in B is also in A, then we write their equality as A = B.

u We can also say that A = B if and only if A B⊆ and B A⊆ .

Example 41: Let A = {1, 2, 3, 4} and B = {3, 1, 4, 2}, then A = B as the order of the elements in a set does not change the set.

Example 42: Let C = {4, 3, 4, 2}, D = {2, 3, 2, 4} and E = {2, 3, 4}, then C = D = E asrepeating the elements in a set does not change the set.

Example 43: Let { }F x x x= − = −| 2 3 2 , G = {2, 1}, and H = {1, 2, 2, 1}, then F = G = H.

2.4.2 COM PA RA BIL ITY

u Two sets A and B are said to be comparable if A ⊂ B or B A⊂ , that is if one of the setsis a subset of the other set.

u Two sets A and B are said to be incomparable if A B⊄ and B A⊄ .

- If A is not comparable to B then there is an element in A which is not inB and, also, there is an element in B which is not in A.

Example 44: Let A = {a, b}, and B = {a, b, c}. Then A is comparable to B, as A B⊆ .

Example 45: Let { }R a b= , , and { }S b c d= , , . Then R and S are not comparable since a R∈ and a S∉ , and c S∈ , and c R∉

2.4.3 CAR DI NAL ITY

u The number of elements in a set is called its cardinality. Cardinality is denoted byplacing vertical bars around the set.

Example 46: |{1, 3, 9, 15}| = 4

Example 47: |{1, 2, 3, . . .}| = ∞

2.4.4 THE PRIN CI PLE OF IN CLU SION AND EX CLU SION

u Let A and B be finite sets. Then A B A B A B∪ = + − ∩

2 - 8

CHAP TER 2: SET THE ORY CS218

Page 38: C2004 Study Guide

2.5 PROOFS

2.5.1 US ING VENN DIA GRAMS

u If three or fewer sets are involved in the given identity, we can draw a Venn diagramfor each side and verify that the sets in question are equal.

Exercise 17: Prove by Venn diagram that ( ) ( ) ( )A B C A B A C∪ ∩ = ∪ ∩ ∪

B C∩ ( )A B C∪ ∩

A B∪ A C∪

( ) ( )A A C∪ ∩ ∪B

Exercise 18: Prove by Venn diagram that ( ) ( )A B C A C B c− ∩ = ∩ ∩

A B− ( )A B C− ∩

A C∩ B c

( )A C B c∩ ∩

2 - 9

CS218 CHAP TER 2: SET THEORY

Page 39: C2004 Study Guide

u The following exercise illustrates how to prove a problem with a Venn diagram.

Exercise 19: Use Venn diagrams to prove the following:

All MA214 students are hardworking and analytical.Peter is not hardworking but analytical.

2 - 10

CHAP TER 2: SET THE ORY CS218

Page 40: C2004 Study Guide

2.5.2 PROOFS USING AL GE BRAIC LAWS

u In order to prove something using an algebraic law you must know some of theimportant laws that apply to sets. (They have been summarized in section 2.9.1). The procedure is to apply the law you are using, then if the law has a name to correctlyidentify the law you are using to the right of the application.

Example 49: Prove ( ) ( )A B A B Ac∪ ∩ ∪ = using algebraic laws.

Statement Reason

( ) ( )A B A B c∪ ∩ ∪ Left hand side

( )= ∪ ∩A B B c Distributive Law

= ∪ ∅A Complement Law

= A Identity Law

Exercise 20: Prove ( ) ( )A B A B Ac∩ ∪ ∩ = using algebraic laws.

Statement Reason

Exercise 21: Prove ( )A A B A∪ ∩ = using algebraic laws.

Statement Reason

2.6 SET THEORY TRUTH TABLES

u The truth tables for intersection, union, and complement are the same as those forand, or, and not.

A B A ∩ B A ∪ B A c

T T T T F

T F F T F

F T F T T

F F F F T

2 - 11

CS218 CHAP TER 2: SET THEORY

Page 41: C2004 Study Guide

2.7 THREE SET VENN DIAGRAMS

Exercise 22: Shade in the correct regions that corresponds to the given data.

a. ( )A B C∩ ∪

b. ( )A B C∩ −

c. ( )A B C c− −

2.8 VENN DIAGRAMS USING REGIONS

u In the diagram notice that it is broken up into four regions. The numbers are used toindicate an area not a numerical value. Each area can be described using the setoperations we learned before.

Area 1 ≡ −A B ≡ ∩A B c

Area 2 ≡ ∩A B

Area 3 ≡ −B A ≡ ∩B A c

Area 4 ( )≡ ∪A B c ≡ ∩A Bc c

Area 1, 2, 3 ≡ ∪A B

Find the following regions:

Exercise 23: Area 1

Exercise 24: Area 2

Exercise 25: Area 3

Exercise 26: Area 4

Exercise 27: Area 5

Exercise 28: Area 6

Exercise 29: Area 7

Exercise 30: Area 8

2 - 12

CHAP TER 2: SET THEORY CS218

Page 42: C2004 Study Guide

2.9 SUMMARY

2.9.1 LAWS OF THE AL GE BRA OF SETS

u Some important laws of sets.

Idempotent Laws

1a. A A A∪ = 1b. A A A∩ =

Associative Laws

2a. ( ) ( )A B C A B C∪ ∪ = ∪ ∪ 2b. ( ) ( )A B C A B C∩ ∩ = ∩ ∩

Commutative Laws

3a. A B B A∪ = ∪ 3b. A B B A∩ = ∩

Distributive Laws

4a. ( ) ( ) ( )A B C A B A C∪ ∩ = ∪ ∩ ∪ 4b. ( ) ( ) ( )A B C A B A C∩ ∪ = ∩ ∪ ∩

Identity Laws

5a. A A∪ ∅ = 5b. A U A∩ =

6a. A U U∪ = 6b. A ∩ ∅ = ∅

Involution Law

7. ( )A Ac c =

Complement Laws

8a. A A Uc∪ = 8b. A A c∩ = ∅

9a. U c = ∅ 9b. ∅ =c U

10a. ( )A B A Bc c c∪ = ∩ 10b. ( )A B A Bc c c∩ = ∪

Alternative Representation for Set Difference

11a. A B A B c\ = ∩ 11b. A B A Bc\ = ∩

Double Complement Law12. ( )A Ac c =

DeMorgan’s Laws

13a. ( )A B A Bc c c∪ = ∩ 13b. ( )A B A Bc c c∩ = ∪

14a. ( ) ( ) ( )X A B X A X B\ \ \∪ = ∩ 14b. ( ) ( ) ( )X A B X A X B\ \ \∩ = ∪

Subset Laws

15a. A B X A X B X∪ ⊆ ⊆ ⊆iff and 15b. X A B X A X B⊆ ∩ ⊆ ⊆iff and

16a. A A B⊆ ∪ and B A B⊆ ∪ 16a. A B A∩ ⊆ and A B B∩ ⊆

Absorbtion Laws

17a. A A B A∪ ∩ =( ) 17b. A A B A∩ ∪ =( )

2 - 13

CS218 CHAP TER 2: SET THEORY

Page 43: C2004 Study Guide

2.9.2 COM MON SYM BOLS AND THEIR MEAN INGS

Symbols Meanings

∈ Is an element of

∉ Is not an element of

A ⊂ B A is a proper subset of B

A ⊆ S A is a subset of S

A ⊄ B A is not a subset of B

S ⊇ A, S ⊃A Set S is a superset of the set A

∅ Empty set

∪ Union

∩ Intersection

A − B, A \ B, A ~ B A minus B

A’ , A c , A A complement

A = B A and B have exactly the same elements

A ≠ B A and B do not have exactly the same elements

A ≡ Β Equivalence; A is equivalent to B

↔, ⇔ If and only if or iff

→, ⇒ Implies

∀ For all, for every

∃ There exists

∋, |, : Such that

∞ Infinity

2.9.3 RE MARKS

l If A B⊄ then there is at least one element in A that is not a member of B.

l Every set is a subset of itself, since every element in a set is in itself.

l The null set ∅ is considered to be a subset of every set.

l A B∪ = B A∪

l ( )A A B⊆ ∪ and ( )B A B⊆ ∪ .

l A B B A∩ = ∩

l ( ) ( )A B A A B B∩ ⊆ ∩ ⊆and

l If A and B are disjoint, then A B∩ = ∅.

l ( )A B A− ⊆

l The sets ( ) ( )A B A B B A− ∩ −, , and are mutually disjoint.

l A B A B c\ = ∩ or A B A B c− = ∩

2 - 14

CHAP TER 2: SET THE ORY CS218

Page 44: C2004 Study Guide

2.10 SET THEORY EXERCISES

u Draw a Venn diagram and shade in the correct regions that corresponds to the givendata:

1. A B C− − 2. ( )A B c−

3. ( )A Bc c−

4. ( )A Bc c c−

5. A B Cc c c∩ ∩

6. A B Cc c c∪ ∪ 7. ( )A B Cc c∩ ∪ 8. A B C∩ ∩ 9. A B C∪ ∪ 10. ( )A B C c∩ ∪

11. A B Cc∩ ∩ 12. A B Cc ∩ ∩

13. A B Cc ∪ ∪ 14. A B Cc∪ ∪

15. A B Cc c∪ ∪

u Show by using Venn Diagrams or otherwise, whether the following identities hold:

16. ( )A B c∩ ≡ ∪A Bc c

17. A B− ≡ ∩A B c

18. A B Cc c c∩ ∩ ( )≡ ∪ ∪A B C c

19. ( )A B C c∪ ∩ ( ) ( )≡ ∪ ∩ ∪A B A C c

u Explain in words, what you understand by:

20. A A⊆

21. A A U∪ =

22. A U A∩ =

23. ∅ ⊆ A

u Suppose { }X x x y y N= = ∈| ,2

{ }P p p= | is a prime number

{ }E s s t t N= = ∈| ,2

Determine

24. P E∩

25. X E∪

26. X P∩

27. E c

2 - 15

CS218 CHAP TER 2: SET THEORY

A B

C

Page 45: C2004 Study Guide

u Verify the following using the concept of regions.

28. ( ) ( )A B C A B C∩ ∩ = ∩ ∩

29. ( ) ( )A B C A B C∪ ∪ = ∪ ∪

u Prove the following:

30. ( )A A B A B\ \ = ∩

31. ( )A A A B= ∩ ∪

32. ( )A B A Bc c c∩ = ∪

33. ( ) ( ) ( )A B C A B A C∪ ∩ = ∪ ∩ ∪

u Determine whether each of the following statements is true or false. Then explain.

34. x x∈ { }

35. { } { }x x⊆

36. { } { }x x∈

37. { } {{ }}x x∈

38. ∅ ⊆ { }x

u Suppose that A is the set { , }a b and that B is the set { }∅ . Write the following sets out infull, listing their elements where possible:

39. the power set P A( )

40. the power set P B( )

41. the Cartesian product A × ∅

42. the Cartesian product A B×

u Venn diagrams

43. Draw a Venn diagram and shade the required region for the following:

i) ( )A B Cc c∩ ∩

ii) B A Cc ∪ ∪( )

44. Show that A B C A B B C∩ ∪ ≠ ∩ ∪ ∩( ) ( ) ( ) by using Venn diagrams.

45. Show that ( )A B C A B Cc c c c∩ ∩ = ∪ ∪ by using Venn diagrams.

46. Show that the following argument is valid using Venn diagrams:

All bakers bake bread. All chefs bake cakes. All the chefs attended the meeting. David bakes cakes, but did not attend the meeting. Therefore, David is not a chef.

2 - 16

CHAP TER 2: SET THE ORY CS218

Page 46: C2004 Study Guide

47. Draw a Venn diagram to show that

i) the following argument to be true

ii) the following argument to be false

S1: All students at Informatics are dedicated and trustworthy

S2: Simon is trustworthy and dedicated

S3: Simon is a student

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

S: Simon is an Informatics student

u Algebraic Laws

48. Prove ( ) ( ) ( )B U A A Bc c c∩ ∩ ∪ ∅ = ∪ using algebraic laws.

2 - 17

CS218 CHAPTER 2: SET THEORY

Page 47: C2004 Study Guide

CHAPTER 3: RELATIONS AND FUNCTIONS

Chapter Objectives

In this chapter, you will learn:

§ how sets relate to relations;

§ what a relation is;

§ how to represent a relation;

§ about the properties of relations ;

§ about the various types of relations;

§ what a function is;

§ what makes something a function;

§ how to represent a function;

§ how to determine a function;

§ about the various types of functions;

§ about the different classes of functions;

§ what operations can be done on functions;

3 - 1

Page 48: C2004 Study Guide

3.1 INTRODUCTION TO RELATIONS

u Before we introduce what is meant by the term ‘relation’, we need to know thefollowing:

3.1.1 OR DERED PAIRS AND PROD UCT SETS

u An ordered pair consists of two elements, say a and b, in which one of them, say a isdesignated as the first element and the other as the second element.

u An ordered pair is denoted by (a, b)

u Two ordered pairs (a, b) and (c, d) are equal if and only if a = c and b = d.

Example 1: The ordered pairs (2, 3) and (3, 2) are different.

Example 2: The set {2, 3} is not an ordered pair since the elements 2 and 3 are not distinguished in a set.

Example 3: Ordered pairs can have the same first and second elements such as (1, 1), (4, 4)

u An ordered n-tuple is defined similarly, the n-tuple ( , , , )x x xn1 2 K having the firstterm x1, the second term x 2 K

u The set of all ordered pairs (a, b), where a ∈ A and b ∈Β , is called the CartesianProduct, or simply the product set, of the two sets.

- Cartesian Product is denoted by A B×

- A B a b a A b B× = ∈ ∈{( , ) | , }

Example 4: Let A = {1, 2, 3} and B = {a, b}. The product set is A B× = {(1, a), (1, b), (2, a), (2, b), (3, a), (3, b)}

Example 5: W = {x, y}. Then W W× = {(x, x), (x, y), (y, x), (y, y)}

l Theorem 1: Let A and B be sets. If A n= , and B m= , then A B nm× =

3.1.2 SOME SPE CIAL SETS

u ∅ denotes the “null” or “empty” set

u Z denotes the set of integers, i.e. { }Z = − − −... , , , , , , , ...3 2 1 0 1 2 3

u Q denotes the rational numbers. The rational numbers are those real numbers which can be expressed as the ratio of two integers. { }Q = = ∈ ∈x x

pq p Z q Z| ,where

u Q c denotes the irrational numbers, i.e. a number that is not rational is irrational.

u N denotes the natural numbers. N = {1, 2, 3, 4, 5, . . . }

u R denotes the real numbers. Real numbers are the rational and irrational numbers.

u For each { }n S nn∈ =N , ,... ,1

3 - 2

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 49: C2004 Study Guide

3.1.3 DEFI NI TION OF RE LA TION

u A binary relation between sets A and B is a subset of A B× . That is, a binary relationis a collection of ordered pairs from A B× .

u If A and B are equal, we refer to the relation as a relation on the set A.

u Since relation R is a subset of A B× , any relation R has a complementary relation R, which is the complement of the set R relative to A B× .

Example 6: Let { }A = 1 2 3, , and { }B a b= , . Define some relations between A and B.

R1 = ( ) ( ) ( ) ( ){ }1 2 3 1, , , , , , ,a b a b

R2 = ( ){ }3, b

R3 = A B×

R4 = ∅

Exercise 1: Let { }A = 1 2 3, , . Let R be the relation on A consisting of ordered pairs ( )a b, such that a b≥ . List the elements of R.

Exercise 2: If A = 4 and B = 3, how many relations between A and B are there?

u The domain of a relation R is the set of all first elements of the ordered pairs whichbelong to R, and the range of R is the set of second elements.

u A relation is also written a R b, which means “a is related to b”

Example 7: Let { }A = 1 2 3, , , and ( ) ( ) ( ){ }R = 1 2 1 3 3 2, , , , , . Then R is a relation on A since it is a subset of A A×

With respect to this relation: 1 2 1 3 3 2R R R, , , where the domain of R is {1, 3} and the range of R is {2, 3}

Example 8: Let A = {eggs, milk, corn} and B = {cows, goats, hens}. We can define a relation R from A to B by ( )a b R, ∈ if a is produced by b. In other words:

R = {(eggs, hens), (milk, cows), (milk, goats)}

With respect to this relation,

eggs R hens, milk R cows, milk R goats

Example 9: Suppose we say that two countries are adjacent if they have some part of their boundaries in common. Then “is adjacent to” is a relation R on the countries of the earth.

Thus:

(Malaysia, Indonesia) ∈ R, but (Indonesia, Thailand) ∉R

3 - 3

CS218 CHAP TER 3: RE LA TIONS AND FUNCTIONS

Page 50: C2004 Study Guide

3.2 REPRESENTING RELATIONS

u Relations can be represented by listing the elements, as in examples 7-9, or they canbe represented graphically, by using pictures, or by using a matrix.

3.2.1 PIC TO RIAL REP RE SENTATION OF RE LA TIONS

Example 10: Let R be a relation from { }A = 1 2 3, , to { }B a b= , where ( ) ( ) ( ){ }R a b a= 1 1 3, , , , , . The relation can be represented as follows:

Exercise 3: Represent example 8 pictorially:

3.2.2 GRAPHI CAL REP RE SEN TA TION OF RE LA TIONS

u Another way of picturing a relation when it is from a finite set to itself is to writedown the elements of the set and then draw an arrow from an element x to an element y whenever x is related to y. This type of diagram is called a directed graph of therelation. (We will be discussing directed graphs in greater detail in chapter 7).

Example 11: The directed graph of ( ) ( ) ( ) ( ) ( ) ( ) ( ){ }R = 1 2 2 2 2 4 3 2 3 4 4 1 4 3, , , , , , , , , , , , , on the set { }A = 1 2 3 4, , , is:

Note: There is an arrow from 2 to itself, since 2 is related to 2 under R.

u We will use the following graphical representation; see example 12, to represent a relation.

Example 12: Let A = {1, 2, 3}, and let R be the relation on A defined as ( ) ( ) ( ) ( ) ( ){ }R = 1 2 2 1 2 3 3 1 3 3, , , , , , , , , . Graphically:

3 - 4

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 51: C2004 Study Guide

Exercise 4: Draw the graphical representations of the relations R1, R2, R3, and R4 from example 6.

Exercise 5: List the ordered pairs belonging to the relation shown below:

Exercise 6: Draw the directed graph representation of the relation “less than or equal to” on the set S3.

Exercise 7: Draw the directed graph representation for the relation R such that, ( ) ( ) ( ) ( ) ( ){ }R = 1 2 2 1 2 3 3 1 3 3, , , , , , , , ,

3 - 5

CS218 CHAP TER 3: RE LA TIONS AND FUNCTIONS

Page 52: C2004 Study Guide

3.2.3 MA TRIX REP RE SEN TA TION OF A RE LA TION

u The more commonly used representation of relations that is also more convenient for computations is using a matrix to represent a relation.

u Let A be a set with n elements, and let B be a set with m elements.

{ }{ }

A a a a

B b b b

n

m

=

=

1 2

1 2

, ,... ,

, ,... ,

u Let R be a relation between A and B. Define the n m× matrix M by

( )M i jfalse a b R

true a b R

i j

i j

,( , )

( , )=

if

if

for i = 1, . . ., n and j = 1, . . ., m. M is called the logical matrix for R.

Exercise 8: Write the matrix that represents ( ) ( ) ( ) ( ){ }R = 3 3 2 3 1 2 3 2, , , , , , ,

Example 13: Let A be the set S 3, and let B be the set S 2. Let R be the relation between A and B. ( ) ( ) ( ) ( ){ }R = 1 1 1 2 2 1 3 2, , , , , , , . Write the matrix representing R.

Since A = 3 and B = 2, the matrix representing R must have three rows and two columns. In row 2, column 2, for instance, the entry will be

false since (2, 2) is not an element of R, i.e. M =

T T

T F

F T

Example 14: Describe the relations corresponding to the two matrices given below.

M M1 2=

=

T F T T

F T F T

T F F T

F T F

T F T

T T T

For matrix M1, there are three rows and four columns, so M1 is a relation R1 between S 3 and S 4 . The graph of R1 is represented in (a). Matrix M 2, which has three rows and three columns then is a relation R2 on the set S 3. The graph of M 2 is represented in (b)

3 - 6

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 53: C2004 Study Guide

3.3 PROPERTIES OF RELATIONS

u Relations on a set can be classified according to certain properties. Let R be a relationon a set A.

- We say that R is reflexive if ∀ ∈x A x R x

- We say that R is symmetric if ∀ ∈ ⇒x y A x R y y R x, ,

- We say that R is transitive if ∀ ∈ ⇒x y z A x R y y R z x R z, , , and

3.3.1 RE FLEX IVE

u Let R be a subset of A A× . Then R is called a reflexive relation if, ( )∀ ∈ ∈a A a a R, ,

Example 15: The directed graph of every reflexive relation includes an arrow from every point to the point itself, i.e.

Example 16: Let { }V = 1 2 3 4, , , and ( ) ( ) ( ) ( ) ( ){ }R = 1 1 2 4 3 3 4 1 4 4, , , , , , , , , . Then R is not a reflexive relation since ( )2 2, does not belong to R

l Remark 1: All ordered pairs ( )a a, must belong to R in order for R to be reflexive.

3.3.2 SYM MET RIC

u Let R be a subset of A A× , then R is called a symmetric relation if ( ) ( )a b R b a R, ,∈ ⇒ ∈

Example 17: The reason for the name of the symmetric property can be seen in the matrices below. Notice that each of the matrix representations for the symmetric relations are symmetric with respect to the main diagonal.

a b c d

a

b

c

d

F F F F

F F T F

F T F F

F F F F

a b c d

a

b

c

d

F T F T

T F T F

F T F F

T F F F

a b c d

a

b

c

d

F F F F

F F F F

F F F F

F F F F

u Directed graph representations of symmetric relations are also readily recognizedbecause for every arrow from a to b there must also be an arrow from b to a.

Example 18: Let { }S = 1 2 3 4, , , , and let ( ) ( ) ( ) ( ) ( ){ }R = 1 3 4 2 2 4 2 3 3 1, , , , , , , , , . Then R is not a symmetric relation since ( )2 3, ∈ R but ( )3 2, ∉ R

3 - 7

CS218 CHAP TER 3: RE LA TIONS AND FUNCTIONS

Page 54: C2004 Study Guide

3.3.3 TRAN SI TIVE

u A relation R in a set A is called a transitive relation i f ( ) ( ) ( )a b R b c R a c R, , ,∈ ∈ ⇒ ∈and

Example 19: The directed graphs below illustrate transitive relations. Note that it is not easy to determine if a relation is transitive from either the matrix or the graph representation.

Example 20: Let { }W a b c= , , , and let ( ) ( ) ( ) ( ){ }R a b c b b a a c= , , , , , , , . Then R is not a transitive relation since ( ) ( ) ( )c b R b a R c a R, , ,∈ ∈ ∉and but

Example 21: Determine if each of the following relations is reflexive, symmetric, or transitive.

1. “Less than” (<), on Z

2. The relation ( ) ( ) ( ){ }R = 1 1 2 3 3 1, , , , , , on the set S 3

3. The relation ( ) ( ){ }R a b c d= , , , , on { }a b c d, , ,

4. The empty relation ∅, on S 3

1. Let R be the “less than” relation on the set Z. Then R is transitive, but not reflexive or symmetric.

2. Since ( )2 2, ,∉ R R is not reflexive. Since ( )2 3, ∈ R, but ( )3 2, ,∉ R R is not symmetric. Finally, ( )2 3, ∈ R and ( )3 1, ,∈ R but ( )2 1, ∉ R, so R is not transitive. Hence R has none of the three properties.

3. Clearly R is neither reflexive nor symmetric. R is transitive, however, since there are no { }x y z a b c d, , , , ,∈ such that x R y and y R z. Thus the condition for transitivity is vacuously satisfied.

4. Let ∅ be the empty relation on the set S 3. First let’s look at symmetry. Symmetry can be restated as the following implication:

If ( ) ( )x y y x, , ,∈ ∅ ∈ ∅then

Since ( )x y, ∈ ∅ is never true, the implication is vacuously true. By similar reasoning, the empty relation is also transitive. However, the empty relation is not reflexive, because the condition for reflexivity is the implication:

If ( )x S x x∈ ∈ ∅3 , ,then

and, for instance, 1 3∈ S , but ( )1 1, ∉ ∅

3 - 8

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 55: C2004 Study Guide

3.3.4 IR RE FLEX IVE

u We say that a relation R on a set S is irreflexive if x R x for all x S∈

u Do not confuse the irreflexive property with the absence of the reflexive property.There are relations that are neither reflexive nor irreflexive.

Example 22: Show that the relation on the set { }a b c, , given by the set of ordered pairs ( ) ( ) ( ){ }a b b c c a, , , , , is irreflexive.

The relation on the set { }a b c, , given by the set of ordered pairs

( ) ( ) ( ){ }a b b c c a, , , , , is irreflexive, because it does not contain any of the

ordered pairs ( ) ( ) ( )a a b b c c, , , , ,

3.3.5 AN TI SYM MET RIC

u We say that R is antisymmetric if for all x, y S x R y y R x∈ , and implies x = y

u Do not confuse the antisymmetric property with the absence of the symmetricproperty either. There are also relations that are neither symmetric norantisymmetric.

Example 23: Show that the relation “greater than or equal to” on Z is antisymmetric.

The relation “greater than or equal to” on the set of integers is antisymmetric, because if x y, ,∈ Z then ( ) ( )x y y x x y≥ ≥ ⇒ =and

3.4 TYPES OF RELATIONS

3.4.1 EQUIVA LENCE RE LA TIONS

u A relation ~ on a set S is called an equivalence relation if it has the following threeproperties:

(1) For each a in S, we have a ~ a - Reflexive property

(2) If a ~ b, then b ~ a - Symmetric property

(3) If a ~ b and b ~ c, then a ~ c - Transitive property

u A relation is an equivalence relation if it is reflexive, symmetric, and transitive.

u The general idea behind an equivalence relation is that it is a classification of objectswhich are in some way “alike”

Example 24: The relation = of equality on any set S is an equivalence relation; that is:

(1) a = a for every a in S; - Reflexive property

(2) if a = b, then b = a; - Symmetric property

(3) if a = b and b = c, then a = c. -Transitive property

3 - 9

CS218 CHAP TER 3: RE LA TIONS AND FUNCTIONS

Page 56: C2004 Study Guide

3.4.2 PAR TIALLY OR DERED RE LA TIONS

u A relation on a set A which is reflexive, antisymmetric, and transitive is called apartial ordering on the set. The reason for the word partial is that not every pair ofelements of A must be related, as in the figure.

We have C A⊆ , but B C⊄ and C B⊄ . In such cases, B and C are said to be incomparable.

Example 25: If a and b are positive integers, a|b means that a is a divisor of b, i.e. b = ac for some integer c. Show that “|” is a partial ordering of

the set of positive integers.

By definition, the a|b means that the number b / a is an integer. We need to verify reflexivity, antisymmetry, and transitivity.

1. Reflexivity: For all positive integers n, n| n as n / n is 1

2. Antisymmetry: If n|m and m|n, then m / n and n / m are both integers. Since ( )n m m n/ /= −1, the integer n / m

has the property that its reciprocal is also an integer. The only such positive integer is 1, and so n / m = 1, i.e. n = m.

3. Transitivity: If n|m and m|p, then ( ) ( )p n p m m n/ / /= × is an integer, since it is the product of two other integers.

It follows that “|” is a partial ordering.

3.4.3 UNI VER SAL RE LA TIONS

u Let A be any set then A A× is known as the universal relation.

3.4.4 EMPTY RE LA TIONS

u Let A be any set, then ∅ is know as the empty relation.

3.4.5 IN VERSE RE LA TIONS

u Every relation R between sets A and B is a subset of A B× . We can reverse the roles ofA and B to obtain a relation between B and A called the inverse relation of R. Theinverse relation of R, denoted R −1, is the relation between B and A given by

( ) ( ){ }R y x x y R− = ∈1 , : ,

3 - 10

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 57: C2004 Study Guide

Exercise 9: Find the inverse of the relation given below:

Exercise 10: Given ( ) ( ) ( ) ( ) ( ){ }R b a b a c= 3 2 5 1 4, , , , , , , , , . Find R −1

3.4.6 COM POS ITE RE LA TIONS

u Let’s look now at how to create new relations from existing ones. Let R be a relationbetween sets A and B, and let S be a relation between B and C. The composition of Rand S is the relation between A and C, denoted S Ro , given by:

( ){ }S R x z x A z C y B x R y y S zo = ∈ ∈ ∃ ∈ ∋, : , , and

Example 26: Graphically represent a composite relation.

where ( )( )S R x S R x S y zo = = =( ( ) ( ) , and

( )( )S R x S R x S u wo = = =( ( )) ( )

u One can view the composite relation as a means of linking elements of A to elementsof C by using elements of B as intermediate points.

3 - 11

CS218 CHAP TER 3: RE LA TIONS AND FUNCTIONS

Page 58: C2004 Study Guide

Exercise 11: Let R be the relation between S 3 and S 4 , and let S be the relation between S 4 and S 2, (see figure below). Find the composite relation S Ro between S 3 and S 2.

3.5 INTRODUCTION TO FUNCTIONS

u A function is an association of exactly one object from one set (the range) with eachobject from another set (the domain).

u This means that there must be at least one arrow leaving each point in the domain,and futher that there can be no more than one arrow leaving each point in thedomain.

Exercise 12: Which of the relations below are functions?

3 - 12

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 59: C2004 Study Guide

3.5.1 ELE MENTS OF A FUNC TION

u We usually denote relations with capital letters. With functions the convention is touse lowercase letters.

u Let f be a function from A to B. Because each element x of A appears in one and onlyone pair ( )x y f, ∈ , it is possible to write ( )y f x= whenever x A∈ . This notationsuggests mapping the element x to the element y. Functions are often referred to asmappings or transformations.

u The unique element ( )y f x= of B assigned to x A∈ by f is called the image of x under f

u We write f A B: → to indicate that f is a function from A to B

u The set A is called the domain of f

u The set B is called the codomain of f

u The range of f denoted by [ ]f A , is the set of all images; that is,

[ ] ( ){ }f A f x x A= ∈:

u The pre-image or inverse image of a set B contained in the range of f is denoted by ( )f B−1 and is the subset of the domain whose members have images in B. In

particular, the inverse image of a point in y in the range is the set of all x for which f x y( ) =

Example 27: Determine whether each of the following relations is a function. For those that are functions, give the domain and range of the

function.

1. ( ) ( ) ( ) ( ){ }1 1 2 3, , , , , , ,a b c b

2. ( ) ( ) ( ){ }a a b b c c, , , , ,

3. ( ){ }x y x y y x, : , are real numbers and − = 1

4. ( ){ }x y x y y x, : , are positive integers and − = 1

1. This is not a function because (1, a) and (1, b) are both in the relation.

2. This is a function, with domain, codomain, and range equal to {a, b, c}

3. Since y x− = 1 iff y x= +1, it is easy to see that this is a function with domain and codomain equal to the set of real numbers. Also, for each real number y, there is a real number x such that y x= +1. Therefore, the range of the function is the set of real numbers.

4. This is a function. The domain and codomain are both the set of positive integers. However, if y is a positive integer, there is a positive integer x

such that y x= +1 iff y ≥ 2. Hence the range is { }2 3, , . . .

u Notice that the function in (4) is not equal to the function in (3), even though theyboth have the form y x= +1

3 - 13

CS218 CHAP TER 3: RE LA TIONS AND FUNCTIONS

Page 60: C2004 Study Guide

3.6 GRAPHING FUNCTIONS

3.6.1 CO OR DI NATE GRAPHS

u The set of all ordered pairs of the function f plotted in a Cartesian coordinate systemis called the graph of f.

u The graph of a function f is equivalent to the graph of the equation ( )y f x= asdescribed in elementary algebra.

Example 28: Draw the graph of ( )f x x= 2

u Not all equations in x and y determine functions.

l Remark 2: For a graph to be the graph of a function, any given vertical line can intersect the graph in a most one point.

Example 29: Draw the graph of the relation y x2 =

Exercise 13: Explain why the graph of y x2 = is not a function.

Exercise 14: Which of the following graphs are graphs of functions?

3 - 14

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 61: C2004 Study Guide

3.7 TYPES OF FUNCTIONS

3.7.1 IN JEC TIONS

u Let f A B: → be a function. The function f is called an injective function, or aninjection, if ( ) ( )∀ ∈ =x y A f x f y, , implies x y= . Graphically this means that if twoarrows arrive at the same point in B, they must come from the same point in A, andtherefore they are the same.

u An injective function is also called a one-to-one function, or 1 1− function.

Example 30: Graphically represent an injective function.

one-to-one function

3.7.2 SUR JEC TIONS

u The function f is called a surjective function, or a surjection, if for each ( )y B x A f x y∈ ∃ ∈ =∋ . Graphically this means there must be an arrow arriving at

each point of B.

u A surjective function is also called an onto function.

Example 31: Graphically represent a surjective function.

onto function

3.7.3 BIJEC TIONS

u A function can also be neither 1 1− nor onto, or it can be both 1 1− and onto. If a functionis both 1 1− and onto it is called a bijection or bijective function.

u A bijection from a set A to itself is called a permutation of the set A.

Example 32: Graphically represent a bijective function.

or

3 - 15

CS218 CHAP TER 3: RE LA TIONS AND FUNCTIONS

Page 62: C2004 Study Guide

Example 33: Graphically represent a function that is neither 1 1− nor onto.

or

l Remark 3: A graph of a function f is 1 1− iff every horizontal line intersects the graph in at most one point.

l Remark 4: A graph of a function f is onto iff every horizontal line intersects the graph in at least one point.

l Remark 5: The codomain and the range are equivalent iff the function is onto.

3.8 CLASSES OF FUNCTIONS

3.8.1 LIM ITS

u The limit of a function f as x approaches infinity for large values of x is a veryimportant concept.

u The function f(x) approaches the limit L as x approaches +∞, written ( )lim

xf x L

→+∞= , if the values of ( )f x get arbitrarily close to L as x gets arbitrarily large.

l Remark 6: If nc

xx n>

=

→+∞0 0, lim for any constant c

l Remark 7: To find the limit of a function as x approaches ∞, first divide the numerator and denominator by the highest power of x appearing in either place and then let x approach ∞

Exercise 15: By remark 10, limx

x→+∞

=1 0. Show that limx

x

x→+∞

−−

=2 1

12

Example 34: Find the following limit: limx

x x

x x→+∞

+ −+ +

3

2

3 1

7 3

Dividing the numerator and denominator by x 3, we have

( ) ( )( ) ( ) ( )

lim limx x

x x

x x x

x x

x x→+∞ →+∞

+ −+ +

=+ −

+ +=

3

2

3 1

1 1 3

3 1

7 3

1

7

2 3

2 3

1 0 0

0 0 0

1

0

+ ++ +

=

We cannot divide by zero; the numerator in the limit approaches 1, the denominator approaches 0 and is always positive. If we divide 1 by smaller and smaller numbers, the quotients will become larger and larger. Thus, we write:

limx

x x

x x→+∞

+ −+ +

= +∞3

2

3 1

7 3

3 - 16

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 63: C2004 Study Guide

l Remark 8: When the limit of a function is 1

0, we say that ( )lim

xf x

→+∞= +∞.

l Remark 9: Another way to view limits as x approaches +∞ or −∞ is to use only the highest degree terms in the numerator and denominator.

Exercise 16: Find the limx

x x

x x→−∞

+− +

5 3

9 4 2

3

4 3

3.8.2 BI NARY OP ERA TIONS

u Another important class of functions is the class of functions known as binaryfunctions.

u A binary operation on a set A is a function op A A A: × → . Thus a binary operationtakes two elements of A and maps them to a third element of A.

u Rather than write ( )op a b, for the value of the operation, it is more common to write a op b a b A, , ∈ .

- ( )op a b, is called prefix notation.

- a op b a b A, , ∈ is called infix notation.

Example 35: Here are some examples of binary operations:

- The set operations union ∪, and relative complement −

- The composition operation o on the set { }F f f A AA = →: is a function from , A a set.

- The logical connectives and and or on a set of propositions.

3.9 OPERATIONS ON FUNCTIONS

3.9.1 EQUAL FUNC TIONS

u Two functions are said to be equal if they have the same domain and codomain, andfor all x in the domain ( ) ( )f x g x=

Example 36: Let ( ) ( )f x x= −6 4 2 and ( )g x x= −3 2, then f g= , since they both have the same domain and codomain, and for all x in the domain ( ) ( )f x g x=

3 - 17

CS218 CHAP TER 3: RE LA TIONS AND FUNCTIONS

Page 64: C2004 Study Guide

3.9.2 SUM OF FUNC TIONS

u The sum of f and g, f g+ , is defined by ( )( ) ( ) ( )f g x f x g x+ = +

Example 37: Find the sum of ( )f x x= +3 5 and ( )g x x= −4 3

( ) ( )( ) ( ) ( )s x f g x x x x= + = + + − = +3 5 4 3 7 2

3.9.3 DIF FER ENCE OF FUNC TIONS

u The difference of f and g, f g− , is defined by ( )( ) ( ) ( )f g x f x g x− = −

Example 38: Find the difference of ( )f x x= +3 5 and ( )g x x= −4 3

( ) ( )( ) ( ) ( ) ( ) ( )d x f g x f x g x x x x= − = − = + − − = − +3 5 4 3 8

3.9.4 PROD UCT OF FUNC TIONS

u The product of f and g, fg, is defined by ( )( ) ( ) ( )fg x f x g x= ⋅

Example 39: Find the product of ( )f x x= +3 5 and ( )g x x= −4 3

( ) ( )( ) ( ) ( ) ( )( )p x fg x f x g x x x x x= = = + − = + −3 5 4 3 12 11 152

3.9.5 QUO TIENT OF FUNC TIONS

u The quotient of f and g, f g, is defined by ( )( )( )

( )f g xf x

g x=

Example 40: Find the quotient of ( )f x x= +3 5 and ( )g x x= −4 3

( ) ( )( ) ( ) ( ) ( ) ( )q x f g x f x g x x x= = = + −3 5 4 3

3.9.6 COM POS ITE FUNC TIONS

u As functions are subsets of relations, the composition of a function is the same as forrelations.

Example 41: Let ( )f x x= +3 5 and ( )g x x= −4 3. Find

a. ( )( )f g xo b. ( )( )g f xo c. ( )( )f f xo d. ( )( )g g xo

a. ( )( ) ( )( ) ( ) ( )f g x f g x f x x x xo = = − = − + = − + = −4 3 3 4 3 5 12 9 5 12 4

b. ( )( ) ( )( ) ( ) ( )g f x g f x g x x x xo = = + = + − = + − = +3 5 4 3 5 3 12 20 3 12 17

c. ( )( ) ( )( ) ( ) ( )f f x f f x f x x x xo = = + = + + = + + = +3 5 3 3 5 5 9 15 9 9 24

d. ( )( ) ( )( ) ( ) ( )g g x g g x g x x x xo = = − = − − = − − = −4 3 4 4 3 3 16 12 3 16 15

3 - 18

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 65: C2004 Study Guide

3.9.7 IN VERTABLE FUNC TIONS

u Any function f has an inverse relation, f −1. The inverse relation does not need to be afunction. If the inverse relation of a function is a function, we say that the function isinvertible.

l Theorem 2: Let f A B: → be a function. The function f is invertible iff f is a bijection.

Example 42: Determine if each of the functions below are invertible.

a. The function is not onto so it is not invertible.

b. The function is an injection and a surjection, i.e. bijective so the inverse relation is a function, i.e. invertible.

l Remark 10: To find the inverse of a function ( )y f x= :

1. Solve the equation ( )y f x= for x in term of y.

2. In the resulting equation, replace x by y and y by x.

3. f −1 equals the right side of the equation found in step 2.

Example 43: Find the inverse of ( )f x x= −4 1

First we solve y x= −4 1 for x in terms of y:

y x+ =1 4 or 4 1x y= + or xy

=+1

4

Now replace x by y and y by x, obtaining ( )y x= +1 4

Therefore, ( ) ( )f x x− = +1 1 4

Example 44: Verify that ( )f xx− =

+1 1

4 is the inverse function of ( )f x x= −4 1

To verify this we need to show that ( )( )f f x xo − =1 and that ( )( )f f x x− =1 o :

( )( ) ( )( ) ( )f f x f f x fx x

x xo − −= =+

= ⋅

+− = + − =1 1 1

44

1

41 1 1 and

( )( ) ( )( ) ( )( )

f f x f f x f xx x

x− − −= = = =− +

= =1 1 1 4 14 1 1

4

4

4o

So since ( )( ) ( )( )f f x f f x xo o− −= =1 1 , ( ) ( )f x x− = +1 1 4 is the inverse of

( )f x x= −4 1

3 - 19

CS218 CHAP TER 3: RE LA TIONS AND FUNCTIONS

Page 66: C2004 Study Guide

3.10 SUMMARY

3.10.1 THEO REMS

l Let A and B be sets. If A n= , and B m= , then A B nm× = .

l Let f A B: → be a function. The function f is invertible iff f is a bijection.

3.10.2 RE MARKS

l All ordered pairs ( )a a, must belong to R in order for R to be reflexive.

l For a graph to be the graph of a function, any given vertical line can intersect thegraph in a most one point.

l A graph of a function f is 1 1− iff any horizontal line intersects the graph in at most one point.

l A graph of a function f is onto iff every horizontal line intersects the graph in atleast one point.

l The codomain and the range are equivalent iff the function is onto.

l If nc

xxn>

=

→+∞0 0, lim for any constant c

l To find the limit of a function as x approaches ∞, first divide the numerator anddenominator by the highest power of x appearing in either place and then to let xapproach ∞.

l When the limit of a function is 1

0, we say that ( )lim

xf x

→+∞= +∞

l Another way to view limits as x approaches +∞ or −∞ is to use only the highestdegree terms in the numerator and denominator.

l To find the inverse of a function ( )y f x= :

1) Solve the equation ( )y f x= for x in terms of y

2) In the resulting equation, replace x by y and y by x

3) f −1 equals the right side of the equation found in step 2

3 - 20

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 67: C2004 Study Guide

3.11 RELATIONS AND FUNCTIONS EXERCISES

u Let { }A = 1 2 3 4, , , , and let R be the relation on A given by ( ) ( ) ( ){ }R = 1 2 1 3 2 4, , , , , . Show the following representation of R.

1. The graph representation

2. The directed graph representation

3. The matrix representation

u Let { }A = 1 2 3 4 5 6, , , , , , and let R be the relation on A given by ( ){ }R x y x y x= <, : or is prime

4. Give the matrix representation of R.

u Using this diagram:

5. Write the relation as a set of ordered pairs.

u Let { }A = 1 3 5 9, , , , and let { }B u v w= , , . Represent the following relations in graphicalform.

6. ( ) ( ) ( ) ( ) ( ){ }R v w u v u1 1 1 5 9 9= , , , , , , , , ,

7. ( ) ( ) ( ) ( ){ }R v v v v2 1 3 5 9= , , , , , , ,

8. ( ) ( ) ( ){ }R u v w3 5 5 5= , , , , ,

u Let Q be the relation on S 4 given by uQ v if u v≠ . Represent Q in each of the followingways:

9. as a set of order pairs

10. in graphical form

11. in matrix form

u Let A and B be sets such that A m= and B n=

12. How many relations between A and B are there?

u Given { } { }A B x y z= =1 2, , , , and { }C = 3 4,

13. Find A B C× ×

u Given ( ) ( )2 6 2x x y, ,+ =

14. Find x and y.

3 - 21

CS218 CHAP TER 3: RE LA TIONS AND FUNCTIONS

Page 68: C2004 Study Guide

u Let R and S be the fol lowing relations on { }A = 1 2 3, , : ( ) ( ) ( ) ( ) ( ){ }R = 1 1 1 2 2 3 3 1 3 3, , , , , , , , , ( ) ( ) ( ) ( ){ }S = 1 2 1 3 2 1 3 3, , , , , , ,

15. Find R S R S∩ ∪, and R c

u For each of the following relations:

16. give the corresponding set of ordered pairs and the matrix representation.

u For each of the following relation matrices, list the set of ordered pairs that belong tothe relation and draw the graph form of the relation.

17. [ ]1 2 3 4

1 T F F T18.

1 2

1

2

F T

F T

19.

1 2 3

1

2

3

T F T

T F F

F T T

u Given { }A = 1 2 3 4, , , and { }B x y z= , , . Consider the following relation from A to B: ( ) ( ) ( ) ( ) ( ){ }R y z y x z= 1 1 3 4 4, , , , , , , , ,

20. Plot R on a coordinate diagram of A B×

21. Determine the matrix of the relation.

22. Draw the arrow diagram of R

23. Find the inverse relation R −1 of R

24. Determine the domain and range of R

u Consider the set { }A a b c= , , and the relations on A represented by the directedgraphs below:

25. Determine which are reflexive, irreflexive, symmetric, antisymmetric, and transitive.

3 - 22

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 69: C2004 Study Guide

u Consider the fo l lowing f ive re lat ions on the set { }A = 1 2 3, , :

( ) ( ) ( ) ( ){ }R = 1 1 1 2 1 3 3 3, , , , , , , ( ) ( ) ( ) ( ) ( ){ }S = 1 1 1 2 2 1 2 2 3 3, , , , , , , , , ,

( ) ( ) ( ) ( ){ }T = 1 1 1 2 2 2 2 3, , , , , , , , ∅ = empty relation, A A× = universal relation.

Determine whether or not each of the above relations on A is:

26. reflexive

27. symmetric

28. transitive

29. an equivalence relation

u Given the relation ( ) ( ) ( ) ( ) ( ){ }R a a b b c c a b b a= , , , , , , , , , on { }A a b c= , ,

30. Show that R is an equivalence relation.

u Graph the partial ordering of:

31. “is a subset of” on the power set ( )P A , where { }A a b= ,

u The relations R, S, T and U are defined upon integers by the following equivalence’s:a R b a b↔ ≥ a S b a b↔ < aT b a R b a S b↔ ∧ aU b a R b a S b↔ ∨

32. which of these relations are reflexive relations?

33. which of these relations are symmetric relations?

34. which of these relations are transitive relations?

u Let R be the relation on the set of positive integers, defined by a R b a biff × is odd.Prove the following properties hold or give a counter-example.

35. reflexivity

36. symmetry

37. transitivity

u Let R be the relation on the set of positive integers defined by a R b iff a b+ =2 10. Give acounterexample to prove that:

38. R is not reflexive

39. R is not symmetric

40. R is not transitive

u Let R be the fo l lowing re lat ion between S 3 and S 5: ( ) ( ) ( ) ( ) ( ) ( ) ( ){ }R = 1 1 1 3 2 3 2 4 3 1 3 4 3 5, , , , , , , , , , , , ,

41. Find R −1, the inverse of R

3 - 23

CS218 CHAP TER 3: RE LA TIONS AND FUNCTIONS

Page 70: C2004 Study Guide

u Let M1 =

F T

T F

F T

, let M 2 =

T F F

T T T

42. Compute M M1 2⋅

43. Compute M M2 1⋅

u Let R and S be the fo l lowing re lat ions on { }A = 1 2 3 4, , , : ( ) ( ) ( ) ( ) ( ){ }R = 1 1 1 3 3 2 3 4 4 2, , , , , , , , , ( ) ( ) ( ) ( ){ }S = 2 1 3 3 3 4 4 1, , , , , , , . Find each of the

following composite relations on A.

44. R So

45. S Ro

46. R Ro

47. S So

u Use the following diagrams.

48. State whether each diagram defines a function from { }a b c, , to { }x y z, ,

u Determine if each of the following functions is injective, surjective, or bijective.

49. ( )f f x x:R R→ = 2

50. ( )f f x x:Z Z→ =+

51. ( ) ( )f f x x x: ,Z Z Z+ + +→ × = +1

u Determine the number of different functions for:

52. a function from { }1 2, to { }a b c, ,

u Determine graphically whether the following functions are 1 1− or onto or bijective.Consider the domain and codomain for the functions to be the real numbers.

53. ( )f x x=

54. ( )g x x= +3 1

55. ( )h x x= −3 1

u Find the inverse of:

56. ( )f x x= −4 1

57. ( )g x x= +3 1

3 - 24

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 71: C2004 Study Guide

u The functions f and g are both injective and surjective functions upon integers. Thefunctions h and i are defined by the following equalities: h f g= o , i g f= − −( ) ( )1 1o

58. which of h and i must be injective functions?

59. what is the relationship between h and i −1?

u Let { }X = 0 1 2, , and { }Y = 0 1 4, , . Let the function f X Y: → be defined by f x x: → 2

60. Is f 1 1− , onto or bijective? Use an arrow diagram to illustrate your answer.

61. Is the inverse relation f Y X− →1 : a function? Why?

u Two real-valued functions are defined by ( )f y y= −4 1 and ( )g z z= 3

62. What is ( )( )g f xo ?

u Show the following functions f and g are inverses of each other.

63. ( )f x x= +1 ( )g x x= −1

64. ( )f x x= 1 ( )g x x= 1 given that x ≠ 0

65. ( ) ( ) ( )f x x x= + −1 1 ( ) ( ) ( )g x x x= + −1 1 given that x ≠ 1

u Find the following limits:

66. limx

x

x→+∞

−+

6 3

2 8

2

67. limx

xx

x→+∞−

+

2

1

68. limx

x

x→+∞

++

5 1

2 3

3

3

u A relation maps elements from set A to set B. A has m elements, and B has n elements. How many one-to-one functions are there if:

69. m n= ?

70. m n> ?

71. m n< ?

u The following functions are defined on the integers. State whether they areone-to-one, onto, or bijective functions, and explain your reasons in each case.

72. f x x( ) = 2

73. g x x x( ) = −3

u Find a formula for the inverse of each of the following:

74. g x x( ) = −2 1

75. h xx

x( ) =

−−

2 3

5 7, where x ≠ 7

5

3 - 25

CS218 CHAP TER 3: RE LA TIONS AND FUNCTIONS

Page 72: C2004 Study Guide

u Relations and functions can both be seen as sets of pairs. The presence of the pair ( , )x y in the relation (or function) indicates that x is related to y (or that x maps to yunder the function).

76. Explain the difference between a function and a relation

77. Explain what is meant by the inverse of a relation

78. Explain what is meant by the composition of two functions

u Suppose that A is the set { , , }1 2 3 and that B is the set { , , , }a b c d , with four distinctelements:

79. Is it possible to define a function f from A to B such that f is onto? Explain your answer.

80. If g is a function from B to A, can the inverse of g be a function? Explain your answer.

81. If i is an onto function from B to A, and h is a 1-1 function from A to B, which of the following statements are true? Explain your answer.

a. h io is a function

b. h io is 1-1

c. h io is onto

u Since functions may be seen as a special case of relations, we may apply the termsreflexive, symmetric, and transitive to functions, with the same meaning as before. IfF, G, and H are functions from { , , }1 2 3 to { , , }1 2 3 , what must be true if

82. F is reflexive?

83. G is symmetric?

84. H is a transitive, onto function?

u Find a formula for the inverse of each of the following.

85. g x x( ) = −2 1

86. h xx

x( ) =

−−

2 3

5 7 where x ≠ 7

5

u The following functions are defined on the integers. State whether they areone-to-one, onto, or bijective functions, and explain your reasons in each case.

87. f x x( ) = 2

88. g x x x( ) = −3

u Using the relation that holds between two integers a and b if and only if a divides bwith no remainder.

89. Define the relation

90. Define what it means for this relation to be transitive

91. Prove that this relation is transitive

3 - 26

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 73: C2004 Study Guide

u Suppose that R is the relation {( , ), ( , ), ( , )}0 2 1 1 2 0 on the set { , , }0 1 2

92. Which pairs would you need to add to R to make a reflexive relation?

93. Which pairs would you need to add to R to make a transitive relation?

u Relations

94. Consider the circle relation C defined for all ( , )x y R R∈ × , such that − ≤ ≤ ∈ ↔ + =1 1 12 2x y x y C x y, ( , ) . Is C a function? Explain.

95. Consider the relation L defined for all ( , ) ( , )x y R R x y L y x∈ × ∈ ↔ = −1 Is L a function? Explain.

96. Consider the relation B x y N N x y= ∈ × − ≤{( , ) : | | }2 Is this relation

i) reflexive?

ii) symmetric

iii) transitive?

iv) an equivalence relation?

In each case explain your answers.

97. Consider the relation R represented by the following matrixV V V

V

V

V

1 2 3

1

2

3

1 1 0

1 1 1

0 1 1

Is the relation

i) reflexive?

ii) symmetric?

iii) transitive?

iv) an equivalence relation?

In each case explain your answers.

u Suppose that R and S are binary relations on a set A. Answer the following, and giveexplanations for your answers.

98. If R and S are reflexive, is R S∩ reflexive?

99. If R and S are symmetric, is R S∩ symmetric?

100. If R and S are transitive, is R S∩ transitive?

u Consider the c irc le re lat ion on the set of real numbers: for a l lx y R x C y x y, ,∈ ↔ + =2 2 1. Determine if each of the following is true, and justifyyour answers.

101. C is reflexive

102. C is symmetric

103. C is transitive.

104. C is an equivalence relation

3 - 27

CS218 CHAP TER 3: RE LA TIONS AND FUNC TIONS

Page 74: C2004 Study Guide

u Suppose that g is a function from A to B and f is a function from B to C.

105. Show that if both f and g are one-to-one functions, then f go is also one-to-one.

106. Show that if both f and g are onto functions, then f go is also onto.

3 - 28

CHAP TER 3: RE LA TIONS AND FUNC TIONS CS218

Page 75: C2004 Study Guide

CHAPTER 4: METHODS OF PROOFS

Chapter Objectives

In this chapter, you will learn:

§ what a predicate quantifier is;

§ an exact definition for odd and even numbers;

§ what absolute value is;

§ what a sequence is;

§ about the different types of numbers;

§ what a recurrence relation is;

§ how to convert repeating decimals to fractions;

§ what a series is;

§ some important properties of sums;

§ the important rules involving exponents;

§ what the inverse, converse, and contrapositive of a proposition is;

§ how to prove something with a direct proof;

§ how to prove something using a contrapositive proof;

§ how to prove something using by contradiction;

§ how to prove something by counterexample;

§ what the principle of mathematical induction is;

§ how to prove something using mathematical induction;

4-1

Page 76: C2004 Study Guide

4.1 MATHEMATICAL FACTS

u Before we continue, you must be familiar with a few basic mathematical facts.

4.1.1 PREDI CATE LOGIC

u We have been using the “Quantifiers” ∀ and ∃ so far without formally introducingthem to you. They are known as predicate quantifiers. ∀ means for all and ∃means there exists.

Example 1: If we have one computer that all students must share, we say:

∃ one computer ∀ students.

Example 2: If each student has a separate computer, we would say:

∀ students ∃ one computer.

Note: The two example may both appear to be saying that “there exists” only one computer; however, example 2 is actually saying mathematically that every student has a ‘unique’ computer.

4.1.2 ODD AND EVEN NUM BERS

u Any odd integer can be expressed as n p= +2 1.

u Any even integer can be expressed as n p= 2 .

4.1.3 AB SO LUTE VALUE

u The absolute value of a number x, denoted x , is x when x is positive or zero and is − xwhen x is negative.

Example 3: Find − 4, and 4 .

( )− − −= =4 4 4 and 4 4=

4.1.4 DI VISI BIL ITY

u If a divides b, we write a b| .

Example 4: 3 18| is true because 18 3 6= × .

4 - 2

CHAP TER 4: METH ODS OF PROOFS CS218

Page 77: C2004 Study Guide

4.1.5 TYPES OF NUM BERS

u There are several different types of numbers which you need to be aware of. They are:

a. Prime numbers: Prime numbers are numbers that are divisible by 1 and the number itself, i.e. 2, 3, 5, 7, 11, 13, 17, 19, 23, . . .

b. Integers: Any of the numbers . . . , − − − −4 3 2 1 0 1 2 3, , , , , , , , . . .

c. Natural numbers: The numbers 1, 2, 3, 4, 5, 6, . . .

d. Whole numbers: The numbers 0, 1, 2, 3, 4, . . .

e. Rational numbers: A number that can be expressed as an integer or as a quotient of integers. (such as 1

243 7, , ).

f. Irrational numbers: A number not expressible as an integer or quotient of integers; a nonrational number.

g. Real numbers: Any rational or irrational number.

4.1.6 RE CUR RENCE RE LA TION

u A recurrence relation is an equation that defines the ith value in a sequence ofnumbers in terms of the preceding i−1 values.

Example 5: ( )0 1 1! ! != = − ⋅and n n n is a recurrence relation, i.e. the factorial relation.

Exercise 1: Find the first six terms of the sequence satisfying the recurrence relation: x x x x xn n n1 2 2 12 1 3 2= = = −+ + .

4.1.7 SEQUENCES

u A sequence is simply a list, such as 2, 4, 6, . . . where the numbers 2, 4, etc. are theterms of the sequence.

Example 6: 1 12

13

1, , , ,L n is a finite sequence.

Example 7: a a a a n1 2 3, , , , ,L L is an infinite sequence.

u A geometric sequence is a sequence for which the ratio of a term to its predecessoris the same for all terms. The general form of a finite geometric sequence is { , , , , , }a ar ar ar arn2 3 1L − , where a is the first term, r is the common ratio, and arn−1 is

the last term. The sum of the terms is a r

r

n( )1

1

−−

4 - 3

CS218 CHAPTER 4: METHODS OF PROOFS

Page 78: C2004 Study Guide

l Remark 1: Sa

r∞ = −1 represents a geometric sequence summed to infinity,

where a is the first term, and r is the common ratio.

Exercise 2: 0 33. is a geometric sequence to infinity. Represent this as a fraction.

Exercise 3: Show that Sa r

r

a

rn

n

=−−

=−

+1

1 1 as n goes to infinity when |r| < 1

l Remark 2: To express a decimal as a fraction:

1. Identify the first term a.

2. Identify the common ratio r.

3. Plug the values into the geometric sequence equation Sa

r∞ =−1

4. Reduce the fraction to lowest terms.

4.1.8 SE RIES

u A series can be written in the form a a a a n1 2 3+ + + + +... ..., or as aii

n

=∑

1. The symbol

ai∑ means summation; read “the sum i equals 1 to n of a sub i”. The starting valueis the value on the bottom of the symbol ∑; the ending value is placed on top of the ∑symbol.

Example 8: Write the sum ( )2 11

5

ii

+=∑ out in full.

( ) ( )[ ] ( )[ ] ( )[ ] ( )[ ] ( )[ ]2 1 2 1 1 2 2 1 2 3 1 2 4 1 2 5 11

5

ii

+ = + + + + + + + + +=∑

[ ] [ ] [ ] [ ] [ ]= + + + + + + + + + = + + + +2 1 4 1 6 1 8 1 10 1 3 5 7 9 11.

Example 9: The series 1 2 3 1 11

+ + + + + + = + +=

∑L k k i ki

k

( ) ==

+

∑ ii

k

1

1

Example 10: The summation i i ki

k

i

k

=

+

=∑ ∑= + +

1

1

11( )

4 - 4

CHAPTER 4: METHODS OF PROOFS CS218

Page 79: C2004 Study Guide

u The following properties about sums should be remembered.

Summation Properties

1. ( )i i k k Ni a

b

i a k

b k

= = +

+

∑ ∑= − ∈

2. ( )i i k k Ni a

b

i a k

b k

= = −

∑ ∑= + ∈

3. cx c x c xii a

b

ii a

b

i= =∑ ∑= is a constant is an expression invo, lving i.

4. ( )x y x y x yi ii a

b

ii a

b

ii a

b

i i+ = += = =∑ ∑ ∑ and are expressions involving i.

5. c nc ci

n

==∑ is a constant

1.

6. x x x ii ai a

a

i==∑ is an expression involving .

Exercise 4: Using the summation properties evaluate each of the following:

a ii

. 35

10

=∑ ( )b j

j. 3 4

1

6

+=

∑ ( )c xx

. 3 38

13

−=∑

4.1.9 EX PO NENTS

u The rules for exponents that you will need to be familiar with are summarized in thefollowing table.

The Rules ofExponents

x x xn m n m⋅ = +

x

xx

n

mn m= −

( )x xn m nm=

x x0 1 0= ≠,

xx

nn

− =1

( )xy x yn n n= ⋅

x

y

x

y

n n

n

=

4 - 5

CS218 CHAPTER 4: METHODS OF PROOFS

Page 80: C2004 Study Guide

4.1.10 LOGIC

u The inverse of p q→ is ~ ~p q→

u The converse of p q→ is q p→

u The contrapositive of p q→ is ~ ~q p→

l Remark 3: p q q p→ ≡ →~ ~

Exercise 5: State the inverse, the converse, and the contrapositive of: If x is odd, then x 2 is odd.

inverse:

converse:

contrapositive:

Exercise 6: State the inverse, the converse, and the contrapositive of: He’s 60, if he’s a day.

inverse:

converse:

contrapositive:

4.2 PROOFS

u Now that we have established the basic tools for propositions and predicates we canuse them to construct logic arguments. There are several ways in mathematics toconstruct a logical argument. A logical argument is the same thing as a proof.

4.2.1 DI RECT PROOFS

u Direct arguments are probably familiar to you from algebra and plane geometry. Letus look a direct proof to show you again what one is:

Example 11: Give a direct proof for “If x y> then x y2 2> .”

We first observe that x y2 2> , since x y> . Also z z2 2= for any number z. The

conclusion follows.

Example 12: Give a direct proof that for real numbers x and y, x y x y+ ≥ + .

Use the fact that for any real number z, z z2 2= . For any real numbers x and y, ( )x y x y x xy y+ = + = + +

2 2 2 22 . But 2 2xy x y≤ , so we get ( )x y x y+ ≤ +2 2

, and the inequality follows.

4 - 6

CHAPTER 4: METHODS OF PROOFS CS218

Page 81: C2004 Study Guide

4.2.2 CON TRA PO SI TIVE PROOFS

u The second kind of argument, contrapositive, is based on the fact that not Q ⇒ notP is logically equivalent to P ⇒ Q i.e. ( ) ( )~ ~q p p q→ ↔ → .

Example 13: Let n be a positive integer. Give a contrapositive proof that, if n is a prime number different from 2, then n is odd.

The contrapositive form of the statement “If n is a prime number different from 2, then n is odd” is “If n is even, then either n = 2 or n is a not a prime number.” We suppose that n is even. Then n p= ⋅2 for a positive integer, p n< . Now, either p = 1 or p > 1. If p = 1, then n = 2. If p > 1, then n is not prime because n is divisible by p and p n≠ or p ≠ 1. In either case, we have proven the contrapositive. Therefore, the initial implication is true.

Example 14: Prove if n 2 is even then n is also even by contrapositive.

The contrapositive form of the statement “if n 2 is even then n is also even” is “if n is odd then n 2 is also odd.” We suppose that n is odd. Then n p= +2 1 and ( )n p p p2 2 22 1 4 4 1= + = + + ( )= + +2 2 2 12p p and if we let

( )m p p= +2 22 then we have n m= +2 1, which is odd. So we have proven the contrapositive. Therefore, the initial implication is true.

4.2.3 PROOFS BY CON TRA DIC TION

u A proof by contradiction is a proof of an implication that shows that joining theassumption “ Q is false” together with the premise “ P is true” leads to a contradiction.

Example 15: Let n be a positive integer. Give a proof by contradiction that if n is a prime number different from 2, then n is odd.

Let ( )P n be the statement “n is a prime number different from 2,” and let ( )Q n be the statement “n is odd.” To carry out the proof by contradiction, we

need to assume that n is a prime number different from 2 and that n is even. Then if we find a contradiction, the proof is complete. From the assumption, we see that n p= ⋅2 for some positive integer p. If p = 1, then n = 2. If p > 1, then n is not prime because n is divisible by p and p n≠ or p ≠ 1. In both cases, we obtain a contradiction, so the initial implication is true.

Example 16: Prove that 2 is an irrational number. Use proof by contradiction.

Using proof by contradiction, we must prove that 2 is a rational number is

false. If 2 is a rational number then 2 can be expressed as a

b with

a b Z b, ,∈ ≠ 0. Assuming that a

b is in lowest terms then: 2 =

a

b, and ( )2

22

2=a

b

⇒ 22

2=a

b 2 2 2b a= which implies a 2 is even. If a 2 is even then a is also even, and

so a p a p p b b p= ⇒ = ⇒ = ⇒ =2 4 4 2 22 2 2 2 2 2. Hence b 2 is also even, and so b is also even. However if both a and b are even then they both have a common factor and are not in lowest terms, so we have a contradiction, and thus the initial implication is true.

4 - 7

CS218 CHAPTER 4: METHODS OF PROOFS

Page 82: C2004 Study Guide

4.2.4 COUN TER EX AM PLES

u At times use of proofs is not only impossible, but unnecessary. Sometimes in order to prove something all that is necessary is to provide an example that proves thestatement false, i.e. a counterexample.

Exercise 7: Prove that ∀ positive integers x ∃ an integer y∋ y x2 = is false.

4.2.5 MATHE MATI CAL IN DUC TION

u Mathematical induction is a method of proving a law or theorem by showing thatit holds in the first case and showing that, if it holds for all cases preceding a givenone, then it also holds for this case.

u Before mathematical induction can be applied it is necessary that the different casesof the law depend upon a parameter which takes on the values 1 2 3, , ,L

u The essential steps of the proof are as follows:

(1) Prove the theorem for the first case.

(2) Prove that if the theorem is true for the nth case (or for the first through nth cases), then it is true for the ( )n+1 th case.

u If there were a case for which it is not true, there must be a first case for which it is nottrue. Because of (1), this is not the first case. But because of (2), it cannot be any othercase [since the previous case could not be true without the next case (known to befalse) being true; it could not be false because the next case is the false case].

u Mathematical induction is useful for proving propositions that must be true for allintegers or for a range of integers.

u Problems to which induction applies have the following form:

Prove: ( )P n for all integers n k≥

Principle of Mathematical Induction

Let P(n) be a proposition that is valid for n k≥ ,

n, k integers.

If (1) P(k) is true, and

(2) ( ) ( )∀ ≥ ⇒ +n k P n P n, 1

then P(n) is true ∀ ≥n k

u The statement ( )P n is called the inductive hypothesis, condition (1) is called thebase step, and condition (2) is called the induction step.

u When proving something using induction you need to be sure to check that bothcondition (1) and condition (2) are satisfied.

4 - 8

CHAPTER 4: METHODS OF PROOFS CS218

Page 83: C2004 Study Guide

Example 17: Prove ( )2 1 2

1i n

i

n

− ==

∑ is true using mathematical induction.

Step 1: Prove for ( )P 1 . ( ) ( ) ( )P ii

1 2 1 2 1 1 2 1 11

1

= − = − = − ==

∑ = 12. So we have

shown this to be true for ( )P 1 .

Step 2: Assume that ( )P k is true, i.e. that ( ) ( )P k i ki

k

= − ==

∑ 2 11

2 is true.

Prove that ( )P k +1 , i.e. ( ) ( )2 1 11

12i k

i

k

− = +=

+

∑ is true.

Proof: ( ) ( ) ( )2 1 2 1 2 1 11

1

1i i k

i

k

i

k

− = − + + −=

+

=∑ ∑ ( ) ( )= + + −P k k2 1 1

( )= + + −k k2 2 1 1 ( )( ) ( )= + + − = + + = + + = +k k k k k k k2 2 22 2 1 2 1 1 1 1

Thus ( )P k +1 is true. Since ( )P k is true implies ( )P k +1 is true, by the

principle of mathematical induction, we have shown that ( )2 11

2i ni

n

− ==∑

Example 18: Prove that ( )

in n

i

n3

1

2 21

4=∑ =

+ is true using mathematical induction.

Step 1: Prove for ( )P 1 . ( )( )

P ii

1 1 11 1 1

4

2

4

4

413

1

13

2 2 2

= = = =+

= = ==∑ . So we have

shown this to be true for ( )P 1

Step 2: Assume that ( )P k is true, i.e. that ( )( )

P k ik k

i

k

= =+

=∑ 3

1

2 21

4 is true.

Prove that ( )P k +1 , i.e. ( ) ( )

ik k

i

k3

1

1 2 21 1 1

4=

+

∑ =+ + +

is true.

Proof: ( )( )

( )i i kk k

ki

k

i

k3

1

13

1

32 2

311

41

=

+

=∑ ∑= + + =

++ +

( ) ( )=

++

+k k k2 2 31

4

4 1

4

( ) ( )( )

=+

++ +k k k k2 2 21

4

4 1 1

4

( ) ( )[ ]=

+ + +k k k1 4 1

4

2 2

( ) ( )

=+ + +k k k1 4 4

4

2 2

( ) ( )( )

=+ + +k k k1 2 2

4

2

( ) ( )

=+ +k k1 2

4

2 2

Since ( )P k is true implies ( )P k +1 is true, by the principle of mathematical

induction we have shown that ( )

in n

i

n3

1

2 21

4=∑ =

+ is true.

4 - 9

CS218 CHAPTER 4: METHODS OF PROOFS

Page 84: C2004 Study Guide

Example 19: Prove that ( )

∀ ≥ + + + + =+

n nn n

1 1 2 31

2, ... is true by induction.

Step 1: Prove for ( )P 1 . Since 1 2 31

+ + + + ==

∑... n ii

n

; ( )( )

P ii

1 111 1

2

2

21

1

1

= = =+

= ==∑

So we have shown this to be true for ( )P 1 .

Step 2: Assume that ( )P k is true, i.e. that ( )( )

P k ik k

i

k

= =+

=∑

1

1

2 is true.

Prove that ( )P k +1 , i.e. ( )( )

ik k

i

k

=

+

∑ =+ +

1

1 1 2

2 is true.

Proof: i i ki

k

i

k

= + +==

+

∑∑ ( )111

1

( )

=+

+ +k k

k1

21

( ) ( )=

++

+k k k1

2

2 1

2

=+

++k k k2

2

2 2

2 =

+ + +k k k2 2 2

2 =

+ +k k2 3 2

2

( )( )=

+ +k k1 2

2

So by induction ( )

1 2 31

2+ + + + =

+... n

n n is true.

Example 20: Prove that n n2 2 1> + for n ≥ 5 is true, using induction.

Step 1: Prove for ( )P 5 ; ( )5 2 5 1 25 10 1 25 112 > + ⇒ > + ⇒ > . Which is true.

Step 2: Assume that ( )P k is true, i.e. that k k2 2 1> + is true. Prove that ( )P k +1 , i.e. ( ) ( )k k+ > + +1 2 1 12 = +2 3k is true.

Proof: ( )k k k k k+ = + + > + + +1 2 1 2 1 2 12 2 = + > +4 2 2 3k k for k ≥ 5

So we have proven that n n2 2 1> + is true for n ≥ 5 by induction.

Example 21: Show that ∀ ≥ >n nn5 2 2, is true, using induction.

Step 1: Prove for ( )P 5 . 2 55 2> ⇒ >32 25 which is true.

Step 2: Assume that ( )P k is true, i.e. that 2 2k k> is true. Prove that ( )P k +1 , i.e. ( )2 11 2k k+ > + is true.

Proof: 2 2 2 21 2 2 2k k k k k+ = ⋅ > ⋅ = + . Since k k2 2 1> + for k ≥ 5, we have:

2 2 12 2 2k k k k= + > + and so

( )2 2 1 11 2 2k k k k+ > + + = + for k ≥ 5

So we have the inequality 2 2n n> for n ≥ 5 proven true by induction.

4 - 10

CHAPTER 4: METHODS OF PROOFS CS218

Page 85: C2004 Study Guide

Example 22: Use induction to prove that ( )12 1n n− lines will be required in

order for n people to talk, given a person must have a direct phone line in order to talk to someone else.

Step 1: Prove for ( )P 1 . ( ) ( )( )P 1 12 1 1 1 0= − = , and since a person does not need a

phone line to talk to themselves, this is true.

Step 2: Assume that ( )P k is true, i.e. that ( )12 1k k − lines are required for k

people is true. Prove that ( )P k +1 , i.e. 12 1 1 1( )( )k k+ + − = ( )( )1

2 1k k+

lines will be required for k +1 people.

Proof: If you add 1 person then k more lines will be needed, so ( )P k k+ lines

will be needed. Thus ( )12 1k k k− +

( )=

− +k k k1 2

2 =

− +k k k2 2

2

( )( )=

+=

+= +

k k k kk k

2

2

1

212 1

So we have proven this true by induction.

4 - 11

CS218 CHAPTER 4: METHODS OF PROOFS

Page 86: C2004 Study Guide

4.3 SUMMARY

4.3.1 RE MARKS

l Sa

r∞ =−1

represents a geometric sequence summed to infinity.

l To express a decimal as a fraction:

1. Identify the first term a

2. Identify the common ratio r

3. Plug the values into the geometric sequence equation Sa

r∞ = −1

4. Reduce the fraction to lowest terms.

l p q q p→ ≡ →~ ~

4.3.2 PRIN CI PLE OF MATHE MATI CAL IN DUC TION

The Principle ofMathematical Induction

The principle of Mathematical Induction states that S n is true

for all positive integers n if :

1. S 1 is true, and

2. If S k is true, then S k+1 is true.

Note: Do not prove something 12 way then prove the other side to that point. This

is not a correct formal proof and is not acceptable.

4 - 12

CHAPTER 4: METHODS OF PROOFS CS218

Page 87: C2004 Study Guide

4.4 METHODS OF PROOFS EXERCISES

u Express the following sums more simply:

1. ( )ii

−=∑ 8

10

17

2. 253

10

jj=∑ 3. 9

1

50

k=∑

4. ( ) ( )2 5 42

10

2

10

i ii i

+ + += =∑ ∑ 5. ( )4 30

36

50

ii

−=∑ 6. ( )5 3

8

8

tt

−=∑

u Write each of the terms in the following sums and add:

7. ( )5 21

8

ii

−=

∑ 8. ii

2

4

10

=∑ 9. ( )i i

i

2

1

5

3+=∑

u Write each of the following using summation notation:

10. 6 12 18 24 120+ + + + +...

11. 10 13 16 19+ + + + ...

12. 4 16 36 64 100 900+ + + + + +... (Hint: factor out 4)

u State the inverse, the converse, and the contrapositive of each of the following:

13. Let P be a computer program. If P is correct then, P complies without error message.

14. If n is a prime number then, n is odd.

15. If it is raining then, I will get wet.

u The Fibonacci sequence is the sequence of integers satisfying the recurrencerelation: x x1 21 1= =, and x x xn n n+ += +2 1 for n ≥ 1. Compute:

16. x3 17. x4 18. x7

u Given the recurrence relation x x x x x x xn n n n1 2 3 3 1 23 2 1 2= = = = ⋅ − −+ + +, , , :

19. Find the first six terms of the sequence that satisfies the recurrence relation.

u Find the recurrence relation connecting S n+1 to:

20. ( )S nn = + + + + + + −3 7 11 15 19 4 1...

u Define a sequence a a a0 1 2, , ,K by the formula a nn = +3 1, for all integers n ≥ 0.

21. Show that this sequence satisfies the recurrence relation a ak k= +−1 3 for all integers k ≥ 1

4 - 13

CS218 CHAPTER 4: METHODS OF PROOFS

Page 88: C2004 Study Guide

u Define a sequence a a a0 1 2, , ,K by the formula

an

nn

n

n

n= =

−−

− −( )( )

( )( )2

2

22

2

12

if is even

if is odd for all integers n ≥ 0

22. Show that this sequence satisfies the recurrence relation a ak k= −−2 2 for

all integers k ≥ 2

u Show the following:

23. That the sequence 0 1 3 7 2 1, , , , , ,K Kn− , for n ≥ 0, satisfies the recurrence relation c ck k= +−2 11 , for all integers k ≥ 1

24. That the sequence 2 3 4 5 2, , , , , ,K K+ n , satisfies the recurrence relation t t tk k k= −− −2 1 2, for all integers k ≥ 2

u Given the sequence: 1 12

14

18, , , ,... and the sum of the first n terms:

( )S

a r

rn

n

=−−

−1

1

1

where

a is the first term and r is the ratio of the n and n−1 terms:

25. Evaluate the limit, i.e. S ∞

u Prove the following by induction:

26.( )( )

1 2 31 2 1

62 2 2 2+ + + + =

+ +... n

n n n

27. ( )( )( )

2 4 6 22 1 2 1

32 2 2 2+ + + + =

+ +... n

n n n

28. The number of n-bit binaries is 2n.

29. ( ) ( )1

1 2

1

2 3

1

1 1×+

×+ +

+=

+...

n n

n

n

30. 2 2 10

1i

i

nn

=

+∑ = −

31. 2 1 3n n+ ≤ for all n N∈

32. n n3 2+ is divisible by 3

33. ( ) ( )3 7 11 4 1 2 1+ + + + − = +... n n n

34. ( )n n 2 5+ is divisible by 6

35. xn −1 is divisible by x−1 for n ≥ 1

36. 1 212

14

12

12+ + + + = −... n n

u Give a direct proof for each of the following:

37. If n 2 is an even integer then n is an even integer

38. If n and m are even integers, then n m+ is an even integer

39. If n and m are even integers, then n m− is an even integer

4 - 14

CHAPTER 4: METHODS OF PROOFS CS218

Page 89: C2004 Study Guide

u Give a contrapositive proof for each of the following:

40. If n 2 is not divisible 25 then n is not divisible by 5

41. If n 2 is an odd integer then n is an odd integer

42. If n and m are even integers, then n m+ is an even integer

43. If n and m are even integers, then n m− is an even integer

44. If x > 1, then either x > 1 or x < −1 for x R∈

u Give a proof by contradiction for each of the following:

45. If n and m are odd integers, then n m+ is an even integer

46. If n is an even integer and m is an odd integer, then n m+ is an odd integer

u Find a counterexample to show that the following are false:

47. If x p= +2 1, where p is a positive integer, then x is a prime number.

48. The sum of two prime numbers is never a prime number.

u Express the following as fractions in lowest terms:

49. 0 13. 50. 0507507. ...

4 - 15

CS218 CHAPTER 4: METHODS OF PROOFS

Page 90: C2004 Study Guide

CHAPTER 5: COMBINATORICS

Chapter Objectives

In this chapter you will learn:

§ about the fundamentals of counting;

§ what the sum rule is;

§ what the product rule is;

§ about factorials;

§ the formula for permutations;

§ the formula for permutations with repetition;

§ the formula for combinations;

§ the formula for combinations with repetitions;

§ how and when to use the counting formulas;

§ about patterns and partitions;

5-1

Page 91: C2004 Study Guide

5.1 BASIC COUNTING RULES

u Combinatorial analysis, or combinatorics, which includes the study ofpermutations, combinations, and partitions, is concerned with determining thenumber of logical possibilities of some event without necessarily enumerating(listing out all the possibilities) each case.

5.1.1 THE SUM RULE

u SUM RULE: If one experiment has m possible outcomes and another experimenthas n possible outcomes, then there are m n+ possible outcomes when exactly one ofthese experiments takes place.

l Remark 1: Sum rule: The general form of the sum rule is: If one event can occur in n1 ways, a second event can occur in n 2 (different) ways, a third event can occur in n3 (still different) ways, . . ., then there are n n n1 2 3+ + + ... ways in which (exactly) one of the events can occur.

Example 1: If there are 52 ways to select a representative for the MA214 class and 49 ways to select a representative for the QT211 class, then according to the rule of sum there are 52 49+ ways to select a representative for either the MA214 class or the QT211 class.

Example 2: Suppose there are seven different courses offered in the morning and five different courses offered in the afternoon. There will be 7 5+ choices for a student that wants to enrol in only one course.

5.1.2 THE PROD UCT RULE

u PRODUCT RULE: If one experiment has m possible outcomes and anotherexperiment has n possible outcomes, then there are m n× possible outcomes whenboth of these experiments take place.

l Remark 2: Product rule: The general form of the product rule is: If something can happen in n1 ways, and no matter how the first thing happens, a second thing can happen in n 2 ways, and no matter how the first two things happen, a third thing can happen in n 3 ways, and. . ., then all the things together can happen in n n n1 2 3× × × ... ways.

Example 3: If there are 52 ways to select a representative for the MA214 class and 49 ways to select a representative for the QT211 class, then according to the rule of product there will be 52 49× ways to select a representative for both the MA214 class and QT211 class.

Example 4: Suppose there are seven different courses offered in the morning and five different courses offered in the afternoon. There will be 7 5× choices for students who want to enrol in one course in the morning and one in the afternoon.

5-2

CHAP TER 5: COM BI NA TOR ICS CS218

Page 92: C2004 Study Guide

Example 5: A variable name in the programming language D++ must be either a letter or a letter followed by a digit. How many different variable names are possible in D++?

First we consider variable names one character in length. Since such names must consist of a single letter, there is only one event, the selection of the letter. The event can happen in 26 ways. Hence there are 26 variable names of length 1

Next we consider variable names two characters in length. Here there are two events. Event 1 is the selection of the letter, event 2 is the selection of the digit. The first event can happen in 26 ways, and the second event can happen in 10 ways, or n1 26= and n 2 10= , so there must be 26 10⋅ , or 260, ways to construct variable names two characters in length. Hence, there are 26 260+ , or 286, possible variable names in D++

Example 6: A calculator can display integers up to eight digits in length. However leading zeros are not allowed. How many distinct numbers

can the calculator display?

There are 10 distinct numbers with only one digit; 90 with two digits; 900 with three digits, . . ., 90,000,000 with eight digits.

Hence there are (10 + 90 + 900 + 9000 + 90000 + 900000 + 90000000 + 900000000) = 100,000,000 distinct numbers. This is however only the positive (or negative) numbers, multiplying by 2 gives will give us both the positive and negative numbers, so 100,000,000 × 2 = 200,000,000, and since we have again included 0 as + 0 and as − 0, we have to subtract 1 giving us a final answer of 199,999,999 distinct numbers that the calculator can display.

5.2 FACTORIAL NOTATION

u One uses the notation n !, read “n factorial,” to denote the product of the positiveintegers from 1 to n, inclusive: ( )( )n n n n! ...= ⋅ ⋅ ⋅ ⋅ − −1 2 3 2 1

l Remark 3: 0 1!= 1 1!= and ( )n n n! != ⋅ −1

Example 7: 2 2 1 2!= ⋅ = 3 1 2 3 6!= ⋅ ⋅ = 4 1 2 3 4 24!= ⋅ ⋅ ⋅ =

Example 8:8

6

8 7 6

68 7 56

!

!

!

!=

⋅ ⋅= ⋅ = 12 11 10

12 11 10 9

9

12

9⋅ ⋅ =

⋅ ⋅ ⋅=

!

!

!

!

5.3 COUNTING FORMULAS

u When selecting elements from a given set, one can allow the list to containrepetitions, or one can insist that the list not contain repetitions. One can also insistthat the order in which you select the elements matters or does not matter.

Order matters Order doesn’t matter

Elements repeated k-sample k-selection

Elements not repeated k-permutation k-combination

5-3

MA214 CHAP TER 5: COMBINATORICS

Page 93: C2004 Study Guide

5.3.1 k-SA MPLES

u With a k-sample order of the elements matters and elements can be repeated. Theformula for a k-sample is n k , where k is the number of samples you select from the setof n elements.

Example 9: A computer represents integers with n-binary digits, using one bit (binary digit) to indicate the sign and the remaining n−1 bits to represent the magnitude of the integer. This is called sign-magnitude representation of integers. How many distinct integers can be represented in this notation?

There are n slots to fill, and each slot can be filled in two different ways. Hence, there are 2n distinct patterns. However, 0 is represented as + 0 and as − 0, so there are 2 1n − distinct integers that can be represented using n bits in the sign-magnitude representation.

Example 10: A number consists of 5 digits such that the sum of the first and last digits must be even. Repetition of digits is allowed; however, the number cannot consist of all zeros. How many different numbers are there?

There are two ways for the sum of the first and last digits to be even: when you add two odd numbers together, and when you add two even numbers together. Note that there are 5 digits that are odd, 1, 3, 5, 7, and 9, and 5 that are even, 0, 2, 4, 6, and 8.

Case 1: First and last digits odd, gives us 5 10 10 10 5⋅ ⋅ ⋅ ⋅ , which is 25000 numbers.

Case 2: First and last digits even, gives us 5 10 10 10 5⋅ ⋅ ⋅ ⋅ = 25000 choices also; however, 1 choice is all 0’s which is not allowed giving us a final answer of 25000 25000 1 49999+ − = numbers.

5.3.2 k-PE RM UT ATIONS

u With a k-permutation the order of the elements matters, but repetition of the

elements is not allowed. The formula for a k-permutation is ( ) ( )P n kn

n k,

!

!=

−, where

k n≤

l Remark 4: k-permutations can be written as nkP , n kP , or as ( )P n k,

Example 11: Find the number of “words” with four distinct letters that can be made from the letters c a b i n e t, , , , , , .

Here n = 7, and k = 4.

The number of words selected is

( )P 7 47

3

7 6 5 4 3 2 1

3 2 1,

!

!= =

⋅ ⋅ ⋅ ⋅ ⋅ ⋅⋅ ⋅

= ⋅ ⋅ ⋅ =7 6 5 4 840

5-4

CHAP TER 5: COM BI NA TOR ICS CS218

Page 94: C2004 Study Guide

Example 12: A number consists of 5 digits such that the sum of the first and last digits must be even. Repetition of digits is not allowed. How many different numbers are there?

This problem is similar to that of example 10; however in this case repetition of the digits is not allowed, which means that we have 5 8 7 6 4⋅ ⋅ ⋅ ⋅ possible numbers. Since there are again two cases which are exactly the same, we have 2 5 8 7 6 4 13440⋅ ⋅ ⋅ ⋅ ⋅ = numbers. This can also be expressed as ( ) ( )2 5 2 8 3⋅ ⋅P P, ,

= ⋅ ⋅ =25

3

8

513440

!

!

!

! numbers.

5.3.3 k-CO MB IN ATIONS

u With a k-combination the order in which the elements are selected does not matterand the elements cannot repeat. The formula for a k-combination is

( ) ( )C n kn

n k k,

!

! !=

l Remark 5: k-combinations can be written as nkC , n kC ,

n

k

, or as ( )C n k,

Example 13: A menu in a Chinese restaurant allows you to order exactly two of eight main dishes as part of the dinner special. How many different combinations of main dishes could you order?

There are 82C combinations of the eight main dishes taken two at a time.

Thus, you could choose one of 82

8

6 2

8 7

228C = =

⋅=

!

! ! different combinations.

Example 14: A group consists of seven men and five women. Find the number m of committees of five that can be selected from the group.

Each committee is a combination of the twelve people taken five at a time.

Thus m C= = =⋅ ⋅ ⋅ ⋅

⋅ ⋅ ⋅=12

5

12

5 7

12 11 10 9 8

5 4 3 2792

!

! ! committees.

Example 15: Suppose in forming a committee from seven men and five women, that the committee m of 5 members is to consist of three men and two women. How many committees can be formed?

In this case the three men can be chosen from the seven men in 73C ways, and

the two women can be chosen from the five women in 52C ways. Hence

m=

= =

⋅ ⋅ ⋅ ⋅⋅ ⋅ =

7

3

5

2

7 5

3 4 2 3

7 6 5 5 4

3 2 2350

! !

! ! ! ! committees.

Example 16: Suppose in forming a committee from seven men and five women, that the committee m, of 5 members, must consist of at least one man and at least one woman. How many committees can be formed?

Using the result from example 14, there are 125 792C = possible committees.

Among these committees, there is 55 1C = committee consisting of the five

women, and 75 21C = consisting of five men. These committees are not allowed

so eliminating them from the possible committees yields m= − − =792 21 1 770 committees.

5-5

CS218 CHAP TER 5: COMBINATORICS

Page 95: C2004 Study Guide

5.3.4 k-S ELE CTIONS

u k-selections is similar to k-combinations in that the order in which you select theelements does not matter, but in this case repetitions can occur. The formula for ak-selection is n k

kC+ −1 ∀ n k, ≥ 1

l Remark 6: k-selections are also called combinations with repetitions .

Example 17: Compute n kkC+ −1 with n = 4, and k = 3

4 3 13

63

6

3 3

6 5 4

3 220+ − = = =

⋅ ⋅⋅ =C C

!

! !

Example 18: Four dice are to be tossed. How many different outcomes are possible if the order does not matter?

If the first die shows 4 and the rest of the dice show 2, it is the same outcome as if the first three dice show 2 and the last one shows 4. Hence, order does not matter. But since all dice could show the same value, repetitions are allowed. Thus the outcomes are the 4-selections from the set { }1 2 3 4 5 6, , , , , , and there are

6 4 14

+ − =C 94

9

4 5

9 8 7 6

4 3 2126C = =

⋅ ⋅ ⋅⋅ ⋅

=!

! ! possible outcomes.

Example 19: How many ways are there to choose 8 coins from a pile containing 100 identical pennies and 80 identical nickels?

Since the coins are identical the order in which the coins are selected does not matter. Further since all pennies and all nickels have the same value repetition is allowed. So we have 8-selections not from 100 80 180+ = coins, but from the two different types of coins, i.e. a penny and a nickel. So we have 2 8 1

89

8+ − =C C

= =9

1 89

!

! ! ways.

Example 20: A hockey team has ten players who want to play in the front line. How many 3-player lines can be formed if a player can be in more than one line?

Here the order in which the players are selected does not matter, and repetition of the players can also occur, since it is possible for a player to be in more than one line. So we have 3-selections of players from 10, which is 10 3 1

3+ − C

= = =⋅ ⋅

⋅=12

3

12

9 3

12 11 10

3 2220C

!

! ! ways.

5.4 PIGEONHOLE PRINCIPLE

u Many results in combinatorial theory come from the following almost obviousstatement:

Pigeonhole Principle: If n pigeonholes are occupied by n+1 or more pigeons, then at least one pigeonhole is occupied by more than one pigeon.

Generalized Pigeonhole Principle: If n pigeonholes are occupied by kn+1 ormore pigeons, where k is a positive integer, then at least one pigeonhole is occupiedby k +1 or more pigeons.

5-6

CHAP TER 5: COM BI NA TOR ICS CS218

Page 96: C2004 Study Guide

Example 21: Find the minimum number of students in a class to be sure that three of them are born in the same month.

Here the n = 12 months are the pigeonholes and k + =1 3 or k = 2. Hence among any kn+ =1 25 students (pigeons), three of them are born in the same month.

Example 22: Suppose a laundrybag contains many red, white, and blue socks. Find the minimum number of socks that one needs to choose in order to get two pairs (four socks) of the same colour.

Here there are n = 3 colours (pigeonholes) and k + =1 4 or k = 3. Thus among any kn+ =1 10 socks (pigeons), four of them have the same colour.

5.5 THE INCLUSIONEXCLUSION PRINCIPLE

u Let A and B be any finite sets. Then | | | | | | | |A B A B A B∪ = + − ∩ . This principle holdsfor any number of sets. The following theorem states the principle for three sets.

Theorem 3: For any finite set A, B, and C we have

| | | | | | | | | | | | | | | |A B C A B C A B A C B C A B C∪ ∪ = + + − ∩ − ∩ − ∩ − ∩ ∩

Example 23: Find the number of mathematics students at a university taking at least one of the languages Mandarin, English, and Japanese given the following data:

65 study Mandarin 20 study Mandarin and English

45 study English 25 study Mandarin and Japanese

42 study Japanese 8 study all three languages

We want to find | |M E J∪ ∪ where M, E, and J denote the sets of students studying Mandarin, English, and Japanese respectively. By the inclusionexclusion principle,

| | | | | | | | | | | | | |M E J M E J M E M J E J∪ ∪ = + + − ∩ − ∩ − ∩ + | |M E J∩ ∩ = + + − − − + =65 45 42 20 25 15 8 100

Thus 100 students study at least one of the languages.

5.6 PARTITIONS

5.6.1 OR DERED PAR TI TIONS

Theorem 4: Let A contain n elements and let n n n r1 2, , ,K be positive integers whose sum is n, that is, n n n nr1 2+ + + =L . Then there exist

n

n n n n r

!

! ! ! !1 2 3 L

different ordered partitions of A of the form [ , , , ]A A Ar1 2 K where A1 contains n1 elements, A2 contains n2 elements, . . ., and Ar contains nr elements.

5-7

CS218 CHAP TER 5: COMBINATORICS

Page 97: C2004 Study Guide

Example 24: Find the number m of ways that nine toys can be divided between four children if the youngest child is to receive three toys and each of the others two toys.

We wish to find the number m of ordered partitions of the nine toys into four cells containing 3, 2, 2, 2 toys respectively. By Theorem 4,

m= =9

3 2 2 27560

!

! ! ! !

Example 25: A puzzle has three squares, two triangles, and four circles. How many patterns can be formed by laying these nine shapes out in a row?

Using Theorem 4, the pieces can be arranged into

9

3 2 4

!

! ! ! =

⋅ ⋅ ⋅ ⋅⋅ ⋅

9 8 7 6 5

3 2 2 = 1260 ways.

5.6.2 PER MU TA TIONS WITH REPE TI TIONS

u Permutations with repetition, or a set of elements in which some of the elementsare alike can be expressed as :

P n n n nn

n n n nrr

( ; , , , )!

! ! ! !1 21 2 3

KL

= where P n n n nr( ; , , , )1 2 K denotes the

number of permutations of n objects of which n1 are alike, n2 are alike, . . ., nr are alike.

Example 26: Find the number of all possible five-letter “words” using the letters from the word “apple”.

What we have is five letters in which two of them repeat, so this is a type of

problem involving a permutation with repetition, or 5

25 4 3 60

!

!= ⋅ ⋅ = ways.

Example 27: How many different signals, each consisting of six flags hung in a vertical line, can be formed from four identical red flags and two identical blue flags?

This problem again involves permutations with repetitions. There are 6

4 2

6 5

215

!

! !=

⋅= signals.

5.6.3 UN OR DERED PAR TI TONS

u In each example from section 5.6.1 the order in which we placed the items made adifference, i.e. order mattered. There are times when you will want to partition a setA into a collection of subsets A A Ar1 2, , ,K where the subsets are now unordered;where the order in which the sets are placed does not make a difference.

u This type of problem can be solved in two ways, as you will see in the next example.

5-8

CHAP TER 5: COM BI NA TOR ICS CS218

Page 98: C2004 Study Guide

Example 28: Find the number m of ways that 12 students can be partitioned into three teams, A A1 2, , and A3, so that each team contains four students.

Method 1: Let A denote one of the students. Then there are 11

3

ways to

choose three other students to be on the same team as A. Now let B denote a student who is not on the same team as A; then there

are 7

3

ways to choose three students of the remaining students to

be on the same team as B. The remaining four students constitute the third team. Thus, altogether, the number of ways to partition the students is

m=

= ⋅ =

11

3

7

3165 35 5775

Method 2: Observe that each partition { , , }A A A1 2 3 of the students can be arranged in 3 6!= ways as an ordered partition. Using Theorem 4

there are 12

4 4 434 650

!

! ! !,= such ordered partitions. Thus there are

m= =34650 6 5775/ (unordered) partitions.

5.6.4 NUM BER OF PARTITIONS

u We also need a way to count the number of partitions that can be formed from a givenset, however, there is no simple closed form expression for this, but there is a simplerecurrence relation that express it.

Theorem 5: The number of ways to partition a set with n elements into k blocks is given by ( )S n k, , where ( )S n k, satisfies the following recurrence relation:

1. ( )S n, 1 1= and ( )S n n, ,= 1 for all n ≥ 1

2. ( ) ( ) ( ) ( )S n k k S n k S n k+ + = + + +1 1 1 1, , , , for n ≥ 1 and 1≤ ≤k n

Exercise 29: In how many ways can a set with five elements be partitioned into three blocks?

We use theorem 5 and write ( ) ( ) ( )S S S5 3 3 4 3 4 2, , ,= +

Now we have to apply theorem 3 again to obtain

( ) ( ) ( ) ( ) ( ) ( )( ) ( ) ( ) ( )

S S S S S S

S S S S

4 3 3 3 3 3 2 4 2 2 3 2 3 1

3 2 2 2 2 2 1 2 1

, , , , , ,

, , , ,

= + = +

= + = ( )( ) ( )

S

S S

3 1 1

3 3 1 2 2 1

,

, ,

=

= =

Putting these values in and moving back up the equations, we get

( ) ( ) ( )S S S3 2 2 1 3 4 2 2 3 1 7 4 3 3 3 6, , ,= + = = ⋅ + = = + =

Finally, ( )S 5 3 3 6 7 25, = ⋅ + =

5-9

CS218 CHAP TER 5: COMBINATORICS

Page 99: C2004 Study Guide

5.7 SUMMARY

5.7.1 FOR MU LAS

u Factorial: ( ) ( )n n n n!= ⋅ − ⋅ − ⋅ ⋅ ⋅1 2 2 1K

u Permutations: ( )( )

( )( ) ( )P n rn

n rn n n n r,

!

!=

−= − − − +1 2 1K , where n is the number of

objects and r is the number selected.

u Permutations with Repetitions: n

n n nr

!

! ! !1 2 K where you have n objects of which n1

are alike, n2 are alike, . . ., nr are alike.

u Combinations: ( )

( )n

rCP n r

r

n

r n r

n

r= =

−=

,

!

!

! !, where n is the number of objects taken

r at a time.

u Combinations with repetitions: n rrC+ −1 , where n is the number of elements and r

is number of selections.

u Number of Partitions: The number of ways to partition a set with n elements intok blocks is given by ( )S n k, , where ( )S n k, satisfies the following recurrence relation:

1. ( )S n, 1 1= and ( )S n n, ,= 1 for all n ≥ 1

2. ( ) ( ) ( ) ( )S n k k S n k S n k+ + = + + +1 1 1 1, , , , for n ≥ 1 and 1≤ ≤k n

5.7.2 THEO REMS

l Pigeonhole Principle: If n pigeonholes are occupied by n+1 or more pigeons, then at least one pigeonhole is occupied by more than one pigeon.

l Generalized Pigeonhole Principle: If n pigeonholes are occupied by kn+1 ormore pigeons, where k is a positive integer, then at least one pigeonhole isoccupied by k +1 or more pigeons.

l For any finite set A, B, and C we have

| | | | | | | | | | | | | | | |A B C A B C A B A C B C A B C∪ ∪ = + + − ∩ − ∩ − ∩ − ∩ ∩

l Suppose there are n objects, of which n1 objects are of type 1, n2 objects are of type

2, and so on, up to n r objects of type r. Then there are ( )( ) ( )n

n n nr

!

! ! !1 2 K distinct

patterns that can be formed with the n objects. Moreover, each pattern appearsexactly ( )( ) ( )n n nr1 2! ! !K times among the n ! permutations.

l The number of ways to partition a set with n elements into k blocks is given by ( )S n k, , where ( )S n k, satisfies the following recurrence relation:

1. ( )S n, 1 1= and ( )S n n, ,= 1 for all n ≥ 1

2. ( ) ( ) ( ) ( )S n k k S n k S n k+ + = + + +1 1 1 1, , , , for n ≥ 1 and 1≤ ≤k n

5-10

CHAP TER 5: COM BI NA TOR ICS CS218

Page 100: C2004 Study Guide

5.7.3 RE MARKS

l Sum rule: If one event can occur in n1 ways, a second event can occur in n2 (different) ways, a third event can occur in n3 (still different) ways, . . ., then there are n n n1 2 3+ + + ... ways in which (exactly) one of the events can occur.

l Product rule: If something can happen in n1 ways, and no matter how the first thing happens, a second thing can happen in n2 ways, and no matter how the first two things happen, a third thing can happen in n3 ways, and. . ., then all the things together can happen in n n n1 2 3× × × ... ways.

l 0 1!= 1 1!= and ( )n n n! != ⋅ −1

l k-permutations can be written as nkP , n kP , or as ( )P n k,

l k-combinations can be written as nkC , n kC ,

n

k

or as ( )C n k,

l k-selections are also called combinations with repetitions.

5.7.4 TA BLE

Order matters Order doesn’t matter

Elements repeated n k n kkC+ −1

Elements not repeated ( )( )P n k

n

n k,

!

!=

−( ) ( )C n k

n

n k k,

!

! !=

5-11

CS218 CHAP TER 5: COMBINATORICS

Page 101: C2004 Study Guide

5.8 COMBINATORICS EXERCISES

u Compute.

1. ( )P 20 17, 2. ( )C 13 9, 3.7

5

4. 7

5P 5. 7 5 15

+ − C 6. ( )S 6 4,

u Let { }S = 1 2 3 4, , , , using the correct formula find the number of:

7. 2-samples

8. 2-selections

9. 2-permutations

10. 2-combinations

u Permutations

11. There are four bus lines between A and B; and three bus lines between B and C. In how many ways can a man travel

(a) by bus from A to C by way of B?

(b) round-trip by bus from A to C by way of B?

(c) round-trip by bus from A to C by way of B, if he does not want to use a bus line more than once?

12. Suppose repetitions are not permitted.

(a) how many three-digit numbers can be formed from the six digits 2, 3, 5, 6, 7, and 9?

(b) How many of these numbers are less than 400?

(c) How many are even?

13. Find the number of ways that a party of seven persons can arrange themselves:

(a) in a row of seven chairs

(b) around a circular table

14. Find the number of distinct permutations that can be formed from the letters of the following words:

(a) RADAR

(b) UNUSUAL

(c) MISSISSIPPI

(d) COMPILER

(e) DISCRETE

15. In how many ways can four mathematics books, three history books, three chemistry books, and two sociology books be arranged on a shelf so that all books of the same subject are together?

5-12

CHAP TER 5: COMBINATORICS CS218

Page 102: C2004 Study Guide

16. Find n if:

(a) P n( , )2 72=

(b) P n P n( , ) ( , )4 42 2=

(c) 2 2 50 2 2P n P n( , ) ( , )+ =

u Combinations

17. In how many ways can a committee consisting of three men and two women be chosen from seven men and five women?

18. A bag contains six white marbles and five red marbles. Find the number of ways four marbles can be drawn from the bag if

(a) they can be any colour

(b) two must be white and two red

(c) they must all be of the same colour

19. How many committees of five with a given chairperson can be selected from 12 persons?

u Ordered and Unordered Partitions

20. In how many ways can nine students be partitioned into three teams containing four, three, and two students, respectively?

21. There are 12 students in a class. In how many ways can the 12 students take four different tests if three students are to take each test?

22. In how many ways can 12 students be partitioned into four teams, A A A1 2 3, , , and A4 , so that each team contains three students.

u The Pigeonhole Principle

23. Assume there are n distinct pairs of shoes in a closet. Show that if you choose n+1 single shoes at random from the closet, you are certain to have a pair.

24. Assume there are three men and five women at a party. Show that if these people are lined up in a row, at least two women will be next to each other.

25. Find the minimum number of students needed to guarantee that five of them belong to the same class (sec1, sec2, sec3, sec4).

26. Let L be a list (not necessarily in alphabetical order) of the 26 letters in the English alphabet (which consists of 5 vowels, A, E, I, O, U, and 21 consonants).

(a) Show that L has a sublist consisting of four or more consecutive consonants.

(b) Assuming L begins with a vowel, say A, show that L has a sublist consisting of five or more consecutive consonants.

5-13

CS218 CHAP TER 5: COMBINATORICS

Page 103: C2004 Study Guide

27. Find the minimum number n of integers to be selected from S = { , , , }1 2 9K so that:

(a) the sum of two of the n integers is even

(b) the difference of two of the n integers is 5

u The Inclusion-Exclusion Principle

28. There are 22 female students and 18 male students in a classroom. How many students are there in total?

29. Of 32 people who save paper or bottles (or both) for recycling, 30 save paper and 14 save bottles. Find the number m of people who

(a) save both

(b) save only paper

(c) save only bottles

30. Find the number N of students in a centre given the data:

12 take AP207, 5 take AP207, CS202, 3 take AP207, CS202, MA214, 20 take CS202, 7 take AP207, MA214, 2 take AP207, CS202, SA205,20 take MA214, 4 take AP207, SA205, 2 take CS202, MA214, SA205, 8 take SA205, 16 take CS202, MA214, 3 take AP207, MA214, SA205,

4 take CS202, SA205, 2 take all four 3 take MA214, SA205, 71take none.

u Miscellaneous Problems

31. A student must take five classes from three areas of study. Numerous classes are offered in each discipline, but the student cannot take more than two classes in any given area.

(a) Using the pigeonhole principle, show that the student will take at least two classes in one area.

(b) Using the inclusion-exclusion principle, show that the student will have to take at least one class in each area.

32. How many different 7-card hands can be drawn from a standard 52-card deck?

33. How many different 3-note sequences can be formed from an 8-note scale?

34. A hockey team has ten players who want to play in the front line. How many distinct 3-player lines can be formed?

35. A certain software package has three main modules. To configure the package, users must choose among options given for each module. If the first module has four options, the second five options, and the third three options, how many different sets of options are supported?

36. How many distinct 5-card poker hands are there?

37. Are there more 4-samples or more 4-selections from a set with six elements?

5-14

CHAP TER 5: COMBINATORICS CS218

Page 104: C2004 Study Guide

38. A salesperson is to visit eight different cities exactly once. In how many different ways can this be done?

39. Three exams are to be scheduled during a four-day period, with at most one exam per day. In how many ways can this be accomplished?

40. Find the number of patterns that can be formed by permuting the letters of the word reentrant?

41. How many ways can a set with three elements be partitioned?

42. There are four groups of students of size 5, 8, 4, and 6. A team of 10 students is selected such that there are at least two students from each group. How many different teams can be formed?

43. A committee of three has to elected from a group of 9 people. This group consists of 5 men and 4 women. How many different committees can be can be formed?

44. A committee consists of a chairperson and 3 members. Given that the chairperson must be a man and no more than 2 members are male, how many ways can a committee be formed from 4 men and 3 women?

45. A committee consists of a chairperson, a vice chairperson, a secretary, a treasurer and a member. If the chairperson is male then the vice chairperson will be female and vice versa. The secretary must be female. In how many ways can the committee be formed if there are four males and four females?

46. A box contains eight black balls and six white balls. In how many ways can four balls be chosen so that:

(a) exactly two black balls are chosen.

(b) at least three black balls are chosen.

(c) at least one white ball is chosen.

47. A box contains nine red balls and eight blue balls and seven white balls. In how many ways can you draw three balls given:

(a) that the three balls are all the same colour.

(b) that you replace the balls after drawing them and all the balls are the same colour?

(c) that all three balls are a different colour?

(d) that you replace the balls after drawing them and that all the balls are a different colour?

48. Three officers, a president, a secretary and a treasurer are to be chosen from among four people: Alan, Brian, Cindy, and Dan. Suppose that Brian cannot be treasurer, and Cindy cannot be secretary. How many ways can the officers be chosen?

49. A sample of 80 car owners revealed that 24 owned station wagons and 62 owned cars which are not station wagons. Find the number k of people who owned both a station wagon and some other car.

5-15

CS218 CHAP TER 5: COMBINATORICS

Page 105: C2004 Study Guide

50. An examination paper consists of 3 questions in section A and 5 questions in section B. A total of 5 questions must be answered. In how many ways can you select the questions if:

(a) you can choose any number of questions from section A or B?

(b) you are to answer not more than 2 questions from section A?

(c) you must answer 2 questions from section A.

51. Suppose 12 people read the Wall Street Journal (W) or Business Week (B) or both. Given three people read only the Journal and six read both, find the number k of people who read only Business Week .

52. Show that any set of seven distinct integers insludes two integers, x and y, such that either x y+ or x y− is divisible by 10.

53. Consider a tournament in which each of n players plays against every player and each player wins at least once. Show that there are at least two players having the same number of wins.

54. Suppose that there are 8 runners in a race. The awards given are gold for the winner, silver for the person who comes second, and bronze for the person who comes third. How many different ways are there to award these medals if all possible outcomes of the race can occur?

55. Given a bit-string of length 10:

a) How many possible bit-strings begin wiht three 0’s?

b) How many possible bit-strings end with two 0’s?

c) How many possible bit-strings begin wiht three 0’s and end with two 0’s?

d) How many possible bit-strings either begin with three 0’s or end with two 0’s?

56. How many 6-digit postal codes are there if the first two digits and the last three digits cannot be 0?

57. A box contains eight black balls and six white balls. In how many ways can four balls be chosen so that:

a) exactly two black balls are chosen?

b) at least three black balls are chosen?

c) at most one white ball is chosen?

58. A multiple choice test contains 10 questions; there are 4 possible answers for each question.

a) How many ways can a student answer the questions on the test if every question is answered?

b) How many ways can a student answer the questions on the test if the students can leave answers blank?

59. A palindrome is a string whose reversal is identical to the string. How many different bit strings of length n are palindromes?

5-16

CHAP TER 5: COMBINATORICS CS218

Page 106: C2004 Study Guide

60. How many bit strings contain exactly eight 0’s and ten 1’s if every 0 must be followed immediately by a 1?

61. Suppose that a department contains 10 men and 15 women. How many ways are there to form a committee with 6 members if it must have the same number of men and women?

5-17

CS218 CHAP TER 5: COMBINATORICS

Page 107: C2004 Study Guide

CHAPTER 6: PROBABILITY

Chapter Objectives

In this chapter, you will be learn:

§ what sample spaces and events are;

§ what makes an event mutually exclusive;

§ some probability properties;

§ what probability is;

§ how to find the probability of some event;

§ how to find the probability of an event given another event has occurred;

§ about the multiplication theorem for probability;

§ what a stochastic process is;

§ how to use a tree diagram;

§ what makes an event independent;

§ what repeated trials are;

§ what a random variable is;

§ about distributions and expected values;

§ how to determine variance and standard deviation;

§ about Binomial distributions;

6 - 1

Page 108: C2004 Study Guide

6.1 INTRODUCTION TO PROBABILITY

u Probability is the study of random or non-deterministic experiments. It is usuallyassociated with games of chance.

6.1.1 SAM PLE SPACES AND EVENTS

u The set S of all possible outcomes of some given experiment is called the samplespace.

u A particular outcome, i.e., an element in S, is called a sample point.

u An event A is a set of outcomes or, in other words, a subset of the sample space S.

u The event { }a consisting of a single sample a S∈ is called an elementary event.

u The empty set ∅ and S itself are events; ∅ is called the impossible event, and S thecertain or sure event.

u Since an event is a set, we can combine events to form new events using the variousset operations:

(i) A B∪ is the event that occurs if A occurs or B occurs (or both);

(ii) A B∩ is the event that occurs if A occurs and B occurs;

(iii) A c , the complement of A is the event that occurs if A does not occur.

u Two events A and B are called mutually exclusive if they are disjoint, i.e. if A B∩ = ∅. In other words, A and B are mutually exclusive if they cannot occursimultaneously.

Example 1: Toss a die and observe the number that appears on top.

The sample space S consists of the six possible numbers; that is, S = { , , , , , }1 2 3 4 5 6

Let A be the event that an even number occurs, B that an odd number occurs, and C that a prime number occurs; that is, let

A B C= = ={ , , } { , , } { , , }2 4 6 1 3 5 2 3 5

Then

A C∪ = { , , , , }2 3 4 5 6 is the event that an even or a prime number occurs.

B C∩ = { , }3 5 is the event that an odd prime number occurs.

C c = { , , }1 4 6 is the event that a prime number does not occur.

Note that A and B are mutually exclusive: A B∩ = ∅. In other words, an even number and an odd number cannot occur simultaneously.

l Remark 1: The probability of an event can be thought of as “a favourable

outcome” over “all possible outcomes,” i.e. favorable

total

6 - 2

CHAPTER 6: PROBABILITY CS218

Page 109: C2004 Study Guide

6.1.2 THE OREMS OF PROB ABIL ITY

l Theorem 1: Let S be a sample space, let E be the class of events, and let P be a real-valued function defined on E. Then P is called aprobability function, and ( )P A is called the probability of the event A if the following axioms hold:

[ ]P1 For every event ( )A P A, 0 1≤ ≤

[ ]P2( )P S = 1

[ ]P3 If A and B are mutually exclusive events, then ( ) ( ) ( )P A B P A P B∪ = +

[ ]P4 If A A1 2, ,K is a sequence of mutually exclusive events, then P A A P A P A( ) ( ) ( )1 2 1 2∪ ∪ = + +K K

l Theorem 2: If ∅ is the empty set, then ( )P ∅ = 0

l Theorem 3: If A c is the complement of an event A, then P A P Ac( ) ( )= −1

l Theorem 4: If A B⊆ , then ( ) ( )P A P B≤

l Theorem 5: If A and B are any two events, then ( ) ( ) ( )P A B P A P A B\ = − ∩

l Theorem 6: If A and B are any two events, then ( ) ( ) ( ) ( )P A B P A P B P A B∪ = + − ∩

6.2 TYPES OF SAMPLE SPACES

6.2.1 FI NITE PROB ABIL ITY SPACES

u Let S be a finite sample space; say, { }S a a an= 1 2, , ,K . A finite probability space isobtained by assigning to each point a Si ∈ a real number p i , called the probability of ai , satisfying the following properties:

(i) each p i is nonnegative, p i ≥ 0

(ii) the sum of the p i is one, p p pi n+ + + =2 1K

The probability ( )P A of any event A, is then defined to be the sum of the probabilities of the points in A

Example 2: Three horses A, B, and C are in a race; A is twice as likely to win as B and B is twice as likely to win as C. What are their respective probabilities of winning, i.e. ( ) ( ) ( )P A P B P C, , and ?

Let ( )P C p= ; since B is twice as likely to win as C, ( )P B p= 2 ; and since A is twice as likely to win as B, ( ) ( ) ( )P A P B p p= = =2 2 2 4 . Now the sum of the probabilities must be 1; hence p p p+ + =2 4 1 or 7 1p = or p = 1

7 Accordingly, ( )P A p= =4 4

7 , ( )P B p= =2 27, ( )P C p= = 1

7

Example 3: What is the probability that horse B or C wins from example 2?

By definition P B C P B P C P B C( ) ( ) ( ) ( )∪ = + − ∩ = + − =27

17

370

6 - 3

CS218 CHAPTER 6: PROBABILITY

Page 110: C2004 Study Guide

6.2.2 FI NITE EQUI PROB ABLE SPACES

u Frequently, the physical characteristics of an experiment suggest that the variousoutcomes of the sample space be assigned equal probabilities. Such a finiteprobability space S, where each sample point has the same probability, will be calledan equiprobable or uniform space. In particular, if S contains n points then theprobability of each point is 1 n. Furthermore, if an event A contains r points then itsprobability is r n

rn⋅ =1 . In other words,

( )P AA

S=

number of elements in

number of elements in

or

( )P AA

=number of ways that the event can occur

number of ways that the sample space can occurS

u It must be emphasized that the above formula for ( )P A can only be used with respectto an equiprobable space, i.e. that each sample point in S must have the sameprobability.

u The expression “ at random” will be used only with respect to an equiprobable space; formally the statement “choose a point at random from a set S” shall mean that S isan equiprobable space, i.e. that each sample point in S has the same probability.

Example 4: Let a card be selected at random from an ordinary pack of 52 cards. Let { }A = the card is a spade and { }B = the card is a face card . What is

( ) ( )P A P B, and ( )P A B∩ ?

Since we have an equiprobable space,

( )P A =number of spades

number of cards = =

13

52

1

4

( )P B = = =number of face cards

number of cards

12

52

3

13

( )P A B∩ = =number of spade face cards

number of cards

3

52

Example 5: Let 2 items be chosen at random from a lot containing 12 items of which 4 are defective. Let A = {both items are defective} and B = {both items are not defective}. Find ( )P A and ( )P B .

S can occur in 122C = 66 ways, the number of ways that 2 items can be chosen

from 12 items;

A can occur in 42C = 6 ways, the number of ways that 2 defective items can

be chosen from 4 defective items;

B can occur in 82 28C = ways, the number of ways that 2 non-defective items

can be chosen from 8 non-defective items.

Accordingly, ( )P A = =6

66

1

11 and ( )P B = =

28

66

14

33

6 - 4

CHAPTER 6: PROBABILITY CS218

Page 111: C2004 Study Guide

Example 6: What is the probability that at least one item is defective from example 5?

{ }C = at least one item is defective is the complement of B; that is, C B c=

Thus by theorem 6.2, ( ) ( ) ( )P C P B P Bc= = − = − =1 114

33

19

33

l Remark 2: The odds that an event with probability p occurs is defined to be the ratio ( )p p: 1−

Example 7: What are the odds that at least one item is defective from example 5?

The odds that at least one item is defective are 19

33

14

33⋅ or 19 14: which

is read “19 to 14”

6.3 CONDITIONAL PROBABILITY

u Let E be an arbitrary event in a sample space S with ( )P E > 0. The probability that anevent A occurs once E has occurred or, in other words, the conditional probabilityof A given E, written ( )P A E| , is defined as follows:

( )( )

( )P A EP A E

P E| =

l Theorem 7: Let S be a finite equiprobable space with events A and E.

Then ( )P A EA E

E| =

∩number of elements in

number of elements in

or ( )P A EA E

E| =

number of ways and can occur

number of ways can occur

Example 8: Let a pair of fair dice be tossed. If the sum is 6, find the probability that one of the dice is 2. In other words, if

{ } ( ) ( ) ( ) ( ) ( ){ }E = =sum is 6 1 5 2 4 3 3 4 2 5 1, , , , , , , , , and

{ }A = a 2appears on at least one die find ( )P A E| and P A( )

Now E consists of five elements and two of them, ( )2 4, and ( )4 2, , belong

to A: ( ) ( ){ }A E∩ = =2 4 4 22

36, , , and P E( ) =

5

36

Then ( )P A EP A E

P E|

( )

( )=

∩= =

236

536

25

6 - 5

CS218 CHAPTER 6: PROBABILITY

Page 112: C2004 Study Guide

Example 9: A man visits a couple who have two children. One of the children, a boy, comes into the room. Find the probability p that the other child is also a boy if (i) the other child is known to be younger, (ii) nothing is known about the other child.

The sample space for the sex of two children is { }S bb bg gb gg= , , , with probability 1

4 for each point. (Here the sequence of each point corresponds to the sequence of births).

(i) The reduced sample space consists of two elements, { }bb bg, ; hence p = 12

(ii) The reduced sample space consists of three elements, { }bb bg gb, , ; hence p = 1

3

6.3.1 MUL TI PLI CA TION THEO REM

l Multiplication Theorem: ( ) ( ) ( )P E A P E P A E∩ = |

l Corollary: For any events A A An1 2, , ,K ,

( )P A A An1 2∩ ∩ ∩K

( ) ( ) ( ) ( )= ∩ ∩ ∩ ∩ −P A P A A P A A A P A A A An n1 2 1 3 1 2 1 2 1| | |K K

Example 10: A lot contains 12 items of which 4 are defective. Three items are drawn at random from the lot one after the other. Find the probability p that all three are not defective.

The probability that the first item is not defective is 812 since 8 of 12 items are

not defective. If the first item is not defective, then the probability that the next item is not defective is 7

11 since only 7 of the remaining 11 items are notdefective. If the first two items are not defective, then the probability that the last item is not defective is 6

10 since only 6 of the remaining 10 items are now not defective. Thus by the multiplication theorem, p = ⋅ ⋅ =8

12711

610

1455

6.3.2 STO CHAS TIC PROC ESSES & TREE DIA GRAMS

u A (finite) sequence of experiments in which each experiment has a finite number ofoutcomes with given probabilities is called a (finite) stochastic process. Aconvenient way of describing such a process and computing the probability of anyevent is by a tree diagram. The multiplication theorem is also used to compute theprobability that the result represented by any given path of the tree does occur.

Example 11: We are given three boxes as follows:

Box I has 10 light bulbs of which 4 are defective.Box II has 6 light bulbs of which 1 is defective.Box III has 8 light bulbs of which 3 are defective.

We select a box at random and then draw a bulb at random. What is the probability p that the bulb is defective?

Here we perform a sequence of two experiments:

(i) select one of the three boxes;(ii) select a bulb which is either defective (D) or not defective (N)

6 - 6

CHAPTER 6: PROBABILITY CS218

Page 113: C2004 Study Guide

The following tree diagram describes this process and gives the probability of each branch of the tree:

The probability that any particular path of the tree occurs is, by the multiplication theorem, the product of the probabilities of each branch of the path, i.e., the probability of selecting box I and then a defective bulb is 1

325

215⋅ =

Now since there are three mutually exclusive paths which lead to a defective bulb, the sum of the probabilities of these paths is the required probability: p = ⋅ + ⋅ + ⋅ =1

325

13

16

13

38

113360

Example 12: A coin, weighted so that ( )P H = 23 and ( )P T = 1

3, is tossed. If heads appears, then a number is selected at random from the numbers 1 through 9; if tails appears, then a number is selected at random from the numbers 1 through 5. Find the probability p that an even number is selected.

The tree diagram with respective probabilities is

Note that the probability of selecting an even number from the numbers 1 through 9 is 4

9 since there are 4 even numbers out of the 9 numbers, whereas the probability of selecting an even number from the numbers 1 through 5 is 2

5 since there are 2 even numbers out of the 5 numbers. Two of the paths lead to an even number: HE and TE. Thus ( )p P E= = ⋅ + ⋅ =2

349

13

25

58135

6.4 INDEPENDENCE

u An event B is said to be independent of an event A if the probability that B occurs isnot influenced by whether A has or has not occurred. Formally:

Events A and B are independent if ( ) ( ) ( )P A B P A P B∩ = ; otherwise they are dependent.

6 - 7

CS218 CHAPTER 6: PROBABILITY

Page 114: C2004 Study Guide

Example 13: Let a fair coin be tossed three times; we obtain the equiprobable space { }S = HHH, HHT, HTH, HTT, THH, THT, TTH, TTT . Consider the events { }A = first toss is heads , { }B = second toss is heads ,

{ }C = exactly two heads are tossed in a row . Show that A and B and A and C are independent events, and that B and C are dependent events.

We have ( ) { }( )P A P= HHH, HHT, HTH, HTT = =48

12

( ) { }( )P B P= HHH, HHT, THH, THT = =48

12

( ) { }( )P C P= = =HHT, THH 28

14

Then ( ) { }( )P A B P∩ = =HHH, HHT 14

( ) { }( )P A C P∩ = =HHT 18

( ) { }( )P B C P∩ = =HHT, THH 14

Accordingly, ( ) ( ) ( )P A P B P A B= ⋅ = = ∩12

12

14 , and so A and B are independent;

( ) ( ) ( )P A P C P A C= ⋅ = = ∩12

14

18 , and so A and C are independent;

( ) ( ) ( )P B P C P B C= ⋅ = ≠ ∩12

14

18 , and so B and C are dependent.

u Frequently, we will postulate that two events are independent, or it will be clear fromthe nature of the experiment that two events are independent.

Example 14: The probability that A hits a target is 14 and the probability that B

hits it is 25. What is the probability that the target will be hit if A and

B each shoot at the target?

We are given that ( )P A = 14 and ( )P B = 2

5, and we seek ( )P A B∪ . Furthermore, the probability that A or B hits the target is not influenced by what the other does; that is, the event that A hits the target is independent of the event that Bhits the target; ( ) ( ) ( )P A B P A P B∩ = . Thus

( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )P A B P A P B P A B P A P B P A P B∪ = + − ∩ = + − = + − ⋅ =14

25

14

25

1120

l Remark 3: Three events A, B, and C are independent if:

(i) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )P A B P A P B P A C P A P C P B C P B P C∩ = ∩ = ∩ =, and

i.e. if the events are pairwise independent, and

(ii) ( ) ( ) ( ) ( )P A B C P A P B P C∩ ∩ =

u Condition (ii) does not follow from condition (i); in other words, three events may bepairwise independent but not independent themselves, as is shown in the nextexample.

Example 15: Let a pair of fair coins be tossed; here { }S = HH, HT, TH, TT is an equiprobable space. Consider the events

{ } { }A = =heads on the first coin HH, HT

{ } { }B = =heads on the second coin HH, TH

{ } { }C = =heads on exactly one coin HT, TH

6 - 8

CHAPTER 6: PROBABILITY CS218

Page 115: C2004 Study Guide

Show that A, B, and C are pairwise independent, but are not independent.

In order to show pairwise independence we must find P A( ), P B( ) and P C( ), and show that P A B P A P B( ) ( ) ( )∩ = , P A C P A P C( ) ( ) ( )∩ = and P B C P B P C( ) ( ) ( )∩ =

Well ( ) ( ) ( )P A P B P C= = = =24

12, and ( ) { }( )P A B P∩ = =HH 1

4,

( ) { }( )P A C P∩ = =HT 14, ( ) { }( )P B C P∩ = =TH 1

4. Since 12

12

14⋅ = condition (i)

in remark 3 is satisfied; so A, B, and C are pairwise independent.

For independence ( ) ( ) ( ) ( )P A B C P A P B P C∩ ∩ = , must be true, but A B C∩ ∩ = ∅ and so ( )P A B C∩ ∩ ( )= ∅P = 0 ( ) ( ) ( )≠ P A P B P C . In other words, condition (ii) is not satisfied and so the events are not independent.

6.5 REPEATED TRIALS

u Let S be a finite probability space. By n independent or repeated trials , we meanthe probability space T consisting of ordered n-tuples of elements of S with theprobability of an n-tuple defined to be the product of the probabilities of its components: ( )( ) ( ) ( ) ( )P s s s P s P s P sn n1 2 1 2, , ,K K=

Example 16: Whenever three horses a, b, and c race together, their respective probabilities of winning are 1

213, and 1

6. In other words, { }S a b c= , , with ( )P a = 1

2, ( )P b = 13 and ( )P c = 1

6. If the horses race twice, what is the probability of horse a winning the first race and horse c winning the second race?

The sample space is { }T aa ab ac ba bb bc ca cb cc= , , , , , , , , for the 2 repeated trials, where to simplify things we write ac for the ordered pair ( )a c, . The probability of ac is ( ) ( ) ( )P ac P a P c= = ⋅ =1

216

112

6.6 RANDOM VARIABLES

u A random variable X is a rule that assigns a numerical value to each outcome in asample space S.

6.6.1 DIS TRI BU TION AND EX PEC TA TION

u Let X be a random variable on a sample space S with a finite image set; say ( ) { }X S x x xn= 1 2, , ,K . We make ( )X S into a probability space by defining the

probability of xi to be ( )P X x i= which we write as ( )f x i . This function f on ( )X S , i.e.defined by ( ) ( )f x P X xi i= = , is called the distribution or probability function ofX and is usually given in the form of a table:

x1 x2L xn

( )f x1 ( )f x 2L ( )f xn

The distribution f satisfies the conditions

(i) ( )f xi ≥ 0 and (ii) ( )f xii

n

==

∑ 11

6 - 9

CS218 CHAPTER 6: PROBABILITY

Page 116: C2004 Study Guide

u Now if X is a random variable with the above distribution, then the mean orexpectation or expected value of X, denoted by ( )E X or µ, is defined by

( ) ( ) ( ) ( ) ( )E X x f x x f x x f x x f xn n i ii

n

= + + + ==∑1 1 2 2

1K

That is, ( )E X is the weighted average of the possible values of X, each value weighted by its probability.

Example 17: A pair of fair dice is tossed. We obtain the finite equiproable space Sconsisting of the 36 ordered pairs of numbers between 1 and 6:

( ) ( ) ( ){ }S = 1 1 1 2 6 6, , , , , ,K

Let X assign to each point ( )a b, in S the maximum of its numbers, i.e. ( ) ( )X a b a b, max ,= . X is a random variable with the image set

( ) { }X S = 1 2 3 4 5 6, , , , ,

Compute the distribution f of X, and the mean of X.

The distribution f of X is:

( ) ( ) ( ){ }( )f P X P1 1 1 1 136= = = =,

( ) ( ) ( ) ( ) ( ){ }( )f P X P2 2 2 1 2 2 1 2 336= = = =, , , , ,

( ) ( ) ( ) ( ) ( ) ( ) ( ){ }( )f P X P3 3 3 1 3 2 3 3 2 3 1 3 536= = = =, , , , , , , , ,

( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ){ }( )f P X P4 4 4 1 4 2 4 3 4 4 3 4 2 4 1 4 736= = = =, , , , , , , , , , , , ,

Similarly,

( ) ( )f P X5 5 936= = = and ( ) ( )f P X6 6 11

36= = =

This information is put in the form of a table as follows:

xi 1 2 3 4 5 6( )f x i

136

336

536

736

936

1136

We next compute the mean of X:

( ) ( )E X x f xi ii

= = ⋅ + ⋅ + ⋅ + ⋅ + ⋅ + ⋅=

∑ 1 2 3 4 5 6136

336

536

736

936

1136

1

6

= 16136 = 4 47.

Example 18: Let Y assign to each point ( )a b, in ( ) ( ) ( ){ }S = 1 1 1 2 6 6, , , , , ,K the sum

of its numbers, i.e. ( )Y a b a b, = + . Then Y is also a random variable on S with the image set ( ) { }Y S = 2 3 4 5 6 7 8 9 10 11 12, , , , , , , , , , . Compute the distribution g and mean of Y

The distribution g of Y is:

yi 2 3 4 5 6 7 8 9 10 11 12

( )g yi1

36236

336

436

536

636

536

436

336

236

136

The mean of Y is:

( ) ( )E Y y g yi ii

= = ⋅ + ⋅ + + ⋅ ==

∑ 2 3 12 7136

236

136

1

12

K

6 - 10

CHAPTER 6: PROBABILITY CS218

Page 117: C2004 Study Guide

Example 19: A coin weighted so that ( )P H = 23 and ( )P T = 1

3 is tossed three times. The probabilities of the points in the sample space

{ }S = HHH, HHT, HTH, HTT, THH, THT, TTH, TTT are as follows:

( )P HHH = ⋅ ⋅ =23

23

23

827 ( )P THH = ⋅ ⋅ =1

323

23

427 ( )P HHT = ⋅ ⋅ =2

323

13

427

( )P THT = ⋅ ⋅ =13

23

13

227 ( )P HTH = ⋅ ⋅ =2

313

23

427 ( )P TTH = ⋅ ⋅ =1

313

23

227

( )P HTT = ⋅ ⋅ =23

13

13

227 ( )P TTT = ⋅ ⋅ =1

313

13

127

Let X be the random variable which assigns to each point in S the largest number of successive heads which occurs. Find the distribution f of X.

The distribution f of X is:

( ) ( )f P0 127= =TTT

( ) { }( )f P1 427

227

227

227

1027= = + + + =HTH, HTT, THT, TTH

( ) { }( )f P2 427

427

827= = + =HHT, THH

( ) ( )f P3 827= =HHH

Which is put in a table as:

x i 0 1 2 3

( )f xi127

1027

827

827

Example 20: What is the mean of X in example 19?

The number of times we get a successive head is as follows:

( )X TTT = 0, ( ) ( ) ( ) ( )X X X XHTH HTT THT TTH= = = = 1, ( ) ( )X XHHT THH= = 2, and ( )X HHH = 3

So the mean is computed as:

( ) ( )E X x f xi i= = ⋅ + ⋅ + ⋅ + ⋅ = =∑ 0 1 2 3 185127

1027

827

827

5027 .

Example 21: A sample of 3 items is selected at random from a box containing 12 items of which 3 are defective. Find the expected number E of defective items.

The sample space S consists of the 12

3220

= distinct equally likely samples of

size 3. Note that there are:

9

384

= samples with no defective items;

39

2108⋅

= samples with 1 defective item;

6 - 11

CS218 CHAPTER 6: PROBABILITY

Page 118: C2004 Study Guide

93

227⋅

= samples with 2 defective items;

3

31

= sample with 3 defective items;

Thus the probability of getting 0, 1, 2, and 3 defective items is respectively 84220

108220

27220, , , and 1

220. Thus the expected number E of defective items is E = ⋅ + ⋅ + ⋅ + ⋅ = =0 1 2 3 07584

220108220

27220

1220

165220 .

6.6.2 VARI ANCE AND STAN DARD DE VIA TION

u The mean of a random variable X measures, in a certain sense, the “average” value ofX. The variance of X measures the “spread” or “dispersion” of X

u Let X be a random variable with the following distribution:

x1 x2L xn

( )f x1 ( )f x 2L ( )f xn

Then the variance of X, denoted by Var(X), is defined by

Var(X) ( ) ( ) ( )( )= − = −=∑ x f x E Xi ii

n

µ µ2 2

1

where µ is the mean of X

u The standard deviation of X, denoted by σX , is the (nonnegative) square root ofVar(X):

( )σX X= Var

u The following theorem gives an alternate and sometimes more useful formula forcalculating the variance of the random variable X.

l Theorem 9: Var(X) ( ) ( )= − = −=∑ x f x E Xi ii

n2 2 2 2

1µ µ

Example 22: Consider the random variable X from example 17 (which assigned the maximum of the numbers showing on a pair of dice). Compute the variance and standard deviation of X.

The distribution of X is:

xi 1 2 3 4 5 6( )f x i

136

336

536

736

936

1136

and the mean of X is 4.47 First we need to compute ( )E X 2 :

( ) ( )E X x f xi i2 2 2 1

362 3

362 5

362 7

362 9

362 11 2 3 4 5 6= = ⋅ + ⋅ + ⋅ + ⋅ + ⋅ + ⋅ 1

361

6

i=∑ = =791

36 2197.

Hence ( ) ( )Var X E X X= − = − =2 2 2197 1998 199µ . . . and σX = =199 14. .

6 - 12

CHAPTER 6: PROBABILITY CS218

Page 119: C2004 Study Guide

Example 23: Compute the variance and standard deviation of Y the random variable of example 18 (which assigned the sum of the numbers showing on a pair of dice).

The distribution of Y is:

yi 2 3 4 5 6 7 8 9 10 11 12( )g yi

136

236

336

436

536

636

536

436

336

236

136

and the mean of Y is 7. First compute ( )E Y 2 :

( ) ( )E Y y g yi i2 2 2 1

362 2

362 1

361974362 3 12 54 8= = ⋅ + ⋅ + + ⋅ = =∑ K .

Hence ( ) ( )Var Y E Y Y= − = − =2 2 54 8 49 58µ . . and σY = =58 24. .

6.7 BINOMIAL DISTRIBUTIONS

u We are looking at repeated and independent trials of an experiment with twooutcomes; we call one of the outcomes success and the other outcome failure. Let pbe the probability of success, so that q p= −1 is the probability of failure.

u If we are interested in the number of successes and not in the order in which theyoccur, then the following theorem applies.

l Theorem 10: The probability of exactly k successes in n repeated trials isdenoted and given by ( ) ( )b k n p p qk

n k n k; , = −

u Here ( )kn is the binomial coefficient. Observe that the probability of no successes is

q n, and therefore the probability of at least one success is 1− q n

Example 24: A fair coin is tossed 6 times or, equivalently, six fair coins are tossed; call heads a success. Then n = 6 and p q= = 1

2

Find (i) The probability that exactly two heads occur.(ii) The probability of getting at least four heads.(iii) The probability of no heads.

(i) The probability that exactly two heads occurs, (i.e. k = 2) is ( ) ( )( ) ( )b 2 6 1

2 26 1

22 1

24 15

64; , = =

(ii) The probability of getting at least four heads (i.e. k = 4 5 6, or ) is ( ) ( ) ( ) ( )( ) ( ) ( )( ) ( ) ( )( )b b b4 6 5 6 6 61

212

12 4

6 12

4 12

2

56 1

25 1

2 66 1

26

; , ; , ; ,+ + = + += + + =15

64664

164

1132

(iii) The probability of no heads (i.e. all failures) is ( )q 6 12

6 164= = , and so the

probability of at least one head is 1 16 164

6364− = − =q

Example 25: A fair die is tossed 7 times; call a toss a success if a 5 or a 6 appears. Then { }( )n p P= = =7 5 6 1

3, , and q p= − =1 23

Find (i) The probability that a 5 or a 6 occurs exactly 3 times.(ii) The probability that a 5 or a 6 never occurs.

6 - 13

CS218 CHAPTER 6: PROBABILITY

Page 120: C2004 Study Guide

(i) The probability that a 5 or a 6 occurs exactly 3 times (i.e. k = 3) is ( ) ( )( ) ( )b 3 7 1

3 37 1

33 2

34 560

2187; , = =

(ii) The probability that a 5 or a 6 never occurs (i.e. all failures) is ( )q 7 2

37 128

2187= =

u If we regard n and p as constants, then the function ( ) ( )P k b k n p= ; , is a discreteprobability distribution:

k 0 1 2 L n

( )P k q n ( )11n nq p− ( )2

2 2n nq p− L p n

It is called the binomial distribution since for k n= 0 1 2, , , ,K it corresponds to the successive terms of the binomial expansion

( ) ( ) ( )q p q q p q p pn n n n n n n+ = + + + +− −

11

22 2 L

u Properties of a binomial distribution are as follows:

Binomial Distribution

Mean µ = np

Variance σ2 = npqStandard deviation σ = npq

Example 26: A fair die is tossed 180 times. Find the expected number of sixes, and the standard deviation.

The expected number of sixes is µ = = ⋅ =np 180 3016 . The standard

deviation is σ = = ⋅ ⋅ =npq 180 516

56

6 - 14

CHAPTER 6: PROBABILITY CS218

Page 121: C2004 Study Guide

6.8 SUMMARY

6.8.1 THEO REMS

l Let S be a sample space, let E be the class of events, and let P be a real-valuedfunction defined on E. Then P is called a probability function, and ( )P A iscalled the probability of the event A if the following axioms hold:

[ ]P1 For every event ( )A P A, 0 1≤ ≤

[ ]P2( )P S = 1

[ ]P3 If A and B are mutually exclusive events, then ( ) ( ) ( )P A B P A P B∪ = +

[ ]P4 If A A1 2, ,K is a sequence of mutually exclusive events, then P A A P A P A( ) ( ) ( )1 2 1 2∪ ∪ = + +K K

l If ∅ is the empty set, then ( )P ∅ = 0

l If A c is the complement of an event A, then ( ) ( )P A P Ac = −1

l If A B⊆ , then ( ) ( )P A P B≤

l If A and B are any two events, then ( ) ( ) ( )P A B P A P A B\ = − ∩

l If A and B are any two events, then ( ) ( ) ( ) ( )P A B P A P B P A B∪ = + − ∩

l Let S be a finite equiprobable space with events A and E. Then

( )P A EA E

E| =

∩number of elements in

number of elements in

l Multiplication Theorem: ( ) ( ) ( )P E A P E P A E∩ = |

l Corollary: For any events A A An1 2, , ,K , ( )P A A An1 2∩ ∩ ∩K ( ) ( ) ( ) ( )= ∩ ∩ ∩ ∩ −P A P A A P A A A P A A A An n1 2 1 3 1 2 1 2 1| | |K K

l Var(X) ( ) ( )= − = −=∑ x f x E Xi ii

n2 2 2 2

1µ µ

l The probability of exactly k successes in n repeated trials is denoted andgiven by ( ) ( )b k n p p qk

n k n k; , = −

6.8.2 RE MARKS

l The probability of an event can be thought of as “a favourable outcome” over “all

possible outcomes,” i.e. favorable

total

l The odds that an event with probability p occurs is defined to be the ratio ( )p p: 1−

l Three events A, B, and C are independent if: (i) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )P A B P A P B P A C P A P C P B C P B P C∩ = ∩ = ∩ =, and i.e. if the

events are pairwise independent, and

(ii) ( ) ( ) ( ) ( )P A B C P A P B P C∩ ∩ =

6 - 15

CS218 CHAPTER 6: PROBABILITY

Page 122: C2004 Study Guide

6.9 PROBABILITY EXERCISES

u Sample spaces and events

1. Let A and B be events. Find an expression and exhibit the Venn diagram for the event that:

(i) A but not B occurs; i.e. only A occurs

(ii) either A or B, but not both, occurs, i.e. exactly one of the two events occurs.

2. Let A, B and C be events. Find an expression and exhibit the Venn diagram for the event that

(i) A and B but not C occurs

(ii) only A occurs

3. Let a coin and a die be tossed; let the sample space S consist of the twelve elements: S = {H1, H2, H3, H4, H5, H6, T1, T2, T3, T4, T5, T6}

(i) Express explicitly the following events: A = {heads and an even number appear}, B = {a prime number appears}, C = {tails and an odd number appear}

(ii) Express explicitly the event that: (a) A or B occurs, (b) B and C occurs, (c) only B occurs

(iii) Which of the events A, B, and C are mutually exclusive?

u Finite probability spaces

4. Suppose a sample space S consists of 4 elements: { }S a a a a= 1 2 3 4, , , . Which function defines a probability space on S?

(i) ( ) ( ) ( ) ( )P a P a P a P a112 2

13 3

14 4

15= = = =, , ,

(ii) ( ) ( ) ( ) ( )P a P a P a P a112 2

14 3

14 4

12= = = − =, , ,

(iii) ( ) ( ) ( ) ( )P a P a P a P a112 2

14 3

18 4

18= = = =, , ,

(iv) ( ) ( ) ( ) ( )P a P a P a P a112 2

14 3

14 4 0= = = =, , ,

5. Let { }S a a a a= 1 2 3 4, , , , and let P be the probability function on S.

(i) Find ( )P a1 if ( ) ( ) ( )P a P a P a213 3

16 4

19= = =, ,

(ii) Find ( )P a1 and ( )P a 2 if ( ) ( )P a P a3 414= = and ( ) ( )P a P a1 22=

(iii) Find ( )P a1 if { }( ) { }( )P a a P a a2 323 2 4

12, , ,= = and ( )P a 2

13=

6. A coin is weighted so that heads is twice as likely to appear as tails. Find P(T) and P(H)

6 - 16

CHAPTER 6: PROBABILITY CS218

Page 123: C2004 Study Guide

7. Two men, m1 and m2, and three women, w w1 2, and w3 are in a chess tournament. Those of the same sex have equal probabilities of winning, but each man is twice as likely to win as any woman.

(i) Find the probability that a woman wins the tournament.

(ii) If m1 and w1 are married, find the probability that one of them wins the tournament

8. Let a die be weighted so that the probability of a number appearing when the die is tossed is proportional to the given number (e.g. 6 has twice the probability of appearing as 3). Let A = {even number}, B = {prime number}, C = {odd number}

(i) Describe the probability space, i.e. find the probability of each sample point

(ii) Find P(A), P(B) and P(C)

(iii) Find the probability that:

(a) an even or prime number occurs

(b) an odd prime number occurs

(c) A but not B occurs

u Finite equiprobable spaces

9. Determine the probability p of each event:

(i) an even number appears in the toss of a fair die

(ii) a king appears in drawing a single card from an ordinary pack of 52 cards

(iii) at least one tail appears in the toss of three fair coins

(iv) a white marble appears in drawing a single marble from an urn containing 4 white, 3 red and 5 blue marbles

10. Two cards are drawn at random from an ordinary pack of 52 cards. Find the probability p that

(i) both are spades

(ii) one is a spade and one is a heart

11. Three light bulbs are chosen at random from 15 bulbs of which 5 are defective. Find the probability p that

(i) none is defective

(ii) exactly one is defective

(iii) at least one is defective

12. Two cards are selected at random from 10 cards numbered 1 to 10. Find the probability p that the sum is odd if

6 - 17

CS218 CHAPTER 6: PROBABILITY

Page 124: C2004 Study Guide

(i) the two cards are drawn together

(ii) the two cards are drawn one after the other without replacement

(iii) the two cards are drawn one after the other with replacement

13. Six married couples are standing in a room

(i) If 2 people are chosen at random, find the probability p that

(a) they are married

(b) one is male and one is female

(ii) If 4 people are chosen at random, find the probability p that

(a) 2 married couples are chosen

(b) no married couple is among the 4

(c) exactly one married couple is among the 4

(iii) If the 12 people are divided into six pairs, find the probability p that

(a) each pair is married

(b) each pair contains a male and a female

14. A class contains 10 men and 20 women of which half the men and half the women have brown eyes. Find the probability p that a person chosen at random is a man or has brown eyes.

u Conditional probability

15. A pair of dice is thrown. Find the probability p that the sum is 10 or greater if

(i) a 5 appears on the first die

(ii) a 5 appears on at least one of the dice

16. Three fair coins are tossed. Find the probability p that they are all heads if

(i) the first coin is heads

(ii) one of the coins is heads

17. A pair of fair dice is thrown. If the two numbers appearing are different, find the probability p that

(i) the sum is six

(ii) an ace appears

(iii) the sum is 4 or less

18. Two digits are selected at random from the digits 1 through 9. If the sum is even, find the probability p that both numbers are odd.

6 - 18

CHAPTER 6: PROBABILITY CS218

Page 125: C2004 Study Guide

19. A man is dealt 4 spade cards from an ordinary pack of 52 cards. If he is given three more cards, find the probability p that at least one of the additional cards is also a spade.

20. Four people, called North, South, East and West, are each dealt 13 cards from an ordinary pack of 52 cards.

(i) If South has no aces, find the probability p that his partner North has exactly two aces.

(ii) If North and South together have nine hearts, find the probability pthat East and West each has two hearts.

u Multiplication theorem

21. A class has 12 boys and 4 girls. If three students are selected at random from the class, what is the probability p that they are all boys?

22. A man is dealt 5 cards one after the other from an ordinary pack of 52 cards. What is the probability p that they are all spades?

23. An urn contains 7 red marbles and 3 white marbles. Three are drawn from the urn one after the other. Find the probability p that the first two are red and the third is white.

24. The students in a class are selected at random, one after the other, for an examination. Find the probability p that the boys and girls in the class alternate if

(i) the class consists of 4 boys and 3 girls,

(ii) the class consists of 3 boys and 3 girls.

u Finite stochastic processes

25. A box contains three coins; one coin is fair, one coin is two-headed, and one coin is weighted so that the probability of heads appearing is 1

3. A coin is selected at random and tossed. Find the probability p that heads appears.

26. Box A contains nine cards numbered 1 through 9, and box B contains five cards numbered 1 through 5. A box is chosen at random and a card drawn. If the number is even, find the probability that the card came from box A.

27. We are given three urns as follows:

Urn A contains 3 red and 5 white marbles.

Urn B contains 2 red and 1 white marble.

Urn C contains 2 red and 3 white marbles.

An urn is selected at random and a marble is drawn from teh urn. If the marble is red, what is the probability that it came from urn A?

6 - 19

CS218 CHAPTER 6: PROBABILITY

Page 126: C2004 Study Guide

28. An urn contains 3 red marbles and 7 white marbles. A marble is drawn from the urn and a marble of the toher colour is then put into the urn. A second marble is drawn from the urn.

(i) Find the probability p that the second marble is red.

(ii) If both marbles were of the same colour, what is the probability p that they were both white?

29. We are given two urns as follows:

Urn A contains 3 red and 2 white marbles.

Urn B contains 2 red and 5 white marbles.

An urn is selected at random; a marble is drawn and put into the other urn; then a marble is drawn from the second urn. Find the probability p that both marbles drawn are of the same colour.

u Independence

30. Let A = event that a family has children of both sexes, and let B = event that a family has at most one boy.

(i) Show that A and B are independent events if a family has three children.

(ii) Show that A and B are dependent events if a family has two children.

31. The probability that a man will live 10 more years is 14, and the probability

that his wife will live 10 more years is 13. Find the probability that

(i) both will be alive in 10 years,

(ii) at least one will be alive in 10 years,

(iii) neither will be alive in 10 years,

(iv) only the wife will be alive in 10 years.

32. Box A contains 8 items of which 3 are defective, and box B contains 5 items of which 2 are defective. An item is drawn at random from each box.

(i) What is the probability p that both items are non-defective?

(ii) What is the probability p that one item is defective and one not?

(iii) If one item is defective and one is not, what is the probability p that the defective item came from box A?

33. The probabilities that three men hit a target are respectively 16

14, and 1

3. Each shoots once at the target.

(i) Find the probability p that exactly one of them hits the target.

(ii) If only one hit the target, what is the probability that it was the first man?

6 - 20

CHAPTER 6: PROBABILITY CS218

Page 127: C2004 Study Guide

u Repeated trials

34. A certain type of missile hits its target with probability 0.3. How many missiles should be fired so that there is at least an 80% probability of hitting a target?

35. A certain soccer team wins (W) with the probability 0.6, loses (L) with the probability 0.3 and ties (T) with the probability 0.1. The team plays three games over the weekend.

(i) Determine the elements of the event A that the team wins at least twice and doesn’t lose; and find P(A).

(ii) Determine the elements of the event B that the team wins, loses and ties; and find P(B).

u Random variables and expectations

36. Find the expectation µ, variance σ2 and standard deviation σ of each of the following distributions:

(i)

xi 2 3 11

( )f xi13

12

16

(ii)

xi− 5 − 4 1 2

( )f xi14

13

12

18

(iii)

xi 1 3 4 5

( )f xi 0.4 0.1 0.2 0.3

37. A fair die is tossed. Let X denote twice the number appearing, and let Y denote 1 or 3 according to whether an odd or an even number appears. Find the distribution, expectation, expectation, variance and standard deviation of

(i) X

(ii) Y

(iii) X Y+

(iv) XY

38. A coin is weighted so that P H( ) = 34 and P T( ) = 1

4 is tossed three times. Let X be the random variable which denotes the longest string of heads which occurs. Find the distribution, expectation, variance and standard deviation of X.

6 - 21

CS218 CHAPTER 6: PROBABILITY

Page 128: C2004 Study Guide

39. Concentric circles of radius 1 and 3 cm are drawn on a circular target of radius 5 cm. A man receives 10, 5 or 3 points if he hits the target inside the smaller circle, inside the middle annular region or inside the outer annular region respectively. Suppose the man hits the target with probability 1

2 and then is just as likely to hit one point of the target as the other. Find the expected number E of points he scores each time he fires.

40. A player tosses two fair coins. He wins $1 if 1 head appears, $2 if 2 heads appear. On the other hand he loses $5 if no heads appear. Determine the expected value E of the game and if it is favourable to the player.

u Binomial distribution

41. Find

(i) ( )b 2 5 13; ,

(ii) ( )b 3 6 12; ,

(iii) ( )b 3 4 14; ,

42. A fair coin is tossed three times. Find the probability P that there will appear

(i) three heads

(ii) two heads

(iii) one head

(iv) no heads

43. Team A has probability 23 of winning whenever it plays. If A plays 4 games,

find the probability that A wins

(i) exactly 2 games

(ii) at least 1 game

(iii) more than half of the games

44. A family has 6 children. Assuming that the probability of any particular child being a boy is 1

2, find the probabilty P that there are

(i) 3 boys and 3 girls

(ii) fewer boys than girls

45. How many dice must be thrown so that there is a better than even chance of obtaining a six?

46. Determine the expected number of boys in a family with 8 children, assuming the sex distribution to be equally probable. What is the probability that the expected number of boys does occur?

6 - 22

CHAPTER 6: PROBABILITY CS218

Page 129: C2004 Study Guide

47. The probability of a man hitting a target is 14.

(i) If he fires 7 times, what is the probability P of his hitting the target at least twice?

(ii) How many times must he fire so that the probability of his hitting the target at least once is greater than 2

3?

u Miscellaneous problems

48. Let A and B be events with ( )P A = 38, ( )P B = 1

2 and ( )P A B∩ = 14. Find

(i) ( )P A B∪

(ii) ( )P A c and ( )P B c

(iii) ( )P A Bc c∩

(iv) ( )P A Bc c∪

(v) ( )P A B c∩

(vi) ( )P B A c∩

49. Find the probability p of an event if the odds that it will occur are a b: , that is “a to b”.

50. A die is tossed 100 times. The following table lists the six numbers and frequency with which each number appeared:

Number 1 2 3 4 5 6

Frequency 14 17 20 18 15 16

Find the relative frequency f of the event

(i) a 3 appears

(ii) a 5 appears

(iii) an even number appears

(iv) a prime appears

51. In a certain college, 25% of the students failed mathematics, 15% of the students failed chemistry, and 10% of the students failed both mathematics and chemistry. A student is selected at random.

(i) If he failed chemistry, what is the probability that he failed mathemetics?

(ii) If he failed mathematics, what is the probability that he failed chemistry?

(iii) What is the probability that he failed mathematics or chemistry?

6 - 23

CS218 CHAPTER 6: PROBABILITY

Page 130: C2004 Study Guide

52. Let A and B be events with ( )P A = 12, ( )P B = 1

3 and ( )P A B∩ = 14. Find

(i) ( )P A B|

(ii) ( )P B A|

(iii) ( )P A B∪

(iv) ( )P A Bc c|

(v) ( )P B Ac c|

53. Find ( )P B A| if

(i) A is a subset of B

(ii) A and B are mutually exclusive

54. Let A and B be events with P A P B( ) , ( )= =38

58 and P A B( )∪ = 3

4. Find P A B( | ) and P B A( | )

55. A string of three bits is obtained randomly.

(i) List all the elements of the sample space

(ii) Let A be the event that the string contains an odd number of 1’s, and let B be the event that the string starts with a 1. Are a and b independent? Explain your answer using probability calculations.

56. Suppose that three computer boards in a production run of 40 are defective. A sample of four is to be selected to be checked for defects.

(i) How many different samples can be chosen?

(ii) How many samples will contain at least one defective board?

(iii) What is the probability that a randomly chosen sample of four contains at least one defective board?

57. A coin is tossed 10 times. In each case, the outcome H (for head), or T (for tail) is recorded.

(i) What is the total number of possible outcomes of the coin-tossing experiment?

(ii) In how many of the possible outcomes are exactly five heads obtained?

(iii) In how many of the possible outcomes are at least nine heads obtained?

(iv) In how many of the possible outcomes are at most one head obtained?

(v) In how many of the possible outcomes are at least one tail obtained?

58. What are independent events?

59. What are mutually exclusive events?

60. A technician is installing software in his labortory; he has six different kinds of packages to choose from, and four computers, each of which is to

6 - 24

CHAPTER 6: PROBABILITY CS218

Page 131: C2004 Study Guide

have one kind of package installed on it. Instead of putting a different package on each machine, he simply picks a package at random each time. Since he has multiple copies of each package, there is the possibility of installing one kind of package on more than one computer. What is the probability that each machine gets a different package?

61. A suitcase contains five pink, four grey, and three blue socks. Three socks are drawn without replacement. Consider the following events

A: at least one pink sock is drawn

B: exactly two pink socks are drawn

C: one sock of each colour is drawn

(i) Which events are mutually exclusive? Explain.

(ii) Which events are not mutually exclusive? Explain.

(iii) Calculate the probabilities of A, B, and C

62. Given two events E1 and E2, state the conditions for the events to be

(i) independent

(ii) mutually exclusive

63. The technician in charge of software installation has put an accounts package on half the machines in the laboratory, and a spreadsheet package on two-thirds of the computers at random, and in no case paying attention to what software is already on the machine. What is the probability that any given machine has:

(i) both packages on it?

(ii) at least one package on it?

(iii) neither package on it?

64. A string containing 8 bits, each of which is either 0 or 1, can be used to represent any one of 2 2568 = different values.

(i) How many 8-bit strings contain seven consecutive zeros?

(ii) How many 8-bit strings are there in which the first three bits are zeros?

(iii) How many 8-bit strings are there in which the first bit is zero?

65. Two ordinary dice are thrown, giving the individual scores p and q each ranging from 1 to 6:

(i) What is the probability that the sum of p and q is exactly 6?

(ii) What is the probability that p q= ?

(iii) What is the probability that p q= and p q+ = 6?

(iv) What is the probability that p q= or p q+ = 6?

6 - 25

CS218 CHAPTER 6: PROBABILITY

Page 132: C2004 Study Guide

66. A single dice is thrown eight times; each time, either 0 or 1 is written down: we write 0 if the score is between 1 and 5; we write 1 if the score is 6.

(i) What is the probability that the resulting bit sequence contains seven consectutive 0’s?

(ii) What is the probability that the resulting bit sequence contains 5 consecutive 0’s?

67. In a lucky draw, you win a computer and a software package. The computer is either a PC or a Macintosh. There are four software packages, three of which will run only on the PC. What is the probability that you have won a compatible pair?

6 - 26

CHAPTER 6: PROBABILITY CS218

Page 133: C2004 Study Guide

CHAPTER 7: GRAPH THEORY

Chapter Objectives

In this chapter you will learn:

§ what makes up a graph;

§ what a multigraph is;

§ what a pseudograph is;

§ what a digraph is;

§ some basis definitions of graph theory;

§ what a subgraph is;

§ how to determine if a graph is isomorphic;

§ about different classes of graphs;

§ how to determine if a graph is bipartite;

§ how to find an adjacency matrix of a graph;

§ how to find the incidence matrix of a graph;

§ how to find the distance matrix of a graph;

§ what makes a graph Eulerian;

§ what makes a graph Hamiltonian;

§ about the travelling salesman problem;

7 - 1

Page 134: C2004 Study Guide

7.1 GRAPHS AND DIGRAPHS

7.1.1 GRAPHS

u A graph is just a set of points called vertices connected by lines called edges.

u Graphs are denoted by uppercase letters like G and H. The set of vertices of a graph Gis denoted by V(G), and the set of edges of a graph G is denoted by E(G).

u A single element from the set of vertices is called a vertex. Vertices will be denotedby lowercase letters.

u An edge is denoted by listing the vertices that are its endpoints. When naming theedge the order of the vertices is not important, e.g. edge db is the same as edge bd.

u If there is an edge joining a pair of vertices, those vertices are said to be adjacent.Otherwise, they are nonadjacent.

u An edge is incident with a vertex if the edge is joined to the vertex. Therefore, anedge is incident with its endpoints.

u The number of edges connected to a given vertex is called the degree of that vertex.The degree of a vertex is denoted d(v). The degree sequence of a graph is the list ofthe degrees of its vertices in non-increasing order.

Exercise 1: Find the degree of each vertex in graph G

Exercise 2: What is the degree sequence of G?

u An edge contributes 1 to the degree of each of its two endpoints. This fact gives us thefollowing theorem.

l Theorem 1: In a graph G, the sum of the degrees of the vertices equals twice the number of edges.

l Corollary 1: The sum of the degrees of the vertices of a graph is an even number.

7 - 2

CHAPTER 7: GRAPH THEORY CS218

Page 135: C2004 Study Guide

7.1.2 MUL TIGRAPHS AND PSEU DO GRAPHS

u A multigraph allows more than one edge between a pair of vertices. Such edges arecalled multiple edges.

u A pseudograph allows loops and multiple edges. A loop is an edge that connects avertex to itself.

7.1.3 DI GRAPHS

u A graph whose edges are all directed is called a directed graph or digraph. Thedirected edges are called arcs.

u In a digraph parallel arcs are pairs of arcs in which one is directed from vertex a tovertex b and the other in directed from vertex b to vertex a. They are distinct arcs andare denoted ab and ba respectively. So the order in which we list the vertices of an arcis important.

u The direction of an arc is indicated by an arrow on the edge.

Digraph H

Exercise 3: List the arcs in the digraph H

Exercise 4: List all the parallel arcs in digraph H.

u The indegree of a vertex v is the number of arcs directed toward v and is denotedid(v)

u The outdegree of v is the number of arcs directed away from v and is denoted od(v).

Exercise 5: List the indegree of each vertex in digraph H .

Exercise 6: List the outdegree of each vertex in digraph H.

7 - 3

CS218 CHAPTER 7: GRAPH THEORY

Page 136: C2004 Study Guide

u Notice that each arc contributes 1 to the indegree of the vertex it points to and 1 to the outdegree of the vertex it points away from. This gives the following theorem:

l Theorem 2: In a digraph, the sum of the indegrees equals the sum of the outdegrees.

7.2 BASIC DEFINITIONS

u A path in a graph G is a sequence of distinct vertices v v v vk0 1 2, , , ,K such that v v v v v vk k1 2 2 3 1, , , ,K − are edges of G.

u The length of a path is the number of edges in it.

l Remark 1: A path having n vertices is denoted Pn

Example 1: In graph G, c e b, , is a path of length 2 between c and b. The edges of the path are ce and eb

Example 2: In graph G, c d e a b, , , , is a path of length 4 between c and b. The edges of the path are cd, de, ea and ab

l Remark 2: A path using k distinct vertices has length k −1

u A graph is connected if every pair of its vertices is connected by a path.

u A graph is disconnected if there is not a path between every pair of vertices.

Example 3: Graph G is a connected graph, while graph H is disconnected, since there is no path between f and i.

u A graph that is disconnected contains two or more pieces, called components of thegraph.

u A cycle is a path that begins and ends at the same place.

l Remark 3: A cycle having n vertices is denoted C n

7 - 4

CHAPTER 7: GRAPH THEORY CS218

Page 137: C2004 Study Guide

7.2.1 SUB GRAPHS

u A subgraph A of graph B has as its vertex set a subset of the vertices of B, and as itsedge set a subset of the edges of B.

l Remark 4: For graphs A and B, A B⊆ iff V A V B( ) ( )⊆ and E A E B( ) ( )⊆

Example 4: Determine which of the graphs are subgraphs of graph B

Graph B is a subgraph of graph B since B B⊆

Graph C is a subgraph of graph B: A subgraph need not contain all the vertices of the original graph.

Graph D is not a subgraph of graph B since bc E D∈ ( ), but bc E B∉ ( )

Graph F is a subgraph of graph B: A subgraph need not contain all the edges of the original graph.

u An induced subgraph is whenever an edge appears between a pair of vertices in theoriginal graph it also must appear in the subgraph.

Example 5: Graph C is an induced subgraph of B

Example 6: F is not an induced subgraph of B, because c and f are vertices in F, and cf E B∈ ( ) but cf E F∉ ( )

7.2.2 ISO MOR PHIC GRAPHS

u Graphs may be drawn differently by different people.

Example 7: Suppose you are asked to draw the graph G with vertex set V G a b c d e( ) { , , , , }= and edge set E G ab ac bc bd ce( ) { , , , , }= . It is possible to

draw this graph in many different ways. For instance:

u Graphs G and H are isomorphic if they can be labelled so that u and v are adjacent in G iff the corresponding vertices are adjacent in H.

u G and H are isomorphic if there exists a , 1 1− onto function between their vertices thatpreserves adjacency. This function is called an isomorphism.

7 - 5

CS218 CHAPTER 7: GRAPH THEORY

Page 138: C2004 Study Guide

l Remark 5: If two graphs are isomorphic, corresponding vertices have the same degree.

Example 8: Describe a function that shows the graphs G1 and G2 are isomorphic.

In order to show that the graphs are isomorphic we must give a correspondence between the vertices of G1 and G2 that preserves adjacency.

Thus, vertex a, of degree 3, must correspond to either e or f; vertex b, of degree 2 must correspond to h or g

If we let f a e f b h f c f( ) , ( ) , ( ) ,= = = and f d g( ) = , then a function f induces a correspondence from the edges of G1 to the edges of G2 as follows: ab eh bc hf ad eg cd fg→ → → →, , , and ac ef→

Because { , , , , }eh hf eg fg ef is precisely the edge set of G2, G1 is isomorphic to G2

Example 9: Describe a function that shows the graphs G3 and G4 are isomorphic.

If we say f k q( ) = , then since i is adjacent to k and has degree 1, f i v( ) = or r So: f k q f m t f i v f j r f n u( ) , ( ) , ( ) , ( ) , ( ) ,= = = = = and f p s( ) = Thus G3 is isomorphic to G4

l Remark 6: Let G and H be isomorphic with isomorphism f V G V H: ( ) ( )→ . If v v vk1 2, , ,K is a shortest path between vertices v1 and vk in G then f v f v f vk( ), ( ), ( )1 2 K is a shortest path between vertices f v( )1 and f vk( )in H

l Remark 7: Some items to check when trying to show that a pair of graphs are not isomorphic are:

1. The number of vertices

2. The number of components

3. The number of edges

4. The degree sequence

5. The length of the shortest path between pairs of vertices with a given degree

6. The length of the longest path in the graph

7 - 6

CHAPTER 7: GRAPH THEORY CS218

Page 139: C2004 Study Guide

Example 10: There are five nonisomorphic graphs with degree sequence 3, 3, 2, 2, 1, 1. Draw them and explain why they are not isomorphic to one another.

The five nonisomorphic graphs are:

Notice that four of the graphs are connected, while graph e has 2 components. In other words graph e is not isomorphic to any of the other graphs as it has 2 components, i.e. is not connected.

In order to see why the other graphs are not isomorphic we focus on the length of the shortest path between the two vertices of degree 1. In graph a this length is 2, in graph b this length is 3, and in graphs c and d the length is 4. This shows that graphs a and b are not isomorphic to any of the other graphs.

We now need to show that graph c and d are not isomorphic to each other. The longest path in graph c has length 4, while the longest path in graph d has length 5. So graph c and d are also not isomorphic.

7.3 CLASSES OF GRAPHS

u There are several important classes of graphs: trees, bipartite graphs, completegraphs, regular graphs and planar graphs.

7.3.1 TREES

u A tree is a connected graph that does not contain a cycle as a subgraph.

l Remark 8: Suppose G is a graph having n vertices. Then the following statements are equivalent:

1. G is a tree

2. G is connected and has n−1 edges

3. G has n−1 edges and no cycles

4. Any two vertices of G are connected by a unique path

5. G contains no cycles, but the addition of any edge to G will produce a single cycle.

7 - 7

CS218 CHAPTER 7: GRAPH THEORY

Page 140: C2004 Study Guide

7.3.2 BI PAR TITE GRAPHS

u A tree is a special type of bipartite graph. A graph is bipartite if its vertices can beseparated into two sets A and B, so that vertices within the same set are nonadjacent.

u A bipartite graph is drawn with the vertices of A on the left and vertices of B on theright, or vertices of A at the top and vertices of B at the bottom.

u Note that the vertices that are adjacent are between vertices of the set A and verticesof the set B. There are no adjacent vertices within the sets A or B.

l Remark 9: A simple labelling procedure determines whether G is bipartite:

G is bipartite iff adjacent vertices get distinct labels:

1. Label any vertex a

2. Label all vertices adjacent to a with the label b

3. Next, label all vertices that are adjacent to a vertex just labelled b with label a

4. Repeat steps 2 & 3 until you have labelled all vertices with a distinct label (bipartite) or you have a conflict, i.e. you have to label a vertex with a and b. (not bipartite)

Example 11: Label each graph to determine if it is bipartite. For those that are bipartite, redraw them showing the vertex sets A and B of the definition.

graph a graph b graph c

redrawing the bipartite graphs to show their bipartite nature yields:

graph a graph c

7 - 8

CHAPTER 7: GRAPH THEORY CS218

Page 141: C2004 Study Guide

u Another way to determine if a graph is bipartite without the labelling procedure isstated in remark 8, where an odd cycle is defined to be a cycle containing an oddnumber of vertices.

l Remark 10: G is bipartite iff G does not contain any odd cycles.

Exercise 7: Draw all nonisomorphic bipartite graphs having four vertices.

7.3.3 COM PLETE GRAPHS

u A complete bipartite graph is one in which each vertex in set A is adjacent to every vertex in set B.

u The complete bipartite graph having m vertices in A and n vertices in B is denoted K m n,

Example 12: Draw the complete bipartite graphs K 2 3, and K 3 3,

l Remark 11: The complete graph K n has n vertices, with every vertex connected to every other vertex.

Exercise 8: Draw each K n for n ≤ 5

7.3.4 REGU LAR GRAPHS

u A graph is k-regular if all its vertices have the same degree, k.

u K n is ( )n−1 -regular, because each vertex of K n has degree n−1

u C n is 2-regular

7 - 9

CS218 CHAPTER 7: GRAPH THEORY

Page 142: C2004 Study Guide

7.3.5 PLA NAR GRAPHS

u A plane graph is a graph drawn in the plane (a flat surface) having on edgescrossing.

u In a plane graph, each cycle not containing any smaller cycles encloses a region calleda face. The region exterior to the graph is called the infinite face .

u Let f be the number of faces (including the exterior face), e be the number of edges,and n be the number of vertices in a plane graph.

l Euler’s formula: In a connected plane graph with f faces, e edges, and nvertices, we have the relationship: n e f− + = 2

Example 13: Redraw the following graphs with as few edge crossings as possible. For any plane graphs you draw, verify Euler’s formula.

Graph a is a plane graph and there are 6 vertices, 9 edges, and 5 faces. Thus n e f− + = − + =6 9 5 2. Graph c is a plane graph also and there are 7 vertices, 13 edges, and 8 faces. Thus n e f− + = − + =7 13 8 2

7.4 MATRICES ASSOCIATED WITH GRAPHS

u Graphs are represented on a computer using matrices. Some matrices are used torepresent graphs, while others are used to describe properties of graphs.

7.4.1 THE AD JA CENCY MA TRIX

u A (0, 1)-matrix is a matrix each of whose entries is 0 or 1. The identity matrix andthe zero matrix are examples of (0, 1)-matrices.

u Let the vertices of G be labelled v v vn1 2, , ,K . The adjacency matrix A(G) is the n n× ( , )0 1 -matrix, where

av v G

ij

i j=

1

0

if is an edge of

otherwise

u Since a vertex is never adjacent to itself, A(G) has 0’s on the diagonal.

7 - 10

CHAPTER 7: GRAPH THEORY CS218

Page 143: C2004 Study Guide

Example 14: A graph G and its adjacency matrix are as follows:

v v v v v

A G

v

v

v

v

v

1 2 3 4 5

1

2

3

4

5

0 1 1 0 1

1 0 1 0 1

1 1 0 0 0

0 0 0 0 1

1 1 0 1 0

( ) =

u A lot of the time a graph does not come conveniently labelled. The graph can havelabels other than v v vn1 2, , ,K or it may have no labels at all. In either case justarbitrarily assign labels v v vn1 2, , ,K to the n vertices of the graph. Different labelassignments will produce different matrices.

u With bipartite graphs however we will always label all the vertices of side A first thenthe vertices of side B. This labelling will be the only acceptable labelling format. (Toensure ease of grading)

Example 15: From the graph G construct A(G)

If we label the graph G as below then A(G) is:

1 2 3 4 5

1

2

3

4

5

0 1 0 0 0

1 0 1 1 0

0 1 0 1 1

0 1 1 0 0

0 0 1 0 0

A G( ) =

Example 16: From the adjacency matrix A(H) construct the graph H.

A H( ) =

0 1 0 1

1 0 1 1

0 1 0 0

1 1 0 0

First labelling the rows and columns of the matrix 1, 2, 3, 4 helps us to obtain the graph H

1 2 3 4

1

2

3

4

0 1 0 1

1 0 1 1

0 1 0 0

1 1 0 0

A H( ) =

u Notice that the adjacency matrix is symmetric, i.e. that a aij ji= ∀ i j,

7 - 11

CS218 CHAPTER 7: GRAPH THEORY

Page 144: C2004 Study Guide

7.4.2 THE IN CI DENCE MA TRIX

u Suppose G has vertex set V G v v vn( ) { , , , }= 1 2 K and edge set E G e e em( ) { , , , }= 1 2 K . Theincidence matrix M(G) is the n m× (0,1)-matrix defined by:

mv e

ij

i j=

1

0

if is an endpoint of

otherwise

u Since an edge has two endpoints, there are two 1’s in each column of M(G)

u Each 1 in row i of M(G) corresponds to an edge incident with vi . Thus, the number of1’s in row i is the degree of vi

Example 17: Find the incidence matrix M mij= of the graph G below.

e e e e e e e e

M

v

v

v

v

v

1 2 3 4 5 6 7 8

1

2

3

4

5

1 1 1 0 1 0 0 0

1 0 0 1 0 0 0 0

0 0 1 1 0 0= 1 1

0 0 0 0 1 1 0 1

0 1 0 0 0 1 1 0

7.4.3 THE DIS TANCE MA TRIX

u The distance between vi and v j , denoted d ij , is the length of the shortest pathconnecting vi and v j . If G is connected, d ij is finite for every pair v vi j, . When G isdisconnected, d ij = ∞ for vertices in distinct components and is finite otherwise.

u The distance matrix D(G) is the n n× matrix where [ ]D G dij ij( ) =

Example 18: Find the distance matrix for the graphs G and H.

v v v v v

D G

v

v

v

v

v

1 2 3 4 5

1

2

3

4

5

0 1 2 2 3

1 0 1 1 2

2 1 0 1 1

2 1 1 0 2

3 2 1 2 0

( ) =

u u u u u

D H

u

u

u

u

u

1 2 3 4 5

1

2

3

4

5

0 2 1

0 1

1 0

2 0 1

1 1 0

( ) =

∞ ∞∞ ∞ ∞∞ ∞ ∞

∞ ∞∞ ∞

u The distance matrix is also symmetric.

7 - 12

CHAPTER 7: GRAPH THEORY CS218

Page 145: C2004 Study Guide

7.5 TRAVERSING GRAPHS

u An interesting part of graph theory is the puzzle in which you try to draw a givenfigure without taking your pencil off the paper, and without drawing over a line.

Example 19: See if you can draw each of the graphs below without taking your pencil off the paper. Before starting, a warning: Only two of them can be drawn in this manner, and it may matter where you start.

7.5.1 EULE RIAN GRAPHS

u Now lets look at a theorem that tells us exactly which figures we can draw withouttaking a pencil off the paper. First some definations:

u A walk is a sequence of vertices v v v vk0 1 2, , , ,K where v vi i+1 is an edge of G. In a walkwe may reuse vertices and/or edges already used.

u A path requires that vertices and edges be distinct.

u A trail is a walk in which the edges (but not necessarily the vertices) are distinct.

u So a path is a special type of trail, and a trail is a special type of walk.

u An Eulerian trail is a trail that includes each edge of the graph.

u If the trail begins and ends at the same vertex, it is said to be closed.

u A bridge is an edge whose removal increases the number of components.

u A graph is Eulerian if it contains a closed Eulerian trail, sometimes called anEulerian circuit. In other words a graph is Eulerian if it contains a walk thatincludes each edge exactly once and ends at the original vertex.

u A graph is semi-Eulerian if it contains an Eulerian trail (the trail need not beclosed)

7 - 13

CS218 CHAPTER 7: GRAPH THEORY

Page 146: C2004 Study Guide

Example 20: Find an Eulerian trail in each of the graphs from example 19, if possible. Which of the graphs is Eulerian?

For graph G we have the Eulerian trail d, e, a, b, e, c, b, d, c. Other trails are possible, but each trail must start at c or d. If the trail starts at c, it will end at d; and if it starts at d it will end at c. Hence G is semi-Eulerian.

For graph H, we have the Eulerian trial f, g, h, i, j, k, v, m, g, i, k, m, f. Other trails are also possible. Hence graph H is Eulerian.

Graph L does not contain an Eulerian trail.

u How can one tell if a graph is Eulerian? The answer is contained in the Eulertheorem.

l Euler Theorem:

(i) A connected graph is Eulerian iff each vertex has an even degree.

(ii) A connected graph is semi-Eulerian but not Eulerian iff the graph contains precisely two vertices having odd degree. Furthermore, the Eulerian trail must begin at one of the odd vertices and end at the other.

u To find a closed Eulerian trail in an Eulerian graph use the following algorithm.

l Fleury’s Algorithm: Suppose a graph is Eulerian. To find an Eulerian trail, begin at any vertex. Record and erase each edge as it is used, subject to the following condition: Never use a bridge unless there is no alternative.

Example 21: Apply Fleury’s Algorithm to graph H from example 19

Starting at vertex f, we record and erase the edges in the trail f, g, m. At this point fm is a bridge and there is an alternative. Use the alternative, thus f, g, m, v is are trail so far. Now however, vk is a bridge but there is no alternative, so we use it. Thus, are trail is f, g, m, v, k, i, g, h, i, j, k, m, f

7.5.2 HA MIL TO NIAN GRAPHS

u A path that contains every vertex of a graph is called a Hamiltonian path.

u If a graph contains a Hamiltonian path it is called semi-Hamiltonian.

u A Hamiltonian cycle is a cycle that includes every vertex. If a graph contains aHamiltonian cycle then the graph is Hamiltonian.

l Remark 12: In Hamiltonian problems, one passes through each vertex exactly once. In Eulerian problems one passes through each edge exactly once.

7 - 14

CHAPTER 7: GRAPH THEORY CS218

Page 147: C2004 Study Guide

Example 22: Draw a connected graph having four vertices that is

a. Hamiltonian and Eulerian

b. Hamiltonian and semi-Eulerian (but not Eulerian)

c. Eulerian and semi-Hamiltonian (but not Hamiltonian)

d. Eulerian but not semi-Hamiltonian

e. Hamiltonian but not semi-Eulerian

f. Neither semi-Eulerian nor semi-Hamiltonian

g. Semi-Eulerian and semi-Hamiltonian

Graphs for c and d do not exist.

Example 23: Find a Hamiltonian cycle for each graph below:

A Hamiltonian cycle for G is a, b, f, d, e, c, a

A Hamiltonian cycle in H is g, h, i, j, k, p, t, o, s, n, r, m, q, v, w, x, y, z, u, g

7 - 15

CS218 CHAPTER 7: GRAPH THEORY

Page 148: C2004 Study Guide

7.5.3 THE TRAV EL LING SALES MAN PROB LEM

u The travelling salesman problem is related to a Hamiltonian graph. In this type ofproblem a salesman plans to visit various locations to show his merchandise. Hewould like to stop at each location once and return to the home office whileminimizing his travel time. Thus, we want to find a minimum-weight Hamiltoniancycle in a weighted graph, where the weights correspond to travel times.

Example 24: Find a minimum-weight Hamiltonian cycle for the weighted graph below.

We must check all Hamiltonian cycles:

a, b, c, d, e, f, a has weight 28

a, b, d, e, f, c, a has weight 26

a, b, e, d, c, f, a has weight 30

a, c, b, d, e, f, a has weight 26

a, c, d, b, e, f, a has weight 28

Thus we can choose either a, b, d, e, f, c, a or a, c, b, d, e, f, a as our minimum-weight Hamiltonian cycle.

u As you can see the travelling salesman problem is difficult, even for a small problem.Unfortunately, there is no efficient method for solving the travelling salesmanproblem.

7 - 16

CHAPTER 7: GRAPH THEORY CS218

Page 149: C2004 Study Guide

7.6 SUMMARY

7.6.1 THEO REMS

l In a graph G, the sum of the degrees of the vertices equals twice the number ofedges.

l Corollary: The sum of the degrees of the vertices of a graph is an even number.

l In a digraph, the sum of the indegrees equals the sum of the outdegrees.

l Euler’s formula: In a connected plane graph with f faces, e edges, and nvertices, we have the relationship: n e f− + = 2

l Euler Theorem:

(i) A connected graph is Eulerian iff each vertex has an even degree.

(ii) A connected graph is semi-Eulerian but not Eulerian iff the graph contains precisely two vertices having odd degree. Furthermore, the Eulerian trail must begin at one of the odd vertices and end at the other.

l Fleury’s Algorithm: Suppose a graph is Eulerian. To find an Eulerian trail, begin at any vertex. Record and erase each edge as it is used, subject to the following condition: Never use a bridge unless there is no alternative.

7.6.2 RE MARKS

l A path having n vertices is denoted Pn

l A path using k distinct vertices has length k −1

l A cycle having n vertices is denoted C n

l For graphs A and B, A B⊆ iff V A V B( ) ( )⊆ and E A E B( ) ( )⊆

l If two graphs are isomorphic, corresponding vertices have the same degree.

l Let G and H be isomorphic with isomorphism f V G V H: ( ) ( )→ . If v v vk1 2, , ,K is ashortest path between vertices v1 and vk in G then f v f v f vk( ), ( ), ( )1 2 K is a shortestpath between vertices f v( )1 and f vk( ) in H

l Some items to check when trying to show that a pair of graphs are not isomorphicare:

1. The number of vertices

2. The number of components

3. The number of edges

4. The degree sequence

5. The length of the shortest path between pairs of vertices with a given degree

6. The length of the longest path in the graph

7 - 17

CS218 CHAPTER 7: GRAPH THEORY

Page 150: C2004 Study Guide

l Suppose G is a graph having n vertices. Then the following statements areequivalent:

1. G is a tree

2. G is connected and has n−1 edges

3. G has n−1 edges and no cycles

4. Any two vertices of G are connected by a unique path

5. G contains no cycles, but the addition of any edge to G will produce a single cycle.

l A simple labelling procedure determines whether G is bipartite:

G is bipartite iff adjacent vertices get distinct labels:

1. Label any vertex a

2. Label all vertices adjacent to a with the label b

3. Next, label all vertices that are adjacent to a vertex just labelled b with label a

4. Repeat steps 2 & 3 until you have labelled all vertices with a distinct label (bipartite) or you have a conflict (not bipartite)

l G is bipartite iff G does not contain any odd cycles.

l The complete graph K n has n vertices, with every vertex connected to every othervertex.

l In Hamiltonian problems, one passes through each vertex exactly once. InEulerian problems one passes through each edge exactly once.

7 - 18

CHAPTER 7: GRAPH THEORY CS218

Page 151: C2004 Study Guide

7.7 GRAPH THEORY EXERCISES

u For each of the following graphs

1. List V(G) 2. List E(G)

3. List the degree of each vertex for each graph

4. List the degree sequence of each graph

u Construct graphs with the following vertex and edge sets:

5. V G a b c d E G ab cd bd bc( ) { , , , } ( ) { , , , }= =

6. V H e f g h i j E H eh ej hi ij fh hj( ) { , , , , , } ( ) { , , , , , }= =

7. V M k m n p q r E M km mp kp qr( ) { , , , , , } ( ) { , , , }= =

u Three graphs have degree sequence 3, 2, 2, 1, 1, 1

8. Find two of them

u Use the following digraphs

9. List the indegree for each vertex

10. List the outdegree for each vertex

11. List the parallel arcs

12. A vertex having indegree 0 is called a transmitter; list all the transmitters

13. A vertex having outdegree 0 is called a receiver; list all the receivers

7 - 19

CS218 CHAPTER 7: GRAPH THEORY

Page 152: C2004 Study Guide

u Explain

14. Why is it easy to spot a vertex that is both a transmitter and a receiver?

15. How you would define a multidigraph?

16. How you would define a pseudodigraph?

17. Why is 5, 3, 3, 2, 1, 1, 1, 1 not the degree sequence of a graph?

18. Why is 5, 2, 1, 1, 1 not the degree sequence of a graph?

u What is the largest number of components a graph can have

19. if it has six vertices and five edges?

20. if it has six vertices and three edges?

21. if it has six vertices and seven edges?

u Using the graph G1

22. List all the paths between a and b

23. Determine what the length of each path between a and b is.

24. Draw three connected subgraphs of G1

25. Draw three disconnected subgraphs of G1

26. Draw the induced subgraph with vertex set {a, b, c, e}

u Graph G has n vertices.

27. What is the minimum number of edges it must have to be connected?

u Explain why each pair of graphs is not isomorphic.

28.

29.

30.

7 - 20

CHAPTER 7: GRAPH THEORY CS218

Page 153: C2004 Study Guide

u Give a function to show that each of the pairs of graphs are isomorphic.

31.

32.

33.

u Draw all nonisomorphic graphs having the following degree sequences:

34. 3, 3, 2, 1, 1, 1, 1 35. 4, 2, 2, 1, 1, 1, 1

36. 3, 2, 1, 1, 1, 1, 1 37. 5, 3, 2, 2, 2, 1, 1

u Draw each of the following

38. A graph that has degree sequence 2, 1, 1, 0

39. A multidigraph that is not a digraph

40. A pseudograph that is not a multidigraph

41. P6 42. C 4 43. C 3 44. P3

45. All trees having five or fewer vertices

46. All eleven trees having seven vertices

47. All six trees having six vertices

48. All connected bipartite graphs having five vertices

49. K 4 50. K 3 4, 51. K 6 52. K 2 5,

53. A 3-regular graph on eight vertices

54. Two 3-reqular graphs on six vertices (be sure they are not isomorphic)

55. A 4-regular graph on seven vertices

7 - 21

CS218 CHAPTER 7: GRAPH THEORY

Page 154: C2004 Study Guide

u Answer and explain

56. Which complete graphs are trees?

57. Which cycles are complete graphs?

58. Which trees are regular?

59. When is K m n, regular?

60. State a property of the incidence matrix of a digraph.

u Show that

61. K m n, has mn edges

u A wheel W n is formed from C n−1 ( )n ≥ 4 by adding an additional vertex v and edgesfrom v to each vertex of C n−1. Draw

62. W4 63. W5 64. W6 65. W7

u How many edges are in the following:

66. K 10 67. C 8 68. P12 69. K 3 7, 70. Wn

u Using the following graphs

71. Redraw them using as few crossing edges as possible.

72. Which graphs are planar?

73. Verify Euler’s formula for the graphs that are planar.

7 - 22

CHAPTER 7: GRAPH THEORY CS218

Page 155: C2004 Study Guide

u Using the following graphs; Find

74. A G( ) 75. A H( ) 76. [ ( )]A G 2 77. [ ( )]A G 3

78. out what the number of walks of length 3 from x1 to x5 there are.

79. B G( ) 80. B H( ) 81. D G( ) 82. D H( ) 83. A L( )

84. A M( ) 85. B L( ) 86. B M( ) 87. D M( ) 88. D L( )

u Using the following graphs

89. Use Euler’s theorem to determine which graphs are Eulerian or semi-Eulerian.

90. List an Eulerian trail for each Eulerian graph and each semi-Eulerian graph.

91. Which graphs are Hamiltonian or semi-Hamiltonian?

92. List a Hamiltonian cycle for each Hamiltonian graph, and list a Hamiltonian path for each semi-Hamiltonian graph.

u For which values of n are each of the following Eulerian:

93. K n 94. Pn 95. C n 96. Wn

u For which values of n are each of the following Hamiltonian:

97. K n 98. Pn 99. C n 100. Wn

u For each values of m and n is K m n,

7 - 23

CS218 CHAPTER 7: GRAPH THEORY

Page 156: C2004 Study Guide

101. Eulerian? 102. Hamiltonian?

u Draw a connected graph having five vertices that is

103. Hamiltonian and Eulerian

104. Hamiltonian and semi-Eulerian (but not Eulerian)

105. Eulerian and semi-Hamiltonian (but not Hamiltonian)

106. Eulerian but not semi-Hamiltonian

107. Hamiltonian but not semi-Eulerian

108. neither semi-Hamiltonian nor semi-Eulerian

109. semi-Hamiltonian and semi-Eulerian

u Using the following graphs:

110. Solve the Traveling Salesman problem for each graph.

u Find the adjaceny matrix for

111. K 4

112. K 2 3,

u Show that the following pairs of graphs are not isomorphic by finding an isomorphicinvariant they do not share.

113.

114.

7 - 24

CHAPTER 7: GRAPH THEORY CS218

Page 157: C2004 Study Guide

u Using the following two graphs

115. Show that the two graphs are isomorphic by finding the two functions

g V G V G

h E G E G

: ( ) ( ' )

: ( ) ( ' )

→→

u Redraw the following bipartite graphs, so that their bipartite natures are evident.

116.

u Draw the graph with the following adjacency matrix

117.

0 1 0 1 0

1 0 0 1 1

0 0 0 1 1

1 1 1 0 1

0 1 1 1 0

118.

0 1 1 0 1

1 0 1 0 1

1 1 0 0 0

0 0 0 0 1

1 1 0 1 0

u Find the diameters of the following matrics

119. A complete graph of n vertices

120. A complete bipartite graph, K m n,

121. An m-regular graph with n vertices

u For all integers n ≥ 1, show that

122. The number of edges of K n is n n( )−1

2

7 - 25

CS218 CHAPTER 7: GRAPH THEORY

Page 158: C2004 Study Guide

u Miscellaneous problems.

123. In a group of 15 people, is it possible for each person to have exactly 3 friends? Explain.

124. How many vertices of K m n, have degree m?

125. How many vertices of K m n, have degree n?

126. What is the total degree of K m n, ?

127. Find a formula in terms of m and n for the number of edges of K m n, . Explain.

128. Draw all non-isomorphic simple graphs with three vertices.

129. Find the adjacency matrix and the distance matrix corresponding to the following graph F:

130. What does it mean for two graphs to G and H to be isomorphic?

131. How would you attempt to show that two graphs are isomorphic?

132. How whould you attempt to show that two graphs are not isomorphic? List the stuctural properties you would have to consider.

133. Explain what is mean by a bipartite graph.

134. If G is a bipartite graph and G is isomorphic to graph H, is it possible for H not to be bipartite? Explain.

135. Show that the following graphs are not isomorphic.

7 - 26

CHAPTER 7: GRAPH THEORY CS218

a

b

c

d

e

a bc

de

qp

st

GH

Page 159: C2004 Study Guide

CHAPTER 8: MATRICES

Chapter Objectives

In this chapter, you will learn:

§ about some operations that can be performed with matrices;

§ about some special types of matrices;

§ how to multiply matrices;

§ how to transform a matrix;

8 - 1

Page 160: C2004 Study Guide

8.1 MATRICES

8.1.1 MA TRIX OPERATIONS

u A matrix is a rectangular table of numbers. The numbers are called entries (orelements) of the matrix.

u The dimension of the matrix is the number of rows and columns it contains. Thedimension is written in the form:

(Number of rows) × (Number of columns)

where the × is read “by.”

Example 1: For the matrix A =

−6 1 3

4 2 5

7 1 8

list a a23 31, , and a12

a23 is the entry in the second row and third column of A. Thus a23 5= . Similarly, a31 7= , and a12 1= −

u An alternative notation used to express the entries of a matrix is , [ ]A ij instead of .a ij

Algebraic Operations on Matrices

EqualityTwo matrices A and B are equal if they have the samedimension and corresponding entries are equal, that is a bij ij= for all pairs (i, j)

AdditionTwo matrices may be added only if they have the samedimension. To add two matrices, add correspondingentries.

SubtractionTwo matrices may be subtracted only if they have thesame dimension. To subtract two matrices, subtractcorresponding entries.

ScalarMultiplication

To multiply a matrix by a scalar, multiply each entryof the matrix by the scalar.

Exercise 1: If Aa b

c d=

and B =

6 3

9 5 and A = B what are the values of a, b, c,

and d?

8 - 2

CHAPTER 8: MATRICES CS218

Page 161: C2004 Study Guide

Example 2: If A =

2 1 4

3 7 10 , B =

−3 5 1

12 2 6 , and C =

−1 1 4

2 8 17

Calculate each of the following:

a. A B+ b. A C− c. 3B d. A B C+ −2 e. B C+ 5

a. A B+ =

+

−2 1 4

3 7 10

3 5 1

12 2 6 =

+ + ++ + +

− −

2 3 1 5 4 1

3 12 7 2 10 6

( ) =

5 4 3

9 9 16

b. A C− =

=

− − −−

− − −

2 1 4

3 7 10

1 1 4

2 8 17

2 1 1 1 4 4

3

( )

− − −

=

− − −2 7 8 10 17

1 2 8

5 1 7

c. 3 33 5 1

12 2 6

3 3 3 5 3 1

3 12 3 2 3 6

9 15B =

=

⋅ ⋅⋅ ⋅ ⋅

=

− −( ) −

3

36 6 18

d. A B C+ − =

+

− −

22 1 4

3 7 102

3 5 1

12 2 6

1 1 4

2 8 17

=+ − + − − +

+ − + − + −

=

2 6 1 1 10 1 4 2 4

3 24 2 7 4 8 10 12 17

7 8 6

19 3 5

e. B C+ =

+

=+ + −

+

− − −

53 5 1

12 2 65

1 1 4

2 8 17

3 5 5 5 1 20

12 10 2 40 6 85

8 10 21

22 42 91+ +

=

Example 3: Find D so that 25 8

1 3

4 7

1 5D+

=

− −

D must be a 2 2× matrix, so let Dx y

z w=

Then 25 8

1 3

x y

z w

+

− =

4 7

1 5 yields

2 5 2 8

2 1 2 3

4 7

1 5

x y

z w

− ++ −

=

Thus, using the definition of equality of matrices, 2 5 4 2 8 7 2 1 1x y z− = + = + = −, , and 2 3 5w− =

Solving each equation gives us x y z= = =−

−92

12 1, , , and w = 4

Therefore, D =

92

12

1 4

8 - 3

CS218 CHAPTER 8: MATRICES

Page 162: C2004 Study Guide

Basic Properties of Matrix Addition and Scalar Multiplication

If A, B, and C have the same dimensions, the following laws hold:

1. Associative property of addition: ( ) ( )A B C A B C+ + = + +

2. Commutative property of addition: A B B A+ = +

3. Distributive properties of scalar multiplication:

a. k A B kA kB( )+ = +

b. ( )k h A kA hA+ = +

4. Properties of the zero matrix (the matrix having all entriesequal to zero):

a. A A+ =0

b. k ⋅ =0 0

c. 0 0⋅ =A

8.1.2 TYPES OF MA TRI CES

u A vector is a list of numbers. If the list is written horizontally in a row then it is called a row vector. If the list is written vertically in a column then it is called a columnvector.

u A row vector with n entries is a 1× n matrix, and a column vector with m entries is an m×1 matrix.

Example 4: An example of a row vector is v = −[ ]15 3 4

Example 5: An example of a column vector is v =

15

3

4

l Remark 1: A column vector is not equal to a row vector even if there entries are the same.

u A matrix is a square matrix if the number of rows equals the number of columns.

u The diagonal of a matrix A consists of all the entries aii , that is, the entries whoserow and column numbers are equal.

u A diagonal matrix is a square matrix is a square matrix whose only nonzero entriesare diagonal entries. That is, aij = 0 if i j≠

u The identity matrix of order n is the n n× matrix having 1’s on the diagonal and 0’selsewhere. The identity matrix is denoted by I n

u The zero matrix is an m n× matrix in which all the entries in the matrix are zero. The zero matrix is denoted by 0 mn

8 - 4

CHAPTER 8: MATRICES CS218

Page 163: C2004 Study Guide

Example 6: Find the diagonal of the matrix A =

1 2 3

4 5 6

7 8 9

Matrix A is a square matrix since the number of rows is three and the number of columns is three also. The diagonal of matrix A is the numbers 1, 5, and 9

Example 7: The matrix

1 0 0 0

0 1 0 0

0 0 1 0

0 0 0 1

is the identity matrix I

Example 8: The matrix 0 0 0 0

0 0 0 0

0 0 0 0

is the zero matrix 0 34

8.1.3 MA TRIX MUL TI PLI CA TION

Matrix Multiplication

1. In order to multiply AB, the number of columns of A must be equal to the number of rows of B. The answer matrix will have the same number of rows as A and the same number of columns as B.

2. To find the (i, j) entry of the answer matrix, multiply row iof A into column j of B and add.

l Remark 2: In order to multiply two matrices the number of columns in the first matrix (vector) must be equal to the number of rows in the second matrix (vector).

l Remark 3: If you can multiply two matrices, the answer is a matrix, not a number.

Example 9: What is [ ]2 59

4−

?

[ ] ( )2 59

42 9 5 4 18 20 2− − −

= ⋅ + ⋅ = − = . Thus [ ] [ ]2 59

42− −

=

Example 10: What is [ ]3 7 2

8

1

6

?

[ ] ( )3 7 2

8

1

6

3 8 7 1 2 6 24 7 12 29− −

= ⋅ + ⋅ + ⋅ = − + = . Thus [ ] [ ]3 7 2

8

1

6

29−

=

l Remark 4: For the product AB to be defined, the middle two numbers must be equal.

8 - 5

CS218 CHAPTER 8: MATRICES

Page 164: C2004 Study Guide

l Remark 5: If the middle numbers of AB are equal, the dimension of AB is given by the two outside numbers

Thus, if n k= , the answer is an m h× matrix.

Exercise 2: For the following matrices, determine if the multiplication AB can be performed and if so what is the dimension of the answer matrix?

a. A is 4 3× and B is 3 2× b. A is 3 2× and B is 3 2×

c. A is 2 4× and B is 4 4× d. A is 3 1× and B is 1 2×

Example 11: Calculate 11 8

5 2

16 4

3 1

2 6−

First check to make sure that the multiplication can be performed:

the answer matrix is a 3 2× matrix. To get the (1, 1) entry, multiply row 1 of

the first matrix into column 1 of the second: ( ) ( ( ))11 3 8 2 33 16 17⋅ + ⋅ = − =− . To get

the (1, 2) entry, multiply row 1 of the first matrix into column 2 of the second:

( ) ( )11 1 8 6 11 48 59⋅ + ⋅ = + = . To get the (2, 1) entry, multiply row 2 of the first

matrix into column 1 of the second: ( ) (( )( ))5 3 2 2 15 4 19⋅ + = + =− − . Thus

11 8

5 2

16 4

3 1

2 6

11 3 8 2 11 1 8 6

5 3−−

=⋅ + ⋅ + ⋅

⋅( )

+ ⋅ +⋅ + ⋅ + ⋅

=− − −

( )( ) ( )

( )

2 2 5 1 2 6

16 3 4 2 16 1 4 6

17 59

19 7

40 40

l Remark 6: To get the ( , )i j entry of a matrix AB, multiply row i of matrix A into column j of matrix B.

8 - 6

CHAPTER 8: MATRICES CS218

Page 165: C2004 Study Guide

8.1.4 TRANS FORM ING MA TRI CES

u If A is an m n× matrix, then the transpose of A is the n m× matrix whose first row isthe first column of A, whose second row is the second column of A and so on.

u The transpose of A is denoted A t

Example 12: Find the transpose of A =

−3 1 5

12 7 6

Since A is a 2 3× matrix, the dimension of A t is 3 2× . The first row of A t is the first column of A, that is, 3 12. The second row of A t is the second column of A, that is, 1 7. The third row of A t is the third column of A. Thus, we have

A t =

3 12

1 7

5 6

Example 13: Determine each of the following:

a.

5 1 9

3 0 2

3 1 6

15 2 8

t

b. 2 1 7

8 3 41 2 6−

[ ] t

a. The transpose has dimension 3 4× , and the rows of the transpose correspond to the columns of the given matrix. Thus, we have

5 3 3 15

1 0 1 2

9 2 6 8

− −

b. First apply the transpose operation. The t applies only to the second matrix (the row vector that becomes a column vector). We then multiply:

2 1 7

8 3 41 2 6

2 1 7

8 3 4

1

2

6− −

=

[ ] t =⋅ + ⋅ + ⋅

⋅ + ⋅ + ⋅

=

( ) ( ) ( )

( ) (( ) ) ( )

2 1 1 2 7 6

8 1 3 2 4 6

46

26

Properties of the Transpose

The transpose satisfies the following properties:

1. ( )A At t =

2. ( )A B A Bt t t+ = +

3. ( )AB B At t t=

4. ( )kA kAt t=

l Remark 7: Matrix A is symmetric if A A t=

8 - 7

CS218 CHAPTER 8: MATRICES

Page 166: C2004 Study Guide

8.2 SUMMARY

8.2.1 RE MARKS

l A column vector is not equal to a row vector even if there entries are the same.

l In order to multiply two matrices the number of columns in the first matrix(vector) must be equal to the number of rows in the second matrix (vector)

l If you can multiply two matrices, the answer is a matrix, not a number.

l For the product AB to be defined, the middle two numbers must be equal.

l If the middle numbers of AB are equal, the dimension of AB is given by the twooutside numbers

Thus, if n k= , the answer is an m h× matrix.

l To get the ( , )i j entry of a matrix AB, multiply row i of matrix A into column j ofmatrix B

l Matrix A is symmetric if A A t=

8 - 8

CHAPTER 8: MATRICES CS218

Page 167: C2004 Study Guide

8.3 MATRICES EXERCISES

u Evaluate:

1. 3

1

10

12

3

2

+

2. 2 1 3

0 5 7

8 11 15

2 3 9

− −

− −

+

3.

5 5

2 3

0 1

2

3 1

7 2

8 5

− −

4. 4 2 7

13 5 8

2 1

10 0−

5. [ ] [ ]5 2 8 4 2 7 5− −+

u For A =

5 2

1 0

2 6

B =

−3 6

0 1

5 8

and C =

13 2

11 9

7 1

evaluate:

6. B A− 2 7. C A B+ −3 8. A C+

9. − 4A 10. 12

32A B+ 11. 01 02 03. . .A B C+ −

u Construct each of the following matrices:

12. 2 4× matrix A where a i jij = − 2

13. 3 3× matrix B where b i ij jij = − +3 4 2

14. 3 2× matrix C where c i jij = max{ , }

15. 2 3× matrix D where d i jij = +2 7

u Solve for the variables in each of the following matrices:

16. 2 5

3

11

7

x

y

+−

=

17. x

y

x

y

++

+

+−

=

3

2 1

5 1

4 2

10

4

18. 3 4

5 2

4 6

3 16

x

y

x

y

++

=−

+

19. 4 3

2

8

9

x y

x y

−+

=

20. x y

x y

+ −− +

=

−2 5

3 2

12

1621.

x y

y w

w

+−

=

2

4

2

9

25

6

u State the dimension of each of the following matrices:

22. 3

8−

23. −

3 1 4 7 8

1 2 3 1 1124.

12 1

3 6

2 2

25. [ ]5 5 1 0−

8 - 9

CS218 CHAPTER 8: MATRICES

Page 168: C2004 Study Guide

u A company has three factories. Their production output is listed in the followingmatrix with the columns representing the four weeks in February:

320 430 190 318

212 189 300 260

290 450 385 273

26. How many items did factory 3 produce in the second week of February?

27. How many items did factory 1 produce in the last week of February?

28. What was factory 2’s total output for the month?

29. How many items did the company produce during the second week of February?

u For the matrix A =

− −

8 1 3 7

3 9 4 2

0 1 2 5

list

30. a13 31. a22 32. a32 33. j a jif 2 3= −

u Find:

34. A matrix E so that 51 3 4

3 1 7

21 5 9

8 11 43E −

=

− −

u Calculate each of the following:

35. 3 5 6

2 0 4

5 7

8 11

0 2

36. 11 12

3 0

5 6

1 2

3 12−

−−

37. [ ]5 8 1 10

2

4

3

17

−−

u If B has dimension 5 2× and AB is square, what is the dimension of:

38. AB 39. B t 40. BA 41. A

u Simplify:

42. 4 3 3

1 0 4

5 4

3 2

1 0

8 17

10 31

− −

−−

−−

+

43. [ ] [ ]−− −

− −− −

−7 12

1 3 5 7

2 4 6 89 10 11 12

u Let A =

1 2

4 1 and B =

2 3

2 5

44. Show that AB BA≠

8 - 10

CHAPTER 8: MATRICES CS218

Page 169: C2004 Study Guide

u Find:

45. A 2 2× matrix A such that A A AA+ =

u Determine each of the following:

46. 4 3 6

1 1 0

t

47. 3 12 2 2

6 5 6 1

− −

t

u Let A =

2 3

5 1 and B =

− 5 0

8 6

48. Show ( )AB A Bt t t≠ 49. ( )AB B At t t=

u Answer the question using the rules of matrics.

50. What do you know about the sizes of the matrices A and B if both of the products AB and BA are defined?

8 - 11

CS218 CHAPTER 8: MATRICES

Page 170: C2004 Study Guide

APPENDIX A: GLOSSARY

The following are some of the terms you should be familiar with, or willencounter during your study of discrete mathematics. You are notrequired to memorize these terms. They are presented here to help yourunderstanding of discrete mathematics.

A - 1

Page 171: C2004 Study Guide

GLOSSARY

u AAbsolute value of a real number: The absolute value of a, written |a|, is thenonnegative number which is equal to a if a is nonnegative and equal to −a if a isnegative.

Additive inverse: The additive inverse of a number a is the number −a for which a a+ − =( ) 0.

Adjacent vertices: Two vertices that are connected together by an edge.

Antecedent: The first statement in an implication. See hypothesis.

Antisymmetric: A relation is antisymmetric if a related to b and b related to a imply a b= .

Arc: A segment, or piece, of a curve which has direction.

u B

Biconditional: A biconditional is an equivalence formed from two givenpropositions by connecting them by “if, and only if .” An equivalence is true if bothpropositions are true, or if both are false. The equivalence formed from propositionsp and q is usually denoted by p q↔ , or p q≡ .

Bijection: A bijection from set A to a set B is a one-to-one correspondence between Aand B, i.e., a function from A into B that is both an injection and a surjection.

Binary (binary number system): A system of numerals for representing realnumbers that uses the base 2 instead of the base 10. Only the digits 0 and 1 areneeded.

Binary operation: An operation which is applied to two objects.

Bridge: In a graph G, a bridge is an edge whose removal will increase the number ofcomponents in the graph.

u C

Cardinal (cardinal number): A number which designates the manyness of a set ofthings; the number of units, but not the order in which they are arranged; used indistinction to signed numbers.

Cartesian product: The Cartesian product of two sets A and B is the set (denotedby A B× ) of all pairs ( , )x y such that x is a member of A and y is a member of B.

Categorical syllogism: A categorical syllogism relates implications with universalquantifiers, an example of which is: If the propositions “ For any quadrilateral T, if Tis a square, then T is a rectangle” and “For any quadrilateral T, if T is a rectangle,then T is a parallelogram” are true, then the proposition “For any quadrilateral T, ifT is a square, then T is a parallelogram” is true.

Circuit: A closed walk that does not contain a repeated edge. See trail.

A - 2

APPENDIX A: GLOSSARY CS218

Page 172: C2004 Study Guide

Closed walk: A walk that begins and ends at the same vertex.

Combination: A combination of a set of objects is any subset without regard toorder.

Comparable (comparable functions): Functions f and g which have real-number values, which have a common domain of definition D, and which are such that either f x g x( ) ( )≤ for all x in D or f x g x( ) ( )≥ for all x in D.

Complement of a set: The set of all objects that do not belong to the given set U, but belong to a given whole space (or set) that contains U.

Complete graph: A graph in which any two distinct nodes are joined by exactly oneedge.

Component of a graph: A maximal connected subgraph.

Compostion of functions: Forming a new function h (the composite function)from given functions g and f by the rule that h x g f x( ) [ ( )]= for all x in the domain of ffor which f x( ) is in the domain of g. This composite of h of g and f is writtenas g fo orgf. The order in which functions are combined is important.

Compostion of relations: Given a relation R and a relation S, the compositerelation R So is the relation for which x is related to z if and only if there is an object yfor which xRy and yRz.

Compound event: Suppose S 1 and S 2 are sampe spaces for the outcomes of twoexperiments and that E1 and E2 are events contained in S 1 and S 2, respectively. Thenthe Cartesian product E E1 2× is a compound event.

Conclusion: The statement which follows (or is to be proved to follow) as aconsequence of the hypothesis of the theorem.

Conditional probability: If A and B are events, then the conditional probability ofA given B is the probability of A, assuming B holds.

Conditional statement: Same as implication.

Conjunction: The proposition formed from two given propositions by connectingthem with the word and. The conjunction of propositions p and q is usually written as p q∧ , or p q⋅ , and read “ p and q .” The conjunction of p and q is true if and only if both pand q are true.

Connected graph: A graph is connected if any two nodes can be joined by movingalong edges, otherwise it is disconnected.

Consecutive: Following in order without jumping.

Consequent: The second statement in an implication. See conclusion.

Contradiction: A contradiction is a statement form that is always false regardlessof the truth values of the individual statements substituted for its statementvariables.

Contradiction proof: See indirect proof.

Contradictory statement: A statement whose form is a contradiction.

Contrapositive: The implication which results from replacing the antecedent bythe negation of the consequent and the consequent by the negation of the antecedent. An implication and its contrapositive are equivalentthey are either both true or

A - 3

CS218 APPENDIX A: GLOSSARY

Page 173: C2004 Study Guide

both false. The contrapositive of an implication is the converse of the inverse (or theinverse or the converse) of the implication.

Converse: The theorem (or implication) resulting from interchanging thehypothesis and conclusion. If an implication is true, its converse my be either true orfalse. If an implication p q→ and its converse q p→ are both true, then theequivalence p q↔ is true.

Cycle: In a graph G is a path that begins and ends at the same place.

u D

Dependent events: Two events are dependent if they are not independent.

Disjoint: Two sets are disjoint if there is no object which belongs to each of the sets(i.e., if the intersection of the sets is the null set).

Difference of sets: The difference A B− of two sets A and B is the set of all objects thatbelong to A and do not belong to B.

Direct proof: A direct proof uses an argument that makes direct use of thehypotheses and arrives at the conclusion.

Directed line (directed edge): A line (or line segment) on which the direction from one end to the other has been indicated.

Disconnected graph: See connected graph.

Disjoint: Two sets are disjoint if there is no object which belongs to each of the sets(i.e., if the intersection of the sets is the null set).

Disjunction: The proposition formed from two given propositions by connectingthem with the word or, thereby asserting the truth of one or both of the givenpropositions. The disjunction of two propositions is false if and only if both thepropositions are false. The disjunction of propositions p and q is usually written p q∨and read “p or q.” This is the inclusive disjunction, which is ordinarily used inmathematics.

Domain: The domain of a function is the set of values which the independentvariable may take on, or the range of the independent variable.

u EEdge: A line or a line segment which is the intersection of two plane faces of ageometric figure, or which is the boundary of a plane figure.

Elementary event: A single outcome of an experiment.

Elurian circuit: Let G be a graph. An Eulerian circuit for G is a circuit that contains every vertex and every edge of G. That is, an Eulerian circuit for G is a sequence ofadjacent vertices and edges in G that starts and ends at the same vertex, uses everyvertex of G at least once, and uses every edge of G exactly once.

Elurian path: Let G be a graph and let v and w be two vertices of G. An Eulerianpath from v to w is a sequence of adjacent edges and vertices that starts at v, ends atw, passes through every vertex of G at least once, and traverses every edge of Gexactly once.

A - 4

APPENDIX A: GLOSSARY CS218

Page 174: C2004 Study Guide

Empty set: The set with no members.

Endpoints: The ends of an edge in a graph.

Equality: The relation of being equal; the statement, usually in the form of anequation, that two things are equal.

Equivalence of propositions: See biconditional.

Equivalence relation: A relation between elements of a given set which is areflexive, symmetric, and transitive relation and which is such that any two elementsof the set are either equivalent or not equivalent.

Equivalent: Two objects that are so related that they are ‘similar’ in such a way that they can be said to be equal.

Even number: An integer that is divisible by 2. All even numbers can be written inthe form 2n, where n is an integer.

Event: For an experient with a finite or countably infinite number of outcomes, anevent is any subset of the possible outcomes of the experiment.

Exclusive disjunction: The exclusive disjunction of p and q is true if and only ifexactly one of p and q is true.

Existential quantifier: The exixtential quantifier is the prefix “there exists.” It issymbolized ∃.

u FFinite geometric sequence: The general form of a finite geometric sequence is { , , , , , }a ar ar ar arn2 3 1L − , where a is the first term, r is the common ratio, and arn−1 is

the last term. The sum of the terms is a r

r

n( )1

1

−−

.

Finite set: A set which contains a finite (limited) number of members; a set whichhas, for some integer n, just n members.

Function: An association of exactly one object from one set (the range) with eachobject from another set (the domain).

u GGeometric sequence: A geometric sequence is a sequence for which the ratio of aterm to its predecessor is the same for all terms.

Graph: An abstract mathematical system that consists of a set of objects callednodes (or vertices or points), a set of objects called edges (or arcs, lines, or segments),and a function f (the incidence function).

Graph theory: The study of graphs.

u H

Hamiltonian circuit: Given a simple graph G, a Hamiltonian circuit for G is asimple circuit that includes every vertex of G. That is, a Hamiltonian circuit for G is a

A - 5

CS218 APPENDIX A: GLOSSARY

Page 175: C2004 Study Guide

sequence of adjacent vertices and distinct edges in which every vertex of G appearsexactly once, and that starts and ends at the same vertex.

Hamiltonian path: Given a graph G and letting v and w be two vertices of G, then aHamiltonian path is a path starting a v and ending at w in which every vertex of graph G appears exactly once.

Hypothesis: An assumed proposition used as a premise in proving something else; acondition; that from which something follows.

Hypothetical syllogism: A hypothetical syllogism is a particular type of syllogismwhich relates three implications ( , , )p q r and states: “If p implies q, and q implies r,then p implies r.” This is frequently written as [( ) ( ] ( )p q q r p r→ ∧ → → →

u I

Image: If A is a subset of the domain of f, then the image of A is denoted by f A( ) andis the set of all images of members of A.

Implication: (1) A statement that follows from other given statements. (2) Aproposition formed from two given propositions by connecting them in the form “ If L, then L.” The first statement is the antecedent (or bypothesis) and the second is theconsequent (or conclusion). An implication is true in all cases except when theantecedent is true and the consequent is false. For propositions p and q, theimplication “if p, then q” is usually written as p q→ , and is read “p implies q.”

Incidence function: A function defined on the set of edges that assigns to eachdirected edged exactly one ordered pair of nodes and to each undirected edge exactlyone unordered pair.

Inclusive disjunction: See disjunction.

Independent events: Two events are independent if the occurance ornonoccurrence of one of them does not change the probability of the occurrence of the other event.

Indirect proof: An indirect proof shows that it is impossible for that which is to beproved to be false, because if it is false some accepted facts are contradicted; in otherwords, it assumes the negation of the proposition to be proved and then shows thatthis leads to a contradiction.

Induction: A method of proving a law or theorem by showing that it holds in the first case and showing that, if it holds for all the cases preceding a given one, then it holdsfor this case. Before the method can be applied it is necessary that the different casesof the law depend upon a parameter which takes on the values 0, 1, 2, 3, …. Theessential steps of the proof are as follows: (1) Prove the theorem for the first case. (2)Prove that if the theorem is true for the nth case (or for the first through nth cases),then it is true for the ( )n+1 th case. (3) Conclude that it must then be true for all cases.For, if there were a case for which it is not true, there must be a first case for which itis not true. Because of (1) this is not the first case. But because of (2), it cannot be anyother case [since the previous case could not be true without the next case (known tobe false) being true; it could not be false because the next case is the false case].

Infinite set: A set which is not finite; a set which has an unlimited number ofmembers; a set which can be put into one-to-one correspondence with a proper part of itself.

A - 6

APPENDIX A: GLOSSARY CS218

Page 176: C2004 Study Guide

Injection: An injection from a set A to a set B is a function that is one-to-one andwhose domain is A and whose range is contained in B.

Integer: Any of the numbers L L, , , , , , , , , ,− − − −4 3 2 1 0 1 2 3 4

Intersection: The intersection of two sets consists of all the points that belong toeach of the sets. The intersection of sets U and V usually is denoted by U V∩ .

Inverse image: The inverse image (pre-image) of a set B contained in the range of fis denoted by f B−1( ) and is the subset of the domain whose members have images inB. In particular, the inverse image of a point y in the range is the set of all x for which f x y( ) = .

Inverse of a function: If y f x= ( ) is equivalent to x g y= ( ), then f is the inverse of g(and vice versa).

Inverse of an implication: The implication which results from replacing both theantecedent and the consequent by their negations. The converse and the inverse of animplication are equivalentthey are either both true or both false.

Irrational number: A real number not expressible as an integer or quotient ofintegers.

Irreflexive: A relation such that x does not bear the given relation to itself for any x.

u J

u K

u LLogically equivalent: Two statements are logically equivalent if they areequivalent because of their logical form rather than because of mathematicalcontent.

Loop: An edge that joins a node to itself.

u M

Mathematical induction: See induction.

Multiple edges: Two egdes with the same set of endpoints.

Multiplicative inverse: The multipicative inverse of a nonzero number a is thenumber 1

a for which a a⋅ =( )1 1.

u N

Natural numbers: The positive integers. 1, 2, 3, …

Negation: The proposition formed from the given proposition by prefixing “It isfalse that,” or simply “not.” The negation of a proposition p is frequently written as

A - 7

CS218 APPENDIX A: GLOSSARY

Page 177: C2004 Study Guide

~p and read “not p.” The negation of a proposition is true if and only if theproposition is false.

Negation: The proposition formed from the given proposition by prefixing “It isfalse that,” or simply “not.” The negation of a proposition p is frequently written as~p and read “not p.” The negation of a proposition is true if and only if theproposition is false.

Node: A dot.

Null set: The set which is emptyhas no members.

u O

Odd integer: A number that is not evenly divisible by 2; any number of the form 2 1n+ , where n is an integer.

Ordered pair: A set with two (possibly equal) terms for which one term isdesignated as the first and the other as the second.

Ordered n-tuple: Similar to an ordered pair, where the ordered n-tuple ( , , , )x x xn1 2 L

has the first term x1, the second term x2, etc.

u P

Pairwise disjoint: A system of more than two sets is pairwise disjoint if each pair ofsets belonging to the system is disjoint.

Parallel arcs: Directed lines in which one is directed from vertex v to vertex w andthe other is directed from vertex w to vertex v.

Path: A sequence of edges that goes from one edge to another through a commonnode, but each edge in the sequence occurs only once.

Partial ordering: A relation on a set A that is reflexive, antisymmetric, andtransitive.

Permutation: (1) An ordered arrangement or sequence of all or part of a set ofthings. (2) An operation which replaces each of a set of objects by itself or anotherobject in the set in a one-to-one manner.

Plane: A surface such that a straight line joining any two of its points lies entirely inthe surface.

Power set: Given a set A, the power set of A denoted P A( ) is the set of all subsets of A.

Pre-image: See inverse image.

Prime number: An integer p which is not 0 or ±1 and is divisible by no integersexcept ±1 and ± p.

Probability: Let n be the number of exhaustive, mutually exclusive, and equallylikely cases of an event under a given set of conditions. If m of these cases are knownas the event A, then the probability of event A under the given set of conditions is mn.

Proof: (1) The logical argument which establishes the truth of a statement. (2) Theprocess of showing by means of an assumed logical process that what is to be provedfollows from certain previously proved or axiomatically accepted propositions.

A - 8

APPENDIX A: GLOSSARY CS218

Page 178: C2004 Study Guide

Proper set: A subset R is a proper subset of a set S if R is a subset of S and R S≠ .

Proposition: (1) A theorem or problem. (2) A theorem or problem with its proof orsolution. (3) Any statement which makes an assertion which is either true or false, orwhich has been designated as true or false.

u Q

Quantifier: Prefixes such as “for every” or “there are.” Quantifiers precede apropositional function and may be represented symbolically. See universialquantifier, existential quantifier.

u R

Range: The range of a function is the set of values that the function takes on.

Rational number: A number that can be expressed as an integer or as a quotient ofintegers.

Real number: Any rational or irrational number.

Reciprocal: See multiplicative inverse.

Recurrence relation: A recurrence relation for a sequence a a a0 1 2, , ,K is a formulathat relates each term ak to certain of its predecessors a a ak k k i− − −1 2, , ,K , where i is afixed integer and k is any integer greater than or equal to i. The initial conditionsfor such a recurrence relation specify the values of a a a ai0 1 2 1, , , ,K − .

Reflexive relation: A relation of which it is true that, for any x, x bears the givenrelation to itself.

Region: A set that is the union of an open connected set and none, some or all of itsboundary points.

Relation: Equality, inequality, or any property that can be said to hold (or not hold)for two objects in a specified order.

u SSequence: A set of quantities ordered as are the positive integers.

Series: The indicated sum of a finite or infinite sequence of terms.

Set: A collection of particular things, as the set of numbers between 3 and 5, the set ofpoints on a segment of a line, or within a circle, etc.

Simple circuit: A circuit that does not have any other repeated vertex except thefirst and the last.

Simple path: A path from v to w that does not contain a repeated vertex.

Subset: If each member of a set A belongs to a set B, then one says that A is contained in B, B contains A, A is a subset of B, or B is a superset of A.

Superset: See subset.

A - 9

CS218 APPENDIX A: GLOSSARY

Page 179: C2004 Study Guide

Surjection: A surjection from a set A to a set B is a function whose domain is A andwhose range is B, i.e., a function from A onto B.

Syllogism: A logical statement that involves three propositions, usually called themajor premise, minor premise, and conclusion , the conclusion necessarily being trueif the premises are true.

Symbol: A letter or mark of any sort representing quantities, relations, oroperations.

Symmetric function: A function of two or more variables which remainsunchanged under every interchange of two of the variables; xy xz yz+ + is a symmetricfunction of x, y, and z.

Symmetric relation: A relation which has the property that if a is related to b, thenb is related in like manner to a.

u TTautology: A tautology is a statement form that is always true regardless of thetruth values of the individual statements substituted for its statement variables.

Tautological statement: A statement whose form is a tautology.

Trail: A walk in which the edges (but not necessarily the vertices) are distinct.

Transitive relation: A relation which has the property that if A bears the relationto B and B bears the same relation to C, then A bears the relation to C.

Transpose of a matrix: The matrix resulting from interchanging the rows andcolumns in the given matrix.

Tree: A connected nonempty graph that contains no closed paths.

u UUndirected edge: A line segment. A line without direction.

Union: The union of of a collection of sets is the set whose members are those objectsthat belong to at least one of the given sets. The union of two set U and V is usuallydenoted by U V∪ .

Universial quantifier: The universal quantifier is the prefix “for every”symbolized ∀.

Universial set: The set of all objects admissible in a particular problem ordiscussion.

u VVertex: A dot. The endpoints in a graph.

u W

Walk: A finite alternating sequence of adjacent vertices from v to w in a graph G.

A - 10

APPENDIX A: GLOSSARY CS218

Page 180: C2004 Study Guide

Whole number: (1) One of the integers 0, 1, 2, 3, … (2) A positive integer; i.e., anatural number.

u X

u Y

u ZZero of a function: A value of the argument for which the function is zero.

A - 11

CS218 APPENDIX A: GLOSSARY

Page 181: C2004 Study Guide