You are on page 1of 12

Patterns in Pascals Triangle

By Nicholas Tomlin, Amy Liu, Glenn Zhang, Jerry Lee, Koen Doodeman

Abstract
This paper explores the properties and patterns of Pascals Triangle in various mod-
uli. Specifically, it focuses on a method for finding the number of zeros in a given
row of Pascals Triangle modulo a prime p. Both recursive and implicit formulas
for Pascals Triangle modulo p are proven. The paper also presents a number of
numerical examples, as well as explanations for a number of related patterns.

Definitions
1) N0 := N {0}.
2) Np (m) stands for the number of 0s in the mth row mod p, where p is prime.

Lemma 1

For all a, b N0 we have


     
a a a+1
+ =
b b+1 b+1

PROOF.

   
a a a! a!
+ = +
b b+1 b!(a b)! (b + 1)!(a b 1)!
a!(b + 1) a!(a b)
= +
(b + 1)!(a b)! (b + 1)!(a b)!
a!(a b) + a!(b + 1)
=
(b + 1)!(a b)!
a!(a + 1)
=
(b + 1)!(a b)!

1
(a + 1)!
=
(b + 1)!(a b)!
(a + 1)!
=
(b + 1)!((a + 1) (b + 1))!
 
a+1
=
b+1

Lemma 2
Binomial Theorem; For all a, b Z and n N0 we have
n  
n
X n
(a + b) = ai bni
i=0
i

PROOF.
We are going to prove this with induction.

Basis
If n = 0 we have (a + b)0 = 1 = 0i=0 0 0
 
ai b0i = a0 b0 = 1 so this is true.
P
i 0

Inductive step
We assume that, for k N0 , it works. We now see that
k  
k
X k i ki
(a + b) = ab
i=0
i
k  
k
X k i ki
(a + b)(a + b) = (a + b) ab
i=0
i
k
X k k  
k+1 i ki
X k i ki
(a + b) =a ab +b ab
i=0
i i=0
i
k
X k   k  
k+1 i+1 ki
X k i ki+1
(a + b) = a b + ab
i=0
i i=0
i

2
k+1   k  
k+1
X k i ki+1
X k i ki+1
(a + b) = ab + ab
i=1
i1 i=0
i
k   k  
X k X k i ki+1
(a + b)k+1 =a k+1
+b k+1
+ i ki+1
ab + ab
i=1
i1 i=1
i
k     
X k k i ki+1
(a + b)k+1 =a k+1
+b k+1
+ abi ki+1
+ ab
i=1
i1 i
k     
X k k
(a + b)k+1 =a k+1
+b k+1
+ + abi ki+1

i=1
i 1 i
k   
X k + 1 i ki+1
(a + b)k+1 =a k+1
+b k+1
+ ab
i=1
i
k+1 
X k+1 
(a + b)k+1 = ai bk+1i
i=0
i

Note that in the 8th line, we used Lemma 1. By the principle of mathematical in-
duction, we now proved that the binomial theorem must be true. 

Lemma 3

For all a, p N0 , where p is prime and 0 < a < p, we have


 
p
0 mod p
a

PROOF.
We know that ap = a!(pa)!
p!

. The number of factors p in a! is 0, since a < p. We have
0 < a, so 0 > a, and therefore p > p a. Thus, the number of factors p in (p a)!
is also 0. Because the number of factors p in p! is exactly 1, the numerator has 1
p!
factor p more than the denominator. Because p 0 mod p, we see that a!(pa)! 0
p

mod p and therefore a 0 mod p. 

Lemma 4

3
For all a, b, p N0 , where p is prime, we have

(a + b)p ap + bp mod p

PROOF.
The binomial theorem gives us
p  
p
X p k pk
(a + b) = a b
k=0
k
p

But Lemma 1 tells us that k
0 mod p, for all 0 < k < p, so we see that
p  
p
X p pk k
(a + b) = a b
k=0
k
    p1  
p p p p X p pk k
= a + b + a b
0 p k=1
k
   
p p p p
a + b mod p
0 p

We know that p0 = 0!(p0)!


p!
= p! = 1 and pp = p!(pp)!
p! p!
 
p!
= p!
= 1. Substituting this
p p p
into our equation gives (a + b) a + b mod p. 

Lemma 5

For all a, b, p N0 , where 0 6 b 6 a and p a positive prime, we have


   
ap a
mod p
bp b

