Week 11 page ! of !1 26
CISC-102 Fall 2018 Week 11
Pascal’s Triangle
An easy way to calculate a table of binomial coefficients was recognized centuries ago by mathematicians in India, China, Iran and Europe. In the west the technique is named after the French mathematician Blaise Pascal (1623-1662). In the example below each row represents the binomial coefficients as used in the binomial theorem.
�1
3.5 Pascal’s Triangle 49
ing trick, we can reduce the problem of counting such distributions to theproblem we just solved: We borrow 1 penny from each child, and then dis-tribute the whole amount (i.e., n + k pennies) to the children so that eachchild gets at least one penny. This way every child gets back the money weborrowed from him or her, and the lucky ones get some more. The “more”is exactly n pennies distributed to k children. We already know that thenumber of ways to distribute n+ k pennies to k children so that each childgets at least one penny is
!n+k−1k−1
". So we have the next result:
Theorem 3.4.2 The number of ways to distribute n identical pennies tok children is
!n+k−1k−1
".
3.4.1 In how many ways can you distribute n pennies to k children if each childis supposed to get at least 2?
3.4.2 We distribute n pennies to k boys and ℓ girls in such a way that (to bereally unfair) we require that each of the girls gets at least one penny (but we donot insist on the same thing for the boys). In how many ways can we do this?
3.4.3 A group of k earls are playing cards. Originally, they each have p pennies.At the end of the game, they count how much money they have. They do notborrow from each other, so that each cannot loose more than his p pennies. Howmany possible results are there?
3.5 Pascal’s Triangle
To study various properties of binomial coefficients, the following picture isvery useful. We arrange all binomial coefficients into a triangular scheme:in the “zeroth” row we put
!00
"; in the first row, we put
!10
"and
!11
"; in the
second row,!20
",!21
", and
!22
"; etc. In general, the nth row contains the num-
bers!n0
",!n1
", . . . ,
!nn
". We shift these rows so that their midpoints match;
this way we get a pyramidlike scheme, called Pascal’s Triangle (named af-ter the French mathematician and philosopher Blaise Pascal, 1623–1662).The figure below shows only a finite piece of Pascal’s Triangle.
!00
"!10
" !11
"!20
" !21
" !22
"!30
" !31
" !32
" !33
"!40
" !41
" !42
" !43
" !44
"!50
" !51
" !52
" !53
" !54
" !55
"!60
" !61
" !62
" !63
" !64
" !65
" !66
"
Week 11 page ! of !2 26
To obtain the entries by hand in a simple way we can use the identity:
.
!
�nk
�=
�n�1k�1
�+
�n�1k
�
50 3. Binomial Coefficients and Pascal’s Triangle
We can replace each binomial coefficient by its numerical value to getanother version of Pascal’s Triangle (going a little further down, to theeighth row):
11 1
1 2 11 3 3 1
1 4 6 4 11 5 10 10 5 1
1 6 15 20 15 6 11 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
3.5.1 Prove that Pascal’s Triangle is symmetric with respect to the vertical linethrough its apex.
3.5.2 Prove that each row of Pascal’s Triangle starts and ends with 1.
3.6 Identities in Pascal’s Triangle
Looking at Pascal’s Triangle, it is not hard to notice its most importantproperty: Every number in it (other than the 1’s on the boundary) is thesum of the two numbers immediately above it. This, in fact, is a property ofthe binomial coefficients we already met, namely, equation (1.8) in Section1.8: !
n
k
"=
!n − 1k − 1
"+
!n − 1
k
". (3.2)
This property of Pascal’s Triangle enables us to generate the trianglevery fast, building it up row by row, using (3.2). It also gives us a tool toprove many properties of the binomial coefficients, as we shall see.
As a first application, let us give a new solution to exercise 3.1.2. Therethe task was to prove the identity
!n
0
"−
!n
1
"+
!n
2
"−
!n
3
"+ · · · + (−1)n
!n
n
"= 0, (3.3)
using the Binomial Theorem. Now we give a proof based on (3.2): Wecan replace
#n0
$by
#n−10
$(both are just 1),
#n1
$by
#n−10
$+
#n−11
$,#n2
$by#n−1
1
$+
#n−12
$, etc. Thus we get the sum
!n − 1
0
"−
%!n − 1
0
"+
!n − 1
1
"&+
%!n − 1
1
"+
!n − 1
2
"&
�2
3.5 Pascal’s Triangle 49
ing trick, we can reduce the problem of counting such distributions to theproblem we just solved: We borrow 1 penny from each child, and then dis-tribute the whole amount (i.e., n + k pennies) to the children so that eachchild gets at least one penny. This way every child gets back the money weborrowed from him or her, and the lucky ones get some more. The “more”is exactly n pennies distributed to k children. We already know that thenumber of ways to distribute n+ k pennies to k children so that each childgets at least one penny is
!n+k−1k−1
". So we have the next result:
Theorem 3.4.2 The number of ways to distribute n identical pennies tok children is
!n+k−1k−1
".
3.4.1 In how many ways can you distribute n pennies to k children if each childis supposed to get at least 2?
3.4.2 We distribute n pennies to k boys and ℓ girls in such a way that (to bereally unfair) we require that each of the girls gets at least one penny (but we donot insist on the same thing for the boys). In how many ways can we do this?
3.4.3 A group of k earls are playing cards. Originally, they each have p pennies.At the end of the game, they count how much money they have. They do notborrow from each other, so that each cannot loose more than his p pennies. Howmany possible results are there?
3.5 Pascal’s Triangle
To study various properties of binomial coefficients, the following picture isvery useful. We arrange all binomial coefficients into a triangular scheme:in the “zeroth” row we put
!00
"; in the first row, we put
!10
"and
!11
"; in the
second row,!20
",!21
", and
!22
"; etc. In general, the nth row contains the num-
bers!n0
",!n1
", . . . ,
!nn
". We shift these rows so that their midpoints match;
this way we get a pyramidlike scheme, called Pascal’s Triangle (named af-ter the French mathematician and philosopher Blaise Pascal, 1623–1662).The figure below shows only a finite piece of Pascal’s Triangle.
!00
"!10
" !11
"!20
" !21
" !22
"!30
" !31
" !32
" !33
"!40
" !41
" !42
" !43
" !44
"!50
" !51
" !52
" !53
" !54
" !55
"!60
" !61
" !62
" !63
" !64
" !65
" !66
"
Week 11 page ! of !3 26
Consider the sum of elements in a row of Pascal’s triangle. If we label the top row 0, then it appears that row i sums to the value 2i. Can you explain why this is the case?
!
50 3. Binomial Coefficients and Pascal’s Triangle
We can replace each binomial coefficient by its numerical value to getanother version of Pascal’s Triangle (going a little further down, to theeighth row):
11 1
1 2 11 3 3 1
1 4 6 4 11 5 10 10 5 1
1 6 15 20 15 6 11 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
3.5.1 Prove that Pascal’s Triangle is symmetric with respect to the vertical linethrough its apex.
3.5.2 Prove that each row of Pascal’s Triangle starts and ends with 1.
3.6 Identities in Pascal’s Triangle
Looking at Pascal’s Triangle, it is not hard to notice its most importantproperty: Every number in it (other than the 1’s on the boundary) is thesum of the two numbers immediately above it. This, in fact, is a property ofthe binomial coefficients we already met, namely, equation (1.8) in Section1.8: !
n
k
"=
!n − 1k − 1
"+
!n − 1
k
". (3.2)
This property of Pascal’s Triangle enables us to generate the trianglevery fast, building it up row by row, using (3.2). It also gives us a tool toprove many properties of the binomial coefficients, as we shall see.
As a first application, let us give a new solution to exercise 3.1.2. Therethe task was to prove the identity
!n
0
"−
!n
1
"+
!n
2
"−
!n
3
"+ · · · + (−1)n
!n
n
"= 0, (3.3)
using the Binomial Theorem. Now we give a proof based on (3.2): Wecan replace
#n0
$by
#n−10
$(both are just 1),
#n1
$by
#n−10
$+
#n−11
$,#n2
$by#n−1
1
$+
#n−12
$, etc. Thus we get the sum
!n − 1
0
"−
%!n − 1
0
"+
!n − 1
1
"&+
%!n − 1
1
"+
!n − 1
2
"&
�3
3.5 Pascal’s Triangle 49
ing trick, we can reduce the problem of counting such distributions to theproblem we just solved: We borrow 1 penny from each child, and then dis-tribute the whole amount (i.e., n + k pennies) to the children so that eachchild gets at least one penny. This way every child gets back the money weborrowed from him or her, and the lucky ones get some more. The “more”is exactly n pennies distributed to k children. We already know that thenumber of ways to distribute n+ k pennies to k children so that each childgets at least one penny is
!n+k−1k−1
". So we have the next result:
Theorem 3.4.2 The number of ways to distribute n identical pennies tok children is
!n+k−1k−1
".
3.4.1 In how many ways can you distribute n pennies to k children if each childis supposed to get at least 2?
3.4.2 We distribute n pennies to k boys and ℓ girls in such a way that (to bereally unfair) we require that each of the girls gets at least one penny (but we donot insist on the same thing for the boys). In how many ways can we do this?
3.4.3 A group of k earls are playing cards. Originally, they each have p pennies.At the end of the game, they count how much money they have. They do notborrow from each other, so that each cannot loose more than his p pennies. Howmany possible results are there?
3.5 Pascal’s Triangle
To study various properties of binomial coefficients, the following picture isvery useful. We arrange all binomial coefficients into a triangular scheme:in the “zeroth” row we put
!00
"; in the first row, we put
!10
"and
!11
"; in the
second row,!20
",!21
", and
!22
"; etc. In general, the nth row contains the num-
bers!n0
",!n1
", . . . ,
!nn
". We shift these rows so that their midpoints match;
this way we get a pyramidlike scheme, called Pascal’s Triangle (named af-ter the French mathematician and philosopher Blaise Pascal, 1623–1662).The figure below shows only a finite piece of Pascal’s Triangle.
!00
"!10
" !11
"!20
" !21
" !22
"!30
" !31
" !32
" !33
"!40
" !41
" !42
" !43
" !44
"!50
" !51
" !52
" !53
" !54
" !55
"!60
" !61
" !62
" !63
" !64
" !65
" !66
"
Week 11 page ! of !4 26
Now let’s compute the sum of squares of the entries of each row in Pascal’s triangle.
12 = 1 12 + 12 = 2 12 + 22 + 12 = 6 12 + 32 + 32 +12 = 20 12 + 42 + 62 + 42 + 12 = 70
These sums all appear in the middle row of Pascal’s triangle.
! Which leads us to conjecture that:
50 3. Binomial Coefficients and Pascal’s Triangle
We can replace each binomial coefficient by its numerical value to getanother version of Pascal’s Triangle (going a little further down, to theeighth row):
11 1
1 2 11 3 3 1
1 4 6 4 11 5 10 10 5 1
1 6 15 20 15 6 11 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
3.5.1 Prove that Pascal’s Triangle is symmetric with respect to the vertical linethrough its apex.
3.5.2 Prove that each row of Pascal’s Triangle starts and ends with 1.
3.6 Identities in Pascal’s Triangle
Looking at Pascal’s Triangle, it is not hard to notice its most importantproperty: Every number in it (other than the 1’s on the boundary) is thesum of the two numbers immediately above it. This, in fact, is a property ofthe binomial coefficients we already met, namely, equation (1.8) in Section1.8: !
n
k
"=
!n − 1k − 1
"+
!n − 1
k
". (3.2)
This property of Pascal’s Triangle enables us to generate the trianglevery fast, building it up row by row, using (3.2). It also gives us a tool toprove many properties of the binomial coefficients, as we shall see.
As a first application, let us give a new solution to exercise 3.1.2. Therethe task was to prove the identity
!n
0
"−
!n
1
"+
!n
2
"−
!n
3
"+ · · · + (−1)n
!n
n
"= 0, (3.3)
using the Binomial Theorem. Now we give a proof based on (3.2): Wecan replace
#n0
$by
#n−10
$(both are just 1),
#n1
$by
#n−10
$+
#n−11
$,#n2
$by#n−1
1
$+
#n−12
$, etc. Thus we get the sum
!n − 1
0
"−
%!n − 1
0
"+
!n − 1
1
"&+
%!n − 1
1
"+
!n − 1
2
"&
�4
nX
i=0
✓n
i
◆2
=
✓2n
n
◆
Week 11 page ! of !5 26
Before proving the theorem there are two preliminary lemmas.
Lemma 1:
For all non-negative integers n,k, n > k. Proof: Since we already showed that this
should be obvious. ⧠
�nk
�� nn�k
�=
�nk
�2
�nk
�=
� nn�k
�
�5
Week 11 page ! of !6 26
Lemma 2: For all non-negative integers m,n,k such that n ≥ m ≥ k. Proof: We use a counting argument. The right hand side can be viewed as the number of subsets of size k chosen from the union of two disjoint sets, S of size m, and T of size n. On the left we sum the choices where all k are from S, then k-1 from S and 1 from T and so on up to all k chosen from set T. ⧠
For example: Suppose S = {a,b} with |S| = m = 2, and T = {c,d,e} with |T| = n = 3 and k = 2. So the sum on the right would be:
�6
kX
i=0
✓m
k � i
◆✓n
i
◆=
✓m+ n
k
◆
2X
i=0
✓2
2� i
◆✓3
i
◆=
✓2
2
◆✓3
0
◆+
✓2
1
◆✓3
1
◆+
✓2
0
◆✓3
2
◆
Week 11 page ! of !7 26
Theorem:
for all natural numbers n ≥ 1.
Proof: Using lemma 1 we can write .
Now we observe that the sum is just a special case of lemma 2, where m = n, and k = n, as follows:
⧠
�ni
�2=
�ni
�� nn�i
�
�7
nX
i=0
✓n
i
◆2
=
✓2n
n
◆
nX
i=0
✓n
n� i
◆✓n
i
◆=
✓n+ n
n
◆
Week 11 page ! of !8 26
Logic and Propositional Calculus
Propositional logic was eventually refined using symbolic logic. The 17th/18th century philosopher Gottfried Leibniz (an inventor of calculus) has been credited with being the founder of symbolic logic. Although his work was the first of its kind, it was unknown to the larger logical community. Consequently, many of the advances achieved by Leibniz were re-achieved by logicians like George Boole and Augustus De Morgan in the 19th century completely independent of Leibniz.
�8
Week 11 page ! of !9 26
A proposition is a statement that is either true or false. For example: The earth is flat. A tomato is a fruit. The answer to the ultimate question of life, the universe, and everything is 42.
�9
Week 11 page ! of !10 26
Basic operations
Let p and q be logical variables.
Basic operations are defined as: Conjunction p ∧ q (p and q) (true if both p and q are true, otherwise false)
Disjunction p ∨ q (p or q) (true if either p or q are true, otherwise false)
Negation ¬p (not p) (true if p is false (not true), otherwise false)
�10
Week 11 page ! of !11 26
Truth tables We can enumerate the values of logical expressions using a truth table.
For example:
!
p q ¬q p∧q p∨q
T T F T T
T F T F T
F T F F T
F F T F F
�11
Week 11 page ! of !12 26
Notation We can denote a logical expression constructed from logical variables p,q, and logical operators ∧,∨, and ¬ (and, or, not) using the notation P(p,q).
We call this type of expression a logical proposition.
For example: ¬(p ∨ q) ( not (p or q)) is a logical proposition that depends on the values of p and q. We can use truth tables to determine truth values of a logical proposition.
p q (p ∨ q) ¬(p ∨ q)T T T F
T F T F
F T T F
F F F T
�12
Week 11 page ! of !13 26
Definitions A tautology is a logical expression that is always true for all values of its variables. A contradiction is a logical expression that is always false (never true) for all values of its variables
!
Whether q is true or false, q ⋁ ¬q is always true, and q ⋀ ¬q is always false.
q ¬q q∨¬q q∧¬qT F T F
F T T F
�13
Week 11 page ! of !14 26
Logical Equivalence Two propositions (using the same variables) P(p,q) Q(p,q) are said to be logically equivalent or equivalent or equal if they have identical truth table values. We notate equivalence:
P(p,q) ≣ Q(p,q)
�14
Week 11 page ! of !15 26
There are a set of “laws” of logic that are very similar to the laws of set theory.
The laws of logic can be proved by using truth tables.
�15
Week 11 page ! of !16 26
!
CH
AP.
4]L
OG
ICA
ND
PRO
POSI
TIO
NA
LC
AL
CU
LU
S75
Fig
.4-6
4.7
AL
GE
BR
AO
FP
RO
PO
SIT
ION
S
Prop
ositi
ons
satis
fyva
riou
sla
ws
whi
char
elis
ted
inTa
ble
4-1.
(In
this
tabl
e,T
and
Far
ere
stri
cted
toth
etr
uth
valu
es“T
rue”
and
“Fal
se,”
resp
ectiv
ely.
)We
stat
eth
isre
sult
form
ally
.
The
orem
4.2:
Prop
ositi
ons
satis
fyth
ela
ws
ofTa
ble
4-1.
(Obs
erve
the
sim
ilari
tybe
twee
nth
isTa
ble
4-1
and
Tabl
e1-
1on
sets
.)
Tabl
e4-
1L
aws
ofth
eal
gebr
aof
prop
osit
ions
Idem
pote
ntla
ws:
(1a)
p∨
p≡
p(1
b)p
∧p
≡p
Ass
ocia
tive
law
s:(2
a)(p
∨q)∨
r≡
p∨
(q∨
r)(2
b)(p
∧q)∧
r≡
p∧
(q∧
r)
Com
mut
ativ
ela
ws:
(3a)
p∨
q≡
q∨
p(3
b)p
∧q
≡q
∧p
Dis
trib
utiv
ela
ws:
(4a)
p∨
(q∧
r)≡
(p∨
q)∧
(p∨
r)(4
b)p
∧(q
∨r)
≡(p
∧q)∨
(p∧
r)
Iden
tity
law
s:(5
a)p
∨F
≡p
(5b)
p∧
T≡
p
(6a)
p∨
T≡
T(6
b)p
∧F
≡F
Invo
luti
onla
w:
(7)¬
¬p≡
p
Com
plem
entl
aws:
(8a)
p∨
¬p≡
T(8
b)p
∧¬p
≡T
(9a)
¬T≡
F(9
b)¬F
≡T
DeM
orga
n’s
law
s:(1
0a)¬
(p∨
q)≡
¬p∧
¬q(1
0b)¬
(p∧
q)≡
¬p∨
¬q
4.8
CO
ND
ITIO
NA
LA
ND
BIC
ON
DIT
ION
AL
STA
TE
ME
NT
S
Man
yst
atem
ents
,pa
rtic
ular
lyin
mat
hem
atic
s,ar
eof
the
form
“If
pth
enq.
”Su
chst
atem
ents
are
calle
dco
nditi
onal
stat
emen
tsan
dar
ede
note
dby
p→
q
The
cond
ition
alp
→q
isfr
eque
ntly
read
“pim
plie
sq”
or“p
only
ifq.
”A
noth
erco
mm
onst
atem
ent
isof
the
form
“pif
and
only
ifq.
”Su
chst
atem
ents
are
calle
dbi
cond
ition
alst
atem
ents
and
are
deno
ted
byp
↔q
The
trut
hva
lues
ofp
→q
and
p↔
qar
ede
fined
byth
eta
bles
inFi
g.4-
7(a
)and
(b).
Obs
erve
that
:
(a)
The
cond
ition
alp
→q
isfa
lse
only
whe
nth
efir
stpa
rtp
istr
uean
dth
ese
cond
part
qis
fals
e.A
ccor
ding
ly,
whe
np
isfa
lse,
the
cond
ition
alp
→q
istr
uere
gard
less
ofth
etr
uth
valu
eof
q.
(b)
The
bico
nditi
onal
p↔
qis
true
whe
neve
rpan
dq
have
the
sam
etr
uth
valu
esan
dfa
lse
othe
rwis
e.
The
trut
hta
ble
of¬p
∧q
appe
ars
inFi
g.4-
7(c)
.Not
eth
atth
etr
uth
tabl
eof
¬p∨
qan
dp
→q
are
iden
tical
,th
atis
,the
yar
ebo
thfa
lse
only
inth
ese
cond
case
.Acc
ordi
ngly
,p→
qis
logi
cally
equi
vale
ntto
¬p∨
q;t
hati
s,
p→
q≡
¬p∨
q
�16
Week 11 page ! of !17 26
We prove DeMorgan’s law with truth tables
p q ¬ (p∨q)
T T F
T F F
F T F
F F T
¬ p ¬ q ¬ p ∧ ¬q
F F F
F T F
T F F
T T T
�17
Week 11 page ! of !18 26
We prove the distributive law with truth tables
p q r p∨(q∧r)
T T T T
T T F T
T F T T
T F F T
F T T T
F T F F
F F T F
F F F F
p q r (p∨q) ∧(p∨r)
T T T T
T T F T
T F T T
T F F T
F T T T
F T F F
F F T F
F F F F
�18
Week 11 page ! of !19 26
Conditional Statements
A typical statement in mathematics is of the form “if p then q”.
For example:
In all of these examples variables are assumed to be natural numbers.
if a ≤ b and b ≤ a then a =b
if a-7 < 0, then a < 7
if 2 | a then 2 | (a)(b)
All of these statements are true if a and b are natural numbers.
In logic we use the symbol → to model this type of statement. However, using the symbol → in logic does not necessarily have a causal relationship between p and q.
“if p then q” is denoted p → q, and pronounced either “if p then q” or “p implies q”.
�19
Week 11 page ! of !20 26
A truth table is used to define the outcomes when using the → logical operator.
This definition does not appear to make much sense, however, this is how implication is defined in logic.
if sugar is sweet then lemons are sour. Is a true implication. if sugar is sweet then the earth is flat. Is a false implication. if the earth is flat then sugar is sweet. Is a true implication. if the earth is flat then sugar is bitter. Is a true implication
p q p → qT T T
T F F
F T T
F F T
�20
Week 11 page ! of !21 26
The truth table for implications can be summarized as:
1. An implication is true when the “if” part is false, or the “then” part is true.
2. An implication is false only when the “if” part is true, and the “then” part is false.
Note that p → q is logically equivalent to ¬p ∨ q.
We can verify this with a truth table p q ¬p ∨ qT T
T F
F T
F F
�21
Week 11 page ! of !22 26
Biconditional Implications
A shorthand for the pair of statements
• if a ≤ b and b ≤ a then a =b • if a =b then a ≤ b and b ≤ a is: a = b if and only if a ≤ b and b ≤ a
This can be notated as a = b ↔ (a ≤ b) ∧ (b ≤ a)
An often used abbreviation for “if and only if” is “iff”.
�22
Week 11 page ! of !23 26
A truth table for the biconditional implication is:
The truth table for biconditional implications can be summarized as:
1. A biconditional implication is true when both p and q are true, or both p and q are false.
Note that p ↔ q is logically equivalent to (p →q) ∧ (q → p) as well as (¬p ∨ q) ∧ (¬q ∨ p).
p q p ↔ qT T T
T F F
F T F
F F T
�23
Week 11 page ! of !24 26
Suppose we have the proposition p →q the contrapositive: ¬q → ¬p ? is logically equivalent as verified by the following truth table.
The following example may help in understanding the contrapositive.
if 2 | a then 2 | (a)(b) is logically equivalent to if 2 ∤(a)(b) then 2 ∤ a.
p q ¬p ¬q ¬q → ¬pT T F F T
T F F T F
F T T F T
F F T T T
�24
Week 11 page ! of !25 26
Suppose we have the proposition p → q the converse: q → p ? is not logically equivalent as verified by the following truth table.
The following example may help in understanding why the converse is not logically equivalent to the implication.
if 2 | a then 2 | (a)(b) is not logically equivalent to if 2 ∣ (a)(b) then 2 ∣ a.
p q q → p p → qT T T T
T F T F
F T F T
F F T T
�25
Week 11 page ! of !26 26
It should be obvious that an implication and its converse results in a biconditional implication.
that is: p ↔ q is logically equivalent to (p → q) ∧ (q → p)
�26