Math Discreta

Embed Size (px)

DESCRIPTION

Discreta ciencias

Citation preview

  • Discrete mathematics and algebraR. SimonMT3170, 2790170

    2011

    Undergraduate study in Economics, Management, Finance and the Social Sciences

    This is an extract from a subject guide for an undergraduate course offered as part of the University of London International Programmes in Economics, Management, Finance and the Social Sciences. Materials for these programmes are developed by academics at the London School of Economics and Political Science (LSE).

    For more information, see: www.londoninternational.ac.uk

  • This guide was prepared for the University of London International Programmes by:

    Dr R.Simon, Lecturer, Department of Mathematics, London School of Economics and Political Science.

    This is one of a series of subject guides published by the University. We regret that due to pressure of work the author is unable to enter into any correspondence relating to, or arising from, the guide. If you have any comments on this subject guide, favourable or unfavourable, please use the form at the back of this guide.

    University of London International Programmes

    Publications OfficeStewart House32 Russell SquareLondon WC1B 5DNUnited Kingdom

    Website: www.londoninternational.ac.uk

    Published by: University of London

    University of London 2011

    The University of London asserts copyright over all material in this subject guide except where otherwise indicated. All rights reserved. No part of this work may be reproduced in any form, or by any means, without permission in writing from the publisher.

    We make every effort to contact copyright holders. If you think we have inadvertently used your copyright material, please let us know.

  • Contents

    Contents

    1 Introduction 1

    1.1 This course . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    1.1.1 Relationship to previous mathematics courses . . . . . . . . . . . 1

    1.1.2 Aims . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    1.1.3 Learning outcomes . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    1.1.4 Topics covered . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    1.2 Recommended books . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    1.2.1 Essential reading . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    1.2.2 Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    1.3 Online study resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    1.3.1 The VLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    1.3.2 Making use of the Online Library . . . . . . . . . . . . . . . . . . 4

    1.4 Examination advice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    1.5 Basic notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    2 Elementary counting 7

    Essential reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    2.2 Selections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    2.2.1 Number of functions . . . . . . . . . . . . . . . . . . . . . . . . . 7

    2.2.2 Functions with restrictions and equivalence relations . . . . . . . 8

    2.2.3 Pascals triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    Exercises for section 2.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    2.3 Inclusion-exclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    2.3.1 The theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    2.3.2 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    2.3.3 Surjective functions . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    Exercises for section 2.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    2.4 Partitions and permutations . . . . . . . . . . . . . . . . . . . . . . . . . 23

    i

  • Contents

    2.4.1 Partitions of an integer . . . . . . . . . . . . . . . . . . . . . . . . 23

    2.4.2 Partition and cycle types . . . . . . . . . . . . . . . . . . . . . . . 23

    2.4.3 Number of partitions . . . . . . . . . . . . . . . . . . . . . . . . . 24

    2.4.4 Permutations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

    2.4.5 Ferrers diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    Exercises for section 2.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    2.5 The Stirling numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    2.5.1 Stirling numbers of the first kind . . . . . . . . . . . . . . . . . . 31

    2.5.2 Stirling numbers of the second kind . . . . . . . . . . . . . . . . . 32

    2.5.3 Number of permutations . . . . . . . . . . . . . . . . . . . . . . . 34

    Exercises for section 2.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

    Learning outcomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

    Solutions to exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

    Solutions to section 2.2 exercises . . . . . . . . . . . . . . . . . . . . . . . 38

    Solutions to section 2.3 exercises . . . . . . . . . . . . . . . . . . . . . . . 39

    Solutions to section 2.4 exercises . . . . . . . . . . . . . . . . . . . . . . . 42

    Solutions to section 2.5 exercises . . . . . . . . . . . . . . . . . . . . . . . 43

    3 Generating functions 47

    Essential reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

    Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

    3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

    3.2 The basic theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

    3.2.1 What is a generating function? . . . . . . . . . . . . . . . . . . . 47

    3.2.2 Making change . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

    3.2.3 The Fibonacci numbers . . . . . . . . . . . . . . . . . . . . . . . . 49

    3.2.4 A way to find the generating function . . . . . . . . . . . . . . . . 51

    3.2.5 Algebraic manipulations . . . . . . . . . . . . . . . . . . . . . . . 52

    3.2.6 Calculus manipulations . . . . . . . . . . . . . . . . . . . . . . . . 53

    3.2.7 How to find the explicit solution . . . . . . . . . . . . . . . . . . . 56

    Exercises for section 3.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

    3.3 Recurrence relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

    3.3.1 What is a recurrence relation? . . . . . . . . . . . . . . . . . . . . 59

    3.3.2 Equivalences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

    3.3.3 Tables and long division . . . . . . . . . . . . . . . . . . . . . . . 62

    3.3.4 Composite linear recurrence relations . . . . . . . . . . . . . . . . 65

    ii

  • Contents

    3.3.5 Initial conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

    Exercises for section 3.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

    3.4 Non-linear recurrence relations . . . . . . . . . . . . . . . . . . . . . . . . 71

    3.4.1 The Catalan numbers . . . . . . . . . . . . . . . . . . . . . . . . . 72

    3.4.2 Partitions of an integer . . . . . . . . . . . . . . . . . . . . . . . . 73

    3.4.3 A theorem of Euler . . . . . . . . . . . . . . . . . . . . . . . . . . 74

    Exercises for section 3.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

    Learning outcomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    Solutions to exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    Solutions to section 3.2 exercises . . . . . . . . . . . . . . . . . . . . . . . 77

    Solutions to section 3.3 exercises . . . . . . . . . . . . . . . . . . . . . . . 79

    Solutions to section 3.4 exercises . . . . . . . . . . . . . . . . . . . . . . . 84

    4 Graph theory 87

    Essential reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    4.1.1 Basic definition and examples . . . . . . . . . . . . . . . . . . . . 87

    4.1.2 Adjacency, distance, and connectivity . . . . . . . . . . . . . . . . 91

    4.1.3 Degree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

    4.1.4 Minors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

    4.1.5 Directed graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

    Exercises for section 4.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

    4.2 Walks and cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    4.2.1 Eulerian walks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    4.2.2 Hamiltonian cycles . . . . . . . . . . . . . . . . . . . . . . . . . . 96

    Exercises for section 4.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

    4.3 Trees and forests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

    4.3.1 Numbers of edges, vertices, and components . . . . . . . . . . . . 99

    4.3.2 Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

    4.3.3 Spanning trees and forests . . . . . . . . . . . . . . . . . . . . . . 102

    4.3.4 Greedy algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

    Exercises for section 4.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

    4.4 Vertex colouring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

    4.4.1 Chromatic number and polynomial . . . . . . . . . . . . . . . . . 104

    4.4.2 A-cyclic orientations . . . . . . . . . . . . . . . . . . . . . . . . . 106

    iii

  • Contents

    Exercises for section 4.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

    4.5 Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

    4.5.1 Halls theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

    4.5.2 Vertex covering . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

    4.5.3 Permutation matrices . . . . . . . . . . . . . . . . . . . . . . . . . 111

    Exercises for section 4.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

    4.6 Directed graphs and flows . . . . . . . . . . . . . . . . . . . . . . . . . . 113

    4.6.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

    4.6.2 Tournaments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

    4.6.3 Network flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

    Exercises for section 4.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

    Learning outcomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

    Solutions to exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

    Solutions to section 4.1 exercises . . . . . . . . . . . . . . . . . . . . . . . 120

    Solutions to section 4.2 exercises . . . . . . . . . . . . . . . . . . . . . . . 122

    Solutions to section 4.3 exercises . . . . . . . . . . . . . . . . . . . . . . . 123

    Solutions to section 4.4 exercises . . . . . . . . . . . . . . . . . . . . . . . 124

    Solutions to section 4.5 exercises . . . . . . . . . . . . . . . . . . . . . . . 126

    Solutions to section 4.6 exercises . . . . . . . . . . . . . . . . . . . . . . . 127

    5 Group theory 129

    Essential reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

    Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

    5.1 Permutations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

    5.1.1 Basic properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

    5.1.2 Transpositions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

    5.1.3 Even or odd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

    Exercises for section 5.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

    5.2 Group axioms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

    5.2.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

    5.2.2 Cancellation law . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

    5.2.3 Examples of groups . . . . . . . . . . . . . . . . . . . . . . . . . . 137

    5.2.4 Subgroups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

    5.2.5 Examples of subgroups . . . . . . . . . . . . . . . . . . . . . . . . 139

    Exercises for section 5.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

    5.3 Cosets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

    iv

  • Contents

    5.3.1 Equivalence relation . . . . . . . . . . . . . . . . . . . . . . . . . 141

    5.3.2 Homomorphisms . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

    5.3.3 Normal subgroups . . . . . . . . . . . . . . . . . . . . . . . . . . 142

    Exercises for section 5.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

    5.4 Group action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

    5.4.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

    5.4.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

    5.4.3 Orbits and stabilisers . . . . . . . . . . . . . . . . . . . . . . . . . 147

    5.4.4 More on homomorphisms . . . . . . . . . . . . . . . . . . . . . . . 149

    5.4.5 Commuting permutations . . . . . . . . . . . . . . . . . . . . . . 150

    Exercises for section 5.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

    5.5 Counting orbits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

    5.5.1 Burnsides lemma . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

    5.5.2 Examples of Burnsides lemma . . . . . . . . . . . . . . . . . . . . 155

    5.5.3 Automorphisms and conjugacy . . . . . . . . . . . . . . . . . . . 156

    Exercises for section 5.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

    Learning outcomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

    Solutions to exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

    Solutions to section 5.1 exercises . . . . . . . . . . . . . . . . . . . . . . . 158

    Solutions to section 5.2 exercises . . . . . . . . . . . . . . . . . . . . . . . 159

    Solutions to section 5.3 exercises . . . . . . . . . . . . . . . . . . . . . . . 161

    Solutions to section 5.4 exercises . . . . . . . . . . . . . . . . . . . . . . . 162

    Solutions to section 5.5 exercises . . . . . . . . . . . . . . . . . . . . . . . 165

    6 Ring and field theory 169

    Essential reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

    Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

    6.1 Introduction to rings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

    6.1.1 Axioms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

    6.1.2 Elementary results . . . . . . . . . . . . . . . . . . . . . . . . . . 170

    6.1.3 Examples of rings . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

    6.1.4 Ideals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

    Exercises for section 6.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

    6.2 Commutative rings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

    6.2.1 Zero divisors and integral domains . . . . . . . . . . . . . . . . . 173

    6.2.2 Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

    v

  • Contents

    6.2.3 Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

    6.2.4 Factoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

    Exercises for section 6.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

    6.3 Polynomial factor rings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

    6.3.1 Basic structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

    6.3.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

    6.3.3 Factoring by an irreducible . . . . . . . . . . . . . . . . . . . . . . 181

    6.3.4 Field extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182

    Exercises for section 6.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

    Learning outcomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185

    Solutions to exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185

    Solutions to section 6.1 exercises . . . . . . . . . . . . . . . . . . . . . . . 185

    Solutions to section 6.2 exercises . . . . . . . . . . . . . . . . . . . . . . . 186

    Solutions to section 6.3 exercises . . . . . . . . . . . . . . . . . . . . . . . 187

    7 Finite geometry 189

    Essential reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

    Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

    7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

    7.2 Finite fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

    7.2.1 Basic construction . . . . . . . . . . . . . . . . . . . . . . . . . . 189

    7.2.2 Characteristic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190

    7.2.3 Cyclic groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190

    7.2.4 Existence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192

    Exercises for section 7.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

    7.3 Finite linear algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

    7.3.1 Basis and dimension . . . . . . . . . . . . . . . . . . . . . . . . . 196

    7.3.2 Determinant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

    7.3.3 Linear transformations . . . . . . . . . . . . . . . . . . . . . . . . 198

    7.3.4 Inner product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

    7.3.5 Diagonalisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199

    Exercises for section 7.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 201

    7.4 Designs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201

    7.4.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

    7.4.2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

    7.4.3 Existence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

    vi

  • Contents

    7.4.4 t-designs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204

    7.4.5 Difference sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205

    Exercises for section 7.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

    7.5 Planes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

    7.5.1 Affine planes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

    7.5.2 Projective planes . . . . . . . . . . . . . . . . . . . . . . . . . . . 208

    7.5.3 Matrix action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

    Exercises for section 7.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . 214

    Learning outcomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214

    Solutions to exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215

    Solutions to section 7.2 exercises . . . . . . . . . . . . . . . . . . . . . . . 215

    Solutions to section 7.3 exercises . . . . . . . . . . . . . . . . . . . . . . . 216

    Solutions to section 7.4 exercises . . . . . . . . . . . . . . . . . . . . . . . 218

    Solutions to section 7.5 exercises . . . . . . . . . . . . . . . . . . . . . . . 220

    8 Coding theory 223

    Essential reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

    Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

    8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

    8.1.1 The problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

    8.1.2 Binary spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

    8.1.3 Distance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

    8.1.4 Error correcting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

    Exercises for section 8.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

    8.2 Linear codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

    8.2.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

    8.2.2 Generator matrices . . . . . . . . . . . . . . . . . . . . . . . . . . 228

    8.2.3 Parity check matrices . . . . . . . . . . . . . . . . . . . . . . . . . 228

    8.2.4 Minimal distance . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

    8.2.5 Correcting one error . . . . . . . . . . . . . . . . . . . . . . . . . 230

    Exercises for section 8.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

    8.3 Special codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232

    8.3.1 Hamming codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232

    8.3.2 Cyclic codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

    8.3.3 Cyclic parity check matrices . . . . . . . . . . . . . . . . . . . . . 234

    8.3.4 Irreducible polynomials . . . . . . . . . . . . . . . . . . . . . . . . 235

    vii

  • Contents

    Exercises for section 8.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 236

    Learning outcomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

    Solutions to exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

    Solutions to section 8.1 exercises . . . . . . . . . . . . . . . . . . . . . . . 237

    Solutions to section 8.2 exercises . . . . . . . . . . . . . . . . . . . . . . . 238

    Solutions to section 8.3 exercises . . . . . . . . . . . . . . . . . . . . . . . 239

    A Sample examination paper 241

    B Solutions, comments and marking scheme to the Sample examinationpaper 251

    viii

  • List of Figures

    List of Figures

    2.1 |Y ||X| = |Y | |Y ||X|. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2 Flip and rotate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    2.3 Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    2.4 How many people are watching? . . . . . . . . . . . . . . . . . . . . . . . 15

    2.5 The Christmas lottery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    2.6 How permutations change functions. . . . . . . . . . . . . . . . . . . . . 19

    2.7 Surjective selections: (a) permuting the range, (b) permuting the domain. 21

    2.8 A permutation in S18 with type [6 42 2 12]. . . . . . . . . . . . . . . . 262.9 Matching cycles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    2.10 Equivalent cycles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    2.11 k is not alone. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    2.12 k is not alone. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    3.1 The Fibonacci numbers. . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

    3.2 A cut of n objects into j objects and n j objects. . . . . . . . . . . . . 73

    4.1 The graph C8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

    4.2 The graph K5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

    4.3 The Peterson graph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

    4.4 A bipartite graph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

    4.5 The complete bipartite graph K3,4. . . . . . . . . . . . . . . . . . . . . . 90

    4.6 Isomorphic graphs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

    4.7 A subgraph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

    4.8 Complementary graphs. . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

    4.9 The 3-dimensional cube. . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

    4.10 Three connected components. . . . . . . . . . . . . . . . . . . . . . . . . 92

    4.11 Every vertex has degree 3. . . . . . . . . . . . . . . . . . . . . . . . . . . 92

    4.12 Minors of a graph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

    4.13 A directed graph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

    4.14 An oriented directed graph. . . . . . . . . . . . . . . . . . . . . . . . . . 94

    4.15 A walk and the unused edges. . . . . . . . . . . . . . . . . . . . . . . . . 96

    ix

  • List of Figures

    4.16 No Hamiltonian cycle? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

    4.17 Adding edge {u, v} to a tree. . . . . . . . . . . . . . . . . . . . . . . . . . 994.18 Some cycle contains e. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

    4.19 All vertices with even degree. . . . . . . . . . . . . . . . . . . . . . . . . 101

    4.20 Two paths from x to y. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

    4.21 G: different colours. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

    4.22 G: same colour. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

    4.23 Two a-cyclic orientations. . . . . . . . . . . . . . . . . . . . . . . . . . . 107

    4.24 A proper critical set. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

    4.25 A B vertex cover. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1124.26 A network. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

    5.1 A transposition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

    5.2 Combining transpositions. . . . . . . . . . . . . . . . . . . . . . . . . . . 132

    5.3 Two cycles from one cycle. . . . . . . . . . . . . . . . . . . . . . . . . . . 133

    5.4 One cycle from two cycles. . . . . . . . . . . . . . . . . . . . . . . . . . . 134

    5.5 The order of g is l. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

    5.6 Cyclic groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

    5.7 The kernel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

    5.8 and generate D4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

    5.9 Orbits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

    5.10 and commute. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

    7.1 Looking for a larger cycle. . . . . . . . . . . . . . . . . . . . . . . . . . . 191

    7.2 An affine plane. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208

    7.3 Projective space: opposite points identified. . . . . . . . . . . . . . . . . . 209

    7.4 Planes and lines are one-to-one. . . . . . . . . . . . . . . . . . . . . . . . 210

    7.5 Representing projective space. . . . . . . . . . . . . . . . . . . . . . . . . 211

    7.6 A translation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

    x

  • 1Chapter 1

    Introduction

    In this very brief introduction, I aim to give you an idea of the nature of this course andto advise on how best to approach it. I also give general information about the contentsand use of this subject guide, on recommended reading, and on how to use thetextbooks.

    1.1 This course

    1.1.1 Relationship to previous mathematics courses

    If you are taking this course as part of a BSc degree, you will already have taken theprerequisite mathematics course 116 Abstract mathematics. In 116 Abstractmathematics you will have learned about the fundamentals of mathematicalreasoning, in addition to some background in discrete mathematics and algebra.

    After studying this course, you should be equipped with a knowledge of concepts whichare central not only to advanced mathematics courses, but to applications ofmathematics in many areas. You may also discover that some concepts appear in manydifferent contexts, so that the course material will at times appear to be interwoven.More generally, a course of this nature, with the emphasis on abstract reasoning andproof, will help you to think in an analytical way and formulate mathematicalarguments in a precise, logical manner.

    1.1.2 Aims

    The course is designed to enable you to:

    obtain general knowledge about the areas of discrete mathematics and algebraunderstand a variety of methods used to construct mathematical proofsacquire an insight into applications such as coding and designs.

    1.1.3 Learning outcomes

    At the end of the course, and having completed the Essential reading and activities youshould be able to:

    demonstrate knowledge of the definitions, concepts, and methods in the topicscovered, and how to apply thesefind and formulate simple proofsmodel situations in a mathematical way and derive useful results.

    1

  • 1 1. Introduction

    1.1.4 Topics covered

    We study the formal mathematical theory of:

    countinggenerating functionsgraphsgroup theoryring and field theoryfinite geometrycoding theory.

    1.2 Recommended books

    1.2.1 Essential reading

    This is just a course guide and not a textbook. Almost all of the theoretical materialcovered in this guide can be found in the two books by Peter Cameron, Introduction toAlgebra and Combinatorics, and the book Discrete Mathematics by Norman Biggs. Theconnections to these books will be mentioned throughout the guide. Additionally, youshould look at Part I (Foundations) of Discrete Mathematics as a summary of theprerequisite mathematical knowledge for this course.

    Unfortunately, there is no single book that covers all the material of this course.Furthermore, some of the material of these books is too advanced for this course. Youwould do well to read the chapters of these books that are mentioned as reading at thestart of each chapter of this guide. Almost all of the theoretical material of this guide isto be found in these three books. However, some of the theoretical material of this guideare variations on themes presented in these three books. When the material cannot befound explicitly in any of these three books, the connections to the appropriate sectionsin these books will, nevertheless, be mentioned. It may prove useful also to workthrough examples and exercises presented in these books as well as the exercises andexamples of this guide. The proofs in this guide are my proofs. Sometimes they areessentially the same as those presented in these three books and sometimes they arequite different. Also, sometimes the proofs by Biggs and Cameron of the same resultwill differ significantly. It is usually an advantage to understand how the same resultcan be proven in different ways, and it is recommended that you read both the proofs inthis guide and the proofs in the three textbooks.

    The full information on these three books is given below:

    R N. Biggs. Discrete Mathematics. (Oxford: Oxford University Press, 2002) [ISBN9780198507178].

    R P.J. Cameron. Introduction to Algebra. (Oxford: Oxford University Press, 2008)[ISBN 9780198527930].

    R P.J. Cameron. Combinatorics. (Cambridge: Cambridge University Press, 1994)[ISBN 9780521457613].

    2

  • 11.3. Online study resources

    When cited in this guide, I will refer to them as Discrete Mathematics, Algebra andCombinatorics respectively.

    Detailed reading references in this subject guide refer to the editions of the settextbooks listed above. New editions of one or more of these textbooks may have beenpublished by the time you study this course. You can use a more recent edition of anyof these books; use the detailed chapter and section headings and the index to identifyrelevant readings. Also check the virtual learning environment (VLE) regularly forupdated guidance on readings.

    1.2.2 Further reading

    Please note that as long as you read the Essential reading you are then free to readaround the subject area in any text, paper or online resource. You will need to supportyour learning by reading as widely as possible. To help you read extensively, you havefree access to the VLE and University of London Online Library (see below).

    There are many additional books that might be useful for this course. Some are listedbelow:

    R M. Artin. Algebra. (Englewood Cliffs, NJ: Prentice Hall, 1991) [ISBN9780130047632].

    R J.A. Bondy and U.S.R Murty. Graph Theory with Applications. (Berlin: SpringerVerlag, 2010) [ISBN 9781849966900].

    R D.S. Dummit and R.M. Foote. Abstract Algebra. (Hoboken, NJ: Wiley, 2003)[ISBN9780471433347].

    R I.N. Herstein. Topics in Algebra. (Hoboken, NJ: Wiley, 1975) [ISBN9780471010906].

    R R. Stanley. Enumerative Combinatorics, Volume 1 (Cambridge: CambridgeUniversity Press, 1997) [ISBN 9780521663519].

    R D.J.A. Welsh. Codes and Cryptography. (Oxford: Clarendon Press, 1988) [ISBN9780198532873].

    R D.B. West. Introduction to Graph Theory. (Englewood Cliffs, NJ: Prentice Hall,2001) [ISBN 9780130144003].

    1.3 Online study resources

    In addition to the subject guide and the Essential reading, it is crucial that you takeadvantage of the study resources that are available online for this course, including theVLE and the Online Library.

    You can access the VLE, the Online Library and your University of London emailaccount via the Student Portal at:

    http://my.londoninternational.ac.uk

    You should have received your login details for the Student Portal with your officialoffer, which was emailed to the address that you gave on your application form. You

    3

  • 1 1. Introduction

    have probably already logged in to the Student Portal in order to register! As soon asyou registered, you will automatically have been granted access to the VLE, OnlineLibrary and your fully functional University of London email account. If you forget yourlogin details at any point, please email [email protected] quoting yourstudent number.

    1.3.1 The VLE

    The VLE, which complements this subject guide, has been designed to enhance yourlearning experience, providing additional support and a sense of community. It forms animportant part of your study experience with the University of London and you shouldaccess it regularly.

    The VLE provides a range of resources for EMFSS courses:

    Self-testing activities: Doing these allows you to test your own understanding ofsubject material.Electronic study materials: The printed materials that you receive from theUniversity of London are available to download, including updated reading listsand references.Past examination papers and Examiners commentaries : These provide advice onhow each examination question might best be answered.A student discussion forum: This is an open space for you to discuss interests andexperiences, seek support from your peers, work collaboratively to solve problemsand discuss subject material.Videos: There are recorded academic introductions to the subject, interviews anddebates and, for some courses, audio-visual tutorials and conclusions.Recorded lectures: For some courses, where appropriate, the sessions from previousyears Study Weekends have been recorded and made available.Study skills: Expert advice on preparing for examinations and developing yourdigital literacy skills.Feedback forms.

    Some of these resources are available for certain courses only, but we are expanding ourprovision all the time and you should check the VLE regularly for updates.

    1.3.2 Making use of the Online Library

    The Online Library contains a huge array of journal articles and other resources to helpyou read widely and extensively.

    To access the majority of resources via the Online Library you will either need to useyour University of London Student Portal login details, or you will be required toregister and use an Athens login:

    http://tinyurl.com/ollathens

    The easiest way to locate relevant content and journal articles in the Online Library isto use the Summon search engine.

    If you are having trouble finding an article listed in a reading list, try removing anypunctuation from the title, such as single quotation marks, question marks and colons.

    4

  • 11.4. Examination advice

    For further advice, please see the online help pages:

    http://www.external.shl.lon.ac.uk/summon/about.php

    1.4 Examination advice

    Important: the information and advice given here are based on the examinationstructure used at the time this guide was written. Please note that subject guides maybe used for several years. Because of this we strongly advise you to always check boththe current Regulations for relevant information about the examination, and the VLEwhere you should be advised of any forthcoming changes. You should also carefullycheck the rubric/instructions on the paper you actually sit and follow those instructions.

    A Sample examination paper is given at the end of this guide. There are no optionaltopics in this course: you should study them all. The examination paper will providesome element of choice as to which questions you attempt: see the Sample examinationpaper at the end of the guide for an indication of the structure of the examinationpaper.

    Please do not assume that the questions in a real examination will necessarily be verysimilar to these sample questions. An examination is designed (by definition) to testyou. You will get examination questions unlike questions in this guide and each yearthere will be examination questions different from those in previous years. The wholepoint of examining is to see whether you can apply knowledge in familiar and unfamiliarsettings. For this reason, it is important that you try as many examples as possible,from the guide and from the textbooks. This is not so that you can cover every possibletype of question the Examiners can think of! It is so that you get used to confrontingunfamiliar questions, grappling with them, and finally coming up with the solution.

    Do not panic if you cannot completely solve an examination question. There are manymarks to be awarded for using the correct approach or method.

    The examination covers the material in this guide. The three textbooks used in thiscourse do contain material that is too advanced for this course, and therefore I wouldnot expect you to have mastered all the material covered in these books. However, ifyou do, it would not hurt your performance in the examination! It would be very helpfulto study the Sample examination paper at the end of this guide to understand the levelof difficulty, the format and the types of topics covered. As a general rule, you will notbe expected to reproduce long or complicated proofs that are contained in this guide.However, knowledge of shorter and simpler proofs may be requested and certainly it isdesirable that you know something of the significance and application of all thetheorems covered in this guide.

    You will not be permitted to use calculators of any type in the examination. This is notsomething that you should panic about: the Examiners are interested in assessing thatyou understand the key concepts, ideas, methods and techniques, and will therefore setquestions which do not require the use of a calculator.

    5

  • 1 1. Introduction

    Remember it is important to check the VLE for:

    up-to-date information on examination and assessment arrangements for this coursewhere available, past examination papers and Examiners commentaries for thecourse which give advice on how each question might best be answered.

    1.5 Basic notation

    We often use the symbol to denote the end of a proof, where we have finishedexplaining why a particular result is true. This is just to make it clear where the proofends and the following text begins.

    6

  • 2Chapter 2

    Elementary counting

    Essential readingR Biggs, Norman. Discrete Mathematics. Chapters 10, 11 and 12.

    R Cameron, Peter J. Combinatorics. Chapters 3 and 5.

    Further readingR Stanley, Richard. Enumerative Combinatorics I.

    2.1 Introduction

    In this chapter, we look at elementary counting, the ways to determine the size of afinite set. In later chapters, we introduce ways to count that involve more sophisticatedalgebraic methods.

    2.2 Selections

    The relevant reading here will be Sections 10.l to 10.4 of Discrete Mathematics andSection 3 of Combinatorics.

    The following definition is in Section 6.2 of Discrete Mathematics.

    Definition 2.1 The cardinality of a non-empty finite set A is its number of elements,equivalently the positive integer n such that there is a one-to-one matching of everyelement of A with every element of {1, 2, . . . , n}. The cardinality of the empty set iszero.

    If X is a finite set, |X| stands for the cardinality of X.

    2.2.1 Number of functions

    A function f from a set X to another set Y is a way of assigning to each element of X asingle element of Y , and f : X Y denotes a function from X to Y .If X and Y are finite, how many functions are there from X to Y ?

    The following lemma is Theorem 10.4 of Discrete Mathematics.

    7

  • 22. Elementary counting

    Lemma 2.1 The number of functions from X to Y is |Y ||X|.ProofThe proof is by induction on the size of X. If |X| = 1, then there are exactly |Y |functions. Given X = X {x} with x 6 X , by induction assume that there are|Y ||X| = |Y ||X|1 functions from X to Y . See Figure 2.1. For every function from X toY we have Y choices of where to send x, for a total of |Y ||X|1|Y | = |Y ||X|.

    X

    x

    Y

    Figure 2.1: |Y ||X| = |Y | |Y ||X|.

    The following lemma is also proven in Section 3.1 of Combinatorics and given as anexample following Theorem 10.4 of Discrete Mathematics.

    Lemma 2.2 The number of subsets of a finite set X (including the empty set andthe full set X) is 2|X|.

    ProofLet Y = {0, 1}. For every function f : X Y = {0, 1} from X to the set {0, 1} of sizetwo define a subset Af of X by Af = {x | f(x) = 1}, the subset that gets mapped to 1by f . Notice that every subset is Af for some function f : X Y = {0, 1} and f = g ifand only if Af = Ag. Therefore the number of subsets of X is 2

    |X| by Lemma 2.1.

    2.2.2 Functions with restrictions and equivalence relations

    The four most common selections determined by restrictions and equivalence relationsare discussed in Section 3.7 of Combinatorics and Section 10.5 of Discrete Mathematics.

    The number of all functions from some set X to some set Y may not be interesting, fortwo reasons:

    (1) what may be interesting is only some subset of all functions: we call this

    Restriction to a subset of the functions

    (2) some pairs of functions may be essentially the same: we call this

    Equivalence relation on the functions

    8

  • 22.2. Selections

    Equivalence relations are also defined in Section 3.8 of Combinatorics and Section 7.2 ofDiscrete Mathematics and you will have studied them in 116 Abstract mathematics.

    A relation on A is a subset of A A. It is an equivalence relation if

    i) a a for all a A (symmetric)ii) a b b a for all a, b A (reflexive)

    iii) a b, b c a c for all a, b, c A (transitive).A partition of a finite set A is a collection {A1, A2, . . . , Ak} of subsets of A such thatA = A1 A2 Ak and Ai Aj = if i 6= j. Every equivalence relation on somefinite set A defines a partition {A1, A2, . . . , Ak} of that set A through a b if and onlyif a and b belong to the same member Ai of the partition. Conversely, any partition{A1, A2, . . . , Ak} of A will define an equivalence relation in the same way. Anequivalence class of the relation is any one Ai of the sets A1, . . . , Ak, and the number ofequivalence classes is k, which is the number of sets in the partition.

    Examples

    To illustrate when a restriction to a subset of functions is important, rather than all thefunctions, consider the selection of a five-member basketball team from 20 possibleplayers. Basketball teams have five different positions, the centre, the right forward, theleft forward, the right guard, and the left guard. A team selection could be seen as afunction from {1, 2, . . . , 5} to {p1, p2, . . . p20}, where the set {1, 2, . . . , 5} stands for thefive different positions on the team and p1, p2, . . . , p20 are the players. There are 20

    5

    possibilities for such functions. However, there is no reason to be interested in thefunction that assigns two different positions i and j to the same player pk, as then wewould get less than five players on the team (and one player covering two differentpositions). We are only interested in the subset of functions such that exactly fiveplayers are chosen. The number we really want is 20 19 18 17 16 = 1, 860, 480.To illustrate how an equivalence relation may be relevant, we may not care in whichorder or to which position the players are chosen, only that five players are chosen. Thisis a combination of a restriction to a subset and an equivalence relation. The number1, 860, 480 must be divided by 120 = 5 4 3 2 1, the number of ways to order the fiveplayers, for the answer 19 17 16 3 = 15, 504.Also possible, though strange to the game of basketball, is concern for the equivalencerelation without the restriction that five players should be chosen. We do not care inwhich order the players are chosen, but a player could be chosen twice (or more often).Determining the number of equivalence classes of this equivalence relation may betricky, due to the different possibilities for functions to choose the same player morethan once. We return to this problem later when we show that there is a simplemathematical solution.

    Another example of when the number of equivalence classes of functions are moreinteresting than the number of functions concerns the number of ways to create anecklace of beads with different colours. Suppose we wanted to create necklaces withtwelve beads using the three colours red, blue, and yellow. The number of ways toassign the three colours to six positions would be 36. However, rotating or flipping the

    9

  • 22. Elementary counting

    necklace results in the same necklace. For example, the necklace defined by the sequencey, y, b, r, b, r is the same necklace as that defined by the sequences r, b, r, b, y, y(flipping between beads) and is the same as that defined by the sequence y, r, b, r, b, y(rotating by one). All three of these functions define the same necklace. See Figure 2.2.Counting the number of necklaces is a problem of counting the number of equivalenceclasses, where two functions are equivalent if they define the same necklace. An effectivemethod for determining this number will be presented in a later chapter.

    r b

    r

    by

    y

    Figure 2.2: Flip and rotate.

    In general, given a subset A of all the functions and an equivalence relation defined by we will want to know the number k such that there is a partition {A1, A2, . . . , Ak} ofA such that for all a, b A it holds that a b if and only if a, b Ai for some i.The following definitions are given in Section 5.2 of Discrete Mathematics and in 116Abstract mathematics.

    A function f : X Y is injective if f(x) = f(y) implies that x = y.The image of a function f : X Y (im (f)) is the subset of all points in Y that aref(x) for some x in X.

    A function f : X Y is surjective if the image of f is the whole set Y .A function that is both injective and surjective is called a bijection.

    A bijective function from a set X to itself is called a permutation of X. See Figure 2.3.

    Injective Surjective Bijective

    Figure 2.3: Examples.

    There are many types of subset restrictions and equivalence relations. But there are twopairs that are most commonly used. They are the same as those presented in Chapter

    10

  • 22.2. Selections

    3.7 of Combinatorics and in Sections 10.5 and 11.2 of Discrete Mathematics. Weconsider the functions from a set X to a set Y .

    1. Subsets of functions:

    With repetitions: all functions from X to Y are relevant.

    Without repetitions: only injective functions from X to Y are relevant.

    2. Equivalence relations:

    Ordered: no two distinct functions from X to Y are considered to be equivalent.

    Unordered: permutations on X yield equivalent functions.

    Permutations on Y yielding equivalent functions define a different equivalence relation.We deal with this later.

    Four most common selections

    Ordered with repetitions: this is the most inclusive. These are all the functions froma k-set to an n-set.

    The best example is the number of different keys that can be made to open a lock. Atevery depth of the key there are finitely many positions. The width of the key has tomatch that of the lock for every position, otherwise the key will not work.

    Ordered without repetitions: This is the subset of injective functions.

    Suppose there is a cricket team of 20 players. The manager must choose not only 11players from the 20 on the team to bat, but also determine the batting order. For thefirst on the batting order, one of 20 can be chosen. For the second, one of 19 can bechosen, and so on. The number of such functions is 20 19 10.The number n (n 1) (n k + 1) is called n falling k and is denoted by (n)k. It isthe number of injective functions from a k-set to an n-set.

    Obviously if k is larger than n then there can be no injective function, and then (n)k isdefined to be zero.

    Unordered without repetitions: Only the injective functions are used, and allfunctions with the same image are equivalent.

    For example, the above example of choosing 5 players from 20 to make a basketballteam is such a selection, where their positions or the order of their selection is notimportant nor considered.

    The number (k)k = k (k 1) 1 is denoted by k!. It is the number of bijectivefunctions from a k-set to itself. The number

    (n)kk!

    is called n choose k, and is written

    as

    (n

    k

    )or as

    n!

    k!(n k)! . This is also the number of k subsets of an n-set. If n is smaller

    than k then (n)k and

    (n

    k

    )would be 0 (as there would be no injective functions from a

    k-set to an n-set) and

    (n

    0

    )=

    (n

    n

    )=

    (0

    0

    )= 1. This is also presented in Section 3.2 of

    Combinatorics.

    11

  • 22. Elementary counting

    Unordered with repetitions: There is a total of k objects and n different types orcolours. What matters is how many objects there are of each type or colour, but theobjects themselves have no identity.

    Example 2.1 In a population of k = 7, there are people of the n = 4 blood types,A, B, C, and D. What are the possible distributions?

    We can represent a distribution as a total of n 1 dividers | between the k objectsthat are to be labelled (representing the division into n different classes). If there aretwo of type A, three of type B, none of type C, and two of type D, we can representthis as AA|BBB||DD.There are n 1 dividers and a distribution is determined by the location of thesedividers in a set of n+ k 1 positions. Therefore the number of distributions is(

    n+ k 1n 1

    )=

    (n+ k 1

    k

    ).

    This argument is made in Section 3.7 of Combinatorics and it is Theorem 11.2 ofDiscrete Mathematics.

    Define n(k) to be n (n+ 1) (n+ 2) (n+ k 1). n(k) is called n rising k, and it isthe same as (n+ k 1)k. We also have the simple identity

    (n+ k 1n 1

    )=n(k)

    k!.

    In the above example we distributed people into blood types where the people had noidentities. We could also distribute coins or money to people where the coins or moneyhad no identity but the people do. This would be the same mathematical problem, butone must remember that the people play different roles; in the former they are in thedomain of the function and have no identities while in the latter they are in the range ofthe function and do have identities. We deal in more detail with this problem in a laterchapter.

    2.2.3 Pascals triangle

    Now we look in more detail at

    (n

    k

    )and its properties. This can also be found in

    Section 11.1 of Discrete Mathematics and Section 3.3 of Combinatorics.

    The following lemma is Theorem 11.1.1 of Discrete Mathematics.

    Lemma 2.3 For n k > 0 (n

    k

    )=

    (n 1k

    )+

    (n 1k 1

    ).

    ProofChoose any number i from 1 to n. The k subsets of {1, 2, . . . , n} can be made includingthe number i or excluding the number i. By including we have

    (n 1k 1

    )ways and by

    excluding we have

    (n 1k

    )ways.

    12

  • 22.2. Selections

    Lemma 2.3 gives one way to calculate

    (n

    k

    )known as Pascals Triangle.

    1

    1 1

    1 2 1

    1 3 3 1

    1 4 6 4 1

    1 5 10 10 5 1

    1 6 15 20 15 6 1

    The following is proven in Section 3.3 of Combinatorics and Section 11.3 of DiscreteMathematics. It is known as the Binomial Theorem.

    Lemma 2.4 (a+ b)n =nk=0

    (n

    k

    )akbnk.

    Proof (1)When n = 0 then

    (0

    0

    )= 1 and we get 1 on both sides of the equation. By induction,

    we can assume that

    (a+ b)n1 =n1k=0

    (n 1k

    )akbnk1.

    It follows that

    (a+ b)(a+ b)n1 =n1k=0

    (n 1k

    )akbnk +

    n1k=0

    (n 1k

    )ak+1bnk1.

    The latter sum can be re-written as

    nk=1

    (n 1k 1

    )akbnk.

    Collecting together the terms for k 1 one gets the coefficient(n 1k 1

    )+

    (n 1k

    )=

    (n

    k

    )(from Lemma 2.3). And for k = 0 one simply gets the coefficient

    (n 1

    0

    )which is 1

    and equal to

    (n

    0

    ).

    Proof (2)The number of unordered ways and without repetition to select k times the letter a and

    n k times the letter b is(n

    k

    ). This is exactly the coefficient for akbnk in the

    expression (a+ b)(a+ b) (a+ b) repeated n times, which counts the number of kchoices for a with n k choices for b.

    13

  • 22. Elementary counting

    Proof (3)Let D be the differential operator on the polynomials, meaning that Df of the

    polynomial f(x) is the functiondf

    dx. From elementary calculus there is Taylors formula,

    which states that for all polynomials f

    f(x+ y) = f(x) + [Df ](x)y + [Dkf ](x)yk

    k!+ .

    Letting f(t) be tn, it follows by substitution, as [Dkf ](x) = (n)kxnk and

    (n

    k

    )=

    (n)kk!

    .

    Exercises for section 2.2

    Exercise 2.1

    How many results are possible when throwing 6 identical 6-sided dice?

    Exercise 2.2

    How many ways are there to roll two identical dice for a sum that is divisible by three?Likewise for a sum divisible by two?

    Exercise 2.3

    Assume that there are nine billiard balls, five of them are black and the other four arecoloured blue, yellow, red, and green. In how many ways can one choose five balls out ofthese nine (so that with respect to the black balls only their number is relevant)?

    Exercise 2.4

    Prove the formula for any integers n and k:

    nk =kj=0

    (k

    j

    )(n 1)j.

    We proved using induction on the number k that nk is the number of functions from ak-set to an n-set. How can this formula be used to prove the same result usinginduction on the number n?

    Exercise 2.5

    Prove the formula for n 1 and s 1:(s+ n

    n

    )=

    (s 1

    0

    )+

    (s

    1

    )+

    (s+ 1

    2

    )+ +

    (s+ n 1

    n

    ).

    2.3 Inclusion-exclusion

    If in a room there are 17 adult men and 22 adult women then there are 39 adults. Why?

    14

  • 22.3. Inclusion-exclusion

    First, all adults are either men or women, and second, nobody is both a man and awoman.

    The North London football teams Arsenal and Tottenham are playing and people arewatching the game on TV in a pub. If 13 fans of Arsenal are watching and 8 fans ofTottenham are watching, how many people are watching? See Figure 2.4.

    TV

    Tottenhamfans

    Arsenal fans

    The Old White Lion

    Figure 2.4: How many people are watching?

    The equation 13 + 8 = 21 might be the wrong answer. First, there may be some peoplewatching who are not fans of either team. Second, some people may be fans of bothteams. If everyone is indeed a fan of one of the two teams and two of them are fans ofboth teams, then we know that 19 people are watching. We can calculate this in twoways. We can break things down into three categories: exclusive fans of Arsenal,exclusive fans of Tottenham, and fans of both, with 13 2 = 11 of the first, 8 2 = 6 ofthe second, and 2 of the third, and then add up for 11 + 6 + 2 = 19. Another way is toadd the 13 and 8 together, and then subtract the 2, the people who were counted twice.The second way is of greater mathematical sophistication.

    2.3.1 The theorem

    Proofs of the following theorem are in Sections 11.4 and 11.5 of Discrete Mathematicsand Section 5.1 of Combinatorics.

    Theorem 2.5 (Inclusion-Exclusion) Let A1, A2, . . . , An be finite sets.ni=1

    Ai

    = 6=K{1,2,...,n}(1)|K|+1iK

    Ai

    .15

  • 22. Elementary counting

    ProofThe proof is by induction on n. If n = 1 then there is only one non-empty subset of {1}and on the right side 1 is put to the power of 2 for (1)2|A1| = |A1|. If n = 2 then onthe right side we have |A1|+ |A2| |A1 A2|.

    Now assume it is true for n 1 and define A to be the setn1i=1

    Ai.

    Using only the two sets An and A,

    ni=1

    Ai

    = |A|+ |An| |A An|.1. By induction

    |A| =

    6=K{1,2,...,n1}(1)|K|+1

    iK

    Ai

    .2. With A An =

    n1i=1

    (Ai An) by induction

    |A An| =

    6=K{1,2,...,n1}(1)|K|+1

    iK

    Ai An .

    Rewrite

    |An| |A An| = |An|

    6=K{1,2,...,n1}(1)|K|+1

    iK

    Ai An

    = |An|

    nK,K 6={n}(1)|K|

    iK

    Ai

    =

    nK{1,2,...,n}

    (1)|K|+1iK

    Ai

    .Now put both parts together.

    The following is a corollary of the inclusion-exclusion theorem that is easy to apply inmany situations, some of which we will present below.

    Corollary 2.6 If for every 1 j n there is a number bj such that for every subsetK {1, . . . , n} with |K| = j the cardinality of

    iK

    Ai is bj then

    ni=1

    Ai

    =nj=1

    (1)j+1(n

    j

    )bj.

    16

  • 22.3. Inclusion-exclusion

    2.3.2 Applications

    Application to co-primes

    For any positive integer n the number (n) is defined to be the number of positiveintegers k less than n such that the greatest common divisor of k and n is 1, meaningthat the only positive integer that divides both k and n is the number 1. The followingapplication is presented in Section 11.5 of Discrete Mathematics.

    Assume that n breaks down to n = p11 p22 pqq , where p1, p2, . . . , pq are distinct prime

    integers.

    To apply inclusion-exclusion, we need to determine first for every subset of primenumbers that divides the number n how many numbers less than or equal to n aredivided by this subset. Let A be any subset of {1, 2, . . . , q}. It is easy to calculate thatthe number of positive integers less than n divisible by all the primes in A is

    niA pi

    ,

    the same as the number of positive integers less than or equal to n divided byiA

    pi.

    Apply the inclusion-exclusion theorem to get

    (n) = n

    A{1,2,...,q}(1)|A|+1 n

    iA pi

    = n

    (1 1

    p1

    )(1 1

    p2

    ) (

    1 1pq

    ).

    Application to derangement

    A company has the idea of its employees giving random Christmas presents to eachother. Each person brings a present for somebody else, and a number is attached to it.The numbers are written on folded pieces of paper which are placed in a box. Theemployees take turns removing a number from the box. An employee receives thepresent corresponding to the number on the selected piece of paper. See Figure 2.5.

    Employees

    Induced bijection

    Employees

    Box

    Figure 2.5: The Christmas lottery.

    17

  • 22. Elementary counting

    The only problem with this idea is the possibility that somebody gives their present tothemselves. If there are only two employees, this probability is one-half. If there arethree employees then this probability is 2

    3(4 out of the six permutations).

    What is the probability of somebody getting their own present if n is large? Will thisprobability converge, and if so to 0, 1, or something in between as n goes to infinity?This problem is treated in Section 11.4 of Discrete Mathematics.

    Let N be the set of employees, and n = |N | its size. For every A N the number ofpermutations of N such that all in A get their own presents is exactly the number ofpermutations of N\A, namely (n |A|)!. For every k the number of subsets of N of sizek is

    (n

    k

    ).

    By the inclusion-exclusion formula the number of permutations of N such that at leastone element is mapped to itself is

    nk=1

    (1)k+1(n

    k

    )(n k)! = n!

    nk=1

    (1)k+1k!

    .

    After dividing by n!, the total number of permutations, the probability that nobodygets their own present is

    1nk=1

    (1)k+1k!

    =nk=0

    (1)kk!

    .

    This is also presented in Theorem 5.1.3 of Combinatorics.

    The Taylor formula for ex isk=0

    xk

    k!. It follows that lim

    n

    nk=0

    (1)kk!

    is e1. Therefore the

    probability that nobody gets their own present is e1 in the limit, or about 0.368. If thecompany is big then the probability that somebody gets their own present is over 60 percent. Interestingly this probability is not monotone in the variable n. Even numbers ofelements give a slightly greater tendency for avoiding the situation where somebodygives a present to themselves.

    2.3.3 Surjective functions

    How many surjective functions are there from a k-set to an n-set? We can use theinclusion-exclusion method to get an answer.

    We calculate the number of surjective functions from a k-set to an n-set by calculatingfirst the number of non-surjective functions. A function that is not surjective avoidssome subset of the n-set. The number of functions that avoids a subset of size j is(n j)k, the total number of functions from a k-set to the other elements excluding thechosen set of size j. By inclusion-exclusion the number of non-surjective functions is

    nj=1

    (1)j+1(n

    j

    )(n j)k.

    Therefore, the number of surjective functions is

    nk nj=1

    (1)j+1(n

    j

    )(n j)k =

    nj=0

    (1)j(n

    j

    )(n j)k.

    18

  • 22.3. Inclusion-exclusion

    This is presented in Theorem 5.1.2 in Combinatorics.

    Surjective selections

    3

    2

    1

    2

    1

    f

    3

    2

    1

    2

    1

    f

    3

    2

    1

    2

    1

    f

    Figure 2.6: How permutations change functions.

    With regard to surjective functions from a k-set to an n-set there are at least two waysto define equivalence relations. One can permute the domain, the k-set. This is what wehave done so far. Also one can permute the range, the n-set. We count the number ofsurjective selections using both approaches. We discover that the solutions are not thatdifferent from the solutions when one does not require surjectivity.

    What do we mean by the equivalence relationships defined by permuting the domainand permuting the range? Take the function f : {1, 2, 3} {1, 2} defined by f(1) = 2,

    19

  • 22. Elementary counting

    f(2) = 2, f(3) = 1. Let be the permutation of the domain {1, 2, 3} represented by thecycle (1 2 3) and the permutation of the range represented by the cycle (1 2). Ifpermutations in the domain defined equivalent functions then f would be equivalent tothe function f which takes 1 to 2, 2 to 1, and 3 to 2. If permutations in the rangedefined equivalent functions then f would be equivalent to the function f whichtakes 1 to 1, 2 to 1, and 3 to 2. See Figure 2.6.

    Permuting the k-set

    How many ways are there to map k non-distinct (equivalent) objects surjectively to ndistinct positions?

    The method is virtually the same as when surjectivity is not required. We reserve ineach of the n positions at least one object. Only the distribution of the rest of theobjects matters. The answer is the same for the distributing of k n objects into npositions without the surjectivity requirement, namely

    (k 1n 1

    ).

    Permuting the n-set

    How many ways are there to map k distinct objects surjectively to n non-distinct(equivalent) positions?

    Divide the number of surjective functions by the number of permutations of n, namely

    n!. Define S(k, n) to be the number1

    n!

    nj=0

    (1)j(n

    j

    )(n j)k. This is also the number of

    ways to partition k distinct objects into n different parts. The numbers S(k, n) arecalled the Stirling Numbers of the Second Kind. We look at them in more detail later,also in relation to the Stirling Numbers of the First Kind.

    Why are the answers to the above two questions so different? When the equivalencerelation is defined by permuting the set X (of size k) why do we not divide the numberof surjective functions by k!, as we do by n! when the equivalence relation is defined bypermuting the set of size n?

    Fix any two objects, a and b, in the set X. Some of the functions will take both a and bto the same position and some will not, which explains the difference and why one doesnot divide by k!. If k = 3 and n = 2 there will be 6 different surjective functions (23 = 8functions in all but two that are not surjective). There are 2 rather than 1 = 6

    3!

    equivalence classes when permuting the k-set, as can be easily checked. See Figure 2.7.

    With regard to permuting the n-set we notice that the surjective solution gives us theanswer for when we do not require surjectivity. Simply, we add up all the possibilitiesfor different sizes of sets that can be hit for the answer S(k, 1) + S(k, 2) + + S(k, n).

    Permuting both the k-set and the n-set

    How many ways are there to map k non-distinct (equivalent) objects into n non-distinct(equivalent) positions? This topic concerns the partitions of an integer, something thatwe consider in more depth later.

    20

  • 22.3. Inclusion-exclusion

    3

    2

    1

    3

    2

    1

    3

    2

    1

    (a)

    2

    1

    2

    1

    (b)

    Figure 2.7: Surjective selections: (a) permuting the range, (b) permuting the domain.

    Example 2.2 (Cards)When playing with a standard deck of 52 cards, in how many ways can a card playerreceive a hand of five cards with at least one card from each suit?

    The total number of hands is

    (52

    5

    ). We count the number of possibilities of

    receiving only cards from 3 or fewer suits, and subtract the result from

    (52

    5

    ).

    Assuming the suits are numbered 1 through 4, for every proper subsetA {1, 2, 3, 4} let HA be the set of hands that uses only the suits in A and let nA bethe number of hands which are made from only suits in the set A. This number nA is(

    13|A|5

    ), and is determined only by the size of A. We need to calculate the size of

    A{1,2,3,4}HA. By inclusion-exclusion this number is

    4

    (39

    5

    ) 6(

    26

    5

    )+ 4

    (13

    5

    )(

    0

    5

    ).

    Subtracting from

    (52

    5

    )gives the answer(

    52

    5

    ) 4(

    39

    5

    )+ 6

    (26

    5

    ) 4(

    13

    5

    )= 685, 464.

    With the total number of hands being

    (52

    5

    )= 2, 598, 960, we see that only about 26

    per cent of all hands have all four suits.

    There is another way to count this number. One of the suits must be represented bytwo cards, the rest by one. We choose one of four suits to be represented twice, and

    then two representatives can be chosen in

    (13

    2

    )= 78 ways. For each of the other

    three suits we have a choice of one of 13 representatives. The answer is4 78 133 = 685, 464. It is valuable to look at both of these methods.

    21

  • 22. Elementary counting

    Exercises for section 2.3

    Exercise 2.6

    How many integers from 1 to 106 (inclusive) are either squares or cubes?

    Exercise 2.7

    What is the number of surjective functions from a 6-set to a 4-set?

    What is the number if the selection is unordered, meaning that only the number ofelements reaching each member of the 4-set is relevant?

    Exercise 2.8

    Define two functions from a 6-set to a 4-set to be equivalent if a permutation of the4-set transforms one function into the other function. There are 46 such functions, buthow many equivalence classes?

    Exercise 2.9

    Consider the functions from a k-set to an n-set and let two functions f, g be equivalentif f = g pi where pi is any permutation of the k-set. Find numbers k and n such thatmore than two-thirds of the functions are surjective however less than one-third of theequivalent classes contain surjective functions.

    Exercise 2.10

    In a standard deck of 52 cards, there are four suits and each suit has the numbers 1 to13 (with King=13 and Ace=1). A 4-hand is a set of 4 different cards from this deck.

    (a) How many different 4-hands can a player receive?

    (b) How many different 4-hands can a player receive such that all 4 cards are of thesame suit?

    (c) How many different 4-hands can a player receive where there are exactly twonumbers present with two cards of each number?

    A game is played with four players, each receiving a 4-hand. Player One holds in hishand all four cards of the number eight. The last three parts concern this situation ofPlayer Ones unusual 4-hand. Two ways are different if and only if some player holds adifferent hand.

    (d) In how many different ways can the rest of the cards be distributed to the otherthree players?

    (e) Of those ways from question (d), for how many will all three other players receivehands that contain four cards of the same suit?

    (f) Of those ways from question (d) how many involve at least one of the other threeplayers also having four cards of the same number? Hint: use inclusion-exclusion.

    22

  • 22.4. Partitions and permutations

    Exercise 2.11

    How many ways are there to distribute 6 black balls (indistinguishable objects) and 6coloured balls (distinguishable objects with 6 distinct colours) to five distinguishablepeople so that three people get 2 objects and two people get 3 objects?

    2.4 Partitions and permutations

    Relevant to this section are Sections 3.5, 13.1 and 13.2 of Combinatorics and Sections12.1 to 12.5 of Discrete Mathematics.

    2.4.1 Partitions of an integer

    A partition of a positive integer k is a way to write k as a sum of positive integers. Forexample, the partitions of 5 are the following:

    5

    4 + 1 3 + 2

    3 + 1 + 1 2 + 2 + 1

    2 + 1 + 1 + 1

    1 + 1 + 1 + 1 + 1

    The above listing of the partitions of 5 are grouped according to the size of thepartition. 3 + 1 + 1 and 2 + 2 + 1 are the partitions of 5 into three parts. For everypositive integer n there will be only one partition into one part, namely n itself, andonly one partition into n parts, namely 1 + 1 + + 1.The partitions of an integer k are the equivalence classes of the functions from a k-setto a k-set when permutations of both the domain and the range of the function result inequivalent functions.

    2.4.2 Partition and cycle types

    The conventional notation for a partition of an integer k uses the form

    [rm11 rm22 rmll ]

    where k =l

    i=1

    rimi and r1 > r2 > > rl and dropping the exponent means that itshould be 1. This is presented in Section 13.1 of Combinatorics and Section 12.4 ofDiscrete Mathematics.

    The partition 3 + 1 + 1 of 5 is written as [3 12].The partition 5 + 3 + 3 + 2 + 2 + 2 + 1 + 1 + 1 of 20 is written as [5 32 23 13].A partition [rm11 rm22 rmll ] of an integer k is also called a type. To every such type andevery set A of size k there belong partitions and permutations of the set A. We presentthe relationship to partitions first.

    23

  • 22. Elementary counting

    2.4.3 Number of partitions

    Every partition of a set A of cardinality k must come in the form{A1r1 , A

    2r1, . . . , Am1r1 , . . . A

    1r2, A2r2 , . . . , A

    m2r2. . . A1rl , A

    2rl, . . . , Amlrl

    }where for any pair i, j the cardinality of Aij is rj, k =

    li=1

    rimi and r1 > r2 > > rl.

    This structure uniquely defines a type, namely[rm11 rm22 rmll

    ]. For example, the

    partition {{1, 3, 4}, {2, 5, 9}, {6, 7}, {8}, {10}} belongs to the type[32 2 12

    ].

    The following lemma can be deduced from Proposition 13.1.5 of Combinatorics.

    Lemma 2.7 The number of partitions of a set of cardinality k belonging to the type[rm11 rm22 rmll ] is

    k!

    (r1!)m1 (rl!)mlm1! ml! .

    ProofWe proceed by induction on l. Assume that l = 1 (and therefore k = r1m1). Let us

    choose the partition members. For the first partition member we have a choice of

    (k

    r1

    )objects. For the second partition member we have a choice of

    (k r1r1

    )objects. The

    total number of possibilities is(k

    r1

    )(k r1r1

    ) (r1r1

    )=

    k! (k r1)! r1!(k r1)! (k 2r1)! 0! (r1!)m1

    =k!

    (r1!)m1.

    But any permutation on the m1 sets of size r1 yields the same partition, and thereforethe number of partitions is

    k!

    (r1!)m1m1!.

    Now assume that the lemma holds for the quantity l 1. Every partition of kcorresponding to the type [rm11 rm22 rmll ] defines a partition of a set of size r1m1according to the type [rm11 ] and a partition of a set of size k r1m1 belonging to thetype [rm22 rmll ]. Vice-versa, due to r1 6= ri for all i > 1, distinct choices for a set of sizer1m1 (determining a complementary choice of a set of size k r1m1) followed bydistinct choices for the partitions of the r1m1-set and partitions of the (k r1m1)-setcorresponding to the types [r1m1] and [r

    m22 rmll ] respectively generate distinct

    partitions of the k-set. Therefore the number of partitions of the k-set is(k

    r1m1

    )r1m1!

    (r1!)m1m1!

    k r1m1!(r2!)m2 (rl!)mlm2! ml! =

    k!

    (r1!)m1 (rl!)mlm1! ml! .

    24

  • 22.4. Partitions and permutations

    We have a formula for the number of surjective functions from a k-set to an n-set andtherefore also a formula for the number of partitions of a k-set into n parts. For everytype of a k-set partitioned into n parts we know from Lemma 2.7 the number ofpartitions belonging to it. These numbers should match up.

    Example 2.3 Consider the surjective functions from a 5-set to a 3-set.

    By the formula the number of surjective functions is

    35 (

    3

    1

    )(3 1)5 +

    (3

    2

    )(3 2)5 = 243 96 + 3 = 150.

    The number of partitions of a 5-set into 3 parts is therefore150

    3!=

    150

    6= 25.

    Now consider the same task using the formula from Lemma 2.7 . A 5-set can bepartitioned into three parts in two ways, as the type [3 12] or as the type [22 1]. Forthe first our formula gives

    5!

    3! 2! = 10 partitions and for the second our formulagives

    5!

    (2!)2 2! = 15 partitions.

    The same classification scheme can be applied to the set of all functions of a k-set to ann-set.

    We can break down these functions:

    1. according to the sizes m = 1, 2, . . . , n of the image

    2. then according to a set for that image

    3. then according to the types, and finally

    4. to the corresponding partitions for each type.

    Example 2.4 Consider the set of all functions from a 5-set to a 3-set.

    We have already considered the types with 3 parts. Next, consider the types with 2parts. These are [4 1] and [3 2]. According to Lemma 2.7:

    the number of partitions corresponding to type [4 1] should be 5!4! 1! = 5, and

    the number of partitions corresponding to type [3 2] should be 5!3! 2! = 10.

    The total number of partitions should be 15, meaning that the correspondingnumber of functions should be 30 (multiplying by 2!). According to the formula thenumber of surjective functions from a 5-set to a 2-set should be 25 2 = 30.Now consider the only type [5] of length 1. The number of partitions correspondingto this type is one. The number of surjective functions (from a 5-set to a 1-set) islikewise 1.

    25

  • 22. Elementary counting

    Now add up all the results. The number of functions from a 5-set to a 3-set should be(3

    3

    )150 +

    (3

    2

    )30 +

    (3

    1

    )1 = 150 + 90 + 3 = 243 = 35.

    2.4.4 Permutations

    Permutations are bijective functions from a finite set to itself. There are k!permutations of a k-set.

    We could express a permutation pi as a function, with pi(i) = ai and then list the resultsin the proper order:

    1 a1, 2 a2, , k ak.

    But there is a much more efficient way of expressing a permutation. Look at where thefirst element 1 goes, namely pi(1). Then look at where this goes, (pi pi)(1) = pi2(1). Wecould continue until some number i = pij(1) = pij+l(1) is repeated for the first time, andfrom then on cyclic repetition would rule:

    1, pi(1), pi2(1), . . . , pij(1) = i, pij+1(1) = pi(i), . . . , pij+l(1) = i.

    But because the permutation pi is a bijection, we could move backwards with its inversepi1 and show that pij+l1(1) = pij1(1) and so on backwards to 1 = pil(1). So startingfrom any element we get a cycle of elements returning to this first element. This allowsus to write down any permutation of a k-set as a partition of the k-set plus a cyclicorientation of each partition. See Figure 2.8.

    Figure 2.8: A permutation in S18 with type [6 42 2 12].

    For example, with k = 9, the following expression for a permutation

    (1 5 3) (2 9) (8) (7 4 6)

    means that 1 is mapped to 5, 5 is mapped to 3, 3 is mapped to 1, and so on, with 8mapped to itself. This is presented in Section 3.5 of Combinatorics and Section 10.6 ofDiscrete Mathematics.

    26

  • 22.4. Partitions and permutations

    Because any permutation of the k-set is based on a partition of the k-set, thepermutations are also classified according to their types.

    A permutation pi2 is conjugate to pi1 if there exists another permutation such that1pi1 = pi2.

    Conjugacy is an equivalence relation,

    (i) reflexive: use the identity permutation itself

    (ii) symmetric: pi1 = 1pi2 pi2 = pi11

    (iii) transitive: pi1 = 1pi2, pi2 = 1pi3 implies that pi1 = 11pi3.

    Conjugating a permutation pi by the permutation is a way to represent the samepermutation pi but with the names of the elements changed according to . Aconjugation is the same concept as a basis change in linear algebra. Therefore thefollowing lemma, also Proposition 13.1.4 of Combinatorics and Theorem 12.5 of DiscreteMathematics, should not be surprising.

    Lemma 2.8 Any two permutations are conjugate if and only if they have the sametype.

    ProofAssume that permutations pi1 and pi2 have the same type and we pair cycles from bothof the same size. Choose any pairing of cycles with size m, the first a cycle of pi1 and thesecond a cycle of pi2:

    (i1, i2, , im) (j1, j2, , jm).Define a function from the members of the first cycle to those of the second by(im) = jm. See Figure 2.9. Extend this function by doing the same for all pairs ofcycles, to a permutation on the whole set. We see that 1 pi2 (il) will beil+1 = pi1(il) (or, if l = m, then i1).

    On the other hand, assuming a conjugacy between pi1 and pi2 with 1pi2 = pi1, we

    choose any cycle (j1, j2, , jm) of pi2 and define i1 to be 1(j1). By 1pi2 = pi1 itfollows that

    pim1 (i1) = (1pi2)m(i1) = 1 pim2 (i1) = 1 pim2 (j1) = 1 (j1) = i1

    (because pim2 (j1) = j1). On the other hand, if pin1 (i1) = i1 for some n strictly smaller than

    m, we would have

    i1 = pin1 (i1) = (

    1pi2)n(i1) = 1 pin2 (i1) = 1 pin2 (j1).

    But could be applied on the left side for j1 = (i1) = pin2 (j1), a contradiction.

    Therefore 1 maps the cycle (j1, , jm) to a cycle (i1, , im), both of size m.Repeating the argument for all the cycles shows that they have the same cycle type.

    The following lemma is also Proposition 13.1.5 of Combinatorics and is presented inSection 12.5 of Discrete Mathematics.

    27

  • 22. Elementary counting

    pi1

    im

    i1i2 i3

    i4

    pi2

    jm

    j1j2 j3

    j4

    Figure 2.9: Matching cycles.

    Lemma 2.9 The number of permutations of a k-set corresponding to a type[rm11 rm22 rmll ] is

    k!

    rm11 rmll m1! ml!.

    ProofEvery permutation of {1, . . . , k} generates a partition of {1, . . . , k} defined by thecycles. For every partition member of size ri, by fixing any element to come first, thereare (ri 1)! ways to define a cycle using the rest of the elements. See Figure 2.10.Therefore to go from the number of partitions to the number of cycles corresponding tothe type we must multiply by ((r1 1)!)m1 ((rl 1)!)ml .

    Just as above, we can check this formula.

    Example 2.5 Consider the permutations of a 5-set. We list the types and thecorresponding number of permutations.

    [5]5!

    5= 24

    [4 1] 5!4

    = 30

    [3 2] 5!3 2 = 20

    [3 12] 5!3 2! = 20

    28

  • 22.4. Partitions and permutations

    [22 1] 5!22 2! = 15

    [2 13] 5!2 3! = 10

    [15]5!

    5!= 1

    The total number of permutations is then 24 + 30 + 20 + 20 + 15 + 10 + 1 = 120 = 5!.

    ar

    a1

    a2

    (a1 a2 a3 . . . ar1 ar)

    (a2 a3 a4 . . . ar a1)

    ...

    (ar a1 a2 . . . ar2 ar1)

    Figure 2.10: Equivalent cycles.

    2.4.5 Ferrers diagrams

    Ferrers diagrams are presented in Section 13.1 of Combinatorics and Sections 26.1 and26.2 of Discrete Mathematics. There is a convenient way to express a particular partitionof k (a type), called a Ferrers diagram. We express [1 22 4 6], a partition of 15.

    29

  • 22. Elementary counting

    Notice the similarity to another partition of 15:

    This is the partition [12 22 4 5].The Ferrers diagram obtained by interchanging the rows and the columns is called theconjugate diagram. The conjugate of the conjugate is the original diagram, a conceptcalled conjugate duality.

    Ferrers diagrams provide intriguing equalities, such as the following:

    Lemma 2.10 The number of partitions of k into j parts is equal to the number ofpartitions of k such that the largest part has size j.

    ProofPartitions of the former are defined by having j rows and partitions of the latter aredefined by having j columns. There is a bijection between these two types of partitions,by applying conjugate duality.

    Lemma 2.11 The number of partitions of k such that no two parts have the same sizeis equal to the number of partitions of k such that no size is skipped from 1 to somemaximal size j.

    ProofA partition with no two parts of the same size has a Ferrers diagram where each row isof a different size. A partition with no size skipped (starting from size one) has a Ferrersdiagram where each column is of a different size. A bijection between the two types ofpartitions follows from conjugate duality.

    Exercises for section 2.4

    Exercise 2.12

    An employer divides 100 pounds among three employees as Christmas presents, and allquantities must be multiples of 10.

    (a) In how many ways can the 100 pounds be distributed?

    (b) in how many ways if every employee must receive at least 10 pounds?

    (c) in how many ways if no two employees get the same quantity?

    (d) How are the answers to the above different if the employees are not distinguished(meaning that the distribution (20, 30, 50) to employees one, two and three is thesame as (30, 50, 20))?

    30

  • 22.5. The Stirling numbers

    Exercise 2.13

    Show that the number of partition of an integer n into distinct and odd parts is equalto the number of partitions of the integer n that are self-conjugate (meaning that theFerrers diagram and its conjugate are the same).

    Exercise 2.14

    Let n and r be positive integers. Show that the number of partitions of n in which thenumber of parts is r or less is equal to the number of partitions of n+ r with exactly rparts.

    2.5 The Stirling numbers

    In the previous section we looked at the number of partitions and permutationsbelonging to the various types of a partition of an integer. One can aggregate this countaccording to the number of sets in the partition and the number of parts in thepermutation. The result is a surprising relationship between these numbers and certainpolynomials that are created in a very natural way.

    The Stirling numbers are presented in Sections 5.3 and 15.6 of Combinatorics andSection 12.1 of Discrete Mathematics.

    2.5.1 Stirling numbers of the first kind

    (x)k = x(x 1)(x 2) (x k + 1),

    x falling k, is a polynomial of degree k in the variable x and can be also written as

    (x)k = s(k, k) xk + s(k, k 1) xk1 + + s(k, 0),

    with integers s(k, n).

    The s(k, n) are called the Stirling numbers of the first kind.

    Let us work out a few:

    (x)0 = 1, (x)1 = x so

    s(1, 1) = 1, s(1, 0) = 0.

    (x)2 = x(x 1) = x2 x, so

    s(2, 2) = 1, s(2, 1) = 1, s(2, 0) = 0.

    (x)3 = (x 2)(x2 x) = x3 3x2 + 2x, so

    s(3, 3) = 1, s(3, 2) = 3, s(3, 1) = 2, s(3, 0) = 0.

    31

  • 22. Elementary counting

    (x)4 = (x 3)(x3 3x2 + 2x) = x4 6x3 + 11x2 6x, sos(4, 4) = 1, s(4, 3) = 6, s(4, 2) = 11, s(4, 1) = 6, s(4, 0) = 0.

    2.5.2 Stirling numbers of the second kind

    S(k, n) is defined to be the number of partitions of a k-set into n parts, and thesenumbers are called the Stirling numbers of the second kind. We show how they relate tothe Stirling numbers of the first kind, something also presented in Section 5.3 ofCombinatorics..

    Because (x)k, (x)k1, . . . , (x)0 = 1 form a basis of the vector space of all polynomialswith real coefficients of degree k or less (just as the xk, xk1, . . . , 1 do the same), wecan write

    xk =kj=0

    R(k, j)(x)j

    for some real numbers R(k, j). By substitution, xk =kj=0

    R(k, j)(x)j can be expanded to

    xk =kj=0

    R(k, j)

    jm=0

    s(j,m)xm.

    With R(k, j) = s(k, j) = 0 if j > k the matrices defined by the R(k, j) and the s(k, j)are inverses of each other, meaning that

    kj=0

    R(k, j)s(j,m) =

    1, k