PROOF.
The binomial theorem gives us
n  
n
X n k nk
(y + z) = y z
k=0
k

4
If we plug in y = x, z = 1 and n = pa, we get:
pa  
pa
X pa k
(x + 1) = x
k=0
k

Since k = pb, the coefficient of xpb is pa



pb
. But Lemma 2 tells us that (x + 1)pa =
((x + 1)p )a (xp + 1p )a (xp + 1)a mod p, so if we apply the binomial theorem (by
setting y = xp , z = 1 and n = a), we see that
a  
p a
X a
(x + 1) = (xp )k
k=0
k

pb
and if we look
 at the coefficient of x (by looking at the sum when k = b), we see
a a ap

that it is b . Therefore b and bp must be congruent mod p. 

Lemma 6
n

The kth number in the nth row of pascals triangle is equal to k
.

PROOF.
We know that the property ab + b+1 a
= a+1
  
b+1
is true (by Lemma 1), so this makes
every number the sum of the two number above it. Now the only property we
and ends with a 1. So we look at 0 and aa .
a
 
still need is that every row starts
a a!
= a! = 1 and aa = a!(aa)!
a!
= a!
 
0
= 0!(a0)! a! a!
= 1. 

Lemma 7

For all a, b, p, n N0 , where p is prime, we have


 n  
ap a
n
mod p
bp b

ap a
 
PROOF. We know from Lemma 3 that bp
b
mod p. We are going to prove
this with mathematical induction.

5
Basis
ap0 a
 
We see that for n = 0, this statement is true, since bp0
b
mod p.

Inductive step
k
We assume that, for k N0 , we have ap a

bpk
b
mod p Now we plug in a = p and
ppk p
 
b = p and we see: ppk p mod p
 k  
ap a
k
mod p
bp b
k
   
p p p
k
mod p
p p p
 k+1   
p p
mod p
pk+1 p
   
p
mod p (by Lemma 3)
p
 k+1   
p
k+1
mod p
p

So if it is true for k, it is true for k + 1. Because its true for 0, it is true for any
number in N0 , by the principle of induction. 

Lemma 8
For any n N0 , the number of factors p (where p is prime) in n! is exactly
 
X n
k=1
pk

k
PROOF. j The
k amount of numbers divisible by p which are smaller or equal to n is
exactly pnk . So if we count the amount of numbers divisible by p, by p2 , ..., and
we add that, then we have counted all numbers with 2 factors p twice (since they
are also divisible by p), the amount of numbers with three factors p thrice, etc.. If
we look at n!, then we see that it has all the factors p of all numbers less then or
equal to n, and because we counted the amount of numbers with k factors p exactly

6
k times, we have the total amount of factors of n!. 

Lemma 9

For all a, b, c, p, n N0 , where 0 < c < pn1 , p prime, 0 6 b 6 a, we have


apn
 
0 mod p
bpn + c

PROOF.
We know that
apn (apn )!
 
=
bpn + c (bpn + c)!(pn (a b) c)!
P j apn k pn 1
We see that there are exactly k=1 pk = nk=1 apnk = a n1 k
P P
k=0 p = a p1
factors in the numerator. In the first part of the denominator, the constant c added
a factors p, but in the second part, the c takes away just as many factors p. But
because c is not a multiple of pn , it makes the (bpn + c) to miss exactly one factor
pn (the specific factor bpn ), and so does the second part. Therefore the numerator
always has more factors p, and this makes the expression congruent to 0 mod p.

Lemma 10
For all b 6 a < p, where a, b, p N0 and p is prime, we have
 
a
6 0 mod p
b
PROOF.
We know that ab = b!(ab)!
a!

and since a < p, a has no factors p. Since dividing by
integers does not add factors to a number, ab has no factors p and is therefore not


congruent to 0 mod p. 

Pattern
We see from Lemmas 6 and 8 that the apn th row looks like the ath row, but that
there are spaces of length pn , and that those spaces are filled with only 0s. Because
0 + 0 = 0, we know that the spaces of length pn are extended in further rows to a

7
triangle pointing downwards (we call these zero triangles). Because these edges are
0, we see that the triangles that follow from the numbers not equal to 0 in the apn th
row (we call these nonzero triangles) are the same as the triangle from the 0th to
n
the pn1 , multiplied by the number at ap bpn
. Because 0 a = 0, that multiplying does
not change the number of 0s, so we can count these. 

