forked from klevasseur/ads
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindividual_chapter.tex
1447 lines (1374 loc) · 69.5 KB
/
individual_chapter.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%**************************************%
%* Generated from MathBook XML source *%
%* on 2016-08-13T15:46:48-04:00 *%
%* *%
%* http://mathbook.pugetsound.edu *%
%* *%
%**************************************%
\documentclass[10pt,]{book}
%% Load geometry package to allow page margin adjustments
\usepackage{geometry}
\geometry{letterpaper,total={5.0in,9.0in}}
%% Custom Preamble Entries, early (use latex.preamble.early)
%% Inline math delimiters, \(, \), need to be robust
%% 2016-01-31: latexrelease.sty supersedes fixltx2e.sty
%% If latexrelease.sty exists, bugfix is in kernel
%% If not, bugfix is in fixltx2e.sty
%% See: https://tug.org/TUGboat/tb36-3/tb114ltnews22.pdf
%% and read "Fewer fragile commands" in distribution's latexchanges.pdf
\IfFileExists{latexrelease.sty}{}{\usepackage{fixltx2e}}
%% Page Layout Adjustments (latex.geometry)
%% This LaTeX file may be compiled with pdflatex, xelatex, or lualatex
%% The following provides engine-specific capabilities
%% Generally, xelatex and lualatex will do better languages other than US English
%% You can pick from the conditional if you will only ever use one engine
\usepackage{ifthen}
\usepackage{ifxetex,ifluatex}
\ifthenelse{\boolean{xetex} \or \boolean{luatex}}{%
%% begin: xelatex and lualatex-specific configuration
%% fontspec package will make Latin Modern (lmodern) the default font
\ifxetex\usepackage{xltxtra}\fi
\usepackage{fontspec}
%% realscripts is the only part of xltxtra relevant to lualatex
\ifluatex\usepackage{realscripts}\fi
%%
%% Extensive support for other languages
\usepackage{polyglossia}
\setdefaultlanguage{english}
%% Magyar (Hungarian)
\setotherlanguage{magyar}
%% Spanish
\setotherlanguage{spanish}
%% Vietnamese
\setotherlanguage{vietnamese}
%% end: xelatex and lualatex-specific configuration
}{%
%% begin: pdflatex-specific configuration
%% translate common Unicode to their LaTeX equivalents
%% Also, fontenc with T1 makes CM-Super the default font
%% (\input{ix-utf8enc.dfu} from the "inputenx" package is possible addition (broken?)
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%% end: pdflatex-specific configuration
}
%% Monospace font: Inconsolata (zi4)
%% Sponsored by TUG: http://levien.com/type/myfonts/inconsolata.html
%% See package documentation for excellent instructions
%% One caveat, seem to need full file name to locate OTF files
%% Loads the "upquote" package as needed, so we don't have to
%% Upright quotes might come from the textcomp package, which we also use
%% We employ the shapely \ell to match Google Font version
%% pdflatex: "varqu" option produces best upright quotes
%% xelatex,lualatex: add StylisticSet 1 for shapely \ell
%% xelatex,lualatex: add StylisticSet 2 for plain zero
%% xelatex,lualatex: we add StylisticSet 3 for upright quotes
%%
\ifthenelse{\boolean{xetex} \or \boolean{luatex}}{%
%% begin: xelatex and lualatex-specific monospace font
\usepackage{zi4}
\setmonofont[BoldFont=Inconsolatazi4-Bold.otf,StylisticSet={1,3}]{Inconsolatazi4-Regular.otf}
%% end: xelatex and lualatex-specific monospace font
}{%
%% begin: pdflatex-specific monospace font
\usepackage[varqu]{zi4}
%% end: pdflatex-specific monospace font
}
%% Symbols, align environment, bracket-matrix
\usepackage{amsmath}
\usepackage{amssymb}
%% allow more columns to a matrix
%% can make this even bigger by overriding with latex.preamble.late processing option
\setcounter{MaxMatrixCols}{30}
%%
%% Color support, xcolor package
%% Always loaded. Used for:
%% mdframed boxes, add/delete text, author tools
\PassOptionsToPackage{usenames,dvipsnames,svgnames,table}{xcolor}
\usepackage{xcolor}
%%
%% Semantic Macros
%% To preserve meaning in a LaTeX file
%% Only defined here if required in this document
%% Used for inline definitions of terms
\newcommand{\terminology}[1]{\textbf{#1}}
%% Subdivision Numbering, Chapters, Sections, Subsections, etc
%% Subdivision numbers may be turned off at some level ("depth")
%% A section *always* has depth 1, contrary to us counting from the document root
%% The latex default is 3. If a larger number is present here, then
%% removing this command may make some cross-references ambiguous
%% The precursor variable $numbering-maxlevel is checked for consistency in the common XSL file
\setcounter{secnumdepth}{3}
%% Environments with amsthm package
%% Theorem-like environments in "plain" style, with or without proof
\usepackage{amsthm}
\theoremstyle{plain}
%% Numbering for Theorems, Conjectures, Examples, Figures, etc
%% Controlled by numbering.theorems.level processing parameter
%% Always need a theorem environment to set base numbering scheme
%% even if document has no theorems (but has other environments)
\newtheorem{theorem}{Theorem}[section]
%% Only variants actually used in document appear here
%% Style is like a theorem, and for statements without proofs
%% Numbering: all theorem-like numbered consecutively
%% i.e. Corollary 4.3 follows Theorem 4.2
%% Definition-like environments, normal text
%% Numbering is in sync with theorems, etc
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
%% Remark-like environments, normal text
%% Numbering is in sync with theorems, etc
\theoremstyle{definition}
\newtheorem{note}[theorem]{Note}
%% Example-like environments, normal text
%% Numbering is in sync with theorems, etc
\theoremstyle{definition}
\newtheorem{example}[theorem]{Example}
%% Miscellaneous environments, normal text
%% Numbering for inline exercises and lists is in sync with theorems, etc
\theoremstyle{definition}
\newtheorem{exercise}[theorem]{Exercise}
%% Localize LaTeX supplied names (possibly none)
\renewcommand*{\proofname}{Proof}
\renewcommand*{\chaptername}{Chapter}
%% Equation Numbering
%% Controlled by numbering.equations.level processing parameter
\numberwithin{equation}{section}
%% For improved tables
\usepackage{array}
%% Some extra height on each row is desirable, especially with horizontal rules
%% Increment determined experimentally
\setlength{\extrarowheight}{0.2ex}
%% Define variable thickness horizontal rules, full and partial
%% Thicknesses are 0.03, 0.05, 0.08 in the booktabs package
\makeatletter
\newcommand{\hrulethin} {\noalign{\hrule height 0.04em}}
\newcommand{\hrulemedium}{\noalign{\hrule height 0.07em}}
\newcommand{\hrulethick} {\noalign{\hrule height 0.11em}}
%% We preserve a copy of the \setlength package before other
%% packages (extpfeil) get a chance to load packages that redefine it
\let\oldsetlength\setlength
\newlength{\Oldarrayrulewidth}
\newcommand{\crulethin}[1]%
{\noalign{\global\oldsetlength{\Oldarrayrulewidth}{\arrayrulewidth}}%
\noalign{\global\oldsetlength{\arrayrulewidth}{0.04em}}\cline{#1}%
\noalign{\global\oldsetlength{\arrayrulewidth}{\Oldarrayrulewidth}}}%
\newcommand{\crulemedium}[1]%
{\noalign{\global\oldsetlength{\Oldarrayrulewidth}{\arrayrulewidth}}%
\noalign{\global\oldsetlength{\arrayrulewidth}{0.07em}}\cline{#1}%
\noalign{\global\oldsetlength{\arrayrulewidth}{\Oldarrayrulewidth}}}
\newcommand{\crulethick}[1]%
{\noalign{\global\oldsetlength{\Oldarrayrulewidth}{\arrayrulewidth}}%
\noalign{\global\oldsetlength{\arrayrulewidth}{0.11em}}\cline{#1}%
\noalign{\global\oldsetlength{\arrayrulewidth}{\Oldarrayrulewidth}}}
%% Single letter column specifiers defined via array package
\newcolumntype{A}{!{\vrule width 0.04em}}
\newcolumntype{B}{!{\vrule width 0.07em}}
\newcolumntype{C}{!{\vrule width 0.11em}}
\makeatother
%% Figures, Tables, Listings, Floats
%% The [H]ere option of the float package fixes floats in-place,
%% in deference to web usage, where floats are totally irrelevant
%% We re/define the figure, table and listing environments, if used
%% 1) New mbxfigure and/or mbxtable environments are defined with float package
%% 2) Standard LaTeX environments redefined to use new environments
%% 3) Standard LaTeX environments redefined to step theorem counter
%% 4) Counter for new environments is set to the theorem counter before caption
%% You can remove all this figure/table setup, to restore standard LaTeX behavior
%% HOWEVER, numbering of figures/tables AND theorems/examples/remarks, etc
%% WILL ALL de-synchronize with the numbering in the HTML version
%% You can remove the [H] argument of the \newfloat command, to allow flotation and
%% preserve numbering, BUT the numbering may then appear "out-of-order"
\usepackage{float}
\usepackage[bf]{caption} % http://tex.stackexchange.com/questions/95631/defining-a-new-type-of-floating-environment
\usepackage{newfloat}
% Figure environment setup so that it no longer floats
\SetupFloatingEnvironment{figure}{fileext=lof,placement={H},within=section,name=Figure}
% figures have the same number as theorems: http://tex.stackexchange.com/questions/16195/how-to-make-equations-figures-and-theorems-use-the-same-numbering-scheme
\makeatletter
\let\c@figure\c@theorem
\makeatother
% Table environment setup so that it no longer floats
\SetupFloatingEnvironment{table}{fileext=lot,placement={H},within=section,name=Table}
% tables have the same number as theorems: http://tex.stackexchange.com/questions/16195/how-to-make-equations-figures-and-theorems-use-the-same-numbering-scheme
\makeatletter
\let\c@table\c@theorem
\makeatother
%% Raster graphics inclusion, wrapped figures in paragraphs
%% \resizebox sometimes used for images in side-by-side layout
\usepackage{graphicx}
%%
%% Multiple column, column-major lists
\usepackage{multicol}
%% More flexible list management, esp. for references and exercises
%% But also for specifying labels (i.e. custom order) on nested lists
\usepackage{enumitem}
%% Lists of references in their own section, maximum depth 1
\newlist{referencelist}{description}{4}
\setlist[referencelist]{leftmargin=!,labelwidth=!,labelsep=0ex,itemsep=1.0ex,topsep=1.0ex,partopsep=0pt,parsep=0pt}
%% Lists of exercises in their own section, maximum depth 4
\newlist{exerciselist}{description}{4}
\setlist[exerciselist]{leftmargin=0pt,itemsep=1.0ex,topsep=1.0ex,partopsep=0pt,parsep=0pt}
%% Indented groups of exercises within an exercise section, maximum depth 4
\newlist{exercisegroup}{description}{4}
\setlist[exercisegroup]{leftmargin=2em,labelindent=2em,itemsep=1.0ex,topsep=1.0ex,partopsep=0pt,parsep=0pt}
%% Support for index creation
%% imakeidx package does not require extra pass (as with makeidx)
%% We set the title of the "Index" section via a keyword
%% And we provide language support for the "see" phrase
\usepackage{imakeidx}
\makeindex[title=Index, intoc=true]
\renewcommand{\seename}{see}
%% Package for tables spanning several pages
\usepackage{longtable}
%% hyperref driver does not need to be specified
\usepackage{hyperref}
%% configure hyperref's \url to match listings' inline verbatim
\renewcommand\UrlFont{\small\ttfamily}
%% Hyperlinking active in PDFs, all links solid and blue
\hypersetup{colorlinks=true,linkcolor=blue,citecolor=blue,filecolor=blue,urlcolor=blue}
\hypersetup{pdftitle={Applied Discrete Structures}}
%% If you manually remove hyperref, leave in this next command
\providecommand\phantomsection{}
%% If tikz has been loaded, replace ampersand with \amp macro
%% extpfeil package for certain extensible arrows,
%% as also provided by MathJax extension of the same name
%% NB: this package loads mtools, which loads calc, which redefines
%% \setlength, so it can be removed if it seems to be in the
%% way and your math does not use:
%%
%% \xtwoheadrightarrow, \xtwoheadleftarrow, \xmapsto, \xlongequal, \xtofrom
%%
%% we have had to be extra careful with variable thickness
%% lines in tables, and so also load this package late
\usepackage{extpfeil}
%% Custom Preamble Entries, late (use latex.preamble.late)
%% Begin: Author-provided macros
%% (From docinfo/macros element)
%% Plus three from MBX for XML characters
\newcommand{\identity}{\mathrm{id}}
\newcommand{\notdivide}{{\not{\mid}}}
\newcommand{\notsubset}{\not\subset}
\newcommand{\lcm}{\operatorname{lcm}}
\newcommand{\gf}{\operatorname{GF}}
\newcommand{\inn}{\operatorname{Inn}}
\newcommand{\aut}{\operatorname{Aut}}
\newcommand{\Hom}{\operatorname{Hom}}
\newcommand{\cis}{\operatorname{cis}}
\newcommand{\chr}{\operatorname{char}}
\newcommand{\Null}{\operatorname{Null}}
\newcommand{\lt}{ < }
\newcommand{\gt}{ > }
\newcommand{\amp}{ & }
%% End: Author-provided macros
%% Title page information for book
\title{Applied Discrete Structures}
\author{Al Doerr\\
Department of Mathematical Sciences\\
University of Massachusetts Lowell\\
\href{mailto:}{\nolinkurl{}}
\and
Ken Levasseur\\
Department of Mathematical Sciences\\
University of Massachusetts Lowell\\
\href{mailto:kenneth_levasseur@uml.edu}{\nolinkurl{kenneth_levasseur@uml.edu}}
}
\date{September, 2016}
\begin{document}
\frontmatter
%% begin: half-title
\thispagestyle{empty}
{\centering
\vspace*{0.28\textheight}
{\Huge Applied Discrete Structures}\\}
\clearpage
%% end: half-title
%% begin: adcard
\thispagestyle{empty}
\null%
\clearpage
%% end: adcard
%% begin: title page
%% Inspired by Peter Wilson's "titleDB" in "titlepages" CTAN package
\thispagestyle{empty}
{\centering
\vspace*{0.14\textheight}
{\Huge Applied Discrete Structures}\\[3\baselineskip]
{\Large Al Doerr}\\[0.5\baselineskip]
{\Large University of Massachusetts Lowell}\\[3\baselineskip]
{\Large Ken Levasseur}\\[0.5\baselineskip]
{\Large University of Massachusetts Lowell}\\[3\baselineskip]
{\Large September, 2016}\\}
\clearpage
%% end: title page
%% begin: copyright-page
\thispagestyle{empty}
\vspace*{\stretch{2}}
\noindent\textcopyright\ 2016\quad{}Al Doerr, Ken Levasseur\\[0.5\baselineskip]
Applied Discrete Structures by Alan Doerr and Kenneth Levasseur is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License. You are free to Share: copy and redistribute the material in any medium or format; Adapt: remix, transform, and build upon the material. You may not use the material for commercial purposes. The licensor cannot revoke these freedoms as long as you follow the license terms.
\par
\vspace*{\stretch{1}}
\null\clearpage
%% end: copyright-page
%% begin: acknowledgement
\chapter*{Acknowledgements}\label{acknowledgement-1}
\addcontentsline{toc}{chapter}{Acknowledgements}
I would like to thank Rob Beezer, David Farmer and other participants on the \href{https://groups.google.com/forum/?fromgroups#!forum","xml-support}{mathbook-xml-support group} for their guidance and work on MathBook XML. Thanks to the Pedagogy Subcommittee of the UMass Lowell Transformational Education Committee for their financial assistance in helping getting this project started.%
%% end: acknowledgement
%% begin: preface
\chapter*{Preface}\label{preface-1}
\addcontentsline{toc}{chapter}{Preface}
This version of \emph{Applied Discrete Structures} is being developed using \emph{Mathbook XML}, A lightweight XML application for authors of scientific articles, textbooks and monographs initiated by Rob Beezer, U. of Puget Sound. %
\par
Sage (\href{http://sagemath.org}{sagemath.org}) is a free, open source, software system for advanced mathematics. Sage can be used either on your own computer, a local server, or on SageMathCloud (\href{https://cloud.sagemath.com}{https://cloud.sagemath.com}). %
\par\hfill\begin{tabular}{l@{}}
Ken Levasseur\\
Lowell MA
\end{tabular}\\\par
%% end: preface
%% begin: table of contents
\setcounter{tocdepth}{1}
\renewcommand*\contentsname{Contents}
\tableofcontents
%% end: table of contents
\mainmatter
\typeout{************************************************}
\typeout{Chapter 1 Set Theory I}
\typeout{************************************************}
\chapter[Set Theory I]{Set Theory I}\label{chapter_5}
\typeout{************************************************}
\typeout{Introduction Goals for Chapter 1}
\typeout{************************************************}
\section*{Goals for Chapter 1}
In this chapter we will cover some of the basic set language and notation that will be used throughout the text. Venn diagrams will be introduced in order to give the reader a clear picture of set operations. In addition, we will describe the binary representation of positive integers (Section 1.4) and introduce summation notation and its generalizations (Section 1.5).%
\typeout{************************************************}
\typeout{Section 1.1 Set Notation and Relations }
\typeout{************************************************}
\section[Set Notation and Relations ]{Set Notation and Relations }\label{Set-Notation-and-Relations}
\typeout{************************************************}
\typeout{Subsection 1.1.1 The notion of a set}
\typeout{************************************************}
\subsection[The notion of a set]{The notion of a set}\label{subsection-1}
The term set is intuitively understood by most people to mean a collection of objects that are called elements (of the set). This concept is the
starting point on which we will build more complex ideas, much as in-geometry where the concepts of point and line are left undefined.
Because a set is such a simple notion, you may be surprised to learn that it is one of the most difficult concepts for mathematicians to define to
their own liking. For example, the description above is not a proper definition because it requires the definition of a collection. (How would you
define ``collection''?) Even deeper problems arise when you consider the possibility that a set could contain itself. Although these problems
are of real concern to some mathematicians, they will not be of any concern to us.
Our first concern will be how to describe a set; that is, how do we most conveniently describe a set and the elements that are in it? If we are going to discuss a set for any length of time, we usually give it a name in the form of a capital letter (or occasionally some other symbol). In discussing set \( A\), if \( x\) is an element of \( A\), then we will write \(x \in A\).\label{notation-1}
On the other hand, if \( x\) is not an element
of \( A\), we write \(x \notin A\).\label{notation-2}
The most convenient way of describing the elements of a set will vary depending on the specific set. %
\par
\emph{ Enumeration.} When the elements of a set are enumerated (or listed) it is traditional to enclose them in braces. For example, the
set of binary digits is\(\{0, 1\}\) and the set of decimal digits is \(\{0, 1, 2, 3, 4, 5, 6, 7, 8, 9\}\). The choice of a name for these sets would
be arbitrary; but it would be ``logical'' to call them \( B\) and \( D\) , respectively. The choice of a set name is much like the
choice of an identifier name in programming. Some large sets can be enumerated without actually listing all the elements. For example, the letters
of the alphabet and the integers from 1 to 100 could be described as
\(A = \{a, b, c,\ldots , x, y, z\}\), and \(G = \{1, 2, \ldots , 99, 100\}\).
The three consecutive ``dots'' are called an ellipsis. We use them when it is clear what elements are included but not listed. An ellipsis is
used in two other situations. To enumerate the positive integers, we would write \(\{1, 2, 3,\ldots \}\), indicating that the list goes on infinitely.
If we want to list a more general set such as the integers between 1 and \( n\), where \( n\) is some undetermined positive integer, we
might write \(\{1,\ldots ,n\}\).
%
\par
\emph{ Standard Symbols}. Frequently used sets are usually given symbols that are reserved for them alone. For example, since we will be
referring to the positive integers throughout this book, we will use the symbol \(\mathbb{P}\) instead of writing \(\{1, 2, 3, \ldots \}\). A few
of the other sets of numbers that we will use frequently are: %
\par
\leavevmode%
\begin{itemize}[label=\textbullet]
\item{}\(\mathbb{(N)}\): the natural numbers, \(\{0, 1, 2, 3, \ldots \}\)%
\item{}\(\mathbb{(Z)}\): the integers, \(\{\ldots , -3, -2, -1, 0, 1, 2, 3,\ldots \}\)%
\item{}\(\mathbb{(Q)}\): the rational numbers%
\item{}\(\mathbb{(R)}\): the real numbers%
\item{}\(\mathbb{(C)}\): the complex numbers%
\end{itemize}
%
\par
\terminology{Set-Builder Notation}\index{Set-Builder Notation}. Another way of describing sets is to use set-builder notation. For example, we could define the rational numbers as \begin{equation*}\mathbb{Q}=\{a/b \mid a, b \in \mathbb{Z}, b\neq 0\}\end{equation*} Note that in the set-builder description for the rational numbers: %
\par
\leavevmode%
\begin{itemize}[label=\textbullet]
\item{} \(a/b\) indicates that a typical element of the set is a ``fraction.'' %
\item{} The vertical line, \(\mid\), is read ``such that'' or ``where,'' and is used interchangeably with a colon. %
\item{} \(a, b\in \mathbb{Z}\) is an abbreviated way of saying \(a\) and \(b\) are integers. %
\item{} Commas in mathematics are read as ``and.'' %
\end{itemize}
%
\par
The important fact to keep in mind in set notation, or in any mathematical notation, is that it is meant to be a help, not a hindrance. We hope that notation will assist us in a more complete understanding of the collection of objects under consideration and will enable us to describe it in a concise manner. However, brevity of notation is not the aim of sets. If you prefer to write \(a\in \mathbb{Z}\) and \(b\in \mathbb{Z}\) instead of \(a, b\in \mathbb{Z}\), you should do so. Also, there are frequently many different, and equally good, ways of describing sets. For example, \(\left\{x\in
\mathbb{R} \mid x^{2}-5x+6=0\right\}\) and \(\left\{x \lvert x\in \mathbb{R}, x^{2 }-5x+6=0\right\}\) both describe the solution set \(\{2, 3\}\).
%
\par
A proper definition of the real numbers is beyond the scope of this text. It is sufficient to think of the real numbers as the set of points on a
number line. The complex numbers can be defined using set-builder notation as \(\mathbb{C} = \{a + b i:a, b \in \mathbb{R}\}\), where \(i^2 = -1\). %
\par
In the following definition we will leave the word ``finite'' undefined.
%
\begin{definition}[ Finite Set]\label{finite-set}
A set is a finite set if it has a finite number of elements. Any set that is not finite is an infinite set.%
\end{definition}
\begin{definition}[ Cardinality]\label{cardinality.}
\label{notation-3}
Let A be a finite set. The number of different elements in A is called its cardinality.%
\end{definition}
\par
As we will see later, there are different infinite cardinalities. We can't make this distinction until Chapter 7, so we will restrict cardinality to finite sets for now.%
\typeout{************************************************}
\typeout{Subsection 1.1.2 Subsets}
\typeout{************************************************}
\subsection[Subsets]{Subsets}\label{ss-subsets}
\begin{definition}[ Subset]\label{subset.}
\label{notation-4}
Let \(A\) and \(B\) be sets. We say that \(A\) is a subset of \(B\) if and only if every element of \(A\) is an element of \(B\). %
\end{definition}
\begin{example}[Some Subsets]\label{Some_Subsets}
\leavevmode%
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-10}{} If \(A = \{3, 5, 8\}\) and \(B = \{5, 8, 3, 2, 6\}\), then \(A\subseteq B\). %
\item\hypertarget{li-11}{} \(\mathbb{N}\subseteq \mathbb{Z}\subseteq \mathbb{Q}\subseteq \mathbb{R}\subseteq \mathbb{C}\) %
\item\hypertarget{li-12}{}If \(S = \{3, 5, 8\}\) and \(T = \{5, 3, 8\}\), then \(S \subseteq T\) and \(T \subseteq S\). %
\end{enumerate}
%
\end{example}
\begin{definition}[Set Equality]\label{set_equality}
Let \(A\) and \(B\) be sets. We say that \(A\) is equal to \(B\) (notation \(A = B\)) if and only if every element of
A is an element of B and conversely every element of B is an element of A; that is, \(A \subseteq B\) and \(B \subseteq A\).%
\end{definition}
\begin{example}[ Examples illustrating set equality]\label{set_equality_examples}
\leavevmode%
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-13}{}In \hyperref[Some_Subsets]{Example~\ref{Some_Subsets}}, \(S = T\). Note that the ordering of the elements is unimportant. %
\item\hypertarget{li-14}{}The number of times that an element appears in an enumeration doesn't affect a set. For example, if \(A = \{1, 5, 3, 5\}\) and \(B = \{1, 5, 3\}\), then \(A = B\). Warning to readers of other texts: Some books introduce the concept of a multiset, in which the number of occurrences of an element matters.%
\end{enumerate}
%
\end{example}
A few comments are in order about the expression ``if and only if'' as used in our definitions. This expression means ``is equivalent to saying,''
or more exactly, that the word (or concept) being defined can at any time be replaced by the defining expression. Conversely, the expression that
defines the word (or concept) can be replaced by the word. %
\par
Occasionally there is need to discuss the set that contains no elements, namely the empty set, which is denoted by \(\emptyset\)\label{notation-5}
\index{Empty set}.
This set is also called the null set.%
\par
It is clear, we hope, from the definition of a subset, that given any set \( A\) we have \(A\subseteq A\) and \(\emptyset \subseteq A\). If \(A\) is nonempty, then
\(A\) is called an \terminology{improper subset}\index{Improper subset} of \(A\). All other subsets of \(A\), including the empty set, are called \terminology{proper subsets }\index{Proper subset} of \(A\). %
\begin{note}[]\label{note-1}
Not everyone is in agreement on whether the empty set is a proper subset of any set. In fact earlier editions of this book sided with those who considered the empty set an improper subset. However, we bow to the emerging consensus at this time.%
\end{note}
\typeout{************************************************}
\typeout{Exercises 1.1.3 Exercises for Section 1.1 }
\typeout{************************************************}
\subsection[Exercises for Section 1.1 ]{Exercises for Section 1.1 }\label{exercises-1}
\hypertarget{exercisegroup-1}{}\typeout{************************************************}
\typeout{Introduction }
\typeout{************************************************}
A Exercises%
\begin{exercisegroup}
\item[1.]\hypertarget{exercise-1}{}List four elements of each of the following sets:%
\par
\leavevmode%
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-15}{} \(\{k \in \mathbb{P} \mid {k - 1} \textrm{ is a multiple of 7}\}\) %
\item\hypertarget{li-16}{} \(\{x \mid x \textrm{ is a fruit and its skin is normally eaten }\}\)%
\item\hypertarget{li-17}{}\(\{x \in \mathbb{Q}\mid \frac{1}{x} \in \mathbb{Z}\}\)%
\item\hypertarget{li-18}{} \(\{2n \mid n \in \mathbb{Z}, n < 0 \}\)%
\item\hypertarget{li-19}{} \(\{s \mid s = 1 + 2 + \cdots + n, n \in \mathbb{P}\}\)%
\end{enumerate}
%
\par\smallskip
\par\smallskip
\noindent\textbf{Answer.}\hypertarget{answer-1}{}\quad
These answers are not unique.%
\par
\leavevmode%
\begin{multicols}{3}
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-20}{} \(8, 15, 22, 29\)%
\item\hypertarget{li-21}{} apple, pear, peach, plum %
\item\hypertarget{li-22}{} \(1/2, 1/3, 1/4, 1/5\)%
\item\hypertarget{li-23}{} \(-8, -6, -4, -2\)%
\item\hypertarget{li-24}{}\(6, 10, 15, 21\)%
\end{enumerate}
\end{multicols}
%
\item[2.]\hypertarget{exercise-2}{} List all elements of the following sets:%
\par
\leavevmode%
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-25}{} \(\{\frac{1}{n} \mid n \in \{3,4,5,6\}\}\)%
\item\hypertarget{li-26}{} \(\{\alpha \in \textrm{ the alphabet } \mid \alpha \textrm{ precedes F}\}\)%
\item\hypertarget{li-27}{} \(\{-k \mid k \in \mathbb{P}\}\)%
\item\hypertarget{li-28}{} \(\{n^2 \mid n = -2, -1, 0, 1, 2\}\)%
\item\hypertarget{li-29}{} \(\{n \in \mathbb{P} \mid n \textrm{is a factor of 24 }\}\)%
\end{enumerate}
%
\par\smallskip
\item[3.]\hypertarget{exercise-3}{} Describe the following sets using set-builder notation. %
\par
\leavevmode%
\begin{multicols}{1}
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-30}{} \(\{ 5, 7, 9, \dots , 77, 79\}\) %
\item\hypertarget{li-31}{}the rational numbers that are strictly between \(-1\) and \(1\) %
\item\hypertarget{li-32}{} the even integers%
\item\hypertarget{li-33}{} \(\{-18, -9,0,9, 18,27, \dots \}\) %
\end{enumerate}
\end{multicols}
%
\par\smallskip
\par\smallskip
\noindent\textbf{Answer.}\hypertarget{answer-2}{}\quad
\leavevmode%
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-34}{} \(\{2k + 1 \mid k \in \mathbb{Z}, 2 \leqslant k \leqslant 39\}\) %
\item\hypertarget{li-35}{} \(\{x \in \mathbb{Q}\mid -1 < x < 1\}\)%
\item\hypertarget{li-36}{} \(\{2n\mid n \in \mathbb{Z}\}\) %
\item\hypertarget{li-37}{} \(\{9n\mid n \in \mathbb{Z}, -2 \leq n\}\)%
\end{enumerate}
%
\item[4.]\hypertarget{exercise-4}{} Use set-builder notation to describe the following sets: %
\par
\leavevmode%
\begin{multicols}{1}
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-38}{}\(\{1, 2, 3, 4, 5, 6, 7\}\) %
\item\hypertarget{li-39}{} \(\{1, 10, 100, 1000, 10000\}\) %
\item\hypertarget{li-40}{} \(\{1, 1/2, 1/3, 1/4, 1/5, . . .\}\) %
\item\hypertarget{li-41}{} \(\{0\}\)%
\end{enumerate}
\end{multicols}
%
\par\smallskip
\item[5.]\hypertarget{exercise-5}{} Let \(A = \{0, 2, 3\}\), \(B = \{2, 3\}\), and \(C = \{1, 5, 9\}\). Determine which of the following statements are true. Give reasons for
your answers. %
\par
\leavevmode%
\begin{multicols}{2}
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-42}{}\(3 \in A\)%
\item\hypertarget{li-43}{}\(\{3\} \in A\) %
\item\hypertarget{li-44}{}\(\{3\} \subseteq A\)%
\item\hypertarget{li-45}{} \(B\subseteq A\)%
\item\hypertarget{li-46}{} \(A\subseteq B\)%
\item\hypertarget{li-47}{}\(\emptyset \subseteq C\) %
\item\hypertarget{li-48}{} \(\emptyset \in A\)%
\item\hypertarget{li-49}{} \(A\subseteq A\)%
\end{enumerate}
\end{multicols}
%
\par\smallskip
\par\smallskip
\noindent\textbf{Answer.}\hypertarget{answer-3}{}\quad
\leavevmode%
\begin{multicols}{3}
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-50}{} True%
\item\hypertarget{li-51}{} False%
\item\hypertarget{li-52}{} True%
\item\hypertarget{li-53}{} True%
\item\hypertarget{li-54}{} False%
\item\hypertarget{li-55}{}True%
\item\hypertarget{li-56}{} False%
\item\hypertarget{li-57}{} True%
\end{enumerate}
\end{multicols}
%
\end{exercisegroup}
\par\smallskip\noindent
\hypertarget{exercisegroup-2}{}\typeout{************************************************}
\typeout{Introduction }
\typeout{************************************************}
C Exercises%
\begin{exercisegroup}
\item[6.]\hypertarget{exercise-6}{} One reason that we left the definition of a set vague is Russell's Paradox. Many mathematics and logic books contain an account of this paradox. Two references are Stoll and Quine. Find one such reference and read it. %
\par\smallskip
\end{exercisegroup}
\par\smallskip\noindent
\typeout{************************************************}
\typeout{Section 1.2 Generating Functions}
\typeout{************************************************}
\section[Generating Functions]{Generating Functions}\label{s-generating-functions}
\index{Generating Functions}\typeout{************************************************}
\typeout{Introduction }
\typeout{************************************************}
This section contains an introduction to the topic of generating functions and how they are used to solve recurrence relations, among other problems.
Methods that employ generating functions are based on the concept that you can take a problem involving sequences and translate it into a problem
involving generating functions. Once you've solved the new problem, a translation back to sequences gives you a solution of the original problem.%
\par
This section covers:%
\par
\leavevmode%
\begin{enumerate}[label=\arabic*]
\item\hypertarget{li-58}{}The definition of a generating function;%
\item\hypertarget{li-59}{}Solution of a recurrence relation using generating functions to identify the skills needed to use generating functions;\\%
\item\hypertarget{li-60}{}An introduction and/or review of the skills identified in point b;\\%
\item\hypertarget{li-61}{}Some applications of generating functions.%
\end{enumerate}
%
\typeout{************************************************}
\typeout{Subsection 1.2.1 Definition}
\typeout{************************************************}
\subsection[Definition]{Definition}\label{ss-what-is-a-generating-function}
\begin{definition}[Generating Function of a Sequence]\label{def-generating-function}
\index{Generating Function}\label{notation-6}
The generating function of a sequence S with terms \(S_0,S_1 ,S_2, \dots \), is the infinite sum
\[G(S;z)=\sum_{n=0}^{\infty} S_n z^n=S_0+S_1 z+S_2 z^2+S_3 z^3+\cdots\]
The domain and codomain of generating functions will not be of any concern to us since we will only be performing algebraic operations on them.%
\end{definition}
\begin{example}[First Examples]\label{ex-first-gf-examples}
\leavevmode%
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-62}{} If \(S_n = 3^n\),\(n \geq 0\), then
\(G(S;z) = 1 + 3z + 9z^2 + 27z^3 +\cdots \\
\\
\quad =\sum_{n=0}^{\infty} 3^n z^n\\
\\
\quad =\sum_{n=0}^{\infty} (3 z)^n\)
We can get a closed form expression for \(G(S;z)\) by observing that \(G(S;z) - 3z G(S;z) = 1\). Therefore,
\(G(S;z) =\frac{1}{1-3 z}\).%
\item\hypertarget{li-63}{}Finite sequences have generating functions. For example, the sequence of binomial coefficients \(C(n; 0)\), \(C(n; 1)\), \(\ldots\),\(C(n;
n)\), \(n \geq 1\) has generating function
\(G(C(n; \cdot ); z) = C(n; 0) + C(n; 1)z +\cdots + C(n; n)z^n\\
\\
\quad \quad = \sum_{k=0}^{\infty} C(n;k) z^k\\
\\
\quad \quad =(1+z)^n\)
by application of the binomial formula.%
\item\hypertarget{li-64}{} If \(Q(n) = n^2\),
\(G(Q;z)=\sum_{n=0}^{\infty} n^2 z^n=\sum_{k=0}^{\infty} k^2 z^k\)
Note that the index that is used in the summation has no significance. Also, note that the lower limit of the summation could start at 1 since \(Q(0)=0\).%
\end{enumerate}
%
\end{example}
\typeout{************************************************}
\typeout{Subsection 1.2.2 Solution of a Recurrence Relation Using Generating Functions}
\typeout{************************************************}
\subsection[Solution of a Recurrence Relation Using Generating Functions]{Solution of a Recurrence Relation Using Generating Functions}\label{ss-solution-of-rr-using-generating-functions}
We illustrate the use of generating functions by solving
\(S(n) - 2S(n - 1) - 3S(n - 2) = 0\), \(n \geq 2\), with \(S(0) = 3\) and \(S(1) = 1\).%
\par
\leavevmode%
\begin{enumerate}[label=\arabic*]
\item\hypertarget{li-65}{} Translate the recurrence relation into an equation about generating functions.%
\par
Let \(V(n) = S(n) - 2S (n - 1) - 3S (n - 2)\), \(n \geq 2\), with \(V(0) = 0\) and \(V(1) = 0\). Therefore,
\[G(V;z) = 0 + 0z +\sum_{n=2}^{\infty} (S(n) - 2S (n - 1) - 3S (n - 2)) z^n= 0\]
%
\item\hypertarget{li-66}{}Solve for the generating function of the unknown sequence,\(G(S,z) = \sum_{n=0}^{\infty} S_n z^n\).
\begin{equation*}
\begin{split}
0 & =\sum_{n=2}^{\infty} (S(n) - 2S (n - 1) - 3S (n - 2)) z^n\\
& =\sum_{n=2}^{\infty} S(n) z^n-2 (\sum_{n=2}^{\infty
} S(n-1) z^n)-3(\sum_{n=2}^{\infty} S(n-2) z^n)
\end{split}
\end{equation*}
%
\par
Close examination of the three sums above shows:%
\par
%
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-67}{}
\begin{equation*}
\begin{split}
\sum_{n=2}^{\infty} S_n z^n &=\sum_{n=0}^{\infty} S_n z^n - S(0)-S(1)z\\
&= G(S;z)-3-z\\
\end{split}
\end{equation*}
since \(S(0)=3\) and \(S(1)=1\).%
\item\hypertarget{li-68}{}
\begin{equation*}
\begin{split}
\sum_{n=2}^{\infty} S(n-1) z^n &=z(\sum_{n=2}^{\infty} S(n-1) z^{n-1})\\
& =z(\sum_{n=1}^{\infty} S(n) z^n)\\
& = z(\sum_{n=0}^{\infty} S(n) z^n-S(0))\\
&= z(G(S;z)-3\\\
\end{split}
\end{equation*}
%
\item\hypertarget{li-69}{}
\begin{equation*}
\begin{split}
\sum_{n=2}^{\infty} S(n-2) z^n & = z^2(\sum_{n=2}^{\infty} S(n-2) z^{n-2})\\
& =z^2G(S;z)\\
\end{split}
\end{equation*}
%
\par
Therefore,
\begin{equation*}
\begin{split}
&(G(S;z)-3-z)-2z(G(S;z)-3)-3z^2G(S;z)=0\\
& \Rightarrow G(S;z)-2z G(S;z)-3z^2G(S;z)=3 - 5z\\
&\Rightarrow G(S;z)=\frac{3-5z}{1-2z-3z^2}\\
\end{split}
\end{equation*}
%
\end{enumerate}
%
\item\hypertarget{li-70}{}Determine the sequence whose generating function is the one we got in Step 2.%
\par
For our example, we need to know one general fact about the closed form expression of an exponential sequence (a proof will be given later):
\begin{gather}
T(n)=b a^n ,n\geq 0 \Leftrightarrow G(T;z)=\frac{b}{1-a z} \label{gf-of-exp}
\end{gather}
%
\par
Now, in order to recognize \(S\) in our example, we must write our closed form expression for \(G(S;z)\) as a sum of terms like \(G(T;z)\) above. Note that the denominator of \(G(S;z)\) can be factored:
\[G(S;z)=\frac{3-5z}{1-2z-3z^2} =\frac{3-5z}{(1-3z)(1+z)}\]
If you look at this last expression for \(G(S;z)\) closely, you can imagine how it could be the result of addition of two fractions,
\begin{gather}
\frac{3-5z}{(1-3z)(1+z)} = \frac{A}{1-3z}+ \frac{B}{1+z}
\label{eq-pf}
\end{gather}
where \(A\) and \(B\) are two real numbers that must be determined. Starting on the right of \hyperref[eq-pf]{(\ref{eq-pf})}, it should be clear that the sum, for
any \(A\) and \(B\), would look like the left-hand side. The process of finding values of \(A\) and \(B\) that make \hyperref[eq-pf]{(\ref{eq-pf})}
true is called the \terminology{partial fractions decomposition} of the left-hand side:
\begin{equation*}
\begin{split}
\frac{A}{1-3z}+ \frac{B}{1+z} &=\frac{A(1+z)}{(1-3z)(1+z)}+ \frac{B(1-3z)}{(1-3z)(1+z)}\\
& =\frac{(A+B)+(A-3B)z}{(1-3z)(1+z)}\\
\end{split}
\end{equation*}
%
\par
Therefore,
\[\left\{
\begin{array}{c}
A+B=3 \\
A-3B=-5 \\
\end{array}
\right\}\Rightarrow \left\{
\begin{array}{c}
A=1 \\
B=2 \\
\end{array}
\right\}\]
and
\[G(S;z)= \frac{1}{1-3z}+ \frac{2}{1+z}\]
%
\par
We can apply \hyperref[gf-of-exp]{(\ref{gf-of-exp})} to each term of G(S;z):%
\par
%
\begin{itemize}[label=\textbullet]
\item{}\(\frac{1}{1-3z}\) is the generating function for \(S_1(n)=1\cdot 3^n= 3^n\)%
\item{}\(\frac{2}{1+z}\) is the generating function for \(S_2(n)=2(-1)^n\).%
\end{itemize}
%
\par
Therefore, \(S(n)=3^n+ 2(-1)^n\).%
\end{enumerate}
%
\par
From this example, we see that there are several skills that must be mastered in order to work with generating functions. You must be able to:%
\par
\leavevmode%
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-73}{}Manipulate summation expressions and their indices (in Step 2).%
\item\hypertarget{li-74}{}Solve algebraic equations and manipulate algebraic expressions, including partial function decompositions (Steps 2 and 3).%
\item\hypertarget{li-75}{} Identify sequences with their generating functions (Steps 1 and 3).%
\end{enumerate}
%
\par
We will concentrate on the last skill first, a proficiency in the other skills is a product of doing as many exercises and reading as many examples as possible.%
\par
First, we will identify the operations on sequences and on generating functions.%
\typeout{************************************************}
\typeout{Subsection 1.2.3 Operations on Sequences}
\typeout{************************************************}
\subsection[Operations on Sequences]{Operations on Sequences}\label{ops-on-sequences}
\begin{definition}[Operations on Sequences]\label{definition-6}
\index{Sequences!Operations on,}\label{notation-7}
\label{notation-8}
\label{notation-9}
Let \(S\) and \(T\) be sequences of numbers and let \(c\) be a real number. Define the sum \(S + T\), the scalar product \(c S\), the product \(S T\), the convolution \(S*T\), the pop operation \(S\uparrow\) (read ``S pop''), and the push
operation \(S\downarrow\) (read ``S push'') term-wise for \(k \geq 0\) by
\begin{align}
(S + T)(k) = S(k) + T(k)\label{seq-op-add}\\
(c S)(k) = c S(k)\label{seq-op-sc-mult}\\
(S \cdot T)(k) = S(k)T(k)\)\label{seq-op-mult}\\
(S*T)(k) = \sum_{j=0}^k S(j) T(k-j)\)\label{seq-op-convolve}\\
(S\uparrow )(k) = S(k+1)\)\label{seq-op-pop}\\
(S\downarrow )(k)=\left\{\begin{array}{cc} 0 & \textrm{ if } k=0 \\ S(k-1) & \textrm{ if } k>0 \\\end{array}\)\\
\end{array}\label{seq-op-push}
\end{align}%
\end{definition}
If one imagines a sequence to be a matrix with one row and an infinite number of columns, \(S + T\) and \(c S\) are exactly as in matrix addition
and scalar multiplication. There is no obvious similarity between the other operations and matrix operations.%
\par
The pop and push operations can be understood by imagining a sequence to be an infinite stack of numbers with \(S(0)\) at the top, \(S(1)\) next,
etc., as in \hyperref[fig-pop-push]{Figure~\ref{fig-pop-push}}a. The sequence \(S\uparrow\) is obtained by ``popping'' S(0) from the stack, leaving a stack as in \hyperref[fig-pop-push]{Figure~\ref{fig-pop-push}}b, with
S(1) at the top, S(2) next, etc. The sequence S I is obtained by placing a zero at the top of the stack, resulting in a stack as in \hyperref[fig-pop-push]{Figure~\ref{fig-pop-push}}c.
Keep these figures in mind when we discuss the pop and push operations.%
\leavevmode%
\begin{figure}
\centering
\includegraphics[width=1\linewidth]{images/fig-pop-push.png}
\caption{Stack interpretation of pop and push operation\label{fig-pop-push}}
\end{figure}
\begin{example}[Some Sequence Operations]\label{ex-some-sequence-operations}
If \(S(n) = n\), \(T(n) = n^2\), \(U(n) = 2^n\), and \(R(n) =n 2^n\) %
\par
\leavevmode%
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-76}{} \((S + T)(n) = n + n^2\)%
\item\hypertarget{li-77}{}\((U + R)(n) = 2^n+ n 2^n= (1+n)2^n\)%
\item\hypertarget{li-78}{}\((2 U)(n) = 2\cdot 2^n= 2^{n+1}\)%
\item\hypertarget{li-79}{} \((\frac{1}{2}R)(n)= \frac{1}{2}n 2^n= n 2^{n-1}\)%
\item\hypertarget{li-80}{} \((S\cdot T)(n) = n n^2 = n^3\)%
\item\hypertarget{li-81}{}\((S*T)(n)= \sum_{j=0}^n S(j) T(n-j)= \sum_{j=0}^n j (n-j)^2\\
\\
\quad \quad =\sum_{j=0}^n ( j n^2-2 n j^2 + j^3)\\
\\
\quad \quad = n^2\sum_{j=0}^n j-2n \sum_{j=0}^n j^2 + \sum_{j=0}^n j ^3\\
\\
\quad \quad =n^{2 }(\frac{n (n+1)}{2})- 2n(\frac{(2n+1)(n+1)n}{6})+\frac{1}{4} n^2 (n+1)^2\\
\\
\quad \quad = \frac{n^2(n+1)(n-1)}{12}\)%
\item\hypertarget{li-82}{}\((U*U)(n) =\sum_{j=0}^n U(j) U(n-j)\\
\\
\quad \quad =\sum_{j=0}^n 2^j 2^{n-j}\\
\\
\quad \quad = (n+1)2^n\)%
\item\hypertarget{li-83}{} \((S\uparrow )(n)=n+1\)%
\item\hypertarget{li-84}{}\((S\downarrow )(n)=\max (0,n-1)\)%
\item\hypertarget{li-85}{} \(((S\downarrow )\downarrow )(n)= \max (0, n - 2)\)%
\item\hypertarget{li-86}{} \((U\downarrow )(n)=\left\{
\begin{array}{cc}
2^{n-1} & \textrm{ if } n>0 \\
0 & \textrm{ if } n=0 \\
\end{array}
\)%
\item\hypertarget{li-87}{} \(((U\downarrow )\uparrow )(n)=(U\downarrow )(n+1)= 2^n= U(n)\)%
\item\hypertarget{li-88}{} \(((U\uparrow )\downarrow ) (n)=\left\{
\begin{array}{cc}
0 & \textrm{ if } n = 0 \\
U(n) & \textrm{ if } n>0 \\
\end{array}
\)%
\end{enumerate}
%
\end{example}
\par
Note that \((U\downarrow )\uparrow \neq (U\uparrow )\downarrow\).%
\begin{definition}[ Multiple Pop and Push]\label{def-multiple-pop-and-push}
\index{Multiple Pop and Push:}\label{notation-10}
\label{notation-11}
If S is a sequence of numbers and \(p\) a positive integer greater than 1, define
\[S\uparrow p = (S\uparrow (p - 1))\uparrow\textrm{ if }p \geq 2 \textrm{ and }S\uparrow 1 = S\uparrow\]
Similarly, define
\[S\downarrow p = (S\downarrow (p - 1))\downarrow\)\textrm{ if }\(p \geq 2\textrm{ and }S\downarrow 1 = S\downarrow\]
%
\end{definition}
\par
In general, \(S \uparrow p)(k) = S(k+p),\) and
\begin{equation*}
(S\downarrow p)(k)=\left\{
\begin{array}{cc}
0 & \textrm{ if } k < p \\
S(k-p) & \textrm{ if } k\geq p \\
\end{array}
\end{equation*}
%
\typeout{************************************************}
\typeout{Subsection 1.2.4 Operations on Generating Functions}
\typeout{************************************************}
\subsection[Operations on Generating Functions]{Operations on Generating Functions}\label{sss-operations-on-generating-functions}
\index{Generating Functions!Operations on,}\begin{definition}[Operations on Generating Functions]\label{definition-8}
\index{Generating Functions!Operations on,}If \(G(z)=\sum_{k=0}^{\infty} a_k z^k\) and \(H(z) =\sum_{k=0}^{\infty} b_k z^k\)
are generating functions and \(c\) is a real number, then the sum \(G + H\), scalar product \(c G\), product \(G H\), and monomial product \(z^p G\), \(p \geq 1\) are generating functions, where
\begin{gather}
(G + H)(z)=\sum_{k=0}^{\infty} (a_k+b_k) z^k\label{gf-sum}\\
[(c G)(z)=\sum_{k=0}^{\infty} c a_k z^k\label{gf-scalarmult}\\
(G H)(z) = \sum_{k=0}^{\infty} c z^k \textrm{ where } c_k= \sum_{j=0}^k a_jb_{k-j}\label{gf-product}\\
(z^p G)(z) = z^p\sum_{k=0}^{\infty} a_k z^k=\sum_{k=0}^{\infty} a_k z^{k+p} = \sum_{n=p}^{\infty} a_{n-p} z^n\label{gf-shift}
\end{gather}
%
\par
The last sum is obtained by substituting \(n - p\) for \(k\) in the previous sum.%
\end{definition}
\begin{example}[Some operations on generating functions]\label{ex-some-gf-operations}
If
\(D(z) =\sum_{k=0}^{\infty} kz^k\) and \(H(z) =\sum_{k=0}^{\infty} 2^k z^k\)
then
\((D + H)(z) =\sum_{k=0}^{\infty} (k+2^k) z^k\)
\((2H)(z)= \sum_{k=0}^{\infty} 2\cdot 2^kz^k =\sum_{k=0}^{\infty} 2^{k+1}z^k\)
\((z D)(z) = z\sum_{k=0}^{\infty} kz^k= \sum_{k=0}^{\infty} kz^{k+1}= \sum_{k=1}^{\infty} (k-1)
z^k \quad = D(z)- \sum_{k=1}^{\infty} z^k\)
\((D H)(z)=\sum_{k=0}^{\infty} (\sum_{j=0}^k j 2^{k-j})z^k\)
\((H H)(z)= \sum_{k=0}^{\infty} (\sum_{j=0}^k 2^j2^{k-j}) z^k=\sum_{k=0}^{\infty} (k+1)2^k z^k\)%
\par
Note: \(D(z) = G(S;z)\), and \(H(z) = G(U;z)\) from Example 8.5.2.%
\end{example}
Now we establish the connection between the operations on sequences and generating
functions. Let \(S\) and \(T\) be sequences and let \(c\) be a real number.
\begin{gather}
G(S+T;z)=G(S;z)+G(T;z)\label{gf-ops-1}\\
G(cS;z)=c G(S;z)\label{gf-ops-2}\\
G(S*T;z)=G(S;z) G(T;z)\label{gf-ops-3}\\
G(S\uparrow ;z)=(G(S;z)-S(0))/z\label{gf-ops-4}\\
G(S\downarrow ;z)=z G(S;z)\label{gf-ops-5}
\end{gather}%
\par
In words, \hyperref[gf-ops-1]{(\ref{gf-ops-1})} says that the generating function of the sum of two sequences equals the sum of the generating functions of those sequences. Take
the time to write out the other four identities in your own words. From the previous examples, these identities should be fairly obvious, with the
possible exception of the last two. We will prove \hyperref[gf-ops-4]{(\ref{gf-ops-4})} as part of the next theorem and leave the proof of \hyperref[gf-ops-5]{(\ref{gf-ops-5})} to the interested reader. Note that
there is no operation on generating functions that is related to sequence multiplication; that is, \(G(S\cdot T;z)\) cannot be simplified.%
\begin{theorem}[Generating functions related to Pop and Push]\label{gf-of-pop-push}
If \(p > 1\),%
\par
\leavevmode%
\begin{enumerate}[label=\alph*]
\item\hypertarget{li-89}{}\(G(S\uparrow p;z) = (G(S;z) -\left.\sum_{k=0}^{p-1} S(k) z^k)/z^k\)%
\item\hypertarget{li-90}{} \(G(S\downarrow p;z) = z^p G(S;z)\).%
\end{enumerate}
%
\end{theorem}
\begin{proof}\hypertarget{proof-1}{}
We prove (a) by induction and leave the proof of (b) to the reader. %
\par
Basis:
\begin{equation*}
\begin{split}
G(S\uparrow;z) &= \sum_{k=0}^{\infty} S(k+1) z^k\\
& =\sum_{k=1}^{\infty} S(k) z^{k-1}\\
& =\left.(\sum_{k=1}^{\infty} S(k) z^k)\right/z\\
& =\left.(S(0)+\sum_{k=1}^{\infty} S(k) z^k-S(0))\right/z\\
& =(G(S;z)-S(0))/z\\
\end{split}
\end{equation*}
Therefore, part (a) is true for \(p=1\).%
\par
Induction: Suppose that for some \(p\geq 1\), the statement in part (a) is true:
\begin{equation*}
\begin{split}
G(S\uparrow (p+1);z) &= G((S\uparrow p)\uparrow ;z)\\
& = (G(S\uparrow p ;z)-(S\uparrow p)(0))/z \textrm{ by the basis}\\
& = \frac{\frac{(G(S;z)-\sum_{k=0}^{p-1} S(k) z^k)}{z^p}-S(p)}{z}\\
\end{split}
\end{equation*}
by the induction hypothesis. Now write \(S(p)\) in the last expression above as \((S(r)z^p )/z^p\) so that it fits into the finite summation:
\begin{equation*}
\begin{split}
G(S\uparrow (p+1);z) & =\left.(\frac{G(S;z)-\sum_{k=0}^p S(k) z^k}{z^p})\right/z\\
& = (G(S;z)-\sum_{k=0}^p S(k) z^k)/z^{p+1}\\
\end{split}
\end{equation*}
%
\par
Therefore the statement is true for \(p+1\).\(\square\)%
\end{proof}
\typeout{************************************************}
\typeout{Subsection 1.2.5 Closed Form Expressions for Generating Functions}
\typeout{************************************************}
\subsection[Closed Form Expressions for Generating Functions]{Closed Form Expressions for Generating Functions}\label{ss-closed-form-expressions-for-generating-functions}
\index{Generating Functions!Closed form expressions for}The most basic tool used to express generating functions in closed form is the closed form expression for the geometric series, which is an expression
of the form \(a + a r + a r^2+ \cdots\). It can either be terminated or extended infinitely.%