-
Notifications
You must be signed in to change notification settings - Fork 0
/
Statistics Textbook.tex
executable file
·7182 lines (5003 loc) · 210 KB
/
Statistics Textbook.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
\documentclass[11pt,a4paper]{book}
\usepackage{lib/Textbook}
\exhyphenpenalty=10000\hyphenpenalty=10000
%\sloppy
\usepackage{enumitem}
\usepackage{mdframed}
\usepackage{tikz}
\usepackage{nccmath}
\usepackage{wrapfig}
\usepackage{textcomp}
\usepackage{multirow}
\usepackage{tasks}
\usetikzlibrary{shapes,arrows,decorations.pathreplacing,calc,positioning,intersections}
\usepackage[export]{adjustbox}
\usepackage{chngcntr}
\usepackage{array}
\usepackage{picture}
\tikzstyle{Box} = [rectangle, minimum height=1cm, draw=black]
\tikzstyle{arrow} = [thick, ->, >=stealth]
\newlist{steps}{enumerate}{1}
\setlist[steps, 1]{label = Step \arabic*:}
\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\W}{\mathbb{W}}
\newcommand{\C}{\mathbb{C}}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{mathtools,amsfonts,amssymb,amsthm}
\usepackage[most]{tcolorbox}
\setlength{\parindent}{0pt}
\usepackage{fourier}
\let\cleardoublepage=\clearpage
% Start document
\begin{document}
\tableofcontents
\chapter{Permutations and Combinations}
\section{Basic Counting Principles}
Is a password with at least one uppercase letter really more secure
than one without? What are my odds of winning the lottery? How many
ways could I arrange my friends around the dining table at my dinner
party? In everyday life, we often need to "count"
the number of ways to arrange objects. However listing out all the
possible arrangements is not always easy. In this chapter we will
be learning some fundamental counting techniques, to help us answer
some of life's burning questions.
\subsection{Addition Principle for Counting}
\begin{tcolorbox}[colback=blue!5, colframe=black, boxrule=.4pt, sharpish corners]
The \textbf{Addition Principle for Counting} states that if we have
$a_{1}$ ways of doing something and $a_{2}$ ways of doing another
thing and we cannot do both at the same time, then the number of ways
we can choose $a_{1}$ \textbf{or} $a_{2}$ is
\[
a_{1}+a_{2}
\]
\end{tcolorbox}
Zoe is trying to decide what to wear to the prom. She has 2 ball gowns,
3 blouses and 1 sundress.
How many different outfits can Zoe choose from?
Zoe has $2+3+1=6$ outfits to choose from.
\subsection{Multiplication Principle for Counting}
\begin{tcolorbox}[colback=blue!5, colframe=black, boxrule=.4pt, sharpish corners]
The \textbf{Multiplication Principle for Counting} states that if
there is a sequence of independent events that can occur $a_{1},a_{2},a_{3},...a_{n}$
ways, then the number of ways all the events can occur is
\[
a_{1}\times a_{2}\times a_{3}\times\ldots\times a_{n}
\]
\end{tcolorbox}
Suppose there are three towns $A$, $B$ and $C$ and that four different
roads can be taken from $A$ to $B$ and two different roads from
$B$ to $C$.
\begin{center}
\includegraphics[width=8cm]{\string"lib/Graphics/CountingProductRule\string".png}
\par\end{center}
This begs the question: ``How many different pathways are there from
$A$ to $C$, going through $B$?''
\begin{minipage}[t]{0.5\textwidth}
If we take road 1, there are two different roads to complete our trip.\\
If we take road 2, there are two different roads to complete our trip
... etc.\\
\end{minipage}
\begin{minipage}[t]{0.2\textwidth}
\begin{center}
\includegraphics[width=8cm]{\string"lib/Graphics/CountingProductRule1\string".png}
\par\end{center}
\end{minipage}
So there are $2+2+2+2=4\times2$ different pathways we can take from
$A$ to $C$.
\newpage
Similarly, for
\begin{center}
\includegraphics[width=12cm]{\string"lib/Graphics/CountingProductRule2\string".png}
\par\end{center}
There would be $4\times2\times3=24$ different pathways from $A$
to $D$, passing through $B$ and $C$.
\subsubsection{Double Counting}
Lisa invites six guests to her birthday party, when they arrive they all shake hands with everybody else at the party. How many handshakes occurred in total?
One guest claims that because there are 7 people at the party and they shook 6 hands each, there should be $7\cdot6=42$ handshakes in total.
This guest is in fact wrong. The same logic would give 2 handshakes if two people meet, which is clearly wrong. That is because it takes 2 people to make 1 handshake, and so every handshake was counted twice.
In actuality, only $42\div 2=21$ handshakes occurred.
\section{Permutations }
\centerline{\begin{minipage}{.68\textwidth}
\begin{tcolorbox}[colback=blue!5, colframe=black, boxrule=.4pt, sharpish corners]
A \textbf{permutation} is an \textbf{ordered arrangement} of a number
of objects.
\end{tcolorbox}
\end{minipage}}
\medskip
Lisa and her guests make their way to the dining table to eat. Since
it is Lisa's birthday, she sits at the head of the table. How many
different seatings are there (with Lisa's place fixed)?
Let us fill the seats one by one, starting with the chair on Lisa's
right. There are $6$ choices for the guest who will sit down first.
How many choices are there for the guest who goes second? There are
only $5$ choices as the person who went first is already seated.
Therefore there are a total of $6\cdot5$ ways to seat the first two
guests.
We can then proceed in a similar manner: we have $4$ choices for
the third guest to be seated, $3$ choices for the fourth guest to
be seated, and so on. Therefore, the number of ways in which the guests can be seated is
\[
6\cdot5\cdot4\cdot3\cdot2\cdot1=6!=720
\]
\centerline{\begin{minipage}{.58\textwidth}
\begin{tcolorbox}[colback=blue!5, colframe=black, boxrule=.4pt, sharpish corners]
The number of permutations of $n$ different objects is $n!$
\end{tcolorbox}
\end{minipage}}
\begin{example}[Seven Layer Cake]
Alice made a seven layer rainbow cake for Lisa. How many ways could
she have arranged the layers of the cake with the $7$ distinct colours
of the rainbow?
\Solution
The answer is $7!=5040$.
\end{example}
The simplicity of the answer to this question was due to several
factors: we used each of our objects exactly once, the order of the
objects mattered, and the objects were all different. In the rest
of this section we will study problems without one or more of these
simplifying factors.
\subsection{Permutations Involving Identical Objects}
\begin{example}[Flowers in a Row (Repeated Colours)]
A gardener has five red flowers, three yellow flowers and two white
flowers to plant in a row. In how many different ways can she do that?
\Solution
This problem differs from the previous one in only one aspect: the
objects are not all different. We are going to answer this question
by reducing it to the previous one, in which all objects were different.
Assume our gardener plants her flowers in a row, then sticks labels
(say numbers 1 through 5 for the red flowers, 1 through 3 for the
yellow ones, and 1 through 2 for the white ones) to her flowers so
that she can distinguish them. Now she has ten different flowers,
and therefore the row of flowers she has just finished working on
can look $10!$ different ways. We have to tell how many of these
arrangements differ only because of these labels.
The five red flowers could be given five different labels in $5!$
different ways. The three yellow flowers could be given three different
labels in $3!$ different ways. The two white flowers could be given
two different labels in $2!$ different ways. Therefore, the labelling
of all ten flowers can be done in $5!\cdot3!\cdot2!$ different ways.
Therefore, the total number of arrangements when the labels are removed
is
\[
\frac{10!}{5!\cdot3!\cdot2!}=2520
\]
\end{example}
\medskip{}
\begin{tcolorbox}[colback=blue!5, colframe=black, boxrule=.4pt, sharpish corners]
The number of permutations of $n$ objects with $n_{1}$ identical
objects of the first type, $n_{2}$ identical objects of the second
type, ..., and $n_{k}$ identical objects of the $k$ type is
\[
\frac{n!}{n_{1}!n_{2}!\ldots n_{k}!}
\]
\end{tcolorbox}
\subsection{Permutations Involving Non-Identical Objects}
\subsubsection{Non-Identical Objects Taken Without Repetition}
\begin{example}[20 Politicians Filling 5 Position]
A president must choose five politicians from a pool of 20 candidates
to fill five different cabinet positions. In how many different ways
can she do that?
\Solution
Indeed, we have $20$ choices for the first candidate, $19$ choices
for the second, and so on, just as we did the case of factorials.
The only difference is that here we do not have $20$ slots to fill.
We stop after choosing $5$ of them.
The number $20\cdot19\cdot18\cdot17\cdot16$ is denoted by $^{20}P_{5}$.
Thus, there are $^{20}P_{5}=1860480$ ways of filling this cabinet.
If the candidates are all equally qualified, it may take a while.
\end{example}
\medskip{}
\begin{tcolorbox}[colback=blue!5, colframe=black, boxrule=.4pt, sharpish corners]
The number of permutations of $n$ different objects taken $r$ at
a time \textbf{without repetition} is
\[
^{n}P_{r}=\frac{n!}{\left(n-r\right)!}
\]
\end{tcolorbox}
\subsubsection{Non-Identical Objects Taken With Repetition}
\begin{example}[Building 10 Intersections]
A city has recently built ten intersections. Some of these will get
traffic lights, and some of those that get traffic lights will also
get a gas station. In how many different ways can this happen?
\Solution
For each intersection, there are three possible scenarios:
\begin{enumerate}
\item No traffic light and no gas station.
\item Traffic light but no gas station.
\item Traffic light and a gas station.
\end{enumerate}
Since we have three possible arrangements for each intersection, there
will be $3\cdot3$ possible arrangements for two intersections, and
a total of $3^{10}$ arrangements for the ten intersections to be
built.
\end{example}
\medskip{}
\begin{tcolorbox}[colback=blue!5, colframe=black, boxrule=.4pt, sharpish corners]
The number of permutations of $n$ different objects taken $r$ at
a time \textbf{with repetition }is $n^{r}$.
\end{tcolorbox}
\begin{example}[Computer Password]
A certain computer access password consists of 3 through 5 lowercase
letters chosen from the 26 letters in the Roman alphabet, with repetitions allowed. How many different passwords are possible?
\Solution
The set of all passwords can be split into three subsets consisting
of passwords with lengths 3, 4, and 5.
By the addition rule, the total number of passwords equals the number
with length 3, plus the number with length 4, plus the number with
length 5.
$\text{Total number of passwords with length 3}=26^{3}$
$\text{Total number of passwords with length 4}=26^{4}$
$\text{Total number of passwords with length 5}=26^{5}$
Hence the total number of passwords is
\[
26^{3}+26^{4}+26^{5}=12355928
\]
(Approximately 12 million)
\end{example}
How many different passwords are possible if the password contains
both uppercase and lowercase letters?
Now instead of having $26$ characters to choose from, we have $52$.
$\text{Total number of passwords with length 3}=52^{3}$
$\text{Total number of passwords with length 4}=52^{4}$
$\text{Total number of passwords with length 5}=52^{5}$
Hence the total number of passwords is
\[
52^{3}+52^{4}+52^{5}=387656256
\]
(Approximately 388 million)
\newpage
\subsection{Permutations in a Circle }
\begin{example}[Meeting of Diplomats]
At a meeting of diplomats, the six participants are to be seated around
a circular table. Since the table has no ends to confer particular
status, it doesn't matter who sits in which chair.
But it does matter how the diplomats are seated relative to each other.
In other words, two seatings are considered the same if one is a rotation of the other. How many different ways can the diplomats be seated?
\Solution
Call the diplomats by the letters $A$, $B$, $C$, $D$, $E$, and
$F$. Since only relative position matters, you can start with any
diplomat (say, $A$), place that diplomat anywhere. There is only
one way to do this. Then consider all arrangements of the other diplomats
around that one. The five diplomats $B$ through $F$ can be arranged
in the seats around diplomat $A$ in all possible orders. So there
are $5!=120$ ways to seat the group.
\end{example}
\begin{minipage}{.5\textwidth}
\begin{center}
\includegraphics[width=3.3cm,valign=t]{\string"lib/Graphics/Diplomatsinacircle\string".png}
\par\end{center}
\end{minipage}
\begin{minipage}{.5\textwidth}
Five other diplomats to be seated: $B,C,D,E,F$
\end{minipage}
\medskip
If the seats where numbered/labelled/distinct from each other in some
way, then it would matter what seat they were sitting in and there
would be $n!$ ways of arranging the diplomats.
\medskip
\centerline{\begin{minipage}{.73\textwidth}
\begin{tcolorbox}[colback=blue!5, colframe=black, boxrule=.4pt, sharpish corners]
The number of ways of arranging $n$ different objects in a circle
is $\left(n-1\right)!$
\end{tcolorbox}
\end{minipage}}
\medskip
Unless specified otherwise, all seats are assumed to be not numbered
when circular arrangement is involved.
\begin{example}[Circular Permutations]
\begin{minipage}[t]{.6\textwidth}
How many ways can four friends use their left hands to hold another
friend as shown in the diagram?
\end{minipage}
\begin{minipage}[t]{.38\textwidth}
\begin{center}
\includegraphics[width=4cm,valign=t]{\string"lib/Graphics/4FriendsHandCircle\string".png}
\par\end{center}
\end{minipage}
\Solution
$\text{Number of ways}=\left(4-1\right)!=3!=6$
\end{example}
\newpage{}
\section{Combinations }
\centerline{\begin{minipage}{.82\textwidth}
\begin{tcolorbox}[colback=blue!5, colframe=black, boxrule=.4pt, sharpish corners]
A \textbf{combination} is a selection of objects \textbf{without regard
to order or arrangement}.
\end{tcolorbox}
\end{minipage}}
\medskip
How many combinations of 3 letter strings can be taken from the set
of 4 letters $\left\{ A,B,C,D\right\} $?
There are $4$ combinations: $ABC$, $BCD$, $ABD$, $ACD$.
\medskip
\begin{tcolorbox}[colback=blue!5, colframe=black, boxrule=.4pt, sharpish corners]
The number of combinations of $n$ different objects taken $r$ at
a time is
\[
^{n}C_{r}=\begin{pmatrix}n\\
r
\end{pmatrix}=\frac{n!}{r!\left(n-r\right)!}
\]
\end{tcolorbox}
How many ways are there of choosing 5 cards out of a standard $52-$card deck?
The answer is that there are $^{52}C_{5}=2598960$ ways.
\begin{example}[Probability of Winning The Lottery]
In a lottery $5$ numbers are selected from $90$. If George buys
$100$ tickets, what is the probability that he wins?
\Solution
$\text{Total number of combinations}={}^{90}C_{5}=43,949,268$
\begin{align*}
\text{P}\left(\text{George wins}\right) & =\frac{100}{43949268}\\
& =2.28\times10^{-6}
\end{align*}
\end{example}
\begin{example}[Forming a Team]
The tennis team comprises 8 boys and 12 girls. Three boys and two
girls are to be chosen at random to enter a competition. In how many
ways can this be done?
\Solution
$\text{Number of ways to choose 3 boys}={}^{8}C_{3}$
$\text{Number of ways to choose 2 girls}={}^{12}C_{2}$
Therefore, the total number of ways to choose 3 boys and 2 girls is
$^{8}C_{3}\times{}^{12}C_{2}=3696$.
\end{example}
\begin{example}[Filling Up Seats]
In how many ways can 5 people be chosen to occupy 3 seats in a row?
\Solution
$\text{Number of ways}={}^{5}C_{3}\times3!=60$
Alternatively, $\text{Number of ways}={}^{5}P_{3}=60$
\end{example}
Note:
\begin{itemize}
\item $^{n}P_{r}={}^{n}C_{r}\times r!$
\item $^{n}C_{r}={}^{n}C_{n-r}$
\item $^{n}C_{0}={}^{n}C_{n}=1$
\end{itemize}
\newpage
\begin{example}[Forming a Team With Restrictions]
Suppose a group of twelve consists of five men and seven women.
\begin{enumerate}[label=(\alph*)]
\item How many five-person teams can be chosen that consist of three
men and two women?
\item How many five-person teams contain at least one man?
\item How many five-person teams contain at most one man?
\end{enumerate}
\Solution
\begin{enumerate}[label=(\alph*)]
\item There are $^{5}C_{3}$ ways to choose $3$ men and $^{7}C_{2}$
ways to choose two women.
Hence by the multiplication rule,
$
\begin{aligned}[t]
\text{Number of teams} & =^{5}C_{3}\times{}^{7}C_{2}\\
& =210
\end{aligned}
$
\item
$
\begin{aligned}[t]
&\text{Number of teams with at least one man}\\
&=\text{Total number of teams}-\text{Number of teams with no men}\\
&=^{12}C_{5}-{}^{7}C_{5}\\
&=771
\end{aligned}
$
\item
$
\begin{aligned}[t]
&\text{Number of teams with at most one man}\\
&=\text{Number of teams with no men}+\text{Number of teams with one man}\\
& =^{5}C_{0}\times{}^{7}C_{5}+{}^{5}C_{1}\times{}^{7}C_{4}\\
& =196
\end{aligned}
$
\end{enumerate}
\end{example}
\newpage
\section{Grouping Method, Inserting Method, Complementary Method}
\begin{example}[Sitting in a Row With Restrictions]
In how many ways can 4 boys and 3 girls be arranged in a row,
\begin{enumerate}[label=(\alph*)]
\item so that the 3 girls are always together?
\item so that the first and last place are occupied by boys?
\item if all the girls are to be separated?
\item if the 3 girls are not all together together?
\end{enumerate}
\Solution
\begin{enumerate}[label=(\alph*)]
\item We can put the $3$ girls together as $1$ group.
The number of ways to arrange the $4$ boys and 1 group of girls is
$5!$.
The number of ways the $3$ girls can arrange each other among themselves
is $3!$.
Thus, the total number of ways that the $3$ girls are always together
is $5!\times3!=720$.
(We call this the \textbf{grouping method})
\item \uline{4} \_ \_ \_ \_ \_ \uline{3}
The $1\text{st}$ and last place can be filled in $3\times4=12$ ways.
The remaining 5 people can be arranged in $5!$ ways.
Thus, the total number of ways the first and last place are occupied
by boys is $12\cdot5!=1440$.
(Alternatively, we could use $\left[^{4}C_{2}\times2!\right]\times5!=1440$)
\item Here we use the \textbf{slotting method}.
\_$B_{1}$\_$B_{2}$\_$B_{3}$\_$B_{4}$\_
Boys can arrange themselves in $4!$ ways.
There are $5$ slots for the $3$ girls. The girls can arrange themselves
$^{5}C_{3}\times3!=60$ ways.
Thus, the total number of ways that the girls are separated is $4!\times60=1440$.
\item Since for any arrangement, EITHER all the 3 girls are together,
OR not all the 3 girls are together,
\begin{align*}
\text{Number of ways 3 girls not all together} & =\text{Total}-\text{Complement}\\
& =7!-720\quad\text{(From part a)}\\
& =4320
\end{align*}
(This is known as the \textbf{complementary method})
\end{enumerate}
\end{example}
\newpage
\begin{example}[Sitting Around a Round Table With Restrictions]
A group of 7 people are to be seated at a round table. Andrew, Jane and Bob are 3 particular people in the group. How many arrangements are there if
\begin{enumerate}[label=(\alph*)]
\item there is no restriction?
\item Andrew and Jane must be together?
\item Andrew and Jane must be separated?
\item Jane must sit between Andrew and Bob?
\end{enumerate}
How many arrangements are there if there is no restriction, but the
seats are numbered?
\Solution
\begin{enumerate}[label=(\alph*)]
\item $\text{Number of arrangements}=\left(7-1\right)!=6!=720$
\item Group Andrew and Jane together as 1 unit.
$\text{Number of ways to arrange 6 units}=5!$
$\text{Number of internal arrangements for Andrew and Jane}=2!$
$
\begin{aligned}[t]
\text{Number of arrangements} & =5!\times2!\\
& =240
\end{aligned}
$
\item \begin{minipage}[t]{.6\textwidth}
Use the slotting method.
$\text{Number of ways to arrange other 5 people}=\left(5-1\right)!=4!$
$\text{Andrew and Jane can arrange themselves in }{}^{5}C_{2}\times2!$ ways.
$
\begin{aligned}[t]
\text{Number of arrangements} & =4!\times{}^{5}C_{2}\times2!\\
& =480
\end{aligned}
$
\end{minipage}
\begin{minipage}[t]{.4\textwidth}
\begin{center}
\includegraphics[width=5cm,valign=t]{\string"lib/Graphics/SlottingMethodCircle\string".png}
\par\end{center}
\end{minipage}
\item Consider Andrew Jane and Bob as 1 unit.
$\text{Number of ways to arrange 5 units}=4!$
Andrew and Bob can permute among themselves in $2!$ ways.
$
\begin{aligned}
\text{Number of arrangements} & =4!\times2!\\
& =48
\end{aligned}
$
\end{enumerate}
If seats are numbered, it is equivalent to arranging them in a row.
Therefore, $\text{number of arrangements}=7!=5040$.
\end{example}
\newpage
\begin{example}[Boys and Girls Alternating]
In how many ways can 5 boys and 5 girls be arranged in a row such
that the boys and girls alternate?
\Solution
\begin{enumerate}[label=Case \arabic*:,leftmargin=1.5cm]
\item The first person is a boy. \hspace{1cm}$BGBGBGBGBG$
$\text{Number of ways}=5!\times5!$
\item The first person is a girl. \hspace{1cm}$GBGBGBGBGB$
$\text{Number of ways}=5!\times5!$
\end{enumerate}
Hence, $\text{total number of ways}=5!\times5!+5!\times5!=28800$
\end{example}
\section{Combinations, Pascal's Triangle and The Binomial Distribution}
\begin{center}
\textit{Mathematics is the art of giving the same name to different
things.}
\par\end{center}
\begin{flushright}
-Henri Poincaré\hspace{1cm}
\par\end{flushright}
Pascal's triangle consists of a triangle of numbers where each term
is equal to the sum of the two terms above it. We adopt the convention
that the topmost row is row $0$ and the leftmost term of each row
is the $0\text{th}$ term. It turns out that the $r\text{th}$ term
in the $n\text{th}$ row is given by $^{n}C_{r}$. Try to verify this
for yourself for a few of the terms!
\begin{center}
\def\N{8}
\tikz[x=0.75cm,y=0.5cm,
pascal node/.style={font=\footnotesize},
row node/.style={font=\footnotesize, anchor=west, shift=(180:1)}]
\path
\foreach \n in {0,...,\N} {
(-\N/2-1, -\n) node [row node/.try]{$n=$ \n:}
\foreach \k in {0,...,\n}{
(-\n/2+\k,-\n) node [pascal node/.try] {%
\pgfkeys{/pgf/fpu}%
\pgfmathparse{round(\n!/(\k!*(\n-\k)!))}%
\pgfmathfloattoint{\pgfmathresult}%
\pgfmathresult%
}}};
\end{center}
The following equations are the binomial expansion of $\left(1+x\right)^{n}$,
where $n=0,1,2,3,4,5,6$.
\begin{align*}
\left(1+x\right)^{0} & =1\\
\left(1+x\right)^{1} & =1+x\\
\left(1+x\right)^{2} & =1+2x+x^{2}\\
\left(1+x\right)^{3} & =1+3x+3x^{2}+x^{3}\\
\left(1+x\right)^{4} & =1+4x+6x^{2}+4x^{3}+x^{4}\\
\left(1+x\right)^{5} & =1+5x+10x^{2}+10x^{3}+5x^{4}+x^{5}\\
\left(1+x\right)^{6} & =1+6x+15x^{2}+20x^{3}+15x^{4}+6x^{5}+x^{6}
\end{align*}
Notice that the coefficients of the binomial expansion of $\left(1+x\right)^{n}$
are simply $\begin{pmatrix}n\\
0
\end{pmatrix},\begin{pmatrix}n\\
1
\end{pmatrix},\begin{pmatrix}n\\
2
\end{pmatrix},\ldots\begin{pmatrix}n\\
n
\end{pmatrix}$.
\newpage
\begin{testyourself}{TEST YOURSELF}
\begin{tasks}[label=(\alph*),label-width=3.5ex]
\task A permutation is an \rule{4cm}{0.5pt} of a number of objects.
\task The number of permutations of a set of $n$ elements equals
\rule{2cm}{0.5pt}.
\task How many ways can the letters in the word COMPUTER be arranged
in a row?
\task The number of permutations of $n$ different objects taken
$r$ at a time without repetition\textbf{ }is \rule{2cm}{0.5pt}.
\task A father has 5 books and wishes to give one to each of his
3 children. In how many ways can he do this?
\task The number of permutations of $n$ different objects taken
$r$ at a time with repetition\textbf{ }is \rule{2cm}{0.5pt}.
\task How many $3-$digit numbers can be formed from the set $\left\{ 1,2,3,4,5\right\} $
if the digits may be used more than once?
\task How many ways can we arrange 2 identical white balls and 3
identical red balls in a row?
\task How many ways can $n$ people sit at a round table?
\task How many ways can $n$ people sit at a round table if the
seats are numbered?
\task A combination is a selection of objects without regard to
\rule{4cm}{0.5pt}.
\task The formula for $^{n}C_{r}$ is \rule{2cm}{0.5pt}.
\task How many ways can we select $5$ people for a team from a group
of 12.
\end{tasks}
\end{testyourself}
\begin{testyourself}{ANSWER}
\begin{tasks}[label=(\alph*),label-width=3.5ex]
\task A permutation is an \textbf{ordered arrangement} of a number of objects.
\task The number of permutations of a set of $n$ elements equals
$\boldsymbol{n!}$.
\task COMPUTER can be arranged $\boldsymbol{8!=40320}$ ways.
\task The number of permutations of $n$ different objects taken
$r$ at a time without repetition\textbf{ }is $\boldsymbol{
^{n}P_{r}=\frac{n!}{\left(n-r\right)!}}$.
\task The father can distribute the books $\boldsymbol{^{5}P_{3}=60}$ ways.
\task The number of permutations of $n$ different objects taken
$r$ at a time with repetition\textbf{ }is $\boldsymbol{n^{r}}$.
\task From the set $\left\{ 1,2,3,4,5\right\}$, we can form $\boldsymbol{5^{3}=125}$ $3-$digit numbers.
\task We can arrange 2 identical white balls and 3 identical red balls $\boldsymbol{\frac{5!}{2!\times3!}=10}$ ways.
\task $n$ people can sit around a table in $\boldsymbol{(n-1)!}$ ways.
\task If the seats are numbered, they can sit in $\boldsymbol{n!}$ ways.
\task A combination is a selection of objects without regard to
\textbf{order or arrangement}.
\task The formula for $^{n}C_{r}$ is $\boldsymbol{\frac{n!}{r!\left(n-r\right)!}}$.
\task We can select 5 people from a group of 12 in $\boldsymbol{^{12}C_{5}=792}$ ways.
\end{tasks}
\end{testyourself}
\chapter{Probability}
\section{Gambling and Probability}
Gambling is the wagering of money or something of value on an event
with an uncertain outcome, with the primary intent of winning money
or material goods. The passion for gambling is as old as humanity
itself. In places such as China, Egypt, Greece, Rome, there are evidences that date back to thousands of years ago. Dice games date back to 500BC in ancient rome. Playing cards were found in China as early as the 9th Century during the Tang Dynasty. The first casinos opened in Italy in the 17th century, the first ever being the Casino di Venezia in 1638.
Mans love for gambling is what led the way for the early developments
in probability theory. We wanted to make more money when gambling,
so we searched for optimal gambling strategies. Many developments
in probability theory were stimulated by solving gambling problems
such as
\begin{itemize}
\item De Mere's problem
\item Newton - Pepys problem
\item The St. Petersberg Paradox
\end{itemize}
These days, the magic of gambling has somewhat dissipated. There is
no more uncertainty in the games of chance we play. Whether it is
blackjack, roulette, or slot machines; one thing is for sure: in the
long run, the house always wins. The gambler will inevitably fall
victim of the law of large numbers.
\newpage
\section{Introduction to Probability}
Probability is a measure of chance. In the case where an experiment
has finitely many outcomes and all outcomes are equally likely to
occur, the probability of an event (set of outcomes) is just the ratio
of the number of outcomes in the event to the total number of outcomes
(which we call the sample space).
\medskip
\centerline{\begin{minipage}{.88\textwidth}
\begin{tcolorbox}[colback=blue!5, colframe=black, boxrule=.4pt, sharpish corners]
A \textbf{sample space} is the set of all possible outcomes of a random
process or experiment.
\medskip
An \textbf{event} is a subset of a sample space.
\end{tcolorbox}
\end{minipage}}
\medskip
For example, a fair six-sided die has a sample of $S=\left\{ 1,2,3,4,5,6\right\} $.
$\therefore n\left(S\right)=6$
Suppose $E$ is the event that an even number is rolled. Since the
even numbers in $S$ are $2,4,6$, event $E$ can be written as $E=\left\{ 2,4,6\right\} $.
$\therefore n\left(E\right)=3$
\medskip
\begin{tcolorbox}[colback=blue!5, colframe=black, boxrule=.4pt, sharpish corners]
If $S$ is a finite sample space in which all outcomes are equally
likely and $E$ is an event in $S$, then the probability of $E$,
denoted $\text{P}\left(E\right)$, is
\[
\text{P}\left(E\right)=\frac{\text{the number of outcomes in }E}{\text{the total number of outcomes in }S}
\]
\end{tcolorbox}