Recursive Formula
If we take a number a, and we want to know how many 0s there are in the ath row
mod p, for some prime p, then, we first look for the biggest possible n with pn 6 a.
Then, we look for the specific number k for which kpn 6 a < (k + 1)pn . We see that
there are exactly k + 1 nonzero triangles (because their top is in the kpn th row and
that row is congruent to the kth row, where the 0s in between are left out, and the
kth row has k + 1 numbers) and so we see that the number of zeros in these non-zero
triangles are exactly k + 1 times the number of zeros in the a kpn th row. Now we
still need to count the number of zeros in the zero-triangles. We see that in the ath
row, there are a + 1 numbers. Now we take away all the numbers that are not part
of a zero-triangle and we see that this is equal to (k + 1)(a kpn + 1). In formula
form, we have:

Np (a) = (k + 1)Np (a kpn ) + (a + 1) (k + 1)(a kpn + 1)


Np (a) = (k + 1)Np (a kpn ) + (a + 1) (k + 1)(a + 1) + k(k + 1)pn
Np (a) = (k + 1)Np (a kpn ) k(a + 1) + k(k + 1)pn

Note that still kpn 6 a < (k + 1)pn . 

Explicit Formula
If we want to compute Np (a) without repeatedly using the recursive formula, we can
write a in base p, so
l
X
a = (al al1 a1 a0 )p = ak pk
k=0

where the al , al1 , , a1 , a0 are the digits of a base p. We know that al pl 6 a <
(al + 1)pl , so we can apply the recursive formula here so we get

Xl Xl1
k
Np (a) = Np ( ak p ) = (al + 1)Np ( ak pk ) al (a + 1) + al (al + 1)pl
k=0 k=0

8
Pn
If we define dn = k=0 ak pk (from which follows that a = dl ), then we see that the
recursive becomes

Np (a) = Np (dl ) = (al + 1)Np (dl1 ) al (dl + 1) + al (al + 1)pl

We know from the definition of dn that an pn 6 dn < (an + 1)pn and so plugging it
into the recursive formula gives us

Np (dn ) = (an + 1)Np (dn1 ) an (dn + 1) + an (an + 1)pn

If we repeatedly substitute this into itself, we get:

Np (dn ) = (an + 1)Np (dn1 ) an (dn + 1) + an (an + 1)pn


Np (dn ) = (an + 1) (an1 + 1)Np (dn2 ) an1 (dn1 + 1) + an1 (an1 + 1)pn1


an (dn + 1) + an (an + 1)pn


2
! 1
!
Y Y
Np (dn ) = (ani+1 + 1) Np (dn2 ) (ani+1 + 1) an1 (dn1 + 1)
i=1 i=1
1
! 0
!
Y Y
+ (ani+1 + 1) an1 (an1 + 1)pn1 (ani + 1) an (dn + 1)
i=1 i=1
0
!
Y
+ (ani + 1) an (an + 1)pn
i=1
2
!
Y
Np (dn ) = (ani+1 + 1) Np (dn2 )
i=1
1
!
Y
an1 (dn1 + 1) + an1 (an1 + 1)pn1

+ (ani+1 + 1)
i=1
0
!
Y
+ (ani+1 + 1) (an (dn + 1) + an (an + 1)pn )
i=1
2
!
Y
Np (dn ) = (ani+1 + 1) Np (dn2 )
i=1
j
1
!
X Y
anj (dnj + 1) + anj (anj + 1)pnj

+ (ani+1 + 1)
j=0 i=1

9
2
!
Y
Np (dn ) = (ani+1 + 1)
i=1
(an2 + 1)Np (dn3 ) an2 (dn2 + 1) + an2 (an2 + 1)pn2


j
1
!
X Y
(ani+1 + 1) anj (dnj + 1) + anj (anj + 1)pnj

+
j=0 i=1
3
!
Y
Np (dn ) = (ani+1 + 1) Np (dn3 )
i=1
2
!
Y
an2 (dn2 + 1) + an2 (an2 + 1)pn2

+ (ani+1 + 1)
i=1
j
1
!
X Y
anj (dnj + 1) + anj (anj + 1)pnj

+ (ani+1 + 1)
j=0 i=1
3
!
Y
Np (dn ) = (ani+1 + 1) Np (dn3 )
i=1
j
2
!
X Y
anj (dnj + 1) + anj (anj + 1)pnj

+ (ani+1 + 1)
j=0 i=1

We can see a pattern occurring, so we can state a conjecture that, for m N, where
m 6 n:
m
!
Y
Np (dn ) = (ani+1 + 1) Np (dnm )
i=1
j
m1
!
X Y
anj (dnj + 1) + anj (anj + 1)pnj

+ (ani+1 + 1)
j=0 i=1

Now if we look at this when m = n, we see that


n
!
Y
Np (dn ) = (ani+1 + 1) Np (d0 )
i=1
j
n1
!
X Y
anj (dnj + 1) + anj (anj + 1)pnj

+ (ani+1 + 1)
j=0 i=1

10
We know that 0 6 a0 < p (by definition), so there are no zeros in the a0 th row
(by Lemma 10). Therefore, since d0 = a0 , we find Np (a0 ) = 0, and we have a
(conjectured) explicit formula:
j
n1
!
X Y
(ani+1 + 1) anj (dnj + 1) + anj (anj + 1)pnj

Np (dn ) =
j=0 i=1

Which we can simplify to:


nj
n
!
X Y
aj (dj + 1) + aj (aj + 1)pj

Np (dn ) = (ani+1 + 1)
j=1 i=1
nj
n
!
X Y
(ani+1 + 1) (aj ) (dj + 1) + (aj + 1)pj

Np (dn ) =
j=1 i=1

Because this formula is just a conjecture, we need to prove it. We will do this by
substituting it into the recursive formula.
(an + 1)Np (dn1 ) an (dn + 1) + an (an + 1)pn
n1j
n1
! !
X Y
(ani + 1) (aj ) (dj + 1) + (aj + 1)pj

= (an + 1)
j=1 i=1

an (dn + 1) + an (an + 1)pn


n1j
n1
! !
X Y
j

= (ani + 1) (aj ) (dj + 1) + (aj + 1)p
j=1 i=0

an (dn + 1) + an (an + 1)pn


nj
n1
! !
X Y
(ani+1 + 1) (aj ) (dj + 1) + (aj + 1)pj

=
j=1 i=1

+ (an )((dn + 1) + (an + 1)pn )


nj
n1
! !
X Y
(ani+1 + 1) (aj ) (dj + 1) + (aj + 1)pj

=
j=1 i=1
nn
!
Y
+ (ani+1 + 1) (an )((dn + 1) + (an + 1)pn )
i=1

11
nj
n
! !
X Y
j

= (ani+1 + 1) (aj ) (dj + 1) + (aj + 1)p
j=1 i=1

= Np (dn )

So our formula must be right. So we have an expression for Np (dn ). Now substitute
the formula for dn and we get
lj j
l
! l
! ! !
X X Y X
Np ak p k = (ani+1 + 1) (aj ) ak pk + 1 + (aj + 1)pj
k=0 j=1 i=1 k=0

And so this is the explicit formula. 

Numerical Examples
We want to compute the number of 0s in the 100th row mod 3. In other words, we
want to calculate N3 (100). The base 3 expansion of 100 is (10201)3 , so (a4 , a3 , a2 , a1 , a0 ) =
(1, 0, 2, 0, 1). Note that here, l = 4. Now we want to know the value of
4j j
4
! 4
! ! !
X X Y X
N3 ak 3k = (ani+1 + 1) (aj ) ak 3k + 1 + (aj + 1)3j
k=0 j=1 i=1 k=0

We will look at all different cases of j (which are j = 1, 2, 3, 4).

j =1: (6)(0)(1 1 + (0 + 1) 31 ) = 0
j =2: (2)(2)(19 1 + (2 + 1) 32 ) = 28
j =3: (2)(0)(19 1 + (0 + 1) 33 ) = 0
j =4: (1)(1)(100 1 + (1 + 1) 34 ) = 61

And so N3 (100) = 0 + 28 + 0 + 61 = 89.

Next, we want to compute N5 (100). We see that (100)10 = (400)5 so (a2 , a1 , a0 ) =


(4, 0, 0). Note that l = 2.

j = 1 : (5)(0)(0 1 + (0 + 1) 51 ) = 0
j = 2 : (1)(4)(100 1 + (4 + 1) 52 ) = 96

12

You might also like