0% found this document useful (0 votes)
58 views

Math 2

1. The document discusses techniques for solving algebraic equations, including substitution, factoring, and exploiting symmetry. 2. An example problem shows substituting y = x^2 to solve a quartic equation in x. 3. Substitution of a = xy and b = x + y is introduced to solve a system of two equations involving x, y, x^2, and xy.

Uploaded by

Bikky Biraji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

Math 2

1. The document discusses techniques for solving algebraic equations, including substitution, factoring, and exploiting symmetry. 2. An example problem shows substituting y = x^2 to solve a quartic equation in x. 3. Substitution of a = xy and b = x + y is introduced to solve a system of two equations involving x, y, x^2, and xy.

Uploaded by

Bikky Biraji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 278

1 Fundamentals

You should read through this handout with a pencil in your hand and a piece of scratch paper
at your side. We cannot emphasize this enough: learning math is not a passive activity.
You can try to follow along with the manipulations we demonstrate here, and you might even
be successful, but you’ll learn and remember far more if you write things out, too.

§1.1 Algebraic Manipulations

Knowing how to solve equations — whether it be systems of equations or polynomial equations


— is a fundamental skill for more difficult math competitions, like the AIME. There’s not that
much theory to it — but you do need a lot of experience, and a good amount of grit. Of course,
we all know how to deal with your standard linear equations, but the examples you’ll encounter
in this section will be more complicated than that.
One technique you’ll often end up using is the idea of substitution. It’s a bit of a vague
idea, so here’s a concrete example.

Example 1.1. Find the roots of the quartic x4 − 13x2 + 36.

Solution. Although normally it’s hard to factor a quartic, this one is special: all of the expo-
nents involved are even. This motivates the following substitution: let y = x2 .
Then our quartic becomes (x2 )2 − 13(x2 ) + 36 = y 2 − 13y + 36. At this point, we can either
use the quadratic formula or observe that it factors as (y − 4)(y − 9) = 0. So y = 4 or y = 9.
But we’re not done yet, unfortunately. We’re looking for the roots of the original quartic, so
we’re trying to figure out what x should be. Given that y = x2 , we get x2 = 9 or x2 = 4, which
gives us the solutions x = ±3 and x = ±2. 

Unfortunately, most substitutions aren’t this simple.

Example 1.2 (1991 AIME). Find x2 + y 2 if x and y are positive integers such that

xy + x + y = 71 and x2 y + xy 2 = 880.

Solution. In this particular case, it’s a lot less obvious what our first step should be. Here
we’ll pull in the idea of factoring: it’s a useful tool that serves to break down and simplify
problems to make key ideas easier to see. In particular, let’s take a closer look at the equation
x2 y + xy 2 = 880.
The left-hand-side — it seems like we could make it a bit easier to deal with. Both terms
being added to each other have an xy-factor — so we note that x2 y + xy 2 = (xy)(x + y).
At this point, our substitution becomes more clear. Above, we have an xy and an x + y; we

1
Everaise Academy (2020) Math Competitions II

have those same terms in the equation xy + x + y = 71. We let a = xy and b = x + y; this yields

a + b = 71
ab = 880.

This seems a lot easier to deal with! We end up with a(71 − a) = 880, or a2 − 71a + 880 = 0.
Factoring this quadratic, we end up with (a−16)(a−55) = 0, so a = 16 or 55 — and respectively,
we get b = 55 or 16.
Remembering how we defined a and b, we either have x + y = 16 and xy = 55 or x + y = 55
and xy = 16 — and the former option clearly makes more sense. As it stands, we end up with
x = 11 and y = 5 (or vice versa), giving us x2 + y 2 = 25 + 121 = 146. 

Exercise 1.3. Express x3 − y 3 and x3 + y 3 in terms of a = xy and b = x + y.

Exercise 1.4 (2013 HMMT). Let x and y be real numbers with x > y such that x2 y 2 + x2 +
y 2 + 2xy = 40 and xy + x + y = 8. Find the value of x.

Exercise 1.5 (2015 AIME II). Let x and y be real numbers satisfying x4 y 5 + y 4 x5 = 810 and
x3 y 6 + y 3 x6 = 945. Evaluate 2x3 + (xy)3 + 2y 3 by following these hints:
1. Can you find some way to factor the given equations?
2. Try the previously-covered a = xy, b = x + y substitution!
3. Don’t rush to find the exact values of each variable too quickly: remember what we’re
looking for.

Something else we can often take advantage of is symmetry.

Example 1.6 (2004 HMMT). Find all real solutions to x4 + (2 − x)4 = 34.

Solution. The given equation is clearly a quartic, so straight expansion seems unlikely to work.
Rather, it would be great if we could get some terms to cancel out.
In particular, note that the average of x and 2 − x is actually 1. This means that x and 2 − x
are equidistant from 1, implying that we can make the substitution x = 1 + t and 2 − x = 1 − t.
Our motivation for this substitution is as follows: consider our new equation,

(1 + t)4 + (1 − t)4 = 34.

When we expand everything all the odd-number powers will cancel! We get

2t4 + 12t2 − 32 = 0.

Time for one more substitution! Set t2 = u, as in the beginning of this section, and divide by
2, giving us the quadratic u2 + 6u − 16 = 0. This yields u = −8 or u = 2; as we’re looking√for
real solutions to the original equation, we can ignore t2 = u = −8, so t2 = u = 2 and t = ± 2.
√ √
Therefore, as x = 1 + t we find that x = 1 + 2 and x = 1 − 2 are solutions, and we are
done. 

Exercise 1.7 (2001 AIME). Find the sum of the roots, real and non-real, of the equation
2001
x2001 + 21 − x = 0, given that there are no multiple roots.

2
Everaise Academy (2020) Math Competitions II

Now we’re going to move onto a slightly different idea.

1 1 1
Example 1.8. Given that x + x = y, express x2 + x2
and x3 + x3
in terms of y.

Solution. Let’s begin by taking a look at x2 + x12 : seeing the squared terms makes us think
about squaring our given x + x1 = y. This gives us

1 2
 
1
x+ = x2 + 2 + 2 = y 2 .
x x
1
Great, it looks like we have an x2 + x2
! All that’s left is to subtract 2 from both sides of the
equation, and we get
1
x2 + = y 2 − 2.
x2
As for x3 + x13 , we note that we have cubed terms, so we might try cubing our given x+ x1 = y.
This gives us
1 3
 
3 1
x+ = x3 + 3x + + 3 = y 3 .
x x x

We have our desired x3 + x13 term, but we’ve still got a 3x + x3 to deal with. Thankfully, this
is just 3(x + x1 ) = 3y, so
 
3 1 3 3
x + 3 = y − 3x + = y 3 − 3y.
x x

and we are done. 

1 1
Exercise 1.9. Derive our expression for x3 + x3
in terms of y = x + x by expanding (x2 +
1
x2
)(x + x1 ).

1 1 1
Exercise 1.10. Given that x + x = 6, find x2 − x2
and x4 + x4
.

Exercise 1.11. Our y = x + x1 substitution gives us a new tool to deal with palindromic
polynomials. Suppose that x4 + 4x3 + 5x2 + 4x + 1 = 0.
1. Note that the coefficients of the polynomial read the same forwards as backwards. This
gives us tons of symmetry — induce some more symmetry by dividing by x2 .
1
2. Try using the y = x + x substitution to solve the quartic!

The examples that we’ve taken on so far have been relatively clean — not in the sense that
there wasn’t a lot of work or that they weren’t involved, but moreso that the substitutions
jumped out immediately. Let’s go over a few more less obvious challenges, involving factoring.

Example 1.12 (2013 HMMT). Determine all real values of A for which there exist distinct
complex numbers x1 , x2 such that the following three equations hold:

x1 (x1 + 1) = A
x2 (x2 + 1) = A
x41 + 3x31 + 5x1 = x42 + 3x32 + 5x2 .

3
Everaise Academy (2020) Math Competitions II

Solution. Let’s begin with the third equation and try to do some factoring; it seems super
symmetric, so this could be useful. We could technically factor an x1 out from the left-hand-
side or an x2 from the right-hand-side, but that doesn’t seem very useful. Rather, we bring over
all the terms to one side, giving us

x41 − x42 + 3x31 − 3x32 + 5x1 − 5x2 = 0.

Aha! Now we can factor an x1 − x2 out of the left-hand-side — and actually, given that x1
and x2 are distinct complex numbers, we know that x1 − x2 6= 0. Therefore we can straight-up
divide by x1 − x2 , yielding

(x21 + x22 )(x1 + x2 ) + 3(x21 + x1 x2 + x22 ) + 5 = 0.

In this case, we applied difference of squares twice to factor x41 −x42 , and we used the difference
of cubes formula to factor 3x31 − 3x32 . Unfortunately, our new equation here doesn’t seem very
conducive to more progress, so it’s time to bring in the first two given equations.
As both x1 (x1 + 1) and x2 (x2 + 1) are equal to A, it’s natural to set them equal. We see that

x21 + x1 = x22 + x2

and as before, we bring over all the terms to one side, yielding

x21 − x22 + x1 − x2 = 0.

Interestingly enough, we can divide by x1 − x2 here, too! That can’t be any coincidence.
That yields
x1 + x2 + 1 = 0.

Now our path becomes clearer. This equation gives us x1 + x2 = −1, and we recognize that
from the equation we found earlier; we now have

0 = −(x21 + x22 ) + 3(x21 + x1 x2 + x22 ) + 5


= 2x21 + 2x22 + 3x1 x2 + 5.

It might look like we’re stuck again — there’s no obvious way to apply our knowledge that
x1 + x2 = −1 from here. But wait — this new equation has an x21 term, an x22 term, and an
x1 x2 term; that should remind us of the expansion of (x1 + x2 )2 ! Since there are 2s, we take a
look at 2 = 2(x1 + x2 )2 = 2x21 + 2x22 + 4x1 x2 ; it follows that

0 = (2 − x1 x2 ) + 5

and thus x1 x2 = 7.
Great! We’ve got x1 + x2 = −1 and x1 x2 = 7 — right now, we could just solve for x1 or x2
and use the result to find A. Here we’re going to emphasize something significant: remember
what you’re looking for — that is, is there an easier way to find A that doesn’t involve finding
x1 or x2 explicitly?
Our two equations that equal A only involve one of x1 or x2 , but we have relations that
involve x1 x2 and x1 + x2 . Therefore we do the natural thing: add the equations. We see that

2A = x21 + x1 + x22 + x2 .

But we know that x21 + x22 = (x1 + x2 )2 − 2x1 x2 , so we have 2A = (−1)2 − 2(7) + (−1) = −14.
Our final answer is A = −7. 

4
Everaise Academy (2020) Math Competitions II

That was a very involved problem — don’t worry if you have to read through the solution
a few times to fully get it! Let’s summarize the key moves and takeaways: one way to make
sure you get the most out of every problem you solve and every solution you read is to think in
terms of large steps, rather than individual manipulations.
Our first move was to tackle the third equation — it looked really symmetric, and we did
some factoring with differences of cubes and fourth powers. Afterwards, we kind of got stuck
and had to bring in the first two equations — again, we pulled the same “move all the terms
to one side” trick and managed to derive a useful identity: x1 + x2 = −1.
Afterwards, we substituted this back into the original equation we found, and recognized that
the terms looked a lot like (x1 + x2 )2 . This, combined with a bit more algebra, got us a value
for x1 x2 .
Finally, we remembered what we were originally looking for, and added our first two equations
to induce a new equation with both x1 s and x2 s. This gave us an answer for A.

Remark. If you’re almost at the end of the problem and you’ve found a way to solve for
some of the variables, make sure to check what you’re originally looking for first! There
may be an easier way to get the final answer without solving explicitly for variables.

Example 1.13 (2010 AIME). Let (a, b, c) be the real solution of the system of equations
x3 − xyz = 2, y 3 − xyz = 6, z 3 − xyz = 20. The greatest possible value of a3 + b3 + c3
can be written in the form m
n , where m and n are relatively prime positive integers. Find
m + n.

Solution. Given that we’re trying to find a value for a3 + b3 + c3 , the most obvious first thing
to consider doing is rewriting the equations as

a3 = 2 + abc
b3 = 6 + abc
c3 = 20 + abc.

So a3 + b3 + c3 = 28 + 3abc, and we’re looking for abc, essentially. Therefore we make the
substitution abc = n, yielding

a3 = 2 + n
b3 = 6 + n
c3 = 20 + n.

Our next step should make a lot of sense: it’s hard to deal with one equation at once, but if
we multiply them all and use abc = n, we get

n3 = (n + 2)(n + 6)(n + 20).

This is actually a quadratic — the n3 terms cancel out. Solving it yields n = − 15 7 , −4 as


3 3 3
solutions. Since we’re looking for the maximum possible value of a + b + c = 28 + 3abc, we
hope to pick the largest value of abc. − 15 15
7 > 4, so we plug in n = abc = − 7 to get an answer
of 151
7 . In the form the question asks for, our answer is 151 + 7 = 158, and we are done. 

5
Everaise Academy (2020) Math Competitions II

Remark. In both this example and the last one, we ran into an issue with equations only
having one variable — in this one, we had things like a3 = 2 + n when we wanted an
abc, and in the last one, we had x1 (x1 + 1) = A when we wanted things in terms of x1 x2
and x1 + x2 . A useful strategy that we employed in both these cases was to either add or
multiply equations together — this gave us all the variables at once, rather than a single
one at a time.

Now, let’s take on the most intimidating problem in this section.

Example 1.14 (2018 NCSSM HMMT TST). Let f be a function from Z to R such that
x = f (n) is the unique real solution to the equation

x7 + x6 + x5 + x4 − 3240
n=
x11 − 1
Compute f (0) · f (1) · f (2) · · · f (3239).

Solution. Okay. That’s a lot to unpack. The best way to truly understand a hard problem is
to play around with it. Let’s try to find some explicit values of f : f (0) seems to be the easiest
one to tackle here. So we let x = f (0), such that

f (0)7 + f (0)6 + f (0)5 + f (0)4 − 3240


0= .
f (0)11 − 1

We require f (0)7 +f (0)6 +f (0)5 +f (0)4 = 3240, and after testing out a few common numbers,
we see that f (0) = 3. Not bad! But if we try the same strategy for f (1), f (2), or any of the
other values, we’re stuck. It’s not immediately obvious how we’re supposed to find these values,
much less 3239 of them.
Whenever a problem asks us to compute that sum or product of a lot of values that are hard
to explicitly compute individually, that’s usually a sign that we should find some way to relate
these values together. The hope is that we can simplify the expression we want to find using
the relations. More often than not, this calls for a technique known as wishful thinking.
The key step in wishful thinking is realizing, “hey, wouldn’t it be really convenient if, say,
f (1) · f (3239) turned into something really simple, like 1?” We’ll take a look at 1 and 3239
specifically because we’re trying to compute the product of a bunch of f (i)’s where the i’s go
up to 3240, and we might be able to pair numbers that sum to 3240 together. It never hurts to
go down this route for a few minutes, so let’s give it a try.
For simplicity, let’s let a = f (1). We get that

a7 + a6 + a5 + a4 − 3240
1= .
a11 − 1

Motivated by the fact that we’d like f (1) and f (3239) to cancel nicely together, and by the
fact that there’s a lot of symmetry in the given exponents, we substitute x = a1 . Let’s call the

6
Everaise Academy (2020) Math Competitions II

resulting value m. This yields

a−7 + a−6 + a−5 + a−4 − 3240


m=
a−11 − 1
a + a + a6 + a7 − 3240a11
4 5
=
1 − a11
a + a + a5 + a4 − 3240a11
7 6
=− .
a11 − 1

If we add this to our first equation, we get that

a7 + a6 + a5 + a4 − 3240 a7 + a6 + a5 + a4 − 3240a11
1+m= −
a11 − 1 a11 − 1
11
3240a − 3240
=
a11 − 1
= 3240.

But that means that m = 3239, so f (3239) = a1 ! Check for yourself that the numbers we
used, 1 and 3239, aren’t special at all — this same argument works for any two positive integers
that sum to 3240. In particular, f (n) · f (3240 − n) = 1 for integer n ∈ [1, 3239].
Our wishful thinking motivated us to conjecture an interesting property of f . Once we used
substitution to prove our conjecture, the entire problem was brought down to its knees. Our
final answer is simply f (0) = 3. 

Remark. We won’t be able to cover every single factorization and substitution possible.
That’s due to the nature of these things: these are techniques you’ll have to figure out on
the spot for yourself. However, what we can offer is a list of common factorizations.
1. x2 + 2xy + y 2 = (x + y)2
2. x2 − 2xy + y 2 = (x − y)2
3. x3 + 3x2 y + 3xy 2 + y 3 = (x + y)3
4. x3 − 3x2 y + 3xy 2 − y 3 = (x − y)3
5. x2 − y 2 = (x + y)(x − y)
6. x3 − y 3 = (x − y)(x2 + xy + y 2 )
7. x3 + y 3 = (x + y)(x2 − xy + y 2 )
8. xn + y n = (x + y)(xn−1 − xn−2 y + xn−3 y 2 − · · · − xy n−1 + y n ) for odd n
9. xn − y n = (x − y)(xn−1 + xn−2 y + xn−3 y 2 + · · · + xy n−1 + y n ) for all n
10. x3 + y 3 + z 3 − 3xyz = (x + y + z)(x2 + y 2 + z 2 − xy − yz − zx)
11. x4 + 4y 4 = (x2 + 2xy + 2y 2 )(x2 − 2xy + 2y 2 )
12. x4 + x2 + 1 = (x2 − x + 1)(x2 + x + 1).
This list is not comprehensive. But it is an almost-complete list of what factorizations
you should expect to encounter on the AIME, HMMT, or similar contests — and you
should feel free to refer to it on the homework for today.

7
Everaise Academy (2020) Math Competitions II

§1.2 Arithmetic and Geometric Sequences and Series

Sequences and series are everywhere on the AMC 10/12 and AIME — this is no exaggeration.
We’ll go over arithmetic and geometric sequences and series in this portion of the handout.
We’ll assume some prior knowledge here: mainly, that you know the definition of arithmetic
and geometric sequences and series, and that you have some basic knowledge of how to approach
the summation of arithmetic series. Here are two quick examples, in case you’re a bit rusty:

Example 1.15. Sum the series 1 + 2 + 3 + · · · + 100.

Solution. The solution most commonly attributed to a young Gauss proceeds as follows: pair
up 1 and 100; 2 and 99; 3 and 98; and similarly pair up the rest of the terms until 50 and 51.
Then each pair of terms sums to 101, and there are 50 pairs in total. (Why?) Thus it follows
that the total sum is 50 · 101 = 5050. 

Remark. Pretty much all arithmetic series can be summed using the same manner — while
there is a formula, it’s quite easy to just derive on the spot, so we wouldn’t recommend
memorizing it. Pair up terms, find how many pairs there are, and multiply!

Example 1.16. Find the sum of the series 1 + 3 + 5 + · · · + (2n − 1) in terms of n.

Solution. Let’s try our pairing-up method again: 1 goes with 2n − 1; 3 goes with 2n − 3; and
so on — all looks the same as before, right?
There’s one small hurdle we might run into: all our pairs have an average of n and sum to
2n — they’re kind of “centered around n”, in a way. But what if n itself is odd? Then n − 2
and n + 2 would make a pair, but n itself wouldn’t have another n to pair with.
So we take cases. First, suppose that n is indeed odd. There are n terms in total in the series
(why?) so there must be n−12 pairs, with one middle element n alone. Each pair sums to 2n, so
n−1
our total is 2 · 2n + n = n2 . Thus the sum comes out to be n2 if n is odd.
What if n is even? Then the two terms nearest n are n − 1 and n + 1, which pair up very
nicely and sum to 2n, just like 1 and 2n − 1, 3 and 2n − 3, and all the other terms. In this
case, there are n terms and therefore n2 pairs of terms, each pair summing to 2n, so we get
n 2 2
2 · 2n = n as the sum of our series. It turns out that the sum is n whether n is even or odd
— how nice! 

Before we move on, we’re going to quickly introduce some helpful notation:
P Pn
Definition 1.17. The symbol denotes a sum. Specifically, i=1 f (i), whereP
f (i) is any
function of i, is just telling us to add f (i) for i from 1 all the way up to n — that is, ni=1 f (i) =
f (1) + f (2) + · · · + f (n).
For the first example we provided in the section, we could have been asked to evaluate
100
X
i = 1 + 2 + · · · + 100.
i=1

8
Everaise Academy (2020) Math Competitions II

As for the second, it would be


n
X
(2i − 1) = [2(1) − 1] + [2(2) − 1] + [2(3) − 1] + · · · + [2(n) − 1]
i=1
= 1 + 3 + 5 + · · · + (2n − 1).

For a tougher example, if we wanted 1 − 4 + 9 − 16 + 25 − 36 + · · · − 10000, we could write


this as
100
X
(−1)i+1 i2 .
i=1

We’ve introduced the −1 power to handle the alternating nature of the sum, and the i2 is used
to generate squares. (Try to figure out why this works on your own — plug in i = 1, 2, and 3,
and convince yourself that these are equivalent representations of the sum!)
We can also write sums to infinity: we know that 1 + 21 + 14 + · · · = 2, where successive terms
are generated by dividing previous terms by 2. But this can equivalently be written as
∞  i  0  1  2
X 1 1 1 1
= + + + · · · = 2.
2 2 2 2
i=0

The variable i is called a dummy variable in that it doesn’t actually matter in the end —
P100 P100
i=1 i = k=1 k = 1 + 2 + 3 + · · · + 100, for example. The most common dummy variables
that we use are i, j, and k for sums.
It turns out that we can write products in much the same way, although we won’t consider
that in this handout: 10
Q
i=1 i = 10!, for example.

Pn
Exercise 1.18. Derive a general formula for the sum of the series j=1 j = 1 + 2 + 3 + · · · + n.
(Yes, you’ve probably seen this before, but give it another try!)

Now we’ll move onto a somewhat harder task: summing geometric series.

P∞ i,
Example 1.19. Derive a formula for the sum of the infinite geometric series i=0 ar with
|r| < 1. (Here, we refer to r as the common ratio for the series.)

P∞ i
Solution. Unpacking the notation, we see that i=0 ar = ar0 + ar1 + ar2 + · · · . Let’s let
S = a + ar + ar2 + ar3 + · · · . We can see that

rS = ar + ar2 + ar3 + ar4 + · · · .

Great! It turns out that S and rS actually look a lot like each other. Indeed, we actually
get S = a + rS — there’s an entire copy of rS embedded in S. Now, with this new equation
S = a + rS, moving all the S terms to one side and dividing yields
a
S=
1−r
and so we’ve derived a formula for S, the sum of the series. 

A few things to note: there’s nothing special, actually, about our a and r here. Indeed, for any
a
starting value a and common ratio r with |r| < 1, it’s true tha the sum a + ar + ar2 + · · · = 1−r .

9
Everaise Academy (2020) Math Competitions II

We haven’t actually mentioned why |r| < 1 is necessary. Suppose that r = 2, and a = 1, for
example. Then our series becomes

S = 1 + 2 + 4 + 8 + ···
1
which we might sum as S = 1−2 = −1. That doesn’t look right — all the terms are positive!

Remark. An infinite geometric series is said to diverge if the common ratio r satisfies
|r| ≥ 1. That means that when you try to sum the series, it doesn’t approach some finite
number. In this case, you cannot use the formula we’ve learned to sum the series.

Let’s put everything together one last time.

Theorem 1.20 (Geometric Series). The infinite sum ∞ i 2


P
i=0 ar = a + ar + ar + · · · is equal
to
a
1−r
where a is the first term of the series, and r is the common ratio of the series.

Remark. This is just a formula for the sum of an infinite geometric series — if you have to
deal with finite geometric series, the formula is a bit uglier. To that end, finite geometric
series can be summed using the same method as infinite geometric series, though: let S be
the sum of the finite series, multiply the entire thing by the common ratio (let’s call it r),
and use the fact that S and rS are super similar. For example,

S = 3 + 9 + 27 + · · · + 729

gives us
3S = 9 + 27 + 81 + · · · + 2187
so therefore, S = 3 + (3S) − 2187. From there you can find S = 1092.

Exercise 1.21. Argue that 0.9 = 0.999 . . . = 1 with Theorem 1.20.

Great! Let’s move onto some harder examples, from competitions.

Example 1.22 (2016 AIME I). For −1 < r < 1, let S(r) denote the sum of the geometric
series
12 + 12r + 12r2 + 12r3 + . . . .
Let a between −1 and 1 satisfy S(a)S(−a) = 2016. Find S(a) + S(−a).

Solution. We’re trying to deal with the condition S(a)S(−a) = 2016, so our first step should
probably be to address S(a) and S(−a). We have, by the infinite geometric series formula,
12
S(a) = 12 + 12a + 12a2 + 12a3 · · · =
1−a
12
S(−a) = 12 − 12a + 12a2 − 12a3 + · · · =
1+a

10
Everaise Academy (2020) Math Competitions II

as 12 is the first term of both series, and the first series has common ratio a and the second has
common ratio −a.
Great. So now we have
12 12 144
· = = 2016.
1−a 1+a (1 − a)(1 + a)

One thing we’ll continuously emphasize is that before rushing forward and solving equations
like the above one, it’s best to first check what we’re looking for — that is, S(a) + S(−a). Using
the previously-derived formulas, we have
12 12
S(a) + S(−a) = +
1−a 1+a
12(1 + a) + 12(1 − a)
=
(1 + a)(1 − a)
24
= .
(1 + a)(1 − a)

144
Nice! It turns out that we already have (1−a)(1+a) = 2016, so all we have to do is divide by
6, giving us
24
= 336
(1 − a)(1 + a)
so our answer is 336. 

A few takeaways: remember firstly that infinite series can be summed really nicely, whether
their common ratios are positive or negative! And as discussed before in Section 1.1, remember
to check what you’re looking for before blindly running ahead and finding the values of variables
— sometimes it’s easier without explicitly finding them, such as in this problem where we didn’t
need to actually solve for a.

Example 1.23 (2012 AIME I). The terms of an arithmetic sequence add to 715. The first
term of the sequence is increased by 1, the second term is increased by 3, the third term is
increased by 5, and in general, the kth term is increased by the kth odd positive integer.
The terms of the new sequence add to 836. Find the sum of the first, last, and middle
terms of the original sequence.

Solution. We’ve got a bunch of words here — the first thing we should do is translate them
into math. Suppose that our arithmetic sequence is a1 , a2 , a3 , · · · , an ; keep in mind that we still
don’t know how many terms there are! Then

a1 + a2 + a3 + · · · + an = 715
(a1 + 1) + (a2 + 3) + (a3 + 5) + · · · + (an + (2n − 1)) = 836

where we’ve noticed that each term of the new sequence is of the form ak + (2k − 1). (Why?)
Note that in our second equation, there’s actually an a1 + a2 + a3 + · · · + an — it’s just hidden!
So we get

836 = (a1 + a2 + a3 + · · · + an ) + (1 + 3 + 5 + · · · + (2n − 1))


= 715 + (1 + 3 + 5 + · · · + (2n − 1).

11
Everaise Academy (2020) Math Competitions II

Recall from an earlier example that the sum 1 + 3 + 5 + · · · + (2n − 1) is just n2 . Therefore
836 = 715 + n2 , and n = 11.
Now we’re looking for the sum of the first, last, and middle terms of the original sequence.
This means that we want to find a1 + a6 + a11 . Note that as a1 , a2 , a3 , · · · , a11 is an arithmetic
sequence, it’s “centered” around a6 — that is, a5 and a7 ’s average is a6 , a4 and a8 ’s average is
a6 , and so on. (Why? Think about the fact that if the common difference is d, the terms before
and after a in a sequence are a − d and a + d.)
So thus we know that a1 + a11 = 2a6 ; a2 + a10 = 2a6 ; and reducing all the terms this way, we
find the equation
11a6 = 715.
3
Meanwhile, we’re just looking for a1 + a6 + a11 = 3a11 . Thus our final answer is 11 · 715 = 195,
and we’re done. 

It turns out that most arithmetic and geometric sequences and series problems on math
competitions end up being a bit formulaic. In the next section, we’ll go over some different
types of sequences and series — ones that aren’t simply arithmetic and geometric.

Exercise 1.24 (2012 AIME II). Two geometric sequences a1 , a2 , a3 , . . . and b1 , b2 , b3 . . . have
the same common ratio, with a1 = 27, b1 = 99, and a15 = b11 . Find a9 .

Exercise 1.25 (2005 AIME II). An infinite geometric series has sum 2005. A new series,
obtained by squaring each term of the original series, has 10 times the sum of the original series.
The common ratio of the original series is m
n where m and n are relatively prime integers. Find
m + n.

§1.3 Other Sequences and Series

While arithmetic and geometric series are the most common types of sums, there are many
other series problems that don’t fit well in either of these two categories. One of these is a mix
of the two, and it is creatively named the “arithmetico-geometric series.”


X i 1 2 3 4
Example 1.26. Compute the infinite sum i
= + + + + ···.
3 3 9 27 81
i=1

Solution. It turns out that using the S and rS trick used to derive Theorem 1.20, with r = 3,
and then applying the same theorem directly on the resulting sum solves the problem (try it
out for yourself!). However, we provide an alternate approach for the sake of variety.
Let’s try to view this problem from a different perspective. Right now, the infinite sum is
expressed in such a way so that we don’t have a formula to arrive at an immediate answer.
What if we break it down into different chunks that are easier to work with? We know, for
example, how to quickly find 31 + 19 + 27
1
+ · · · , which looks suspiciously similar to the problem
we have at hand. If we continue down this train of thought, we get the following:

12
Everaise Academy (2020) Math Competitions II

1 1 1 1
S= + + + + ···
3 9 27 81
1 1 1
+ + + + ···
9 27 81
1 1
+ + + ···
27 81

If we sum the expression above vertically, we obtain the expression that we originally started
with. However, if we sum it horizontally using Theorem 1.20, we get S = 12 + 61 + 18 1
+ ···.
3
Applying the theorem once again gives us a final value of 4 . 

We solved this problem by quite literally changing perspectives. This is a good strategy to
use whenever you’re dealing with something that looks suspiciously familiar, but not quite right
— turn the problem into something that you do know how to work with.

X 2j − 1 1 3 5 7
Exercise 1.27. Sum the series = + + + + ···.
2j 2 4 8 16
j=1

Another common type of infinite series is the telescoping series, which is when a lot of the
terms in the sequence cancel out rather nicely, leaving one clean expression at the end. We
use the word “telescope” to describe such a series, since each next term collapses the series,
similarly to how a long, retractable telescope can collapse to a size no bigger than a pencil. This
description may be rather confusing, so it’s best to illustrate the concept with an example:


X 1 1 1 1 1
Example 1.28. Find = + + + + ···
i · (i + 1) 1·2 2·3 3·4 4·5
i=1

Solution. Note that


1 n+1 n 1 1
= − = −
n(n + 1) n(n + 1) n(n + 1) n n+1
This is great, because our original problem can now be written as the following:
∞          
X 1 1 1 1 1 1 1 1 1 1
− = − + − + − + − ···
i i+1 1 2 2 3 3 4 4 5
i=1

As you can see, each next term collapses on itself, leaving a rather nice looking sum! Taking
this expression as it approaches infinity, it’s easy to see that the sum itself approaches 1. 

Let’s take a look at the motivation behind this problem — we mentioned before that in general,
telescoping sums collapse after each term. To see what this means, let’s let Sn = ni=1 i·(i+1)
1
P
.
1 2 3
Trying out a few values by hand, we see that S1 = 2 , S2 = 3 , and S3 = 4 . From here, it’s
1
reasonable to conclude that Sk = 1 − k+1 , but can we prove why this must be the case?
We’ve calculated already that S1 = 1 − 12 , S2 = 1 − 13 , and S3 = 1 − 41 . These Sn ’s have
another nice property in general, though: they share a lot of common terms. That is, if we have
1
Sn−1 and Sn , all their terms up to the last n·(n+1) will be the same. When we have a situation
like this it’s often nice to subtract Sn−1 from Sn , then — recall our proof of the geometric series
formula, in which we ended up with a bunch of common terms and subtracted.

13
Everaise Academy (2020) Math Competitions II

1
So Sn − Sn−1 = n·(n+1) , from definition. But now let’s look back at our smaller cases:
S2 − S1 = 2 − 3 ; S3 − S2 = 13 − 14 . Miraculously enough, our equation at the beginning
1 1
1 1
of this paragraph yields S2 − S1 = 2·3 , and S3 − S2 = 3·4 . At this point, the pattern that
1 1 1
n(n+1) = n − n+1 should be quite visible — and we can proceed as in the solution.

P
Remark. Sometimes, it’s not easy to determine how exactly a series ai telescopes. If you
ever get stuck, try to relate each ai to a different sequence, bi , such that ai = bi+1 − bi . In
1
this particular example, ai = i·(i+1) and bi = − 1i . With this in mind, the sum of the first
n terms of the sequence of ai ’s will simply evaluate to bn+1 − b1 .

Let’s look at a harder example; here, the telescoping substitution will be trickier to spot.

Example 1.29 (2018 Math Prize for Girls). Consider the sum
n
X 1
Sn = √ .
k=1
2k − 1

Determine bS4901 c. Recall that bxc is the greatest integer less than or equal to x.

Solution. Accurately summing square roots is next to impossible, so let’s see if we can bound
the expression at hand in between two values. This usually requires a telescoping approach, so
we’ll go with that route here. To account for edge cases that will arise later, let’s define
n
X 1
Tn = √
k=2
2k − 1

so that 1 + Tn = Sn . Now, notice that


√ p √ p √
2k − 1 + 2(k − 1) − 1 < 2 2k − 1 < 2(k + 1) − 1 + 2k − 1.

Taking the reciprocals and rationalizing the denominators will leave us with
√ p p √
2k − 1 − 2(k − 1) − 1 1 2(k + 1) − 1 − 2k − 1
> √ > .
2 2 2k − 1 2

So in reality, we have that


n p n 
X √  X √ p 
2(k + 1) − 1 − 2k − 1 < Tn < 2k − 1 − 2(k − 1) − 1 .
k=2 k=2

This sum telescopes — if we set n = 4901, we see that a lot of the summands in both the
lower and upper bounds of the inequalities cancel, leaving us with just
√ √ √ √
9803 − 3 < T4901 < 9801 − 1
√ √
The upper bound is exactly 98, and, using crude estimates of 3 ≈ 1.71 and 9803 ≈ 99, the
lower bound is a little bit more than 97. Thus, bT4901 c = 97, and so bS4901 c = 98. 

The main idea behind solving this problem is bounding this sum between two easier-to-find
integers, as we’re only asked to find the floor of this sum. To do so, we’ll probably want the lower

14
Everaise Academy (2020) Math Competitions II

and upper bounds to be in the form of a telescoping series involving square roots. Referring
back to the remark made after the previous problem, our telescoping series should most likely
√ √
be one whose summands are in the form n + 2 − n, as we’re only summing the reciprocals
of the square roots of every other number in our original expression. It turns out that these key
insights are all that we needed, and the rest of the solution comes quite naturally!

§1.4 Homework Problems

Problem 1.1 (2010 HMMT). [3] Suppose that x and y are positive reals such that

x − y 2 = 3, x2 + y 4 = 13.

a+ b
x can be written in the form c . Find a + b + c.

Problem 1.2 (2008 HMMT). [4] Positive real numbers x, y satisfy the equations x2 + y 2 = 1
and x4 + y 4 = 17 m
18 . xy can be written in the form n . Find m + n.

Problem 1.3. [5] Earlier in this handout, we asked you to find real solutions for x4 + 4x3 +
5x2 + 4x + 1 = 0 by dividing by x2 , and making the substitution y = x + x1 . This time around,
we’re going to ask you to solve it a different way, and also solve a seemingly-unrelated problem:
1. Expand (x + 1)4 . Does it look anything like this?
2. Add something to both sides of the equation to make it look like the expansion you did
above, and solve the equation!
3. (2013 AIME

I) The real root of the equation 8x3 − 3x2 − 3x − 1 = 0 can be written in the

3 3
a+ b+1
form c , where a, b, and c are positive integers. Find a + b + c.

Problem 1.4. [6] Another method we didn’t get too much of a chance to talk about is setting
variables when we don’t even have any involved. You should consider this whenever the numbers
seem like they were arbitrarily chosen!
p
1. (1989 AIME) Compute (31)(30)(29)(28) + 1.
2. (BMO 2007) Find the value of
14 + 20074 + 20084
.
12 + 20072 + 20082

Problem 1.5. [6] Let a, b, c, x, y, z be real numbers such that


x y z
+ + = 52
a b c
a b c
+ + = 147
x y z
xyz
= 9.
abc
x2 y2 z2
Find a2
+ b2
+ c2
.

Problem 1.6 (2006 AIME I). [7] The number


√ √ √
q
104 6 + 468 10 + 144 15 + 2006
√ √ √
can be written as a 2 + b 3 + c 5, where a, b, and c are positive integers. Find a · b · c.

15
Everaise Academy (2020) Math Competitions II

x−y y−z z−x


Problem 1.7 (2012 PUMaC). [8] If x, y, and z are real numbers with z + x + y = 36,
find 2012 + x−y y−z z−x
z · x · y .

Problem 1.8 (2016 AIME II). [4] Initially Alex, Betty, and Charlie had a total of 444 peanuts.
Charlie had the most peanuts, and Alex had the least. The three numbers of peanuts that
each person had form a geometric progression. Alex eats 5 of his peanuts, Betty eats 9 of her
peanuts, and Charlie eats 25 of his peanuts. Now the three numbers of peanuts that each person
has form an arithmetic progression. Find the number of peanuts Alex had initially.

Problem 1.9 (2005 AIME I). [5] For each positive integer k, let Sk denote the increasing
arithmetic sequence of integers whose first term is 1 and whose common difference is k. For
example, S3 is the sequence 1, 4, 7, 10, .... For how many values of k does Sk contain the term
2005?

Problem 1.10 (1989 AIME). [6] If the integer k is added to each of the numbers 36, 300, and
596, one obtains the squares of three consecutive terms of an arithmetic series. Find k.

Problem 1.11 (2016 AIME I). [8] A strictly increasing sequence of positive integers a1 , a2 , a3 , . . .
has the property that for every positive integer k, the subsequence a2k−1 , a2k , a2k+1 is geometric
and the subsequence a2k , a2k+1 , a2k+2 is arithmetic. Suppose that a13 = 2016. Find a1 .

Problem 1.12. (Classical) [6] Evaluate the sum


1 1 1
√ √ +√ √ + ··· + √ √ .
1+ 2 2+ 3 99 + 100

Problem 1.13. (Folklore) [8] Let Fi be the ith term of the Fibonacci sequence, defined by
F0 = 1, F1 = 1, and Fn = Fn−1 + Fn−2 for n > 1. Show that the sum
1 1 1
+ + + ···
F0 F2 F1 F3 F2 F4
never exceeds 1.

16
2 Complex Numbers

§2.1 Introduction

We’ll expect familiarity with trigonometric functions extended to all real numbers, and the
rectangular and polar forms of complex numbers. You should have read up on this with the
material we sent you before the start of the program.

Remark. We will also provide a little cheat-sheet on this page, in case you forget some of
the properties that we use in the following sections.
If z = a + bi and w = c + di are complex numbers, then
1. z = a − bi denotes the conjugate of z.

2. |z| = a2 + b2 denotes the magnitude of z.
3. Everything we’d like to be true about conjugates is true. That is, z + w = z + w;
z · w = zw; (z) = z.
4. Everything we’d like to be true about magnitudes is true. That is, |z| · |w| = |zw|;
|z|n = |z n |; | z1 | = |z|
1
.
5. Conjugates and magnitudes work well together. That is, zz = |z|2 . We use this fact
often when we “real”-lize complex denominators.
6. |z| is the distance between 0 and z in the complex plane. That is, the equation |z| = 3
when graphed is just the circle centered around 0 with radius 3 in the complex plane.
7. |w − z| is the distance between w and z in the complex plane. That is, the equation
|w − (1 + 2i)| = 7 when graphed is just the circle centered around 1 + 2i with radius
7 in the complex plane.
8. The Triangle Inequality for Complex Numbers states that for any complex
numbers z and w, |z − w| ≤ |z| + |w|.
9. Complex numbers add according to the parallelogram law: in particular, if complex
numbers w and z correspond to points W and Z in the complex plane, and O is the
origin, then w + z corresponds to a point X such that OW XZ is a parallelogram.

Disclaimer: The examples are meant to be challenging. Some are quite intuitive, and others
require a lot of thought and experimentation. Don’t be discouraged if you can’t come up with
the solution on your own. If you can’t solve an example problem, don’t hesitate to read the
solution, as it might require a trick, or theory that you’re unfamiliar with. Most of all, have
fun solving! We hope you enjoy these problems and learn a lot from them!

§2.2 Problem-Solving with a + bi

It turns out that knowing that complex numbers z can be expressed as a + bi for reals a and b
is enough to tackle a lot of problems.

1
Everaise Academy (2020) Math Competitions II

Example 2.1 (“Square Roots”). Find all complex numbers z such that z 2 = 7 + 24i.

Solution. As in a previous example, we’ll let z = a + bi for some real numbers a and b. Then

z 2 = (a2 − b2 ) + 2abi
= 7 + 24i.

The key step is as follows: two complex numbers are equal if and only if their real and
imaginary parts are equal. Therefore, a2 − b2 = 7, and 2ab = 24. If the reader wishes to solve
this system, they should do so; we’ll claim that one solution falls out immediately though, that
being a = 4 and b = 3.
But wait — the problem reads “find all.” Indeed, there’s one more solution: a = −4, and
b = −3. Whenever you’re working with complex numbers, be careful to check if there are other
solutions! Our answers are 4 + 3i and −4 − 3i. 

Example 2.2 (2009 AIME I). There is a complex number z with imaginary part 164 and a
positive integer n such that
z
= 4i.
z+n
Find n.

Solution. We will apply a strategy similar to the one we used for our first example: set
z = a + bi. In particular, we actually know that in this case, z = a + 164i. Therefore our given
equation is
a + 164i
= 4i.
a + n + 164i
We could clear the denominator by multiplying by the conjugate, but we’ll show a different
tactic here: let’s just multiply through by a + n + 164i. Our equation then becomes

a + 164i = 4i(a + n + 164i)


= −656 + 4(a + n)i.

Now we have a + 164i = −656 + 4(a + n)i. We equate the real parts and imaginary parts to
find that a = −656 and 164 = 4(a + n) instantly.
It’s easy to solve for n from here: we get n = 697 as our answer. 

Remark. There are plenty of complex number problems in contests like the AIME, HMMT,
and PUMaC that can be solved just by letting your complex number be a + bi and doing
a bit of algebra.

§2.3 Thinking Geometrically

The key thing to keep in mind here are that if we’re given two complex numbers z and w, then
|z − w| is the distance between them.

2
Everaise Academy (2020) Math Competitions II

Example 2.3. Describe all points z satisfying |z − (1 + 2i)| = 5.

Solution. The given equation implies that the distance between z and 1 + 2i on the complex
plane is 5. Therefore, it’s just a circle centered at 1 + 2i with radius 5. 


Example 2.4 (2004 AMC 12B). A function f is defined by f (z) = iz̄, where i = −1 and
z̄ is the complex conjugate of z. How many values of z satisfy both |z| = 5 and f (z) = z?

Solution. First, let’s try to figure out what f (z) should do to a point — and we’ll do that by
taking it in steps.
We’ll deal with multiplication by i. Suppose that w = a + bi is a complex number. Then
iw = −b + ai. Refer to the diagram below:

In fact, you can see from this that multiplication by i is equivalent to a 90◦ counterclockwise
rotation. (We’ll see another reason why this is true later.) Moreover, it’s clear that conjugation
reflects a point over the real axis.
Therefore, if some z is to satisfy the given condition, z must lie on the circle with radius 5
centered at the origin, and reflecting z over the real axis and then rotating that reflected point
by 90◦ counterclockwise must give us z again.
First, let’s suppose that z is some point on the upper half of the circle centered at 0 with
radius 5. Then the angle between z and the positive real axis must be 45◦ , as shown below; we
need this to ensure that a 90◦ rotation sends z back to z.

3
Everaise Academy (2020) Math Competitions II

Now, if z is some point on the lower half of the circle, the angle between z and the negative
real axis must be 45◦ . Again, refer to the diagram below.

Make sure to draw your own circle with radius 5 centered at 0, and try drawing a few values
of z lying on that circle, their reflections over the real axis, and then the results upon rotation
by 90◦ . This will help confirm for you that these two are the only possibilities! Our answer is
2. 

Exercise 2.5. This section is called “Thinking Geometrically,” but you should try solving the
above example algebraically!

Example 2.6 (Adapted from 1992 AIME). Consider the region in the complex plane that
z 40
consists of all points z such that both 40 and (z) have real and imaginary parts between 0
and 1, inclusive.
1. Let z = a + bi, and find inequalities in terms of a and b that account for real and
imaginary parts being between 0 and 1.

4
Everaise Academy (2020) Math Competitions II

2. Interpret these inequalities geometrically, by graphing their boundaries on the coor-


dinate plane.
3. Provide a geometric description of the region in which z = a + bi can lie in.
4. Find the area of the region described in part 3.

z a+bi a b a
Solution. Let’s begin with part 1. We have 40 = 40 = 40 + 40 i. It follows that 0 ≤ 40 ≤1
b
and 0 ≤ 40 ≤ 1. Furthermore,

40 40 40a + 40bi
= = .
z a − bi a2 + b2
40a 40b
Therefore 0 ≤ a2 +b2
≤ 1 and 0 ≤ a2 +b2
≤ 1. So we have the following four inequalities:
• 0 ≤ a ≤ 40,
• 0 ≤ b ≤ 40,
• 0 ≤ 40a ≤ a2 + b2 , and
• 0 ≤ 40b ≤ a2 + b2 .
Let’s move onto part 2. Starting with the easier inequalities, we know that 0 ≤ a ≤ 40 and
0 ≤ b ≤ 40, so every working point z must lie within the following square below:

The problem isn’t that easy, though, unfortunately. We also have to deal with the inequalities
40a ≤ a2 + b2 and 40b ≤ a2 + b2 . (It’s clear that a and b are positive, so we may omit the left
inequalities.)
We might run into a problem here: how do we interpret these inequalities? Often the best
thing to do when you’re
√ stuck is to try some
√ values. Plugging in a = 10, 20, and 30 yields the
inequalities b ≥ 10√ 3, b ≥ 20, and b ≥ 10 3,√ respectively. Since we’re looking at the boundary,
let’s plot 10 + 10 3i, 20 + 20i, and 30 + 10 3 on the plane. (Remember that z = a + bi —
that’s how we got these points!)

5
Everaise Academy (2020) Math Competitions II

That looks like a semicircle centered at 20 with radius 20 that’s being traced out! Of course
— a2 + b2 = 40a reduces to (a − 20)2 + b2 = 400, which is the graph of a circle centered at 20
with radius 20. Similarly, the other inequality 40b ≤ a2 + b2 yields a semicircle centered at 20i
with radius 20 when we consider its boundary.

Now we can proceed to part 3. We’re looking for points outside the semicircles — an easy
way to check this is to try plugging in some points. (For example, 30 + 10i does not satisfy the
inequalities because 40(30) ≤ 302 + 102 is not true.) So our region consists of the points inside
the 40 × 40 square, but outside the two semicircles.
We’ll leave the calculation of part 4 to the reader: some geometry yields 1200 − 200π. We
are done. 

That was a tough problem that involved a combination of algebraic and geometric techniques!
The important takeaway: when you’re not sure how to relate some sort of algebraic inequality to
the complex plane, always try testing a few points — that can often reveal something interesting.
Let’s go over two more tough AIME problems.

6
Everaise Academy (2020) Math Competitions II

Example 2.7 (1999 AIME). A function f is defined on the complex numbers by f (z) =
(a + bi)z, where a and b are positive numbers. This function has the property that the
image of each point in the complex plane is equidistant from that point and the origin.
Given that |a + bi| = 8 and that b2 = m/n, where m and n are relatively prime positive
integers, find m + n.

Solution. Well, this is certainly a mouthful. Let’s take it step by step: “the image of each
point in the complex plane is equidistant from that point and the origin.” Well, that means
that if we feed z into the function, its image, (a + bi)z, is equidistant from z and 0.
Therefore, we know that |(a + bi)z − z| = |(a + bi)z| for all complex numbers z — because
for any two complex numbers w and z, |w − z| outputs the distance between w and z on the
complex plane. So the left-hand-side of this equation is the distance between the image and z,
and the right-hand-side is the distance between the image and 0.
Let’s now recall that |wz| = |w| · |z| for any complex numbers w and z. Using this property
yields
|z| · |(a − 1) + bi| = |z| · |a + bi|
or equivalently, |(a − 1) + bi| = |a + bi|.
Finally, this equation now yields

(a − 1)2 + b2 = a2 + b2

which reduces to a = 12 . As |a + bi| = 8, it follows that a2 + b2 = 64, or equivalently that


b2 = 255
4 . Therefore our answer is 259, as desired. 

That was a tough problem, but let’s break it down a bit. We approached it by recalling that
|w − z| is the distance between complex numbers w and z, and using that to turn the given
words into an equation. From there, we recalled that |w| · |z| = |wz|, which we used to make
our equation easier to deal with — it got rid of the |z|’s entirely, in fact. Finally, we did some
magnitude computations, and finished things off. It might seem hard to pull off all those steps
in a contest, but the key here for us was to just remember our properties, and use them to
simplify the problem step by step.
Here’s one last problem, with a different geometric flavor to it.

Example 2.8 (2012 AIME II). Let z = a + bi be the complex number with |z| = 5 and b > 0
such that the distance between (1 + 2i)z 3 and z 5 is maximized, and let z 4 = c + di. Find
c + d.

Solution. Let’s begin the same way as last time: the distance between (1 + 2i)z 3 and z 5 is

|(1 + 2i)z 3 − z 5 | = |z 3 (1 + 2i − z 2 )|
= |z 3 ||(1 + 2i − z 2 )|
= |z|3 |1 + 2i − z 2 |
= 125|1 + 2i − z 2 |.

So we just need to maximize |1 + 2i − z 2 |. We know from the Triangle Inequality that

|1 + 2i − z 2 | ≤ |1 + 2i| + |z 2 |

7
Everaise Academy (2020) Math Competitions II

so let’s check and see if we can make equality hold; that would mean that |1+2i−z 2 | = 5+25.
As z = a + bi, we see that

|1 + 2i − (a + bi)2 | = |1 + 2i − (a2 − b2 + 2abi)|


= |(1 − a2 + b2 ) + (2 + 2ab)i|.

It actually seems a bit difficult to find a and b from here — after all, we’d have to square
(1 − a2 − b2 ), which would give us a quartic.
So let’s take a different route: let’s say that z 2 = e + f i. This is perfectly legal, after all. In
this case, we have

25 + 5 = |1 + 2i − (e + f i)|
= |(1 − e) + (2 − f )i|
p
= (1 − e)2 + (2 − f )2 .

Therefore expansion yields 630 + 50 5 = (1 − e)2 + (2 − f )2 . We have two variables and one
equation. Are we dead in the water?
Not so fast! Often when we’re in times like this, we can make progress by returning to how
we defined things. As z 2 = e + f i, it follows that |z 2 | = |e + f i| — so, as |z| = 5, |e + f i| = 25,
or equivalently, e2 + f 2 = 625. There’s our other equation.
We’ll leave the reader to do most of the computation in between, but after a fair bit of
simplification we arrive with

e + 2f = −25 5
e2 + f 2 = 625.

2

From √ √ quadratic f √− 20f 5 + 500 = 0 by substituting
these equations we can obtain the
e = −25 5 − 2f , and from here f√= ±10 5 and√e = ±5 5 then. Checking signs with the first
equation, it’s clear that f = −10 5 and e = −5 5 is the only working combination.
√ √
Therefore z 2 = −5 5 − 10 5i, so z 4 = −375 + 500i, and our answer is 125. 

Here’s an alternative, less computationally heavy approach: we want to maximize the distance
between 1 + 2i and z 2 , as we’re trying to maximize |1 + 2i − z 2 |. Given that |z| = 5, once again,
we know that |z 2 | = 25. Therefore the complex number z 2 lies on the circle centered at 0 with
radius 25. Let’s plot that circle and the point 1 + 2i:

8
Everaise Academy (2020) Math Competitions II

It’s clear that if we want to maximize the distance between a point on this circle and 1 + 2i,
we should choose the intersection of the ray with endpoint at 1 + 2i passing through the origin,
as demonstrated below:

We know that the slope of this ray is 2! Therefore if z 2 = e + f i, we must have 2e = f ; once
again, we know that e2 + f 2 = 625. This system turns out to be much easier to solve, and we
can once again find z 4 and finish the problem.
That was certainly a tough problem, with two very different approaches. A couple things
to remember: when we first tried our algebraic approach, z = a + bi didn’t lead us anywhere
because we’d have to solve a quartic. Since we only needed z 4 , we decided we could just deal
with z 2 , which allowed us to deal with second-degree equations.
For our geometric approach, we began by drawing out our complex numbers — which is a
technique that’s always helpful. From there, we figured out that we could maximize the distance
with a bit of geometry, and completed the problem.

Remark. Whenever you’re dealing with distances, the Triangle Inequality will often present
a nice approach, but you can also sometimes try interpreting the conditions of the problem
geometrically — it might lead to quicker, cleaner solutions.

Unfortunately, there are still a lot of problems out there that don’t fall to these methods
— and to address that we’ll introduce a new way of looking at complex numbers in the next
section.

§2.4 Complex Numbers, Reimagined

Definition 2.9. The argument of a complex number z, denoted arg(z), is defined as the
angle a complex number z makes with the real axis, where angles are taken mod 2π and
counterclockwise from the positive real axis.

You should already be familiar with the polar form of a complex number z = a + bi: it is
z = r(cos θ + i sin θ), where θ = arg(z). Generally we’ll abbreviate cos θ + i sin θ as cis θ, for any
angle θ.
Let’s go over a fundamental theorem of complex-number multiplication, which will motivate
another different representation of complex numbers.

9
Everaise Academy (2020) Math Competitions II

Theorem 2.10 (De Moivre’s Theorem). For any two complex numbers z1 = r1 cis θ1 and
z2 = r2 cis θ2 , z1 z2 = r1 r2 cis(θ1 + θ2 ).

Proof. We have

z1 z2 = r1 r2 cis θ1 cis θ2
= (r1 r2 )(cos θ1 + i sin θ1 )(cos θ2 + i sin θ2 )
= (r1 r2 )(cos θ1 cos θ2 − sin θ1 sin θ2 + i(cos θ2 sin θ1 + cos θ1 sin θ2 ))
= (r1 r2 )(cos(θ1 + θ2 ) + i sin(θ1 + θ2 ))
= (r1 r2 ) cis(θ1 + θ2 )

as desired. The second-to-last step follows by the cosine and sine angle addition formulas. 

In short, what De Moivre’s Theorem tells us that when we multiply two complex numbers,
we multiply
√ their magnitudes and √
add their angles. Here’s an example for some clarity: consider
z1 = 1 + i 3 = 2 cis 3 and z2 = 3 3 + 3i = 6 cis π6 .
π

Multiplying z1 z2 using their rectangular forms gives us


√ √
z1 z2 = (1 + i 3)(3 3 + 3i)
√ √
= 3 3 − 3 3 + 9i + 3i
= 12i

by standard complex-number multiplication.


We could have reached this result even faster with Theorem 2.10, though. Note that z1 =
2 cis π3 and z2 = 6 cis π6 , so by De Moivre’s Theorem, z1 z2 = (2)(6) cis( π3 + π6 ), which comes out
as 12 cis π2 . But cis π2 = cos π2 + i sin π2 , and cos π2 = 0 and sin π2 = 1, so we indeed get 12i, just
as before.
While we won’t be able to prove the next result, it should make sense, given what we’ve
already proven regarding De Moivre’s Theorem.

Theorem 2.11 (Euler’s Theorem). If e = 2.718 . . . is Euler’s constant, then eiθ = cis θ.
Furthermore, z = r · eiθ , where r = |z| and θ = arg(z), for every complex number z.

The proof goes far beyond the scope of this handout; however, this result is particularly
important because it gives complex numbers the properties of exponents. For example, De
Moivre’s Theorem follows immediately from this identity.

Corollary 2.12 (De Moivre’s Theorem). For any two complex numbers z1 = r1 cis θ1 and
z2 = r2 cis θ2 , z1 z2 = r1 r2 cis(θ1 + θ2 ). Additionally, z1n = r1n cis(nθ).

Proof. We have r1 cis θ1 = r1 eiθ1 and r2 cis θ2 = r2 eiθ2 , so z1 z2 = r1 r2 ei(θ1 +θ2 ) = r1 r2 cis(θ1 + θ2 )
as desired. 

Exercise 2.13 (Important). Convince yourself that multiplying a complex number z by eiθ is
equivalent to rotating z about the origin in the complex plane by the angle θ, counterclockwise.

10
Everaise Academy (2020) Math Competitions II

It’s vitally important to understand that reiθ and r cis θ are just equivalent ways of expressing
π
the same complex number. For example, 3ei· 3 = 3 cis π3 , and both these complex numbers are

equal to 23 + 3 2 3 i. Moreover, the famous Euler’s identity follows directly from this result: we
have eiπ + 1 = 0 because eiπ = cis(π) = −1.
Returning to our previous example, we had z1 = 2 cis π3 and z2 = 6 cis π6 — or equivalently,
π π π π π
z1 = 2ei 3 and z2 = 6ei 6 . Their product is z1 z2 = 12ei( 3 + 6 ) = 12ei· 2 = 12i, just as before —
and rather than citing De Moivre’s Theorem, all we did was manipulate exponential rules.

Example 2.14 (Art of Problem Solving Forums). Find (i + 1)3200 − (i − 1)3200 .

Solution. We’ve
√ got big exponents, so let’s use exponential form. Observe that z = i + 1 has
π
√ i· π arg z = 4 by the properties of 45 − 45 − 90 triangles upon
magnitude 2, and furthermore,
graphing z. Thus i + 1 = 2e 4 .
√ 3π
In a similar manner, we may find i − 1 = 2ei· 4 . Thus
√ π √ π
(i + 1)3200 − (i − 1)3200 = ( 2ei· 4 )3200 − ( 2ei· 4 )3200
√ π 3π
= ( 2)3200 (e3200i· 4 − e3200i· 4 )
= 21600 (e800iπ − e2400iπ ).

Miraculously, we know that e800iπ = 0, as cis(800π) = cos(800π) + i sin(800π) = 0. In a


similar manner, e2400iπ = 0, so the whole thing collapses to 0, and we are done. 

Example 2.15. Find all real and complex solutions to the equation x5 − 1 = 0.

Solution. We essentially want to solve x5 = 1, so let’s let x = reiθ . As |x5 | = r5 = 1, we can


assume r = 1, as r is a real number. Then x = eiθ , so x5 = e5iθ = 1.
Let’s ask a slightly different question for a moment: for what values of α does eiα = 1 hold?
Keep in mind that α corresponds to the angle that the segment between 0 and eiα makes with
the positive real axis, so we need α to be a multiple of 2π; that is, α = 2kπ for any integer k.
Another way to see this is to note that eiα = cos α + i sin α, and to satisfy cos α = 1 we must
have α be a multiple of 2π (from which sin α = 0 will also follow.)
Therefore 5iθ = 2kπ for some integer k, and θ = 2kπ 5 . Testing out integers, we see that
2π 4π 6π 8π
k = 0, 1, 2, 3, 4 gives us θ = 0, 5 , 5 , 5 , and 5 as solutions; all other solutions reduce to one
of these (for example, k = 7 yields 14π 4π
5 = 5 .)
2iπ 4iπ 6iπ 8iπ
Thus our solutions to this equation are 1, e 5 ,e 5 ,e 5 , and e 5 . 

Remark. It’s very important to remember that two angles θ1 and θ2 are equal in this context
if θ1 + 2kπ = θ2 for some integer k.

It turns out that in general, the solutions to xn = 1 are very, very important and applicable
to plenty of math, and we’ll go over that more in-depth in the next section.

11
Everaise Academy (2020) Math Competitions II

Example 2.16 (2019 AMC 12B). How many nonzero complex numbers z have the property
that 0, z, and z 3 , when represented by points in the complex plane, are the three distinct
vertices of an equilateral triangle?

Solution. Equilateral triangles have a number of nice properties — in particular, we’ll start
by using the property that all its lengths are equal.
We know that |z − 0| = |z 3 − z| = |z 3 − 0|. Therefore |z| = |z 3 | = |z|3 ; suppose that z = reiθ .
Then |z| = r and |z|3 = r3 , so r = r3 implies r = 1.
Now let’s find θ. Dealing with |z 3 − z| is a bit more difficult, so instead of lengths, let’s use
angles. Note that as r = 1, both z and z 3 lie on the unit circle; moreover, note that multiplying
z by z 2 is equivalent to rotating z by 2θ about the origin. (This is because multiplying a complex
number by z 2 is the same as multiplying it by e2iθ , so in essence we are adding 2θ to the angle.)
Therefore 0, z, and the complex number z 3 that results in rotating z by 2θ degrees must form
an equilateral triangle. Now, this new complex number z 3 can either be π3 counterclockwise of
z, or 5π
3 counterclockwise of z — both cases lead to an equilateral triangle. Therefore 2θ = 3
π

or 2θ = 5π
3 .
You might think that this just gives us θ = π6 and θ = 5π
6 as solutions — and you’d be close.
The problem is that when we’re solving angle equations, we have to take additional multiples of
2π into account. Indeed, we could have 2θ = 2π + π3 — that is, the case where the resulting z 3
complex number is π3 off z 3 after a full rotation.
Taking this into account, we get another solution θ = 7π 5π
6 . Similarly, 2θ = 2π + 3 gives
θ = 6 . We leave it for the reader to check that taking 2θ = 2kπ + 3 and 2θ = 2kπ + 5π
11π π
3 can
only ever generate the four aforementioned solutions, and we are done; our answer is 4.
Therefore, the complex numbers we’ve found all have magnitude 1 and correspond to the
angles θ = π6 , 5π 7π 11π
6 , 6 , and 6 . Thus there are four numbers total, and we are done. 

Exercise 2.17. Confirm for yourself geometrically that if z = eiπ/6 , e5iπ/6 , e7iπ/6 , or e11iπ/6 ,
then 0, z, and z 3 form an equilateral triangle.

Let’s try a tougher AIME problem that also involves a bit of geometry. At this point, you
should expect to be doing geometry along with any sort of algebraic manipulations with complex
numbers.

Example 2.18 (2014 AIME I). Let w and z be complex numbers such that |w| = 1 and
|z| = 10. Let θ = arg w−zz . The maximum possible value of tan2 θ can be written as pq ,
where p and q are relatively prime positive integers. Find p + q. (Note that arg(w), for
w 6= 0, denotes the measure of the angle that the ray from 0 to w makes with the positive
real axis in the complex plane.)

Solution. Since we’re literally given the magnitudes of w and z, we naturally begin with
eiβ
exponential form: let z = 10eiα and w = eiβ . Then w−z w
z = z − 1 = 10eiα − 1, and simplifying
the fraction we get
1 i(β−α)
e − 1.
10
Let’s think about what this complex number actually means, geometrically. We know that
1 i(β−α) 1
10 e is a complex number with magnitude 10 , and its argument is the angle β − α. On the

12
Everaise Academy (2020) Math Competitions II

other hand, what do we do about the −1?


It turns out that the −1 actually represents a horizontal translation by 1 unit to the left. So
1
let’s draw a diagram: the green circle below is the circle centered at the origin with radius 10
1 i(β−α)
— on which the complex number 10 e must lie — and the blue circle below is the circle
1
centered at −1 with radius 10 — on which the complex number w−z 1 i(β−α)
z = 10 e − 1 must lie.
w−z
Note that this complex number z can be any point on the boundary of the blue circle. (Keep
in mind, also, that we are referring to the boundaries of these circles, and not their interiors!)

Recall that tan θ for any angle θ is essentially a measure of slope. Since we need to maximize
tan2 θ where θ = arg( w−z z ), we’ll want to draw a tangent line from 0 to the blue circle; try
to convince yourself that this is the highest |(tan θ)| can get. (Remember that β − α can be
literally any angle we want it to be!)


Then by the Pythagorean Theorem on triangle OAP , we see that OA = 3 1011 , so tan(180◦ −
θ) = 3√111 . This means that |(tan θ)| = 3√111 , and tan2 θ = 99
1
. Our answer is 100. 

We’ve covered a translation; now let’s cover one more rotation.

Example 2.19 (2014 AIME II). Let z be a complex number with |z| = 2014. Let P be the
1
polygon in the complex plane whose vertices are z and every w such that z+w = z1 + w1 .

Then the area enclosed by P can be written in the form n 3, where n is an integer. Find
the remainder when n is divided by 1000.

1 1
Solution. Let’s begin by dealing with the given algebraic condition: we’re given z+w = z + w1 .
This simplifies to −1 = wz + wz , which then becomes w2 + wz + z 2 = 0.
Since we’re looking for every w such that this condition is satisfied, we want some sort of
expression for w in terms of z. Thus, treating z like a constant, we use the quadratic formula:

13
Everaise Academy (2020) Math Competitions II

we see that

−z ±z 2 − 4z 2
w=
√2
−z ± 3iz
= .
2
√ √
Therefore we must have w = z( −1+2 3i ) or w = z( −1−2 3i ). Since we’re looking for an area,
it’s natural to express these complex numbers in exponential form: in general, it is far easier to
understand the geometrical effect of multiplying by some complex number when that number is
expressed in exponential form. (For example, we know that multiplying by eiθ is just equivalent
to a rotation by θ, whereas multiplying by a + bi tells us almost nothing.)
√ √
We find that −1+2 3i = e2iπ/3 and −1−2 3i = e4iπ/3 . So multiplying z by these numbers is
equivalent to rotating z by 2π 4π ◦ ◦
3 and 3 , or 120 and 240 — so that means that the possible
values of w are just z rotated by those angles.
It follows that the three points form an equilateral triangle on the circle with radius 2014.
We’ll leave the reader to find that, with some basic geometry, the answer is 147. 

§2.5 Roots of Unity

Example 2.20. In this example, we’ll find solutions to the equation xn − 1 = 0 for some
small values of n.
1. Find all solutions to the equation x2 − 1 = 0.
2. Find all solutions to the equation x3 − 1 = 0.
3. Find all solutions to the equation x4 − 1 = 0.

Solution. To solve x2 − 1 = 0, all we need to do is use difference of squares: it yields x = ±1


as solutions.
As for x3 − 1, we can begin with difference

of cubes: it√yields (x − 1)(x2 + x + 1) = 0. From
there, the quadratic formula gives us − 12 + 23 i and − 12 − 23 i as the solutions to x2 + x + 1 = 0,
√ √
3 3
so our only solutions are x = 1, − 21 + 2 i, and − 12 − 2 i.
Finally, x4 − 1 can also be approached with difference of squares: we get (x2 − 1)(x2 + 1) = 0,
which implies that x = ±1, ±i are the only solutions. 

Let’s graph the solutions to these three equations.

14
Everaise Academy (2020) Math Competitions II

Our x2 case looks like two points; our x3 case looks like an equilateral triangle; our x4 case
looks like a square. All the points lie on the unit circle. Hmm, that looks interesting!
Let’s sketch a regular pentagon.

The magnitude of each of these points is 1; their angles are 0, 2π 4π 6π 8π


5 , 5 , 5 , and 5 . That is, the
complex numbers at these vertices are 1, e2iπ/5 , e4iπ/5 , e6iπ/5 , and e8iπ/5 . Now might be a good

15
Everaise Academy (2020) Math Competitions II

time to remember the example we did in the last section — these are precisely all the solutions
to x5 − 1 = 0!

Theorem 2.21 (Roots of Unity). The solutions to the equation xn − 1 = 0 for a positive
integer n are given by
2kiπ
e n
for integers k satisfying 0 ≤ k ≤ n − 1. These complex numbers form a regular n-gon when
graphed in the complex plane.
Generally, we’ll let ω be equal to e2iπ/n ; then the nth roots of unity will be 1, ω, ω 2 , · · · , ω n−1 .

Proof. We know, from the Fundamental Theorem of Algebra, that there are n solutions to
any nth-degree polynomial equation; therefore, we just need to check that all of these complex
numbers satisfy the given equation.
Observe that for any integer k satisfying 0 ≤ k ≤ n − 1, we have

(e2kiπ/n )n − 1 = e2kiπ − 1
= (cos(2kiπ) + i sin(2kiπ)) − 1
= (1 + 0i) − 1
=0

as desired.
As for why they form a regular n-gon: observe that the angle between each consecutive
complex number above is 2π
n , so they’re just n points equally spaced on the unit circle. 

Exercise 2.22. Explain why if ω = e2iπ/n , then the nth roots of unity are 1, ω, ω 2 , · · · , ω n−1 .

Example 2.23 (2012 AIME I). The complex numbers z and w satisfy z 13 = w, w11 = z,
and the imaginary part of z is sin mπ
n , for relatively prime positive integers m and n with
m < n. Find n.

Solution. The two given equations imply z = (z 13 )11 = z 143 , so z 142 = 1. This means that z
2kiπ
is a 142nd root of unity, so z = e 142 for some k between 0 and 141. Then
kπ kπ
z = cos + i sin .
71 71

Therefore our answer is n = 71, as 71 is prime; nothing can possibly cancel with it. We are
done. 

Example 2.24 (1984 AIME). The equation z 6 +z 3 +1 = 0 has complex roots with argument
θ between 90◦ and 180◦ in the complex plane. Determine the degree measure of θ.

Solution. The substitution z 3 = y leads to one solution, but we’ll present a different one. In
particular, note that
(z 3 − 1)(z 6 + z 3 + 1) = z 9 − 1.

16
Everaise Academy (2020) Math Competitions II

Therefore, if z 6 + z 3 + 1 = 0, then z 9 = 0. So all the solutions of z 6 + z 3 + 1 = 0 are ninth


roots of unity.
However, not all the ninth roots of unity are solutions to z 6 + z 3 + 1 = 0. In fact, the third
roots of unity are not solutions to this equation, because they’re already covered by z 3 − 1 in
the factorization above.
The ninth roots of unity are e2kiπ/9 for k = 0, 1, 2, · · · , 8; they correspond to the angles
0◦ , 40◦ , 80◦ , · · · , 320◦ in degrees. Meanwhile, the third roots of unity correspond to the angles
0◦ , 120◦ , and 240◦ .
It follows the remaining solutions correspond to the angles 40◦ , 80◦ , 160◦ , 200◦ , 280◦ , and 320◦ .
The only one of these that lies between 90◦ and 180◦ is 160◦ . Our answer is 160. 

Exercise 2.25 (Art of Problem Solving Forums). Prove x2 + x + 1 | x31 + x17 + 1. Hint: Can
you show that the roots of x2 + x + 1 are also the roots of x31 + x17 + 1?

We don’t always have to have r = 1 to deal with roots of unity.

Example 2.26 (2017 AMC 12B). What is the sum of the roots of z 12 = 64 that have a
positive real part?

2kiπ
Solution. We know the solutions to z 12 = 1: they’re z = e 12 for 0 ≤ k ≤ 11. However, if we
want the solutions to z 12√= 64, we need the magnitude of z to be different: in fact, we must
have |z|12 = 64, so |z| = 2.
√ 2kiπ
Therefore the solutions to z 12 =√64 are 2e 12 ; make sure you understand why this is the
2kiπ
case! (If it helps, try plugging z = 2e 12 into the equation — by the rules of complex-number
multiplication, the magnitude gets raised to the 12th and the angle gets multiplied by 12.)
So we’re looking for the solutions with a positive real part. That means that we’re looking
for the solutions on the right half of the unit circle: that is, the ones marked in blue, rather
than red.

√ 2kiπ
Let’s convert to cis form, to make adding them easier: our solutions are z = 2e 12 for
k = 0, 1, 2, 10, and 11.

17
Everaise Academy (2020) Math Competitions II

Before we rush in too quickly, let’s√stop for a moment: the imaginary part of 2eiπ/6 should
cancel with the imaginary part of 2e11iπ/6 . Think about it; look at the diagram — when
we express these numbers in rectangular form, their coordinates on the imaginary axis should
cancel when we add them.
√ √ √
Similarly, the imaginary part of 2 2eiπ/3 cancels with the imaginary part of 2e5iπ/3 .
Therefore we only √ really need√to add up the real parts, and ignore the imaginary parts. Thus,
2kiπ
as the real part of 2e 12 is 2 cos 2kπ 12 , we’re looking for

 
2(0)π 2(1)π 2(2)π 2(10)π 2(11)π
2 cos + cos + cos + cos + cos .
12 12 12 12 12
√ √
This comes out to 2 2 + 6, and we are done. 

Exercise 2.27. Note that we could also solve this geometrically; look √ at the diagram above.
There are 30 − 60 − 90 triangles everywhere, each with hypotenuse 2. Try doing so yourself!
(This is pretty much equivalent to the algebraic solution, to be fair.)

Exercise 2.28 (2018 AMC 12B). The solutions to the equation (z + 6)8 = 81 are connected in
the complex plane to form a convex regular polygon, three of whose vertices are labeled A, B,
and C. What is the least possible area of 4ABC?

Let’s go over two more tough late-AIME problems.

Example 2.29 (2004 AIME I). The polynomial

P (x) = (1 + x + x2 + · · · + x17 )2 − x17

has 34 complex roots of the form zk = rk [cos(2πak ) + i sin(2πak )], k = 1, 2, 3, . . . , 34, with
0 < a1 ≤ a2 ≤ a3 ≤ · · · ≤ a34 < 1 and rk > 0. Given that a1 + a2 + a3 + a4 + a5 = m/n,
where m and n are relatively prime positive integers, find m + n.

Solution. As established many times before in this section, when we’re dealing with something
like 1 + x + x2 + · · · + x17 , we’ll make use of the fact that multiplying this expression by x − 1
yields x18 − 1. Therefore
 18 2
x −1
P (x) = − x17
x−1
(x18 − 1)2 x17 (x − 1)2
= −
(x − 1)2 (x − 1)2
(x36 − 2x18 + 1) − x17 (x2 − 2x + 1)
=
(x − 1)2
36 19
x −x −x +1 17
= .
(x − 1)2

Nicely enough, the x18 terms cancel, and furthermore, the numerator factors! Therefore we’re
left with
(x19 − 1)(x17 − 1)
P (x) = .
(x − 1)2
That means that the roots of P (x) are just the 17th and 19th roots of unity, except for 1.
We’re looking for the five roots with the smallest arguments. (Why?)

18
Everaise Academy (2020) Math Competitions II

Therefore our five roots are cis( 2π 2π 4π 4π 6π


19 ), cis( 17 ), cis( 19 ), cis( 17 ), and cis( 19 ). Make sure you un-
derstand why this is the case — if we’re moving counterclockwise from 1 on the unit circle, we’ll
hit the first vertex of our regular 19-gon, then the first vertex of our regular 17-gon, and the
rest of the terms we need to sum proceed the same way.
1 1 2 2 3 159
Our sum is 19 + 17 + 19 + 17 + 19 = 323 , and our final answer is 482. 

Example 2.30 (1994 AIME). The equation

x10 + (13x − 1)10 = 0

has 10 complex roots r1 , r1 , r2 , r2 , r3 , r3 , r4 , r4 , r5 , r5 , where the bar denotes complex con-


jugation. Find the value of

1 1 1 1 1
+ + + + .
r1 r1 r2 r2 r3 r3 r4 r4 r5 r5

Solution. The ri and ri pairs should remind us of roots of unity immediately: after all, those
complex numbers are reflections in the x-axis, and when we draw regular polygons inscribed in
the unit circle we’ll end up with pairs of points that are reflections over the x-axis. However,
it’s unclear as of now how to induce roots of unity.
Let’s try to get a 1 involved somehow by dividing the entire equation by x10 . That yields

1 10
 
1 + 13 − =0
x
or equivalently,
1 10
 
13 − = −1.
x

That doesn’t mean that 13 − x1 will be a 10th root of unity, unfortunately, but we can still
20
work with this. In fact, observe that 13 − x1 = 1 — that is, 13 − x1 must be a 20th root
of unity that is not a 10th root of unity. Make sure you understand why this is the case! If
ω = eiπ/10 , then these roots are ω, ω 3 , ω 5 , · · · , ω 19 .

19
Everaise Academy (2020) Math Competitions II

Before rushing in and calculating everything explicitly, let’s take a quick step back and re-
member what we’re trying to find. We know that x = r1 , r1 , · · · , r5 , r5 are the solutions to
the original equation. Let’s say, without loss of generality, that 13 − r11 = ω, and let’s try to
determine which root of unity 13 − (r11 ) is equal to — we know that it must be equal to one of
them because x = r1 is also a solution to the equation.
We have 13 − r11 = 13 − r11 = ω by basic properties of the conjugate. But ω = ω 19 —
make sure you understand why! (You can interpret this geometrically: the roots ω and ω 19 are
reflections over the real axis in the diagram above. In fact, for any m, the roots ω m and ω 20−m
are reflections over the real axis, and thus conjugates.)
Thus without loss of generality let us suppose that 13 − r11 = ω, 13 − (r11 ) = ω 19 ; 13 − r12 = ω 3 ,
13 − (r12 ) = ω 17 ; . . .; 13 − r15 = ω 9 ; 13 − (r15 ) = ω 11 . It follows that

1 1 1 1 1
+ + + + = (13 − ω)(13 − ω 19 ) + · · · + (13 − ω 9 )(13 − ω 11 ).
r1 r1 r2 r2 r3 r3 r4 r4 r5 r5

Let’s take a look at (13 − ω)(13 − ω 19 ): expansion yields 169 − 13(ω + ω 19 ) + ω 20 . Importantly,
ω 20 = 1, so this just becomes 170 − 13(ω + ω 19 ).
Expanding the rest of the products in a similar manner, we get that our total is equal to

850 − 13(ω + ω 3 + ω 5 + · · · + ω 19 ).

We’ll present two approaches to finish off the problem here: our first is algebraic. Observe
that S = ω + ω 3 + · · · + ω 19 = ω(1 + ω 2 + · · · + ω 18 ). Therefore (ω 2 − 1)S = ω(ω 20 − 1) = 0 as ω
is a 20th root of unity. But ω 6= −1, 1 as it is not a 10th root of unity, so therefore ω 2 − 1 6= 0
so S = 0, and our answer is 850.
Alternatively, observe that ω + ω 11 = 0 — it is clear by geometry that ω = −ω 11 ! Similarly,
we get ω 3 = −ω 13 , · · · , ω 9 = −ω 19 , so the whole thing collapses, and once again our answer is
850. 

That was a really tough problem! We began by noting that we should try to use roots of
unity in some form, and proceeded to manipulate the equation into an easier form to work with.
Afterwards, we figured out how to incorporate the rk1rk terms by showing that if 13 − r1k = ω m ,
then 13 − (r1k ) = ω 20−m . Finally, we did a bit of algebra — and possibly some geometry! —
and finished off the problem.
The homework problems this time around are quite difficult. If you’re struggling with a
problem, please be sure to ask for help — that’s what office hours is for!

§2.6 Homework Problems

Problem 2.1 (2017 AMC 12A). [4] There are 24 different complex numbers z such that z 24 = 1.
For how many of these is z 6 a real number?

Problem 2.2 (2007 AIME I). [4] The complex number z is equal to 9 + bi, where b is a positive
real number and i2 = −1. Given that the imaginary parts of z 2 and z 3 are equal, find b.

Problem 2.3 (2019 AMC 12A). [5] Let


1+i
z= √ .
2

20
Everaise Academy (2020) Math Competitions II

What is
2 2 2 2 1 1 1 1
(z 1 + z 2 + z 3 + · · · + z 12 ) · ( 1 2 + 22 + 32 + ··· + 122 )?
z z z z

Problem 2.4 (2008 AMC 12B). [6] A function f is defined by f (z) = (4 + i)z 2 + αz + γ for all
complex numbers z, where α and γ are complex numbers and i2 = −1. Suppose that f (1) and

f (i) are both real. The smallest possible value of |α| + |γ| can be written as a. What is a?

Problem 2.5 (2002 AMC 12A). [6] Find the number of ordered pairs of real numbers (a, b)
such that (a + bi)2002 = a − bi. Hint: Sometimes you substitute z = a + bi; this time try substituting
a + bi = z!

Problem 2.6 (2016 HMMT). [6] Complex number ω satisfies ω 5 = 2. Find the sum of all
possible values of
ω 4 + ω 3 + ω 2 + ω + 1.

Problem 2.7 (2012 AIME II). [7] The complex numbers z and w satisfy the system

20i
z+ = 5 + i,
w
12i
w+ = −4 + 10i.
z
Find the smallest possible value of |zw|2 .

Problem 2.8 (1990 AIME). [7] The sets A = {z : z 18 = 1} and B = {w : w48 = 1} are both
sets of complex roots of unity. The set C = {zw : z ∈ A and w ∈ B} is also a set of complex
roots of unity. How many distinct elements are in C?

Problem 2.9 (2009 AMC 12B). [7] A region S in the complex plane is defined by

S = {x + iy : −1 ≤ x ≤ 1, −1 ≤ y ≤ 1}.

A complex
 number z = x + iy is chosen m uniformly at random from S. The probability that
3 3
4 + 4 i z is also in S can be expressed as n , where m and n are relatively prime integers. Find
m + n.

Problem 2.10 (2000 AIME II). [8] Given that z is a complex number such that z + z1 = 2 cos 3◦ ,
1
find the least integer that is greater than z 2000 + z 2000 .

Problem 2.11 (2005 AIME II). [8] For how many positive integers n less than or equal to
1000 is (sin t + i cos t)n = sin nt + i cos nt true for all real t?

Problem 2.12 (1988 AIME). [8] Let w1 , w2 , . . . , wn be complex numbers. A line L in the
complex plane is called a mean line for the points w1 , w2 , . . . , wn if L contains points (complex
numbers) z1 , z2 , . . . , zn such that
n
X
(zk − wk ) = 0.
k=1

For the numbers w1 = 32+170i, w2 = −7+64i, w3 = −9+200i, w4 = 1+27i, and w5 = −14+43i,


there is a unique mean line with y-intercept 3. Find the slope of this mean line.

21
Everaise Academy (2020) Math Competitions II

z+i
Problem 2.13 (2002 AIME I). [10] Let F (z) = for all complex numbers z 6= i, and let
z−i
1
zn = F (zn−1 ) for all positive integers n. Given that z0 = + i and z2002 = a + bi, where a
137
and b are real numbers, find a + b.

Problem 2.14 (2011 AIME II). [10] Let z1 , z2 , z3 , . . . , z12 be the 12 zeroes of the polynomial
z 12 − 236 . For each j, let wj be one of zj or izj . Then the maximum possible value of the real
12
X √
part of wj can be written as m + n where m and n are positive integers. Find m + n.
j=1

Problem 2.15 (1997 AIME). [10] Let v and w be p distinct, randomly chosen roots of the
1997 m

equation z − 1 = 0. Let n be the probability that 2 + 3 ≤ |v + w|, where m and n are
relatively prime positive integers. Find m + n.

22
3 Polynomials

§3.1 Factoring and Roots

Definition 3.1. A polynomial is a function of the form

P (x) = an xn + an−1 xn−1 + · · · + a1 x1 + a0 ,

where n is a positive integer.


We’ll primarily be dealing with polynomials with real coefficients — that is, a0 , a1 , · · · , an
will be real numbers. The number an is called the leading coefficient and cannot be equal
to 0. However, polynomials will accept complex inputs; for example, if P (x) = x2 + 1, then
P (i) = 0. A real or complex number r is said to be a root of a polynomial P if P (r) = 0; for
example, the roots of the polynomial P (x) = x2 + 3x2 + 2 are −1 and −2.
The degree of a polynomial P (x) is equal to the highest exponent that x is raised to in its
expansion. In particular, the degree of P (x) = 3x2 +1 is 2; the degree of P (x) = 732x6 −23x5 −1
is 6; the degree of P (x) = 1 — a constant, nonzero polynomial — is 0. We usually define the
degree of P (x) = 0 to be negative infinity, for reasons which will become more clear later.
A polynomial Q(x) is a factor of P (x) if there exists some polynomial R(x) such that
P (x) = Q(x)R(x). Think back to the analogue with integers: 3 is a factor of 6 because
there exists some integer x (2, in this case) such that 6 = 3x.
An example with polynomials: Q(x) = x + 1 is a factor of P (x) = x2 − 5x − 6, because there
exists an R(x) — namely, R(x) = x − 6 — such that P (x) = Q(x)R(x).

We’ll state the following very powerful result without proof.

Theorem 3.2 (Fundamental Theorem of Algebra). A polynomial P (x) of degree n has n


roots in total, real and complex. This allows us to express any polynomial P as

P (x) = a(x − r1 )(x − r2 ) · · · (x − rn )

where r1 , · · · , rn are the roots of P , and a is its leading coefficient.

We also obtain an important corollary that is used in a decent number of problems:

Corollary 3.3. If a polynomial P has degree at most n, but there exist n + 1 values
r1 , r2 , . . . , rn+1 such that P (ri ) = 0 for all i, then P is the zero polynomial.

Some polynomials might not look like they have n roots total: for example, P (x) = (x −
1)2 (x − 2) might seem to only have 1 and 2 as roots. However, in this case we say that 1 is
a double root, or that it has multiplicity 2. In general, if (x − r)k is a factor of P (x) but
(x − r)k+1 is not, then the multiplicity of the root r is k.
The roots and factors of a polynomial are intimately related by the following theorem.

1
Everaise Academy (2020) Math Competitions II

Theorem 3.4 (Factor Theorem). A number r is a root of the polynomial P (x) if and only
if x − r is a factor of P (x).

Proof. First, we’ll prove the forwards direction: if r is a root of P (x), then P (r) = 0. Assume
the degree of P is n. Write P (x) as

P (x) = a(x − r1 )(x − r2 ) · · · (x − rn )

so that r1 , r2 , · · · , rn are the roots of P . Then, as P (r) = 0, we know that a(r−r1 ) · · · (r−rn ) = 0,
so at least one of r − r1 , · · · , r − rn must be equal to 0; therefore r = ri for some i between 1
and n. It follows indeed that x − r is a factor of P (x), as desired, as all the x − ri ’s are factors
of P (x).
Now, if x − r is a factor of P (x), then P (x) = (x − r)Q(x) for some other polynomial Q(x).
It follows that P (r) = (r − r)Q(r) = 0, so therefore f is a root of P (x), as desired. 

The general version of the Factor Theorem is the Remainder Theorem.

Theorem 3.5 (Remainder Theorem). The remainder of P (x) when divided by x − r is P (r).

Proof. Let P (x) = (x − r)Q(x) + q for some constant q. Then the remainder upon dividing
P (x) by x − r is clearly q; moreover, P (r) = (r − r)Q(r) + q = q, as desired. 

Example 3.6. Factor the cubic P (x) = x3 − 6x2 + 11x − 6.

Solution. It’s generally quite hard to factor arbitrary cubics, but it turns out that this one
is quite nice. Instead of directly trying to find factors, we’ll use Theorem 3.4: observe that
P (1) = 1 − 6 + 11 − 6 = 0, so x − 1 is a factor of P (x).
At this point, if you know polynomial long division you can divide P (x) by x − 1 to find a
quadratic, which factors nicely. We won’t explain polynomial long division in this handout —
if you don’t know it, feel free to look it or synthetic division up! — but we will present an
alternative method.
Suppose that P (x) = (x − 1)Q(x) for some polynomial Q of degree 2. (Why must Q be a
quadratic?) Then P (x) = (x − 1)(x2 + ax + b) for some constants a and b — we know the
leading term of the quadratic has to be 1 — and expansion yields

P (x) = x3 − 6x2 + 11x − 6 = (x − 1)(x2 + ax + b)


= x3 + (a − 1)x2 + (b − a)x − b.

Comparing coefficients, we see that b = 6 and a = −5, so P (x) = (x − 1)(x2 − 5x + 6).


Factoring our new quadratic, we get P (x) = (x − 1)(x − 2)(x − 3), as desired. 

It turns out that the factor representation of a polynomial is a lot more powerful than it seems.
For one, it’s much easier to work with, which leads us to some particularly cool problems.

2
Everaise Academy (2020) Math Competitions II

Example 3.7. Let P (x) = x2020 + 20x20 + x have roots r1 , r2 , . . . , r2020 . Compute the value
of (r12 − 1)(r22 − 1) · · · (r2020
2 − 1).

Solution. Let’s use the difference of squares factorization to break this problem down. After
doing so, we’re left with

(r1 − 1)(r2 − 1) · · · (r2020 − 1)(r1 + 1)(r2 + 1) · · · (r2020 + 1).

This looks suspiciously similar to the factored form of a polynomial we had seen above— recall
that by definition,
P (x) = (x − r1 )(x − r2 ) · · · (x − r2020 ).
If we plug in x = 1, we get

P (1) = (1 − r1 )(1 − r2 ) · · · (1 − r2020 ) = (−1)2020 (r1 − 1)(r2 − 1) · · · (r2020 − 1),

where we multiplied each of the 2020 factors by −1. These factors match exactly with the first
half of the expression we wanted to find! We achieve a similar result if we plug in x = −1:

P (−1) = (−1 − r1 )(−1 − r2 ) · · · (−1 − r2020 ) = (−1)2020 (r1 + 1)(r2 + 1) · · · (r2020 + 1).

Since (−1)2020 is just 1, this means that the original expression we wanted to evaluate was
simply P (1) · P (−1) all along. Plugging these values into the given definition of P , we arrive at
our answer of 22 · 20 = 440. 

Exercise 3.8 (2020 CCA Math Bonanza). If a, b, c are the roots of x3 + 20x2 + 1x + 5, compute
(a2 + 1)(b2 + 1)(c2 + 1). Hint: While x2 + 1 may not factor over the real numbers, try factoring it as
x2 − (−1) and using difference of squares.

There are some other cool things we can do with Theorem 3.4.

Example 3.9 (2016 AIME I). Let P (x) be a nonzero polynomial such that (x − 1)P (x + 1) =
(x + 2)P (x) for every real x, and (P (2))2 = P (3). Then P ( 27 ) = m
n , where m and n are
relatively prime positive integers. Find m + n.

Solution. One of the key things to keep in mind is that the given equation is true for every
real x. This means that we should try substituting some values of x that might give us more
information; given our (x − 1)P (x + 1) on the left-hand-side, we might begin by substituting
x = 1 to make that the expression equal to 0. That yields 0P (2) = 3P (1), or equivalently,
P (1) = 0 — so 1 is a root of P !
That seems helpful. Let’s try roughly the same thing for the right-hand-side: we plug in
x = −2, giving us −3P (−1) = 0, so x = −1 is also a root.
At this point, it seems like we might be a bit stuck, because there’s no more ways to get x − 1
or x + 2 equal to 0. However, now might be a good time to use the information we’ve already
found: as P (1) = P (−1) = 0, we’ll set x = 0 so that P (x + 1) = P (1) = 0. Then 0 = 2P (0), so
P (0) = 0.
We might try using our three roots −1, 0, and 1 to gain some more information by just plugging
in numbers, but it turns out that it’s impossible to make more headway in this direction.

3
Everaise Academy (2020) Math Competitions II

Now it’s time to recall Theorem 3.4: we know that −1, 0, and 1 are roots of P , so

P (x) = x(x − 1)(x + 1)Q(x)

for some polynomial Q. This seems like it might be a helpful equation to substitute the given
information into: as P (x + 1) = (x + 1)(x)(x + 2)Q(x + 1) by plugging x + 1 into the above
equation, we have

(x − 1)(x + 1)(x)(x + 2)Q(x + 1) = (x + 2)(x)(x − 1)(x + 1)Q(x).

The terms on either side of this equation look remarkably similar: if x 6= −2, −1, 0, 1, that
means that Q(x + 1) = Q(x). But we know that this is true for all x except for these numbers
— that implies that Q must be a constant polynomial! This is because the polynomials (x −
1)(x)(x + 1)(x + 2)Q(x) and (x − 1)(x)(x + 1)(x + 2)Q(x + 1) agree at infinitely many points, so
therefore they must be the same polynomial and therefore Q(x) = Q(x + 1) and Q is constant.
Therefore, for some constant k we have

P (x) = kx(x − 1)(x + 1).

It might be time to look back at P (2) and P (3): we have P (2) = 6k and P (3) = 24k. Then
(6k)2 = 24k implies that 36k 2 = 24k — so either k = 0, which contradicts our given that P (x)
is a nonzero polynomial, or k = 32 .
That means that P (x) = 32 x(x − 1)(x + 1), and at this point we can just plug in 72 , giving us
an answer of 105
4 . Our final answer is 105 + 4 = 109. 

Remark. For a lot of problems like this — where you’re given a polynomial equation of
some sort — the best first thing to do is play around with the equation, try and find some
roots, and then use the Factor Theorem.

§3.2 Vieta’s Formulae

Now we’ll introduce some techniques to deal with sums, products, and other combinations of
roots.

Definition 3.10. Define the kth elementary symmetric sum of n variables a1 , a2 , · · · , an


as the sum of all combinations of products of k of these variables at a time. We’ll denote this
as Sk . (The original number of variables will be clear from context.)
Of course, it’s hard to understand this without some examples. The first elementary sym-
metric sum of any n variables a1 , · · · , an , denoted S1 , is just

S1 = a1 + a2 + · · · + an .

The second, S2 , is
S2 = a1 a2 + a1 a3 + · · · + an−1 an ,
where S2 is the sum of all products of all pairs of elements.
For a few specific cases: if there are five variables a, b, c, d, and e, then

S4 = abcd + abce + abde + acde + bcde.

4
Everaise Academy (2020) Math Competitions II

If there are four variables a, b, c, and d, then

S2 = ab + ac + ad + bc + bd + cd

and
S4 = abcd.

Exercise 3.11. Explain why the kth elementary symmetric sum of n variables is the sum of
n

k terms.

Exercise 3.12. Find the third elementary symmetric sum of w, x, y, and z.

Now we’ll introduce a very important theorem.

Theorem 3.13 (Vieta’s Formulae). Given a polynomial P (x) = an xn + an−1 xn−1 + · · · +


a1 x + a0 with roots r1 , r2 , · · · , rn , Vieta’s Formulae state that
an−k
Sk = (−1)k · ,
an
where Sk denotes the kth elementary symmetric sum of the roots r1 , · · · , rn .

Proof. We know that we can express P (x) as

P (x) = a(x − r1 )(x − r2 ) · · · (x − rn )

for some constant a. In this case, it is clear that a = an .


Expanding this yields

P (x) = an xn + an (−r1 − r2 − · · · − rn )xn−1


+ an (r1 r2 + r1 r3 + · · · + rn−1 rn )xn−2
+ . . . + (−r1 )(−r2 ) · · · (−rn ).

Look at these coefficients! Miraculously, they’re the elementary symmetric sums of the n
roots. Additionally, depending on which coefficient we’re dealing with, we have a power of −1
to deal with — and as such, by comparing coefficients,

an (Sk )(−1)k = an−k .

This rearranges to the desired equation. 

Let’s try a few examples.

Example 3.14. If p, q, r, and s are the roots of P (x) = 2x4 − 6x3 − 30x2 + 12x + 10, then
find
1. p + q + r + s,
2. pq + pr + ps + qr + qs + rs,
3. pqr + pqs + prs + qrs, and
4. pqrs.

5
Everaise Academy (2020) Math Competitions II

Solution. We know that p + q + r + s = S1 , the first elementary symmetric sum, so our answer
is
−6
S1 = (−1) · = 3.
2
Next, pq + pr + ps + qr + qs + rs = S2 , so our answer is
−30
S2 = (−1)2 · = −15.
2

Now, pqr + pqs + prs + qrs = S3 , so our answer is


12
S3 = (−1)3 · = −6.
2

Finally, pqrs = S4 , so our answer is


10
S4 = (−1)4 · = 5.
2


Example 3.15. Suppose that p, q, and r are numbers, real or complex, that satisfy the
equations

p+q+r =6
pq + qr + rp = 11
pqr = 6.

Find all possible values of p, q, and r.

Solution. We could solve this system of equations in any number of ways, but we’ll show this
one. Suppose that p, q, and r are the roots of a cubic polynomial — we’ll assume that the
leading coefficient is 1, for the same of simplicitly. Then it follows, by Vieta’s formulae, that
the cubic polynomial we’re interested in is

x3 − 6x2 + 11x − 6.

Convince yourself that this is true! Now, we know from an example from earlier in this
handout that the roots of this polynomial are 1, 2, and 3, so (p, q, r) can be any permutation of
(1, 2, 3). 

We’ll present some exercises soon, but first, a very important theorem and example.

Theorem 3.16. Any symmetric sum in n variables can be written as a polynomial of


elementary symmetric sums of n variables.

By symmetric sum, we mean a sum that is symmetric in n variables. For some examples:
a3 + b3 is symmetric in a and b; x2 y + x2 z + y 2 x + y 2 z + z 2 x + z 2 y is symmetric in x, y, and z.
Here is an example of a sum which is not symmetric: a2 b + b2 c + c2 a is cyclic in a, b, and c;
the symmetric sum would be a2 b + a2 c + b2 a + b2 c + c2 a + c2 b.

6
Everaise Academy (2020) Math Competitions II

Example 3.17. Express a3 + b3 and x2 y + x2 z + y 2 x + y 2 z + z 2 x + z 2 y as polynomials of


elementary symmetric sums.

Solution. For a3 + b3 , we have S1 = a + b and S2 = ab. Factoring yields

a3 + b3 = (a + b)(a2 − ab + b2 )
= (a + b)((a + b)2 − 3ab)
= S1 (S12 − 3S2 )

which is a polynomial in S1 and S2 , as desired.


As for x2 y + x2 z + y 2 x + y 2 z + z 2 x + z 2 y: this is a bit tougher to crack. Let this expression
be T . Since we need terms of the form x2 y, we might try starting with xy + yz + zx. If we
multiplied this by x + y + z, we’d get the terms we want, so

(xy + yz + zx)(x + y + z) = x2 y + xy 2 + y 2 x + y 2 z + zx2 + zy 2 + 3xyz


= T + 3xyz

so therefore
S2 S1 = T + 3S3
and thus T = S2 S1 − 3S3 , a polynomial in S1 , S2 , and S3 , as desired. 

Exercise 3.18. Suppose that P (x) = 3x2 − 12x + 27 has roots p and q. Find
1. pq and p + q,
2. p2 + q 2 , and
1
3. p + 1q .

Exercise 3.19. Suppose that P (x) = 7x3 − 2x2 − x + 49 has roots p, q, and r. Find p2 + q 2 + r2 .

These have been relatively simple direct applications so far. Let’s move onto some harder
examples.

Example 3.20 (2005 AIME I). The equation

2333x−2 + 2111x+2 = 2222x+1 + 1

has three real roots. Given that their sum is m/n where m and n are relatively prime
positive integers, find m + n.

Solution. This might not look like a polynomial equation at first — mostly because it isn’t
one right now. However, there’s a very natural substitution we can make: let y = 2111x .
Then our new equation is
y3
+ 4y = 2y 2 + 1.
4
You might think that at this point we can just shift all the terms over to one side and calculate
the sum of the values for y, and be done. But unfortunately, we made a substitution at first;

7
Everaise Academy (2020) Math Competitions II

let’s remember what we were originally looking for. If r1 , r2 , and r3 were the three roots of the
original equation, then if y1 , y2 , and y3 are the three roots of this new equation we have

yi = 2111ri

for i = 1, 2, and 3.
We want to find r1 + r2 + r3 . The only natural way to induce this sum is to multiply y1 , y2 ,
and y3 , rather than adding them; we see that

y1 y2 y3 = 2111(r1 +r2 +r3 ) .

Perfect — we can find y1 y2 y3 using Vieta’s formulas, which gives us 2111(r1 +r2 +r3 ) = 4.
2
Therefore r1 + r2 + r3 = 111 , and our answer is 113. 

Exercise 3.21 (1984 USAMO). The product of two of the four roots of the quartic equation
x4 − 18x3 + kx2 + 200x − 1984 = 0 is −32. Determine the value of k. Hint: Don’t be scared off
by the fact that this is a USAMO problem — use Vieta’s formulae and see what happens.

There are some special techniques we can use to deal with sums of powers of roots.

Example 3.22. Suppose that P (x) = x3 − 7x2 − 12x + 10 has roots a, b, and c. Find
a3 + b3 + c3 .

Solution. It is possible to decompose a3 +b3 +c3 as a polynomial of elementary symmetric sums:


try doing so yourself with the factorization a3 +b3 +c3 −3abc = (a+b+c)(a2 +b2 +c2 −ab−bc−ca).
However, that’s not the solution we’ll present this time.
Consider the equation
x3 = 7x2 + 12x − 10.

If x is a solution to this equation, then x must be one of a, b, and c. Therefore

a3 = 7a2 + 12a − 10
b3 = 7b2 + 12b − 10
c3 = 7c2 + 12c − 10.

At this point, we’ll define Pn = an + bn + cn for convenience. Adding the equations, we get

P3 = 7P2 + 12P1 − 30.

Miraculously, it’s much easier to compute P1 and P2 : the former is just 7 by Vieta’s formulae,
and the latter is equal to (a + b + c)2 − 2(ab + bc + ca) = 72 − 2(−12) = 73. Thus P3 =
7(73) + 12(7) − 30 = 565. 

Exercise 3.23. Compute a4 + b4 + c4 in the above problem. Hint: Try multiplying the equation by
x3 = 7x2 + 12x − 10 by x.

We’ll use the same idea as above in the next example — just slightly adapted.

8
Everaise Academy (2020) Math Competitions II

Example 3.24 (2003 AIME II). Consider the polynomials P (x) = x6 − x5 − x3 − x2 − x


and Q(x) = x4 − x3 − x2 − 1. Given that z1 , z2 , z3 , and z4 are the roots of Q(x) = 0, find
P (z1 ) + P (z2 ) + P (z3 ) + P (z4 ).

Solution. We might try to approach this the exact same way we approached the last example:
if we let Pn = z1n + z2n + z3n + z4n , then we’re looking for
P6 − P5 − P3 − P2 − P1 .

However, it’s extremely difficult to directly compute P6 or P5 , and even P3 presents challenges.
So let’s take a bit of a different approach, involving factoring: you might notice that x2 Q(x)
looks like it shares a lot of terms with P (x). In fact,
P (x) = x2 Q(x) + x4 − x3 − x
= x2 Q(x) + Q(x) + x2 − x + 1.

Then, for each 1 ≤ i ≤ 4, Q(zi ) = 0. It follows that


P (z1 ) + P (z2 ) + P (z3 ) + P (z4 ) = (z12 + z22 + z32 + z42 ) − (z1 + z2 + z3 + z4 ) + 4
= P2 − P1 + 4.

But it’s easy to see that P1 = 1 and P2 = P12 − 2(z1 z2 + z1 z3 + · · · + z3 z4 ). But z1 z2 + z1 z3 +


· · · + z3 z4 = −1, so P2 = 3. Our final answer is 3 − 1 + 4 = 7. 

Exercise 3.25 (2019 AMC 12). Let sk denote the sum of the kth powers of the roots of the
polynomial x3 − 5x2 + 8x − 13. In particular, s0 = 3, s1 = 5, and s2 = 9. Let a, b, and c be
real numbers such that sk+1 = a sk + b sk−1 + c sk−2 for k = 2, 3, .... What is a + b + c?

Exercise 3.26 (2019-2020 Winter Mock AMC 10). Let r1 , r2 , and r3 be roots of the cubic
polynomial P (x) = x3 − 6x2 + b where b is real. It is also known that r13 + r23 + r33 = 72. What
is the value of P (10)?

In general, it’s not a good idea to expand everything and bash unless you have to. We’ll take
a look at a few more examples of that.

Example 3.27 (Adapted from HMMT 2009). Let a, b, and c be the 3 roots of x3 − x + 1 = 0.
1. Find a polynomial with roots a + 1, b + 1, and c + 1.
2. Find a polynomial with roots a1 , 1b , and 1c .
1 1 1
3. Find a+1 + b+1 + c+1 .

Solution. For the first part of the problem, let’s let P (x) = x3 − x + 1. Then we want to be
able to plug in a + 1 and somehow obtain 0, which motivates considering
P (x − 1) = (x − 1)3 − (x − 1) + 1.

Now plugging in x = a + 1 here will give us P ((a + 1) − 1) = P (a) = 0, and similar for
x = b + 1, c + 1. Therefore, a + 1, b + 1, and c + 1 are the roots of P (x − 1) = (x − 1)3 − (x − 1) + 1.
Fully expanded, our polynomial is
x3 − 3x2 + 2x + 1.

9
Everaise Academy (2020) Math Competitions II

1
Now let’s look at the second part. We want to be able to plug in a and obtain 0, which
motivates considering  
1 1 1
P = 3 − + 1.
x x x

Now plugging in x = a1 gives us P (a) = 0, as desired. However, x13 − x1 + 1 is not quite a


polynomial; therefore we multiply through by x3 , giving us x3 P ( x1 ) = 1 − x2 + x3 . Now plugging
in a1 , 1b , or 1c for x will give us 1 − x2 + x3 = 0, so that’s our desired polynomial.
For the third and final part of the problem, we could certainly multiply through by (a+1)(b+
1)(c + 1) and attempt to express everything in terms of elementary symmetric sums. But that
would be very computational, so let’s take another tack.
First, we already know from part 1 that a polynomial with roots a + 1, b + 1, and c + 1 is
Q(x) = x3 − 3x2 + 2x + 1. Now we want a polynomial with whose roots are the reciprocals of
those roots, so we consider Q( x1 ) = x13 − x32 + x2 + 1; this has roots a+1
1 1
, b+1 1
, and c+1 , but it’s
3
not yet a polynomial. Multiplying through by x , we see that
 
3 1
x Q = 1 − 3x + 2x2 + x3
x
1 1 1
has the desired roots a+1 , b+1 , and c+1 . So we just want their sum, which is −2, by Vieta’s
formulae. 

Exercise 3.28. Prove that if P (x) = an xn + an−1 xn−1 + · · · + a1 x + a0 has roots r1 , r2 , · · · , rn ,


then Q(x) = a0 xn + a1 xn−1 + · · · + an−1 x + an , with P (x)’s coefficients reversed, has roots
1 1 1
r1 , r2 , · · · , rn .

Let’s do a tough problem that combines the ideas from the previous problem with a bit of
Vieta trickery.

Example 3.29 (Art of Problem Solving Forums). Let a, b, and c be the roots of the poly-
nomial x3 − 3x2 + 4x − 5. Find the sum of the coefficients of the monic polynomial with
roots ab, bc, and ac.

Solution. It doesn’t seem like there’s a direct way to construct a polynomial with the roots
ab, bc, and ac, unlike how we constructed polynomials with shifted and reciprocal roots in the
previous problem. However, ab, bc and ac do remind us of Vieta’s formulae: we can easily get
ab+bc+ca = 4. However, this only really gives us one of the coefficients of the monic polynomial
with roots ab, bc, and ac, so let’s take a different tack.
We know that abc = 5 by Vieta’s formulae. That allows us to conclude that ab, bc, and ca
are actually equal to 5c , a5 , and 5b . This looks a lot more promising!
We already know a way to obtain a polynomial with reciprocal roots — that is, a1 , 1b , and 1c .
Our polynomial with roots a1 , 1b , and 1c is

Q(x) = −5x3 + 4x2 − 3x + 1,

by the previous exercise. (You can also just proceed by the method in the previous example.)
Now we need to find a polynomial with five times the roots of Q. This means that we
can just consider Q( x5 ): if d is a root of Q(x), then plugging in 5d for x in Q( x5 ) gives us
Q( 5d x 5 5 5
5 ) = Q(d) = 0. Therefore the roots of Q( 5 ) are a , b , and c .

10
Everaise Academy (2020) Math Competitions II

But x 1 3 4 3
Q =− x + x2 − x + 1.
5 25 25 5
We’re looking for the sum of the coefficients of the monic polynomial with roots ab, bc, and
ca, though. So we need the coefficient of the x3 term to be 1. Multiplying by −25, we get

x3 − 4x2 + 15x − 25.

The sum of its coefficients is 1 − 4 + 15 − 25 = −13, and we are done. 

§3.3 Other Polynomial Techniques

Sometimes there isn’t anything clever to do.

Example 3.30 (Adapted from 2014 AMC 12). Let P be a cubic polynomial with P (0) =
k, P (1) = 2k, and P (−1) = 3k. What is P (2) + P (−2)? Express your answer in terms of
k.

Solution. Occasionally, we really don’t have much choice other than to bash. In this case,
as P is cubic, we’ll let P (x) = x3 + ax2 + bx + c; although we technically should have an x3
coefficient, we may just assume without loss of generality that it’s 1.
Then, as P (0) = k, we get c = k; next, P (1) = 1 + a + b + k = 2k, so 1 + a + b = k. Finally,
P (−1) = −1 + a − b + k = 3k, so −1 + a − b = 2k. That gives us the system

1+a+b=k
−1 + a − b = 2k.

That’s three variables and two equations — not enough to uniquely determine everything!
However, we’re just looking for P (2) + P (−2) in terms of k. That ends up being

P (2) + P (−2) = (8 + 4a + 2b + k) + (−8 + 4a − 2b + k)


= 8a + 2k.

so we just need to find 8a in terms of k.


Adding the two equations we found before, we see that 2a = 3k. Therefore, 8a = 12k, so our
answer is 12k + 2k = 14k. 

Remark. If you’re ever completely stuck, there’s often nothing better to do than to use the
general form of a polynomial and see where it takes you.

Exercise 3.31 (2019 CMIMC). Let P (x) be a quadratic polynomial with real coefficients such
that P (3) = 7 and
P (x) = P (0) + P (1)x + P (2)x2
for all real x. What is P (−1)?

Now we’ll introduce a powerful technique called roots of unity filter.

11
Everaise Academy (2020) Math Competitions II

Example 3.32 (Roots of Unity Filter). Recall from the previous day that the kth roots of
unity are the n solutions to
xk − 1 = 0,
and can be expressed as 1, ω, ω 2 , · · · , ω k for some complex number ω with magnitude 1.
Prove that if P (x) is some polynomial, then

P (1) + P (ω) + P (ω 2 ) + · · · + P (ω k−1 )


S=
k
is the sum of all the coefficients of all the terms of P (x) that have exponents divisible by
k.

Solution. Let’s suppose that ar xr is some term of our polynomial P (x) such that r is not
divisible by k. Then, when we add P (1) + P (ω) + · · · + P (ω k−1 ), we’ll end up with a term that
looks like
ar + ar ω r + ar ω 2r + · · · + ar ω (k−1)r
somewhere in our expansion.
Miraculously, as this is ar multiplied by a finite geometric series with first term 1 and common
ratio ω r , we can rewrite this as  kr 
ω −1
ar .
ωr − 1
(It is also possible to notice this by remembering the factorization (1+x+x2 +· · ·+xk−1 )(x−1) =
xk − 1.)
kr −1
But ω kr = (ω k )r = 1, so in fact ar ( ωωr −1 ) = 0. Therefore the entire term vanishes — and
in fact, since we chose r to be some arbitrary number not divisible by k, in the expansion of
P (1) + P (ω) + · · · + P (ω k−1 ), we don’t have to worry about any of the coefficients of xr terms
where r is not divisible by k.
What if r is divisible by k? Then ar + ar ω r + ar ω 2r + · · · + ar ω (k−1)r = kar . Therefore the
expression S actually comes out to be
 
1 X
(kar ) ,
k
r is divisible by k

which indeed is the sum of all the coefficients of the terms of P (x) that have exponents divisible
by k. 

Example 3.33 (Classical). Find


       
2019 2019 2019 2019
+ + + ··· + .
0 3 6 2019

Solution. Motivated by the Binomial Theorem, we’ll consider the expansion of (1 + x)2019 .
Miraculously, we’re actually trying to find the sum of the coefficients of the terms that have
exponents divisible by 3! Therefore we’re looking for
P (1) + P (ω) + P (ω 2 )
S= ,
3

12
Everaise Academy (2020) Math Competitions II

where ω = e2iπ/3 .
√ √
3 3 2019
But we can also write e2iπ/3 = − 21 + 2 i, so P (ω) = (1 + ω)2019 = ( 12 + 2 i) . But it turns

1 3
out that 2 + 2 i = eiπ/3 , and raised to the 2019th power, this comes out to be −1.
√ √ √
Next, ω 2 = − 12 − 23 i, so P (ω 2 ) = (1 + ω 2 )2019 = ( 12 − 3 2019
2 i) . Meanwhile, 1
2 − 3
2 i = e5iπ/3 ,
so raising that to the 2019th power also gives us −1.
P (1)−2 22019 −2
Therefore our final answer is S = 3 = 3 , and we are done. 

§3.4 Homework Problems

Problem 3.1 (2012 Mock AMC 12). [5] The polynomial x3 − Ax + 15 has three real roots.
Two of these roots sum to 5. What is |A|?

Problem 3.2 (2010 AMC 10A). [4] The polynomial x3 − ax2 + bx − 2010 has three positive
integer zeros. What is the smallest possible value of a?

Problem 3.3 (2011 NIMO Summer Contest). [4] The roots of the polynomial P (x) = x3 +5x+4
are r, s, and t. Evaluate (r + s)4 (s + t)4 (t + r)4 .

Problem 3.4. [7] Here’s a technique that often comes in handy: if P (x) = f (x) for some
polynomial f of x for a lot of values — let’s say a1 , · · · , an — you can often consider the
polynomial P (x) − f (x), which must have roots a1 , · · · , an .
• (2017 AMC 12) The graph of y = f (x), where f (x) is a polynomial of degree 3, contains
points A(2, 4), B(3, 9), and C(4, 16). Lines AB, AC, and BC intersect the graph again at
points D, E, and F , respectively, and the sum of the x-coordinates of D, E, and F is 24.
f (0) can be expressed as mn , where m and n are relatively prime integers. Find m + n.
• (2010 AMC 12B) Let a > 0, and let P (x) be a polynomial with integer coefficients such
that
P (1) = P (3) = P (5) = P (7) = a, and
P (2) = P (4) = P (6) = P (8) = −a.
What is the smallest possible value of a?

Problem 3.5 (2008 AIME II). [6] Let r, s, and t be the three roots of the equation

8x3 + 1001x + 2008 = 0.

Find (r + s)3 + (s + t)3 + (t + r)3 .

Problem 3.6 (1996 AIME). [7] Suppose that the roots of x3 + 3x2 + 4x − 11 = 0 are a, b, and
c, and that the roots of x3 + rx2 + sx + t = 0 are a + b, b + c, and c + a. Find t.

Problem 3.7 (2014 AIME II). [7] Real numbers r and s are roots of p(x) = x3 + ax + b, and
r + 4 and s − 3 are roots of q(x) = x3 + ax + b + 240. Find the sum of all possible values of |b|.

Problem 3.8 (2017 CMIMC). [8] Suppose P (x) is a quadratic polynomial with integer coeffi-
cients satisfying the identity

P (P (x)) − P (x)2 = x2 + x + 2016

for all real x. What is P (1)?

13
Everaise Academy (2020) Math Competitions II

Problem 3.9 (2020 AIME I). [7] Let P (x) be a quadratic polynomial with complex coefficients
whose x2 coefficient is 1. Suppose the equation P (P (x)) = 0 has four distinct solutions, x =
3, 4, a, b. Find the sum of all possible values of (a + b)2 .

Problem 3.10 (2011 AIME I). [8] For some integer m, the polynomial x3 − 2011x + m has the
three integer roots a, b, and c. Find |a| + |b| + |c|.

Problem 3.11 (2014 USAMO). [9] Let a, b, c, d be real numbers such that b − d ≥ 5 and all
zeros x1 , x2 , x3 , and x4 of the polynomial P (x) = x4 + ax3 + bx2 + cx + d are real. Find the
smallest value the product (x21 + 1)(x22 + 1)(x23 + 1)(x24 + 1) can take.

Problem 3.12 (2018 HMMT). [10] Assume the quartic x4 −ax3 +bx2 −ax+d = 0 has four real
roots 21 ≤ x1 , x2 , x3 , x4 ≤ 2. The maximum possible value of (x1 +x2 )(x1 +x3 )x4
(x4 +x2 )(x4 +x3 )x1 can be expressed
as m
n , where m and n are relatively prime integers. Find m + n.

Problem 3.13 (2005 IMO Shortlist). [11] Let a, b, c, d, e, f be positive integers and let
S = a+b+c+d+e+f . Suppose that the number S divides abc+def and ab+bc+ca−de−ef −df .
Prove that S is composite.

Problem 3.14 (USAMO 1977). [11] If a and b are two of the roots of x4 + x3 − 1 = 0, prove
that ab is a root of x6 + x4 + x3 − x2 − 1 = 0.

14
4 Inequalities

§4.1 Common Misconceptions

Inequalities are one of the most common topics in algebra. Inequality problems usually ask
about the behaviour of a function, particularly about the minimum and maximum values that
it can take.

Proposition 4.1 (Basics). For any real numbers a, b, c, d,


1. If a ≥ b and c ≥ d, then a + c ≥ b + d.
2. If a ≥ b and b ≥ c, then a ≥ b ≥ c.
3. If a ≥ b ≥ 0 and c is a positive real number, then ac ≥ bc ≥ 0. Otherwise, if c is a
negative real number, then ac ≤ bc ≤ 0. The case where c = 0 is not very interesting.
This all holds true if you replace ≥ signs with ≤, >, or < signs.

Here are some common misconceptions about inequalities:


1. a ≥ b and c ≥ d doesn’t give you
a − c ≥ b − d.

2. a ≥ b and c ≥ d doesn’t give you


ac ≥ bd.

3. a ≥ b and c ≥ b doesn’t give you


a ≥ c.

(Note that these are still misconceptions if we again replace all the ≥ signs with ≤, >, or <
signs.)

Exercise 4.2. Give a counterexample of the above three misconceptions.

Remark. The third misconception seems foolish, but people fall for it constantly!

§4.2 Trivial Inequality

Let’s begin with one of the most fundamental inequalities. Though it seems obvious, the Trivial
Inequality is often crucial when solving more difficult inequalities.

Theorem 4.3 (Trivial Inequality). If x is any real number we have

x2 ≥ 0

with equality holding if and only if x = 0.

1
Everaise Academy (2020) Math Competitions II

More generally, if x1 , x2 , ..., xn are real numbers,


n
X
x2i ≥ 0.
i=1

Let’s first go over one example of the Trivial Inequality that you’ll all be very familiar with.

Example 4.4. Find the minimum possible value of f (x) = x2 + 4x + 5 as x ranges over all
real values.

Solution. This looks pretty similar to the squared term (x + 2)2 = x2 + 4x + 4 but the constant
term is different. That makes it a good candidate for completing the square. Doing this gives
us that our expression is equal to
(x + 2)2 + 1
and as (x + 2)2 is a squared term, we know that it’s greater than or equal to 0. Using this gives
us that
(x + 2)2 + 1 ≥ 1.
Also note that this must be the minimum value as x = −2 (to make x + 2 equal to 0!) gives us
that the expression is equal to 1.
So the minimum value for this expression is 1. 

Exercise 4.5. What is the minimum value of x2 − 2x + y 4 − 16y 2 ? When does this minimimum
occur?

Exercise 4.6. What is the minimum value of x2 − 2x + y 4 + 16y 2 ? When does this minimum
occur?

Let’s move onto some harder problems.

Example 4.7. Prove that for all real numbers a, b, c

3(a2 + b2 + c2 ) ≥ (a + b + c)2 ≥ 3(ab + bc + ca).

Solution. Let’s prove the first portion of the inequality:

3(a2 + b2 + c2 ) ≥ (a + b + c)2 .

To be able to apply the trivial inequality we need two things:


1. We need squared terms, and
2. We need a 0 on one side of the inequality.
While we have squared terms here, using the Trivial Inequality now does not yield any useful
results. Instead let’s try expanding the terms, which gives the equivalent form

3a2 + 3b2 + 3c2 ≥ a2 + b2 + c2 + 2ab + 2bc + 2ca,

which reduces further to


2a2 + 2b2 + 2c2 ≥ 2ab + 2bc + 2ca.

2
Everaise Academy (2020) Math Competitions II

Now we seem to be getting somewhere! These terms bear some resemblance to the expansion
of quadratics like (a − b)2 = a2 − 2ab + b2 ≥ 0. However, this only has one term of the form 2ab.
We know the other two can be found in the expansions of (b − c)2 and (c − a)2 , so what if we
try summing these three together? By the trivial inequality,

(a − b)2 + (b − c)2 + (c − a)2 ≥ 0,

which after expansion gives

2a2 + 2b2 + 2c2 − 2ab − 2bc − 2ac ≥ 0,

which is the desired inequality. It remains for us to show that

(a + b + c)2 ≥ 3(ab + bc + ca).

We expand out the left hand side again to get

a2 + b2 + c2 + 2(ab + bc + ca) ≥ 3ab + 3bc + 3ca.

which we can simplify as


a2 + b2 + c2 ≥ ab + bc + ac
which is the inequality we proved earlier!
As you can tell, sometimes it’s advantageous to expand terms, as we can obtain certain
manipulable forms which we can deal with using simple techniques like the Trivial Inequality. 

Example 4.8 (AM-GM for 2 variables). Prove that for any positive reals a and b we must
have
a+b √
≥ ab.
2

Solution. The form we have the inequality in at the moment doesn’t seem the easiest to work
with. If possible, it’d be nice to have all the variables on one side of the equation as then we’re
just proving that something is greater than 0, which we can do by the trivial inequality.
That motivates us to re-write the equation as

a − 2 ab + b ≥ 0.

We then notice that this seems similar to the expansion for (x − y)2 , which motivates us to
re-write the left-hand side as √ √ 2
a− b .

By the trivial inequality, this is greater than 0, so we are done.




It’s important to note that we could only take the square roots of a and b as they were both
positive. This inequality wouldn’t hold if both of them were negative, for example!

3
Everaise Academy (2020) Math Competitions II

Remark. In an Olympiad it’d be optimal to write the process in the opposite direction, so
the solution would look more like the following:
√ √
Notice that we can substitute x = a − b to the trivial inequality, so we have
√ √ a+b √
( a − b)2 ≥ 0 ⇒ ≥ ab.
2

Namely, manipulating inequalities that we want to show true isn’t always correct: re-
member that not all steps are reversible!

Exercise 4.9 (QM-AM in 2 variables). Prove that


r
a2 + b2 a+b

2 2
for all positive real numbers a and b. Carefully justify each step along the way and write it up
in the way outlined above.

Example 4.10 (British MO 2009). Find all integers x,y and z such that

x2 + y 2 + z 2 = 2(yz + 1)

and
x + y + z = 4018.

Solution. This is a strange system of equations (especially as it’s in 3 variables) and there
doesn’t seem to be an obvious line of attack. It would be nice if we could somehow put
some bounds on the variables, so we could reduce this down to casework. This is where using
inequalities could be useful!
The 2yz term looks promising. If we move it the left-hand side we get

y 2 − 2yz + z 2 + x2 = 2

which is equivalent to
0 ≤ (y − z)2 + x2 = 2
by the trivial inequality. So 0 ≤ x2 ≤ 2 and 0 ≤ (y − z)2 ≤ 2.
This gives us that x2 and (y − z)2 , as squares of integers, are both equal to 0 or 1. They have
to sum to 2 so both of them are equal to 1.
Then x = 1 or x = −1 and y = z + 1 or z = y + 1. We’ll deal with the x = 1, y = z + 1 case
here (the other cases will be identical!) which gives us

1 + (z + 1) + z = 4018

and then we can rearrange to find z to get

z = 2008

so the solution will be x = 1, y = 2009, z = 2008.

4
Everaise Academy (2020) Math Competitions II

Doing the other three cases will again only take subbing in some values and rearranging - the
hard part of the problem was done once we’d managed to bound ourselves to 2 values for each
part. The takeaway is that the trivial inequality took us from something we didn’t know how to
solve (a system with 3 variables) to something we can use methods we’ve previously developed
for. 

Remark. Inequalities have plenty of applications outside of just proving other inequalities!

Example 4.11 (Canada 2012). Let x, y, z be positive real numbers. Show that

x2 + xy 2 + xyz 2 ≥ 4xyz − 4

Solution. It’d be easy to get intimidated by this inequality — it has 3 variables and it looks
a lot more complicated than anything we’ve seen so far. However, many inequalities (such as
this one) can be solved by doing many simple steps, one at a time; don’t be scared off!
The equation looks like it will be easier to deal with if we move all the terms onto one side,
so we only have to prove that something is at least zero. This gives us

x2 + xy 2 + xyz 2 − 4xyz + 4,

which we want to prove is greater than or equal to 0.


We then want to create some squared terms, so that we can apply the trivial inequality.
Let’s deal with all the terms that have z in first, as z only appears in terms together with x
and y so it should be the easiest to isolate. These terms are

xyz 2 − 4xyz = xy(z 2 − 4z).

We could also remove a factor of z, but we’re looking for squared terms, so this will likely
not be useful. Is there anything that would help us turn this into a squared term?
Well, we know that
z 2 − 4z + 4 = (z − 2)2 ≥ 0,
so adding 4xy to get xy(z 2 − 4z) + 4xy = xy(z 2 − 4z + 4) does the trick, as x and y are originally
positive reals. Of course, to ensure that we are not doing anything illegal with our original
inequality, we must also subtract 4xy, meaning we want to prove

x2 + xy 2 + xyz 2 − 4xyz + 4 + 4xy − 4xy ≥ 0


x2 + xy 2 − 4xy + 4 + xy(z 2 − 4z + 4) ≥ 0
x2 + xy 2 − 4xy + 4 + xy(z − 2)2 ≥ 0.

So far so good! Now it is enough to show that x2 + xy 2 − 4xy + 4 ≥ 0, as the last term on the
left-hand side xy(z − 2)2 is always positive by the trivial inequality.
If we want to apply the trivial inequality again, we’ll need to find some more terms that we
can turn into squares. But this should look quite similar to before. Notice that y now only
appears in terms together with x, just like z did with xy before. Let’s look at the terms

xy 2 − 4xy.

5
Everaise Academy (2020) Math Competitions II

Notice that we can factor out x to get

x(y 2 − 4y),

which looks a lot like


x(y 2 − 4y + 4),
which would be a squared term.
So we use the same trick again! Adding 4x − 4x to the left hand side of our inequality gives
us

x2 + xy 2 − 4xy + 4 + 4x − 4x + xy(z − 2)2 ≥ 0


x2 − 4x + 4 + x(y 2 − 4y + 4) + xy(z − 2)2 ≥ 0
x2 − 4x + 4 + x(y − 2)2 + xy(z − 2)2 ≥ 0
.

The term x(y − 2)2 is non-negative by the trivial inequality, so all that is left are the terms with
only x. But these terms are just (x−2)2 so all we need to show is (x−2)2 +x(y−2)2 +xy(z−2)2 ≥
0. But this is true by the trivial inequality, so we are done!

Remark. Notice how each time, we figured out which term was going to be the easiest to
work with and looked at that. This method wouldn’t have worked as well had we tried to
look at y as the first variable, for example. In general, it’s good to try isolate variables
that only appear by themselves or only appear a few times as these are likely to be the
easiest to work with.

If we were writing this solution up in an olympiad, it would be better to write it as: Move
all the terms over to the left-hand side, then the inequality we want to prove is

x2 + xy 2 + xyz 2 − 4xyz + 4 ≥ 0

The expression on the left-hand side is equivalent to

xy(z − 2)2 + x(y − 2)2 + (x − 2)2

which, by the trivial inequality (and the fact that x, y are positive), is greater than zero so we’re
done.
Equality holds if and only if x = y = z = 2. 

Exercise 4.12. What is the maximum value of 6zy 2 − 24yz + 24z − y 2 z 2 + 4yz 2 − 4z 2 − 9y 2 +
36y − 36? When does this occur?

Example 4.13. Let a, b, c be positive real numbers. Prove that


 
1 b 1 c 1 a
max + , + , + ≥ 1.
a 4 b 4 c 4

Solution. We would like to use the trivial inequality here. Suppose we could somehow get
terms of the same variable together — after all, it’s a bit hard to deal with a1 + 4b by itself so
it’d be nice if we had a1 + a4 instead.

6
Everaise Academy (2020) Math Competitions II

What could we do if we had that? Well, 4 and 1 are both square numbers so maybe we could
rearrange this to get something squared. Take x1 + x4 for x a positive real number. If we multiply
both sides by 4x, which we can do as x is positive, we get

x2 + 4.

We know that this is greater than 0 by the trivial inequality, but it’d be useful if we could
get something stronger. What if we could make this into a larger squared term?
Notice that this looks a lot like x2 − 4x + 4 = (x − 2)2 ≥ 0. If we move the 4x term to the
right-hand side we get the inequality
x2 + 4 ≥ 4x
which can be divided by 4x (as it’s positive) to get
x 1
+ ≥ 1.
4 x

This is promising. To use this inequality, we need to have terms with the same variable
together, which we can get just by adding the 3 terms a1 + 4b , 1b + 4c , and 1c + a4 . This gives
           
1 b 1 c 1 a 1 a 1 b 1 c
+ + + + + = + + + + +
a 4 b 4 c 4 a 4 b 4 c 4
≥ 1 + 1 + 1 = 3.

This is incredibly useful since it allows us to conclude that


       
1 b 1 c 1 a 1 b 1 c 1 a
3 max + , + , + ≥ + + + + +
a 4 b 4 c 4 a 4 b 4 c 4
≥ 3,

which immediately implies the desired result. Equality holds if a = b = c = 2 as stated from
the Trivial Inequality. 

Remark. When dealing problems involving either max(a, b, c) or min(a, b, c), it is often
useful to consider things like sum or product of all three terms instead of thinking how to
handle it alone. As in the previous example, we used the fact that x + y + z ≥ 3 to prove
that max(x, y, z) ≥ 1. This works as we can see that,

3 max(x, y, z) ≥ x + y + z ≥ 3.

A similar method can be used for the min function and product as well. As an example,
suppose you have xyz ≤ 27. Then,

min(x, y, z)3 ≤ xyz ≤ 27.

Therefore, we have min(x, y, z) ≤ 3.


You might have noticed that we could also do this the other way round, with max and
product and min and sum, but you’ll see why this is less useful as you work through the
next section.

Exercise 4.14 (UK MOG 2012). The numbers a, b and c are real. Prove that at least one of
the three numbers (a + b + c)2 − 9bc, (a + b + c)2 − 9ca and (a + b + c)2 − 9ab is non-negative.

7
Everaise Academy (2020) Math Competitions II

§4.3 AM-GM Inequality

Theorem 4.15 (AM-GM Inequality). For positive real numbers a1 , a2 , . . . , an ,


a1 + a2 + · · · + an √
≥ n a1 a2 . . . an
n
with equality holds if and only if a1 = a2 = ... = an .

Remark. We won’t be proving this. The most famous proof of AM-GM is by Cauchy
Induction, which works by proving the case of n = 2, n → 2n and n → n − 1. You can
try this on your own!

Let’s start with some straightforward application of AM-GM:

1
Example 4.16. Find the minimum value of x + x where x ranges over all positive reals.

Solution. We can just directly apply AM-GM, with a1 = x, a2 = x1 :


r
1 1
x + ≥ 2 x · = 2.
x x

In retrospect, we can note that this was a good thing to do as the x and x1 term cancelled.
In general, when we’re finding upper and lower bounds we want to get something that’s not in
terms of x so we want things that will cancel when we multiply or add. This will allow us to
use AM-GM. For the rest of the examples, it’s useful to keep in mind that, to use AM-GM, we
want stuff to cancel.
1
Equality holds when 0 < x = x which is at x = 1. 

p
3
Example 4.17. Find the maximum value of (3 − a − b)ab for any positive reals a, b such
that a + b < 3.

Solution. This also looks like a pretty direct application of AM-GM. However, to apply AM-
GM we need all our variables to be positive, which we should first check.
Notice that since a + b < 3, we then have 3 − (a + b) > 0. Therefore, (3 − a − b), a, and b are
all positive reals.
We are then ready to apply AM-GM on (3 − a − b), a and b:
p
3 (3 − a − b) + a + b
(3 − a − b)ab ≤ =1
3

Equality holds when 3 − a − b = a = b, which is when a = b = 1.


p
So the maximum value of 3 (3 − a − b)ab is 1. 

8
Everaise Academy (2020) Math Competitions II

Remark. It’s important to check that equality holds as otherwise there could be another
way of manipulating the inequality to get a tighter bound. This’ll become more important
as we move on to more complicated problems.


3
Exercise 4.18. If 3ab = 3, prove that a + b ≥ 6. When does equality hold?

9x2 sin2 x+4


Exercise 4.19 (AIME 1983). Find the minimum value of x sin x for 0 < x < π.

Example 4.20 (Russia 1995). Let x and y be positive real numbers. Prove that
1 x y
≥ 4 2
+ 4 .
xy x +y y + x2

Solution. This doesn’t initially look like an easy application of AM-GM. We’ve got sums in
the denominators and these don’t seem to be that easy to work with — it’d be nice if we could
somehow have the summed terms separate from the fractions.
We could multiply out by both denominators on the right-hand side and then try and simplify
the resulting inequality. This would probably work, but it would certainly be quite tedious. How
about we consider both fractions separately?
For the first fraction, we have the denominator x4 + y 2 . If we apply AM-GM to this, we get

x4 + y 2 ≥ 2x2 y.

Now if we divide both sides by x4 + y 2 we get

2x2 y
1≥
x4 + y 2
which looks pretty similar to the fraction that we want. In fact, if we divide out by 2xy, we get
exactly the fraction that we want! This gives us
1 x
≥ 4 .
2xy x + y2

Looking good! Now let’s do the same thing with the other fraction. Applying AM-GM to
y4 + x2 gives us
y 4 + x2 ≥ 2y 2 x
and we can divide both sides by y 4 + x2 then 2xy, as we did for the other fraction, to get
1 y
≥ 4 .
2xy y + x2

Adding the two inequalities we have gives us


x y 1 1 1
+ ≤ + = ,
x4 + y 2 y 4 + x2 2xy 2xy xy
as desired. 

9
Everaise Academy (2020) Math Competitions II

Remark. Note that we did all this because we had sums in the denominators. In general,
this is a difficult thing to deal with in inequalities so we’ll almost always want to use some
sort of technique that allows us to consider the sum separately first.

Exercise 4.21. In the above example, when is equality reached?

You might notice that most equalities are reached when all of the variables are the same. But
here are some trickier applications of AM-GM where equalities don’t necessarily hold when all
of the variables are the same value:

3
Example 4.22. Determine the minimum value of a3 + a where a ranges over all positive
reals.


Solution. Directly using AM-GM won’t give us anything useful: a3 + a3 ≥ 2a 3. We still have
the minimum in terms of a which means that it’s going to be difficult to understand how it
behaves. It would be easier if we could just get a minimum with no terms of a in by getting the
terms in the product to cancel.
3
This motivates us to break a apart. Now, we have
s  3
3 3 3 1 1 1 4 3
1
a + =a + + + ≥4 a · = 4.
a a a a a

Equality holds when a = 1. 

Remark. Remember to check whether equality holds or not!

Exercise 4.23. If a, b and c are positive reals and a + b + c = 4, what is the maximum value
of a2 bc5 ? When does this maximum occur?

Exercise 4.24 (UK MOG 2014). What is the minimum value of

a2 b a
+ 2+
b c c
where a, b and c are positive real numbers? When does this minimum occur?

Example 4.25. Determine the minimum value of


27
a+
(a − b)b

where a > b are positive reals.

Solution. Okay, this seems weird. But let’s remember that to apply AM-GM, we want to have
a term that can cancel the term (a − b)b. We could just add in the term b(a − b) to cancel that
but then we’d need to subtract this again at the end, leaving variables in the minimum, and we
still haven’t cancelled the a term. Is there something else that we could do instead?

10
Everaise Academy (2020) Math Competitions II

Well, how about multiplying it by b and a − b? This still cancels the terms and, even better,
the two terms add up to a. So our initial expression could actually be rewritten as
27
(a − b) + b + .
(a − b)b
Then, by AM-GM,
s
27 27 27
a+ = (a − b) + b + ≥ 3 3 (a − b) · b · =9
(a − b)b (a − b)b (a − b)b

Equality holds when (a, b) = (6, 3) since


• a − b = b, this gives us a = 2b.
• b= 27
(a−b)b = 27
b2
. This gives us b = 3.


Remark. Another reminder that we always want terms to cancel!

AM-GM also has versatile applications in problems that at first-glance don’t appear to be
related to inequalities whatsoever. Frequently, considering the equality conditions reveals im-
portant relationships between variables. This can help you find solutions to equations in a
similar way to example 4.6.

Example 4.26 (Britain 1996). Find all positive real solutions to the system of equations
given by a + b + c + d = 12 and abcd = 27 + ab + ac + ad + bc + bd + cd.

Solution. Again, we note that this is an equation in 4 variables so it’s unlikely our usual tech-
niques for solving equations will work. But we can also note that the equations are symmetric
(and all the variables are positive), which means that they’ll probably be a good candidate for
AM-GM. Any inequality we get from AM-GM would be able to help us bound possible values
of the variables.
By AM-GM on the first equation,

4
12 = a + b + c + d ≥ 4 abcd.

Divide this out by 4 to get √


4
3≥ abcd.
We can then take everything to the 4th power, as all the variables are positive, giving

81 ≥ abcd.

If we do AM-GM directly on right-hand side of the second equation, the constant term could
make things rather ugly, as we then have 7th roots. Instead, we’ll do it on all the other terms,
then add 27 on to both sides at the end, giving us a cleaner expression as a result.
Doing this gives us √
6
ab + ac + ad + bc + bd + cd ≥ 6 a3 b3 c3 d3 ,
and combining this with the given equation gives us:

abcd − 27 ≥ 6 abcd.

11
Everaise Academy (2020) Math Competitions II

Squaring this inequality gives us

a2 b2 c2 d2 − 54abcd + 272 ≥ 36abcd

which can be re-arranged to give us

(abcd − 9)(abcd − 81) ≥ 0.

Now we know that either both of these terms are non-negative or both are non-positive. But
abcd ≥ 27 by the second equation (as all variables are positive), so abcd − 9 is positive. This
means that abcd − 81 is non-negative. 81 ≥ abcd by the first equation so, combining these, we
must have abcd = 81.
Note that for this value to be possible we needed both inequalities to actually be equalities.
With AM-GM, equality in both inequalities is obtained if and only if a = b = c = d. In this
case, the solution is a = b = c = d = 3. 

To end this section, here’s a more difficult max-min type inequality that involves the structure
of a sequence.

Example 4.27 (India IMO TST Practice Test 2018). Let an , bn be sequences of positive reals
such that
1
an+1 = an +
2bn
1
bn+1 = bn +
2an
for all n ∈ N. Prove that, max(a2018 , b2018 ) > 44.

Solution. This seems intimidating. But this should be easier after you’ve done Example 4.7!
We’re going to use the same trick here, where we consider a2018 b2018 and prove that this is
greater than 442 .
We should also note that the number 2018 is fairly arbitrary, so we can probably replace it
with the constant n and prove a more general result, then move back to the specific case later.
While this may seem to make the problem harder, considering this as generally as possible will
allow us to see more of the structure of the problem and may make things easier to prove.
So let’s consider an bn for each n. This gives us
an bn 1
an+1 bn+1 = an bn + + + .
2bn 2an 4an bn

We’d probably like to simplify this some more. The two middle terms look quite similar and
would also cancel if we multiplied them, so let’s try doing AM-GM on just those terms.
an bn
Using AM-GM on 2bn + 2an we get

an bn
+ ≥1
2bn 2an
which gives us the combined inequality of
1
an+1 bn+1 ≥ an bn + +1
4an bn

12
Everaise Academy (2020) Math Competitions II

Here our instincts tell us to use AM-GM on an bn and 4an1 bn to cancel them, but this turns
out not to be very helpful, because we just get an+1 bn+1 ≥ 2 for all n ≥ 1.
This is of course useless for proving that a2018 b2018 > 1936, but we’ll keep our simpler in-
equality in mind in case it becomes useful for something else.
Well what other bound would be useful instead? In fact, the following simpler inequality
turns out to be very helpful:
1
an bn+1 ≥ an bn + + 1 > an bn + 1.
4an bn
Because of our seemingly less useful inequality, we have a2 b2 ≥ 2, which then allows us to get
an bn ≥ n by induction. This gives us

max(a2018 , b2018 )2 ≥ a2018 b2018 ≥ 2018 > 1936

which is equivalent to max(a2018 , b2018 ) > 44.




13
Everaise Academy (2020) Math Competitions II

§4.4 Homework Problems

Problem 4.1. [3] Find all positive real solutions to the equation
x8 + y 8 − 2xy = 6(xy − 1).

Problem 4.2 (British MO 1996). [4] Let a, b and c be positive real numbers.
Prove that
4(a3 + b3 ) ≥ (a + b)3 .
Also prove that
9(a3 + b3 + c3 ) ≥ (a + b + c)3 .

Problem 4.3 (Nesbitt’s inequality). [5] Prove that, for all positive real numbers a, b and c,
a b c 3
+ + ≥ .
b+c a+c a+b 2
Problem 4.4 (JBMO Shortlist 2012). [6] Let a, b, c be positive real numbers such that abc = 1.
Show that
1 1 1 (ab + bc + ca)2
+ + ≤ .
a3 + bc b3 + ca c3 + ab 6
Problem 4.5 (Singapore MO Junior, modified). [6] Let a > b > 0. Determine the minimum
value of
√ 3 3
2a +
ab − b2
Problem 4.6 (IMO 2012). [7] Let a1 , a2 , ..., an be positive real numbers such that a1 a2 ...an = 1.
Prove that
(a2 + 1)2 (a3 + 1)3 ...(an + 1)n > nn .

Problem 4.7 (Czech/Slovak Match 2005). [8] Let a, b, c be positive real numbers such that
abc = 1. Prove that
a b c 3
+ + ≥ .
(a + 1)(b + 1) (b + 1)(c + 1) (c + 1)(a + 1) 4
Problem 4.8 (Serbia 2005). [10] Let a, b, c be positive real numbers such that a + b + c = 3.
Prove that √
√ √
a + b + c ≥ ab + bc + ca.

Problem 4.9 (Mathematical Reflections). [8] Let a, b, c be positive real numbers. Prove that
1 1 1 1 2
 
1 1 1
+ + ≤ + + .
2a2 + bc 2b2 + ca 2c2 + ab 9 a b c

Problem 4.10 (Mathematical Reflections). [8] Let x, y, z be positive real numbers with x ≤
2, y ≤ 3 and x + y + z = 11. Prove that xyz ≤ 36.

Problem 4.11 (Ukraine 2001). [10] Let a, b, c, x, y, z be positive real numbers such that x +
y + z = 1. Prove that
p
ax + by + cz + 2 (ab + bc + ca)(xy + yz + zx) ≤ a + b + c.

Problem 4.12 (USAJMO 2014). [7] Let a, b, c be real numbers greater than or equal to 1.
Prove that
10a2 − 5a + 1 10b2 − 5b + 1 10c2 − 5c + 1
 
min , , ≤ abc
b2 − 5b + 10 c2 − 5c + 10 a2 − 5a + 10

14
5 Recurrence Relations

§5.1 Definitions

We’re going to start by introducing some terminology that we’ll use throughout the handout.
We’ll also look at several examples of sequences of real numbers {an }n≥0 together with the
recurrence relations that define them.

Definition 5.1. A recurrence relation is a formula that tells us how to calculate a term in
the sequence, an , by using previous terms from the sequence.

Some examples of recurrence relations could include an+1 = 2a2n + 3, an+1 = 2an + 8an−1 , or
even just an+1 = an . In each of these if we knew all the previous terms of a sequence then we’d
have a way to calculate the next term. Another well known recurrence relation is the formula
for the Fibonacci numbers, Fn+1 = Fn + Fn−1 . It’s a good idea to keep these four examples in
mind as we’ll be referring to them throughout the first two sections of the handout.

Definition 5.2. For a given recurrence relation, a recurrent sequence is a sequence that
satisfies that relation.

For example, any constant sequence {c} will satisfy the relation an+1 = an as all the terms
of the sequence are equal. The Fibonacci sequence 1, 1, 2, 3, 5, 8, ... is a well-known sequence
satisfying Fn+1 = Fn + Fn−1 and we can check that this sequence works as 2 = 1 + 1, 3 = 2 + 1,
5 = 3 + 2 and so on.

Definition 5.3. An initial condition tells us what some number of terms in the sequence
are. The initial conditions should tell us enough terms of the sequence to uniquely identify the
sequence.

For example, we might have the recurrence an+1 = 2an with the initial condition a0 = 1
(which would generate the sequence 1, 2, 4, 8, . . . ) or the recurrence an+1 = an + an−1 with the
initial conditions a1 = 1, a4 = 5 (which generates the sequence 1, 1, 2, 3, 5, . . . ).

Remark. To uniquely identify a sequence, we need at least as many initial conditions as


there are terms that an depends on. an+1 = an + an−1 would need 2 values for the initial
conditions and a relation like an+1 = an an−1 an−2 would need at least 3 values.

We can gain a sense of why this is true by changing the initial conditions for one of the
examples above — if we have an+1 = an + an−1 with initial conditions a1 = 1 (same as before),
a4 = 9 then we get the sequence 3, 1, 4, 5, 9, . . . . Hence we can see that one condition wasn’t
enough, we needed the second value to know which sequence we were dealing with.

Definition 5.4. A recurrence relation is homogeneous if it doesn’t contain any constant


terms. Otherwise, it’s inhomogeneous.

For example, an+1 = 4an is homogeneous but an+1 = a5n + 3 and an+1 = an + 2an−2 + 3 are
inhomogeneous as they both contain the constant term +3.

1
Everaise Academy (2020) Math Competitions II

Exercise 5.5. Which of our original 4 examples were homogeneous? Which were inhomoge-
neous?

§5.2 Linear Recurrences

To define a linear recurrence, we’re going to start by looking at the definition of a linear
combination.

Definition 5.6. Given a set of variables x1 , x2 , . . . , xn , a linear combination of the variables


is of the form
c1 x1 + c2 x2 + · · · + cn xn
where c1 , . . . , cn are real numbers.

For example, x, x + y, 2x + 3y and πx + ey would all be examples of linear combinations of


x and y.
Now we can define what a linear recurrence is.

Definition 5.7. A linear recurrence is a recurrence relation where an+1 is expressed as a


linear combination of previous terms of the sequence.

Remark. Technically a linear recurrence can also contain a constant term. These tend to
be called inhomogeneous linear recurrences. For the rest of this section and the next, we’re
only going to deal with homogeneous linear recurrences as these are easier to solve and
work with. Later we’ll talk about techniques for turning inhomogeneous linear recurrences
in to homogeneous ones!

Examples of linear recurrences include an+1 = an , an+1 = 2an + an−1 + 3an−2 and an+1 =
πan + ean−4 .

Exercise 5.8. Using this definition, which of our 4 previous examples are also examples of a
linear recurrence?

The first part of this handout is mostly going to focus on techniques to find sequences that
satisfy a given linear recurrence (finding solutions of a linear recurrence).
Now we’re going to look at a very important property of the solutions of linear recurrences
that will be helpful when we discuss explicit forms in the next section.

Proposition 5.9. Let {an } and {bn } both be solutions to a linear recurrence (without
initial conditions). Then any linear combination of {an } and {bn } is also a solution to the
recurrence.

Before we prove this, we’re going to look at an example. Let’s take another look at the
recurrence an+1 = 2an + 8an−1 .

Exercise 5.10. By plugging in an−1 = 4n−1 , an = 4n and an+1 = 4n+1 , check that {an } = {4n }
is a solution to the recurrence. Use the same method to prove that {(−2)n } is also a solution.

2
Everaise Academy (2020) Math Competitions II

We now have two solutions to the linear recurrence. If our proposition is true, we’ll also have
that any linear combination of these two solutions will work.
Let’s try and see if the linear combination 3 · (−2)n + 4n satisfies the recurrence relation. Note
that an+1 = 3 · (−2)n+1 + 4n+1 , 2an = 6 · (−2)n + 2 · 4n and 8an−1 = 24 · (−2)n−1 + 8 · 4n−1 . We
can use this to get that

2an + 8an−1 = 6 · (−2)n + 2 · 4n + 24 · (−2)n−1 + 8 · 4n−1


= −12 · (−2)n−1 + 8 · 4n−1 + 24 · (−2)n−1 + 8 · 4n−1
= (−12 + 24) · (−2)n−1 + (8 + 8) · 4n−1
= 12 · (−2)n−1 + 16 · 4n−1
= 3 · (−2)n+1 + 4n+1
= an+1 .

So we have that {3 · (−2)n + 4n } is also a solution which matches with what the proposition
said should be true.
We’re going to move on to prove the proposition now but it’s a worthwhile exercise to spend a
little time thinking about how we could modify the method we used above to prove the theorem.

Proof. Express the recurrence relation as

xn+1 = c0 xn + c1 xn−1 + · · · + ck xn−k .

Note that, by the definition of a solution, we have that

an+1 = c0 an + c1 an−1 + · · · + ck an−k

and
bn+1 = c0 bn + c1 bn−1 + · · · + ck bn−k
for all n ≥ k.
Take a linear combination of {an } and {bn }, denoting it {yn }. Now any linear combination
of an and bn can be represented as ran + sbn for some r, s ∈ R so we can say yn = ran + sbn .
But we can take r times the first equation and s times the second equation which, added
together, gives us

yn+1 = ran+1 + sbn+1


= r(c0 an + c1 an−1 + · · · + ck an−k ) + s(c0 bn + c1 bn−1 + · · · + ck bn−k )
= c0 (ran + sbn ) + c1 (ran−1 + sbn−1 ) + · · · + ck (ran−k + sbn−k )
= c0 yn + c1 yn−1 + · · · + ck yn−k

for all n ≥ k.
And this is exactly the definition of {yn } being a solution to the recurrence. So any linear
combination of 2 solutions is also a solution. 

§5.3 Explicit Forms and Characteristic Polynomials

So far we’ve just been talking about recurrent sequences in a general sense, but we can’t just
use the recurrence to calculate every term in a sequence as that’d take much too long. It would

3
Everaise Academy (2020) Math Competitions II

be really convenient if we could immediately calculate the nth term for any linear recurrence
without calculating every single term leading up to it, wouldn’t it? It turns out that we can —
before we tell you how, though, let’s work through some examples to see where the intuition
for this cure-all formula came from.

Example 5.11. Let an≥0 be a sequence such that a0 = 1 and an+1 = 2an . Find an explicit
form for an .

Solution. Testing out the first few values, we get that a1 = 2, a2 = 4, and a3 = 8. By now, it
should be clear that an = 2n for any n. We’re going to prove that’s the case now.
Note that for it to be a solution to the recurrence relation with the initial conditions, we need
to have an+1 = 2an for all n ≥ 0 and a0 = 1. Verifying our sequence, we see that a0 = 20 = 1,
and an+1 = 2n+1 = 2 · 2n = 2an , so both conditions are satisfied.
How do we know this is the only solution? Well each term is uniquely determined by the
term before, so if we know a0 we know every term in the sequence. So only one sequence works
and, as our sequence works, our sequence must be the only solution. 

Remark. Notice that if the problem gave an initial condition of a0 = c for an arbitrary
constant c, our general form would be an = c · 2n instead. Since we can scale the solution
sequence by any constant factor of c without violating the relation, the initial conditions
are, in a sense, what tells us how much to scale the sequence by to find the unique solution
to a problem.

Let’s tackle a slightly less obvious recurrence problem now.

Example 5.12. Let an≥0 be a sequence such that a0 = x, a1 = y and an+1 = 5an − 6an−1 .
Find an explicit form for an if
1. x = 1, y = 2
2. x = 1, y = 3
3. x = 1, y = 4.

Solution. We provide a solution sketch to each of the three parts:


1. Time to test out some values again: plugging things in, we get that a2 = 4, a3 = 8,
and a4 = 16. It seems like it’s powers of 2 all over again, but it’s much less obvious this
time! Verify for yourself that an = 2n is a solution to this problem by checking the initial
conditions and simplifying the equation after plugging the explicit value for an into the
relation.
2. More testing! Plugging things in gives a2 = 9, a3 = 27, and a4 = 81. This time it seems
like it’s powers of 3 — verify for yourself that an = 3n works.
3. If we try to plug values in again, we’re probably not going to get anywhere. a2 = 14,
a3 = 46, and a4 = 146 doesn’t really ring any bells, after all. Let’s take a look at what
we can do. Ignoring the initial conditions for now, we know that from our work above,
an = 2n and bn = 3n are both sequences that satisfy the given relation. Because the
relation is linear, we also know that dn = c1 an + c2 bn is valid for any constants c1 and c2 !

4
Everaise Academy (2020) Math Competitions II

Now, we can use the initial conditions to tweak c1 and c2 to determine the unique solution
to our recurrence. Plugging in n = 0, we get that c1 · 20 + c2 · 30 = 1, while n = 1 gives us
c1 · 21 + c2 · 31 = 4. We get that c1 = −1 and c2 = 2, so our solution is dn = 2 · 3n − 2n .
Verify for yourself that this explicit form works.


It turns out that the only “simple” solutions to the recurrence relation above (ignoring initial
conditions) are an = 2n and an = 3n — all the others are some linear combination of these two.
The reason this is the case is because 2 and 3 are the roots of the characteristic polynomial
of the relation an+1 = 5an − 6an−1 .

Definition 5.13. Let an be a sequence of real numbers and cn , cn−1 , . . . , cn−k be real constants.
The characteristic polynomial of the relation an+1 = cn an + cn−1 an−1 + · · · + cn−k an−k is
given by
P (x) = xk+1 − cn xk − cn−1 xk−1 − · · · − cn−k .
For example, the characteristic polynomial of an+1 = 5an − 6an−1 is x2 − 5x + 6.

Remark. The characteristic polynomial for a recurrence relation is unique - given a recur-
rence relation we can say what its characteristic polynomial is and vice-versa.

With this definition, we can introduce a powerful theorem and a corresponding formula.

Theorem 5.14. Let P (x) be the corresponding characteristic polynomial of the recurrence
relation an+1 = cn an + cn−1 an−1 + · · · + cn−k an−k , where cn−k = 0 For any root r of P ,
the sequence an = rn satisfies the given relation.

Proof. Because r is a root, we can plug it in to the polynomial to get that


rk+1 − cn rk − cn−1 rk−1 − · · · − cn−k = 0.
Multiplying everything by rn−k and rearranging the terms, we get that
rn+1 = cn rn + cn−1 rn−1 + · · · + cn−k rn−k .
This is exactly the condition for an = rn to be a solution to the recurrence equation so we’re
done. 

Using the fact that linear combinations of solutions are also solutions, we’re now ready to
solve any homogeneous linear recurrence relation problem.

Theorem 5.15. If the roots r0 , r1 , . . . , rk of the characteristic polynomial are all distinct,
then the solution to the recurrence an+1 = cn an + cn−1 an−1 + · · · + cn−k an−k with initial
conditions a0 = x0 , a1 = x1 · · · ak = xk is

an = c00 r0n + c01 r1n + · · · + c0k rkn

where c00 , c01 , . . . c0k are constants such that the initial conditions are satisfied.

This is just a direct application of Theorem 5.14 together with the result about linear com-
binations of solutions.

5
Everaise Academy (2020) Math Competitions II

Remark. There’s no clean way to represent c00 , c01 , . . . c0k — it simply just amounts to just
solving a system of linear equations.

You might’ve noticed the caveat that we have in our general formula — the roots of the
characteristic polynomial need to be distinct. Let’s look at an example where this is not the
case.

Example 5.16. Solve xn+1 = 4xn − 4xn−1 with initial conditions x0 = 0 and x1 = 2.

Solution. Testing out the next few values, we see that x2 = 8, x3 = 24, x4 = 64, and x5 = 160.
This isn’t an exponential sequence — we have 3x2 = x3 but 83 x3 = x4 - so it’s going to be a bit
more complicated to spot a solution.
One thing we might notice is that 22 |x2 , 23 |x3 , 24 |x4 and so on. We’ll use this to rewrite the
terms as x2 = 2 · 22 , x3 = 3 · 23 , x4 = 4 · 24 . Now we’re seeing more of a pattern! Let’s guess
that xn = n · 2n .
Verify for yourself that this sequence works by plugging in the explicit form back into the
equation. 

Before, all our recurrence relations were a linear combination of exponential variables. Here,
however, the characteristic polynomial x2 −4x+4 has a double root of x = 2, so it wouldn’t make
sense for the solution sequence to be a linear combination of the roots — after all, c1 · 2n + c2 · 2n
is just (c1 + c2 )2n .
Let’s take another look at the explicit form we found for this recurrence relation. Notice
that we expected terms in the form c1 2n , but we instead got terms in the form c1 n · 2n with
a double root. We won’t prove the result here, but if the characteristic polynomial has a root
r of multiplicity k, then the sequences rn , nrn , n2 rn , . . . , nk−1 rn satisfy the recurrence relation.
Thus, in our example above, our solution sequence must be in the form c1 2n + c2 n2n . In this
example, the given initial conditions yielded c1 = 0 and c2 = 1.

§5.4 Manipulating Recurrence Rules

Though we have a way to solve every homogeneous linear recurrence, we’re far from mastering
recurrences in general. Just like algebraic expressions and equations from the first algebra
handout, we can also use clever techniques such as manipulations and substitutions to solve
general recurrence relations as well.

Example 5.17. If a0 = 20, a1 = 20, find an explicit form for an if


1. an+1 = 2an + 3an−1 + 2020
2. an+1 = 2an + 3an−1 + 2020n,

Solution. As before, we’ll approach parts separately.


1. This is almost a homogeneous linear recurrence, but there’s an annoying term in both
relations added at the end. If we could somehow get rid of that, solving this problem
would be a piece of cake. To do so, we use a technique called index shifting, where we

6
Everaise Academy (2020) Math Competitions II

mess around with the indices of the recurrence relation to yield some important hidden
properties.
Since an+1 = 2an + 3an−1 + 2020 holds for all n, an = 2an−1 + 3an−2 + 2020 must be true
as well. Subtracting these two equations, we end up with an+1 − an = 2an + an−1 − 3an−2 .
After rearranging the terms, we obtain the relation an+1 = 3an + an−1 − 3an−2 , which
must also hold true for all n.
By just shifting the indices and manipulating the resulting expressions, we’ve now come up
with a much simpler yet equivalent recurrence relation! Note that, however, the relation
depends on the last three terms instead of the last two terms now, so we need an extra
initial condition. But this is easy — we can simply compute a2 from what we were given.
The characteristic polynomial of this relation is x3 − 3x2 − x + 3, which has roots −1, 1, 3.
This tells us that an = c1 (−1)n + c2 1n + c3 3n . Using the fact that the initial conditions
are a0 = 20, a1 = 20, and a2 = 2120, we can get the three equations

20 = c1 + c2 + c3

20 = −c1 + c2 + 3c3
and
2120 = c1 + c2 + 9c3 .
We have 3 equations and 3 variables so we can solve for the ci to get that
525 525 n
an = · (−1)n + · 3 − 505
2 2
2. We might also try to substitute the variables such that the relation becomes nicer to work
with. Let’s let an = bn + x + yn and try to tweak x and y such that the final term in the
relation, 2020n, miraculously cancels out. Plugging our substitution in, we see that

bn+1 + x + y(n + 1) = 2bn + 2x + 2yn + 3bn−1 + 3x + 3y(n − 1) + 2020n.

We want everything except the bi to cancel out so that we’re left with a nice, homogeneous
linear recurrence relation. This requires

x + yn + y = 5x + 5yn − 3y + 2020n
0 = 4x + 4yn − 4y + 2020n
0 = 4x − 4y + (4y + 2020)n

for all n. From here, we can immediately deduce that x = y = −505.


Thus, an = bn − 505 − 505n, and we get an equivalent relation of bn+1 = 2bn + 3bn−1 with
initial conditions b0 = a0 + 505 + 505 · 0 = 525 and b1 = a1 + 505 + 505 · 1 = 1030. Because
the characteristic polynomial x2 −2x−3 has roots −1, 3, we know that bn = c1 (−1)n +c2 3n .
Using the initial conditions, we can solve for c1 and c2 (as in the last example) to get that
545 1555 n
bn = · (−1)n + ·3 .
4 4
This means that the final answer to our original question is the sequence
545 1555 n
an = · (−1)n + · 3 − 505 − 505n.
4 4


7
Everaise Academy (2020) Math Competitions II

Remark. While we used a different method for each part of the question, both methods will
work for both parts of the question. It’s useful to try switching the approaches, to help
you practice applying them.

It turns out that substitutions are especially useful in solving nonlinear recurrence relations—
the overarching goal is to find a good substitution for the sequence that yields a linear recurrence
relation, which is much easier to work with.

Example 5.18 (2019 HMMT). A sequence of real numbers a0 , a1 , . . . , a9 with a0 = 0, a1 = 1,


and a2 > 0 satisfies
an+2 an an−1 = an+2 + an + an−1
for all 1 ≤ n ≤ 7, but cannot be extended to a10 . In other words, no values of a10 ∈ R
satisfy
a10 a8 a7 = a10 + a8 + a7 .
Compute the smallest possible value of a2 .

Solution. It turns out we can solve for an+2 to make this relation easier to work with. After
doing so, we get that
an + an−1
an+2 = .
an an−1 − 1
tan(α)+tan(β)
This looks suspiciously similar to the tangent addition formula tan(α + β) = 1−tan(α) tan(β) .
Thus, if we let tan(bn ) = an , we get a much simpler relation:

bn+2 = −(bn + bn−1 ).

Now, we know that b0 = 0 and b1 = π4 . For a10 to have no possible value, we require that
b10 ≡ π2 (mod π). Letting b2 = x, we can easily compute the next few values and get that
b10 = 3π π
4 − 2x. We see that x = 8 is the smallest positive value that satisfies our conditions, and
we can check that
√ this value doesn’t cause the sequence to terminate anywhere earlier. Thus,
a2 = tan( π8 ) = 2 − 1. 

Remark. Substituting values using trigonometric functions, known as a trig sub, is actually
quite common and useful. In particular, conditions such as x2 + y 2 = c for some constant
c may call for the substitution x = cos(α) and y = sin(α).

p
Exercise 5.19. Let a1 , a2 , . . . be a sequence such that a1 = 1 and an+1 = a2n + n. Find
a2020 .

To finish off this section, we’re going to look at one more example of index switching, to show
how this algebraic technique can be applied to a more number theoretic problem.

Example 5.20 (British MO 2000). For each positive integer k > 1, define the sequence {an }
by a0 = 1 and
an = kn + (−1)n an−1

8
Everaise Academy (2020) Math Competitions II

for each n ≥ 1. Determine all values of k for which 2000 is a term of the sequence.

Solution. This is technically a (non-homogeneous) linear recurrence but it’s going to be pretty
difficult to deal with the (−1)n term — is there some way we could get rid of this?
Let’s do the same trick as in the first part of Example 5.17. Take

a2n = 2kn + a2n−1

and
a2n+1 = 2kn + k − a2n .
Then we can subtract the second equation from the first to get that

a2n − a2n+1 = 2kn + a2n−1 − 2kn − k + a2n

which will simplify to


a2n+1 + a2n−1 = k.
This is starting to look pretty similar to Example 5.17, so let’s try and solve it in a similar way.

a2n+1 + a2n−1 = k

and replacing n with n + 1 gives us

a2n+3 + a2n+1 = k

so subtracting the first equation from the second gives us

a2n+3 − a2n−1 = 0.

This gives us that a1 = a5 = a9 = . . . and a3 = a7 = a11 = . . . so, if we have a term equalling


2000 in the odd indexed terms, either a1 = 2000 or a3 = 2000.

a1 = k − a0 = k − 1

so if a1 = 2000 then k = 2001. Now a1 + a3 = k so a1 = k − 1 gives us that a3 = 1 so a3 can’t


equal 2000.
Now we’ve shown when an odd indexed term can equal 2020, what about even indexed terms?
Let’s do index switching again but this time we’re going to start with a different set of
equations. Let’s take a look at
a2n = 2kn + a2n−1
and
a2n−1 = 2kn − k − a2n−2 .
We’ll add the two equations to get

a2n + a2n−1 = 4kn − k + a2n−1 − a2n−2

which can be simplified as


a2n + a2n−2 = 4kn − k.
Again, we’ve got a similar situation to Example 5.17 so we’re going to deal with it by index
switching. Replacing n with n + 1 in the above recurrence gives us

a2n+2 + a2n = 4kn + 4k − k

9
Everaise Academy (2020) Math Competitions II

and subtracting the first equation from the second gives us that

a2n+2 − a2n−2 = 4k.

We’ve now got two arithmetic sequences — one of the terms indexed by 2, 6, 10, . . . and the
other of the terms indexed by 4, 8, 12, . . . . Let’s use what we learnt on the first day of the class
to find out when 2000 will appear in one of the sequences.
Note that a2 = 2k + a1 = 3k − 1 and a4 = 4k + a3 = 4k + 1. So solving for the general terms
of the arithmetic sequences gives us that a4n+2 = 3k − 1 + 4nk and a4n+4 = 4k + 1 + 4nk.
Now when can these be equal to 2000? a4n+4 = 4(k + nk) + 1 is always going to be odd so
we can discard this. That leaves us with

a4n+2 = 4nk + 3k − 1 = 2000

which you can solve to get the solutions k = 3, 23, 87, 667.
So the final solutions are k = 3, 23, 87, 667, 2001. 

Remark. In this example, we used index switching several times to repeatedly reduce our
recurrence down. While there are other ways to produce this problem, index switching
gives us a way of cancelling out problematic terms one at a time, making it a fairly reliable
method of solving problems on contests.

§5.5 Homework Problems

Problem 5.1 (Mathcounts 2014, modified). [3] If a1 = 0, a2 = 4, and an = 4(an−1 − an−2 ) for
n > 2, characterise all n such that an is a power of 2.

Problem
√ 5.2 (AMC 12B 2016). [5] The sequence (an ) is defined recursively by a0 = 1, a1 =
19
2, and an = an−1 a2n−2 for n ≥ 2. What is the smallest positive integer k such that the
product a1 a2 · · · ak is an integer?

Problem 5.3 (AIME I 2017). [5] Let a10 = 10, and for each integer n > 10 let an = 100an−1 +n.
Find the least n > 10 such that an is a multiple of 99.

Problem 5.4 (Balkan MO 2004). [5] The sequence {an }n≥0 of real numbers satisfies the rela-
tion:
1
am+n + am−n − m + n − 1 = (a2m + a2n )
2
for all non-negative integers m and n, m ≥ n. If a1 = 3 find a2004 .

Problem 5.5. [6] Find a recurrence relation for the sequence {an } where an = Fn2 .

Problem 5.6 (British MO 2015). [6] The first term x1 of a sequence is 2014. Each subsequent
term of the sequence is defined in terms of the previous term. The iterative formula is

( 2 + 1)xn − 1
xn+1 = √ .
( 2 + 1) + xn
The 2015th term, x2015 , can be written as − m
n . Find m + n.

10
Everaise Academy (2020) Math Competitions II

Problem 5.7 (British MO 2002). [6] Prove that the sequence defined by
1 p
y0 = 1, yn+1 = (3yn + 5yn2 − 4), (n ≥ 0)
2
consists only of integers.

an +2009
Problem 5.8 (2009 AIME I). [7] The terms of the sequence (ai ) defined by an+2 = 1+an+1
for n ≥ 1 are positive integers. Find the minimum possible value of a1 + a2 .

Problem 5.9 (2007 AIME I). [8] A sequence is defined over non-negative integral indexes in
the following way: a0 = a1 = 3, an+1 an−1 = a2n + 2007.
Find the greatest integer that does not exceed

a22006 + a22007
.
a2006 a2007

Problem 5.10 (OMO 2019). [6] The sequence of non-negative integers F0 , F1 , F2 , . . . is defined
recursively as F0 = 0, F1 = 1, and Fn+2 = Fn+1 + Fn for all integers n ≥ 0. Find d, the largest
positive integer such that, for all integers n ≥ 0, Fd divides Fn+2020 − Fn .

Problem 5.11 (British MO 2020). [12] A sequence b1 , b2 , b3 , . . . of nonzero real numbers has
the property that
b2 − 1
bn+2 = n+1
bn
for all positive integers n. Suppose that b1 = 1 and b2 = k where 1 < k < 2. Show that there
is some constant B, depending on k, such that −B ≤ bn ≤ B for all n.

11
6 Fundamentals

This week we move onto combinatorics. Although the sort of equation-solving and algebraic
work we do won’t be as complicated as last week, again, you should approach this section with
a pencil and a piece of scratch paper.

§6.1 Casework and Complementary Counting

We’re going to begin by reviewing a few basics of combinatorics: casework and complemen-
tary counting. The former is a method of simplifying the work you have to do into smaller
sub-problems, and the latter is a way of counting something different when what you need to
count seems infeasible.
Keep in mind that counting problems — no matter how easy or difficult they might be — are
always really, really tricky. A single missed case might lead to a completely incorrect answer;
read every problem carefully, multiple times.

Example 6.1 (2015 AIME I). The nine delegates to the Economic Cooperation Conference
include 2 officials from Mexico, 3 officials from Canada, and 4 officials from the United
States. During the opening session, three of the delegates fall asleep. Assuming that the
three sleepers were determined randomly, the probability that exactly two of the sleepers
are from the same country is m
n , where m and n are relatively prime positive integers. Find
m + n.

Solution. Recall that the probability can be found by taking the number of successful out-
comes divided by the total number of outcomes. Thus, the first thing we’ll attempt to do is
find the total possible outcomes are — or, that is, how many ways are there for three people to
fall asleep?
Given that there
 are nine distinct delegates, the total number of ways to choose three to fall
9
asleep is just 3 , so our denominator is set.
As for the numerator, this is when we bring in the casework. Let’s count the number of ways
we can choose two from Mexico and one from somewhere else: that’s 7. For two from Canada
and one from somewhere else, we have 32 ways to choose the Canadians and 6 ways to choose
another delegate, giving us 18 working cases. Finally, if we have two Americans, we have 42
ways to choose them and 5 ways to choose another delegate, adding 30 cases.
Thus the total number of successful outcomes is 30 + 18 + 7 = 55, and the total number of
55
outcomes is 84, so our answer is 84 , which is irreducible; therefore m + n = 139. 

Exercise 6.2. Solve the above example using complementary counting — how many ways are
there to choose three delegates such that there are not exactly two sleepers from the same
country?

1
Everaise Academy (2020) Math Competitions II

Example 6.3 (2010 AIME I). Define an ordered triple (A, B, C) of sets to be minimally
intersecting if |A ∩ B| = |B ∩ C| = |C ∩ A| = 1 and A ∩ B ∩ C = ∅. For example,
({1, 2}, {2, 3}, {1, 3, 4}) is a minimally intersecting triple. Let N be the number of minimally
intersecting ordered triples of sets for which each set is a subset of {1, 2, 3, 4, 5, 6, 7}. Find
the remainder when N is divided by 1000.
(Note: |S| denotes the number of elements in the set S.)

Solution. Note that A and B share an element, B and C share an element, and C and A share
an element, and that no elements belong to A, B, and C.
Thereforelet’s begin by choosing an element that belongs to each of A ∩ B, B ∩ C, and C ∩ A;
there are 73 · 6 ways to do so. Assume without loss of generality that 1 ∈ (A ∩ B), 2 ∈ (B ∩ C),
and 3 ∈ (C ∩ A).
Each of the remaining elements — 4, 5, 6, and 7 — can be in at most one set. Therefore there
are four choices for each, yielding 44 .
Our answer is 73 · 6 · 44 = 53760, so our answer is 760.



§6.2 The Principle of Inclusion-Exclusion

The Principle of Inclusion-Exclusion — often abbreviated to PIE — provides a way for us


to calculate the size of the union of possibly intersecting sets.

Proposition 6.4 (Principle of Inclusion Exclusion). Suppose that A1 , A2 , A3 , · · · , An are sets,


possibly intersecting. Then
n
X
|A1 ∪ A2 ∪ A3 ∪ · · · ∪ An | = |Ai |
i=1
X
− |Ai ∩ Aj |
1≤i,j≤n
X
+ |Ai ∩ Aj ∩ Ak |
1≤i,j,k≤n

− · · · + (−1)n |A1 ∩ A2 ∩ · · · · An |.

Let’s go over a couple specific cases to familiarize ourselves with this. If n = 2, then
|A1 ∪ A2 | = |A1 | + |A2 | − |A1 ∩ A2 |.

This is equivalent to our two-circle Venn Diagram, as shown below.

2
Everaise Academy (2020) Math Competitions II

Then |A1 ∪ A2 | can be found by adding |A1 | and |A2 | and subtracting the section in the
middle, |A1 ∩ A2 |.
Let’s take a look at the three-set case, too. If n = 3, then

|A1 ∪ A2 ∪ A3 | = |A1 | + |A2 | + |A3 | − |A1 ∩ A2 | − |A1 ∩ A3 | − |A2 ∩ A3 | + |A1 ∩ A2 ∩ A3 |.

This is equivalent to our three-circle Venn Diagram, as shown below.

If we wanted to count |A1 ∪ A2 ∪ A3 |, we could start by adding |A1 |, |A2 |, and |A3 |. Then
we’d have to subtract out |A1 ∩ A2 |, |A2 ∩ A3 |, and |A3 ∩ A1 |, but doing so would mean that we
don’t count |A1 ∩ A2 ∩ A3 | at all. Then we add |A1 ∩ A2 ∩ A3 | back in, and that’s how we count
|A1 ∪ A2 ∪ A3 |.
One way you can visualize this: after adding |A1 |, |A2 |, and |A3 |, we might write a 3 in the
very middle region of the diagram above because that intersection has been counted thrice, a
2 in the three regions adjacent to it because each of those are counted twice, and a 1 in the
outer regions. Then when we subtract |A1 ∩ A2 |, |A2 ∩ A3 |, and |A3 ∩ A1 |, the middle region
gets subtracted out thrice, so the number becomes 0; the three regions adjacent to have a 1 in
them. Finally, we add |A1 ∩ A2 ∩ A3 | back in, so now there’s a 1 in each region, meaning that
everything is counted exactly once.
Let’s go over some problems.

Example 6.5 (2017 AMC 10B). There are 20 students participating in an after-school
program offering classes in yoga, bridge, and painting. Each student must take at least one
of these three classes, but may take two or all three. There are 10 students taking yoga,
13 taking bridge, and 9 taking painting. There are 9 students taking at least two classes.
How many students are taking all three classes?

Solution. Let Y, B, and P be the sets of students taking yoga, bridge, and painting. Then

|Y ∪ B ∪ P | = |Y | + |B| + |P | − |Y ∩ B| − |B ∩ P | − |P ∩ Y | + |Y ∩ B ∩ P |.

Let’s make some sense of the given information. There are 20 students participating in the
program, so |Y ∪ B ∪ P | = 20. Moreover, |Y | = 10, |B| = 13, and |P | = 9. Therefore

|Y ∩ B| + |B ∩ P | + |P ∩ Y | = 12 + |Y ∩ B ∩ P |.

3
Everaise Academy (2020) Math Competitions II

Now let’s us the final piece of information. Since there are 9 students taking at least two
classes, after accounting for overcounting, the equation

|Y ∩ B| + |B ∩ P | + |P ∩ Y | − 2|Y ∩ B ∩ P | = 9

must hold. (Why? Try drawing a Venn Diagram yourself if you’re struggling to understand
this.)
It follows that |Y ∩ B ∩ P | = 3, and we are done. 

Example 6.6 (2019 AMC 10A). How many positive integer divisors of 2019 are perfect
squares or perfect cubes (or both)?

Solution. Let A1 be the set of positive integer divisors of 2019 that are perfect squares, and
let A2 be the set of positive integer divisors of 2019 that are perfect cubes. Then we want to
find |A1 ∪ A2 |.
We have |A1 ∪ A2 | = |A1 | + |A2 | − |A1 ∩ A2 |. Thus 2019 = 39 · 679 ; a perfect square divisor
must have even exponents of both 3 and 67, so there are 5 choices — 0, 2, 4, 6, and 8 —
for the exponent of each of 3 and 9. Therefore 2019 has 5 · 5 = 25 perfect square divisors:
30 · 670 , 32 · 670 , 34 · 670 , · · · , 38 · 678 . (We’ll cover the topic of counting divisors more in our
Number Theory week.)
Similarly, we find that 2019 has 16 perfect cube divisors: 30 · 670 , 33 · 670 , 36 · 670 , · · · , 39 · 679 .
Now let’s count how many divisors are both perfect squares and perfect cubes, or perfect sixth
powers: those divisors are just 30 · 670 , 36 · 670 , 30 · 676 , and 36 · 676 , so there are 4 of them.
Our final answer is 25 + 16 − 4 = 37. 

Our previous example problems have been PIE in the two or three case. Let’s move onto
something a bit more complex.

Example 6.7 (2001 AIME II). Each unit square of a 3-by-3 unit-square grid is to be colored
either blue or red. For each square, either color is equally likely to be used. The probability
of obtaining a grid that does not have a 2-by-2 red square is m n , where m and n are relatively
prime positive integers. Find m + n.

Solution. After trying for a bit by yourself, you should quickly realize that it seems much
easier to count the number of grids that do contain a 2-by-2 red square. We’ll deal with the
fact that’s probability at the very end.
So the main problem to deal with is overlap: if we tried to count the number of grids that
had a 2-by-2 red square in the top right, and add it to the number of grids with a 2-by-2 red
square in the top left, we’d be double-counting some grids.
Let’s turn to PIE: let A1 be the number of grids that have a 2-by-2 red square in the top
left, let A2 be the number of grids that have a 2-by-2 red square in the top right, let A3 be the
number of grids that have a 2-by-2 red square in the bottom left, and let A4 be the number of
grids that have a 2-by-2 red square in the bottom right. Let S = |A1 ∪ A2 ∪ A3 ∪ A4 | be the
quantity we’re trying to count, and keep in mind that we’re complementary counting — so the
quantity that we’re looking for is 512 − S, because there are 29 = 512 grids in total.

4
Everaise Academy (2020) Math Competitions II

Then

S = |A1 | + |A2 | + |A3 | + |A4 |


− |A1 ∩ A2 | − |A1 ∩ A3 | − |A1 ∩ A4 | − |A2 ∩ A3 | − |A2 ∩ A4 | − |A3 ∩ A4 |
+ |A1 ∩ A2 ∩ A3 | + |A1 ∩ A2 ∩ A4 | + |A1 ∩ A3 ∩ A4 | + |A2 ∩ A3 ∩ A4 |
− |A1 ∩ A2 ∩ A3 ∩ A4 |.

Now let’s proceed step by step. We know that |A1 |, the number of grids with a red 2-by-2
square in the top left is just 25 = 32. Therefore by symmetry |A1 | = |A2 | = |A3 | = |A4 | = 32,
and |A1 | + |A2 | + |A3 | + |A4 | = 128.
Next, let’s count the number of ways we can have two 2-by-2 squares. There are two cases:
either the squares can share two unit squares (in the case of |A1 ∩ A2 |, |A2 ∩ A4 |, |A4 ∩ A3 |,
and |A3 ∩ A1 |) or the squares can share a single square in the middle (in the case of |A1 ∩ A4 |
and |A2 ∩ A3 |.) In the former case, 6 squares are already red so there are 23 = 8 of each
type; in the latter case, 7 squares are already red so there are 22 = 4 of each type. Thus
|A1 ∩ A2 | + |A1 ∩ A3 | + |A1 ∩ A4 | + |A2 ∩ A3 | + |A2 ∩ A4 | + |A3 ∩ A4 | = 4 · 8 + 2 · 4 = 40.
Now, if we have three 2-by-2 squares, it turns out there’s only one square that’s uncolored.
In the case of |A1 ∩ A2 ∩ A3 |, we know that each square except for the bottom right square is
determined, so there are two choices for that square, so |A1 ∩ A2 ∩ A3 | = 2. Thus by symmetry
|A1 ∩ A2 ∩ A3 | + |A1 ∩ A2 ∩ A4 | + |A1 ∩ A3 ∩ A4 | + |A2 ∩ A3 ∩ A4 | = 8. And finally, it’s clear
that |A1 ∩ A2 ∩ A3 ∩ A4 | = 1.
It follows that S = 128 − 40 + 8 − 1 = 95, so 512 − S = 417. That’s the number of grids that
417
don’t have a 2-by-2 square, so our answer is 512 , so m + n = 929. 

Finally, one last tough example. Here we’ll prove an important formula in number theory.

Example 6.8. Suppose that n is an integer and that n = pe11 pe22 · · · pekk is its prime factor-
ization. Let φ(n) denote the number of positive integers between 1 and n, inclusive, that
are relatively prime to n. Prove that
    
1 1 1
φ(n) = n 1 − 1− ··· 1 − .
p1 p2 pk

Solution. Let’s first count the number of positive integers that are not relatively prime to
n. Let A1 , A2 , . . . , Ak be sets of positive integers less than or equal to n that are multiples of
p1 , p2 , . . . , pk , respectively. It should be clear that any integer not relatively prime to n must
fall in one of {A1 , · · · , Ak }. Then we want to find

|A1 ∪ A2 ∪ A3 ∪ · · · ∪ Ak |,

which we’ll do using PIE.


First, we’ll find |A1 | + |A2 | + · · · + |Ak |; we have |A1 | = pn1 , because there are pn1 multiples
of p1 between 1 and n. Similarly, there are pni multiples of pi for any i between 1 and k. So if
we’re counting the number of positive integers relatively prime to n, our first move should be
to add
k
X n n n
|Ai | = + + ··· +
p1 p2 pk
i=1

5
Everaise Academy (2020) Math Competitions II

to the total.
P
Next, we need to subtract 1≤i,j≤k |Ai ∩ Aj |. Let’s look at |A1 ∩ A2 |: this is the set of
numbers divisible by both p1 and p2 , of which there are p1np2 . Therefore we need to subtract
X X n
|Ai ∩ Aj | =
pi pj
1≤i,j≤k 1≤i,j≤k

where we’ve gone ahead and generalized the 1, 2 case.


At this point we’ll stop for a moment: note that in the expansion of φ(n) above, we have
exactly the terms already found — multiplied by a factor of −1, which is to be expected because
we’re complementary counting. Indeed, we can get the term pn1 + · · · pnk by taking a 1 from each
term being multiplied except for one of them and a p1i from the last one; to get pairs, we just
need to choose p1i , p1j from two of the binomials, and 1s from everything else.
We’ll leave the rest of the details of the proof up to the reader — but at this point it should
be quite clear how to proceed. 

§6.3 Distributions

Distributions are a frequently reoccurring problem type in AIME-level competitions. Generally,


in distribution problems, we wish to count the number of ways to distribute objects of type A
to some other objects of type B.

Example 6.9 (Classical). James has 9 indistinguishable pieces of candy and wishes to
distribute them to 4 kids. In how many ways can he do this? (It is OK for a kid to receive
0 pieces of candy.)

Solution. This is a classic example of a technique called stars-and-bars. Visualize the pieces
of candy as being on a line, and suppose we have 3 bars, which we place in the spaces between
candies. We can then distribute the candies according to the number of candies in each group
(candies in the gap between two bars, or between the end of the line and a bar).

For example, the above diagram depicts a scenario in which the first kid gets two candies,
the second gets four, the third gets two, and the fourth gets one.
Thus there is a one-one correspondence between the candies and these arrangements. Now,
there are 12 total objects, of which 9 are candies, and 3 are bars. Hence, there are 12
3 such
arrangements on a line, which is our answer. 

Exercise 6.10. In general, if we wish to distribute m pieces of candy to n kids with no other
restrictions, how many ways can we do this?

Variants of the distribution problem occur frequently. The following few harder examples
show a few other techniques which appear when dealing with distributions.

6
Everaise Academy (2020) Math Competitions II

Example 6.11 (ARML). Compute the number of distinct ways in which 77 one-dollar bills
can be distributed to 7 people so that no person receives less than 10 dollars.

Solution. The easiest way to get around this sort of restriction to note is that to ensure that
everyone receives 10 or more dollars, we can just start by giving 10 dollars to everyone.
 Then
7+6
we have 7 dollar bills left to distribute to 7 people as we choose, and there are 7 = 1716
ways in total. 

Example 6.12 (Classical). How many nonnegative integer solutions are there to x + y + z ≤
n, for any integer n?

Solution. Note that this is actually equivalent to the candy-distribution and dollar-distribution
problems we solved earlier, with a few caveats; in this case, we’re distributing n or less things
among 3 people. The “or less” clause is the troublesome one, so let’s ignore that for now —
that’s a strategy we often use.
So how many ways are there to distribute n things among 3 people, with no restrictions?
Well, we’ve solved that problem before: that’s equivalent to arranging n balls and 2 sticks,
n+2

yielding 2 ways in total.
What if it’s n − 1 balls? Then we have (n−1)+2 = n+1
 
2 2 ways
 in n+1
total.
 Moreover, we can do
every single case the same way — our sum comes out to n+2 n
= n+3
 
2 + 2 + 2 + · · · + 3 ,
by the Hockey Stick Principle. We are done. 

This last example is a distribution problem which makes no usage of stars and bars.

Example 6.13 (2018 AIME I). For every subset T of U = {1, 2, 3, . . . , 18}, let s(T ) be the
sum of the elements of T , with s(∅) defined to be 0. If T is chosen at random among all
subsets of U , find the probability that s(T ) is divisible by 3.

Solution. The idea here is that we can separate U into 3 parts: U0 , U1 , U2 , where, for each
i ∈ U , we write i ∈ Uj iff i ≡ j (mod 3). Similarly, define T0 , T1 , T2 as follows: for any i ∈ T ,
we write i ∈ Tj if i ≡ j (mod 3). Note that s(T ) is unaffected by choices we make from U0 , so
we can take any arbitrary subset; for now, we will forget about U0 , and work only with U1 and
U2 . Also, we have |T1 | + 2|T2 | ≡ 0 (mod 3) (where T0 , T1 , T2 are similarly defined as Ui ). This
implies that |T1 | ≡ |T2 | (mod 3).
We now just do casework on |T1 |. If |T1 | ≡ 0 (mod 3), there are 60 + 63 + 66 = 22 ways
  

to pick the numbers from T1 . Symmetrically, there are 22 ways to pick the numbers from T2
as well, meaning that there are 222 = 4842 ways 2to pick the numbers from T1 and T2 . Similarly,
if |T1 | ≡ 1 (mod 3), there are 61 + 64 = 21 = 441 ways to pick the numbers from T1 and
2
T2 . Finally, if |T1 | ≡ 2 (mod 3), there are, 62 + 65

= 441 ways to pick the numbers from
T1 and T2 . Hence, there are a total of 441 · 2 + 484 = 1366 ways to decide the numbers from T1
and T2 .
Now, we consider T0 . Since T0 can be any subset of U0 , and the subset T0 does not affect
s(T ), we may simply multiply the total by 26 = 64, the total number of possible subsets T0 .
This implies that the total number of such subsets T is 683 · 27 . As there are 218 total subsets
7
of U , the answer is 683·2
218
= 683
211
. 

7
Everaise Academy (2020) Math Competitions II

§6.4 Homework

Problem 6.1 (2003 AIME I). [3] An integer between 1000 and 9999, inclusive, is called balanced
if the sum of its two leftmost digits equals the sum of its two rightmost digits. How many
balanced integers are there?

Problem 6.2 (2010 AMC 10B). [4] Seven distinct pieces of candy are to be distributed among
three bags. The red bag and the blue bag must each receive at least one piece of candy; the
white bag may remain empty. How many arrangements are possible?

Problem 6.3 (2012 AIME II). [3] At a certain university, the division of mathematical sciences
consists of the departments of mathematics, statistics, and computer science. There are two
male and two female professors in each department. A committee of six professors is to con-
tain three men and three women and must also contain two professors from each of the three
departments. Find the number of possible committees that can be formed subject to these
requirements.

Problem 6.4 (1983 AIME). [5]Twenty five of King Arthur’s knights are seated at their cus-
tomary round table. Three of them are chosen — all choices of three being equally likely —
and are sent off to slay a troublesome dragon. Let P be the probability that at least two of the
three had been sitting next to each other. If P is written as a fraction in lowest terms, what is
the sum of the numerator and denominator?

Problem 6.5 (1990 AIME). [6] In a shooting match, eight clay targets are arranged in two
hanging columns of three targets each and one column of two targets. A marksman is to break
all the targets according to the following rules:
1. The marksman first chooses a column from which a target is to be broken.
2. The marksman must then break the lowest remaining target in the chosen column.
If the rules are followed, in how many different orders can the eight targets be broken?

Problem 6.6 (Christmas Math Competitions). .[7] In the array of points below, each point is
one unit away from its neighbours. How many ways are there √ to select 4 of these points such
that the distance between any two chosen points is at most 2 2?

Problem 6.7 (2011 AIME II). [6] Define an ordered quadruple of integers (a, b, c, d) as inter-
esting if 1 ≤ a < b < c < d ≤ 10, and a + d > b + c. How many ordered quadruples are
there?

Problem 6.8 (1998 AIME). [8] Let n be the number of ordered quadruples (x1 , x2 , x3 , x4 ) of
positive odd integers that satisfy 4i=1 xi = 98. Find 100
n
P
.

Problem 6.9 (1988 AIME). [7] A convex polyhedron has for its faces 12 squares, 8 regular
hexagons, and 6 regular octagons. At each vertex of the polyhedron one square, one hexagon,
and one octagon meet. How many segments joining vertices of the polyhedron lie in the interior
of the polyhedron rather than along an edge or a face?

8
Everaise Academy (2020) Math Competitions II

Problem 6.10 (Ankan Bhattacharya). [10] A class has ten students, and the teacher has twenty
distinct stones. The teacher randomly gives each stone to one of the students. The happiness
of the class is defined as the product of the number of stones each student has. The expected
value of the happiness of the class can be expressed as m
n , where m and n are relatively prime
positive integers. Find the remainder when m + n is divided by 1000.

Problem 6.11 (2007 AIME I). [8] In the 6×4 grid shown, 12 of the 24 squares are to be shaded
so that there are two shaded squares in each row and three shaded squares in each column. Let
N be the number of shadings with this property. Find the remainder when N is divided by
1000.

Problem 6.12 (2012 AIME II). [12] In a group of nine people each person shakes hands with
exactly two of the other people from the group. Let N be the number of ways this handshaking
can occur. Consider two handshaking arrangements different if and only if at least two people
who shake hands under one arrangement do not shake hands under the other arrangement.
Find the remainder when N is divided by 1000.

Problem 6.13 (2008 AIME II). [12] There are two distinguishable flagpoles, and there are 19
flags, of which 10 are identical blue flags, and 9 are identical green flags. Let N be the number
of distinguishable arrangements using all of the flags in which each flagpole has at least one flag
and no two green flags on either pole are adjacent. Find the remainder when N is divided by
1000.

9
7 Bijections and Expected Value

Bijections are mappings of one set onto another. They give us a way to pair up the elements
from a set A with the elements from a set B. When these sets are finite, a bijection implies an
equal number of elements in the sets, which can simplify a lot of counting problems.

§7.1 Bijections

Two sets A and B are in one-to-one correspondence, or bijective, if there exists a function
f : A → B which satisfies both of the following properties:

1. f is one-to-one or injective: if f (x) = f (y), then x = y.


2. f is onto or surjective: for every b ∈ B, there exists an a ∈ A such that f (a) = b.

The definition of a bijection is a little abstract. Here are some examples of how bijections
may be used.

Example 7.1 (Classical). Consider a grid with m columns and n rows. How many ways are
there to get from the bottom-left corner to the top-right corner with only unit steps up or
right?

Solution. If m and n are small, we could directly count the number of paths from the bottom-
left corner to the top-right corner.

To describe this process, let’s place the grid onto first quadrant of the coordinate plane. The
bottom-left corner will be the origin. There is only 1 path to (x, 0) and (0, y) for any x or y.
Further, the number of paths to (x, y) is the sum of the number of paths to (x − 1, y) and the
number of paths to (x, y − 1). Eventually, we would get the number of paths to the top-right
corner.
If m and n are large, this process is tiresome. Is there a better way of doing this?
In order to get to (m, n), we must take m steps right and n steps up. We can write each path
as a sequence of letters R and U , which correspond to steps right and steps up. For example,
the following path could be written as RRU RU RU U :

1
Everaise Academy (2020) Math Competitions II

Each path corresponds to one such sequence, and each sequence corresponds to one such
path. Thus, we can construct a bijection between the following sets:

the set of paths from (0, 0) to (m, n) using only up or right steps
l
the set of sequences with m R’s and n U ’s

We know that the latter set has exactly m+n



m elements, since we are choosing m spots to
place the R’s. Thus, the number of paths from (0, 0) to (m, n) using only up or right steps must
be m+n
m . 

Directly counting the number of paths would have become computational. Instead, we found
a bijection which could allow us to count another set with the same number of elements. Try
the exercise before moving onward.

Remark. A proof involving a bijection between two sets A and B should do the following:

1. Obtain an element of B from any element of A.


2. Recover an element of A from any element of B.
3. Explain why the sets map onto each other.

Exercise 7.2 (2006 AIME II). Let (a1 , a2 , a3 , . . . , a12 ) be a permutation of (1, 2, 3, . . . , 12) for
which a1 > a2 > a3 > a4 > a5 > a6 and a6 < a7 < a8 < a9 < a10 < a11 < a12 . An example of
such a permutation is (6, 5, 4, 3, 2, 1, 7, 8, 9, 10, 11, 12). Find the number of such permutations.

Let’s take a look at another classical example.

Example 7.3 (Classical). Determine the number of distinct rectangles that can be found
on a m × n grid.

Solution. We could proceed with casework on the dimensions of the rectangles; count the
number of 1 × 1 rectangles, 1 × 2 rectangles, etc. Perhaps there is a better way.
First, let’s ask ourselves how we may determine a rectangle. Any rectangle is bounded by
two vertical lines and two horizontal lines. Further, a selection of two vertical lines and two
horizontal lines defines exactly one rectangle. Does this remind you of the bijection criteria?

2
Everaise Academy (2020) Math Competitions II

Each rectangle corresponds to a selction of two vertical and two horizontal lines, and each
selection of two vertical and two horizontal lines corresponds to a rectangle. Since there are
m + 1 vertical lines to choose from and n + 1 horizontal lines to choose from, we may construct
the bijection between the two sets:

the number of rectangles on a m × n grid


l
the number of ways to select two horizontal and two vertical lines

There are m+1 × n+1


 
2 2 ways to select two horizontal and
 two vertical lines. Thus, the
m+1 n+1

number of rectangles on a m × n grid must be 2 × 2 . 

The key observation was that each rectangle is bounded by two horizontal gridlines and two
vertical gridlines. Is there a way to apply this idea to a classical exercise? For a challenge, try
out the problem without reading the parts!

Exercise 7.4 (Classical). A triangular grid is obtained by dividing an equilateral triangle of


side length n into n2 equilateral triangles of side length 1, by lines parallel to the sides of the
triangle. In this question, we are going to determine the number of parallelograms bounded by
the line segments of the grid.
1. What are the possible orientations of such a parallelogram?
2. Let’s focus on counting parallelograms with orientation ♦. Extend the triangular grid one
extra row at the bottom. Do you see a clever bijection?
Hints: How can we relate a parallelogram to points on the extension?

3. Compute the number of parallelograms of all orientations bounded by the line segments
of the grid.

A partition of a positive integer n is a decomposition of n into a sum of positive integers.


The order of the integers doesn’t matter and the positive integers do not have to be distinct.

3
Everaise Academy (2020) Math Competitions II

For example, there are 3 partitions of 3: 3, 1 + 2, and 1 + 1 + 1.


Partitions are riddled with bijections — let’s try two classical examples.

Example 7.5 (Classical). Prove that the number of partitions of n into distinct parts is
equal to the number of partitions of n into odd parts.

Solution. It’s difficult to directly compute the number of partitions of n into distinct parts.
There’s a lot of casework and bashing, which gets very messy. Perhaps we should look for a
bijection. How can we transform a partition of distinct parts into a partition of odd parts?
Let’s consider a specific example: 26 = 12 + 5 + 4 + 3 + 2. In order to get rid of the even
parts, we would have to partition 12, 4, and 2 into odd numbers. Since there is only 1 way to
partition 2 (1 + 1) and there are only 2 ways to partition 4 (1 + 1 + 1 + 1, 3 + 1), we’ll take a
closer look at 12.
This is tricky, since 12 can be written as a sum of odd numbers in a plethora of ways. Since
we are looking for a bijection, we want to ensure that 12 may be recovered from our partition.
Is there a specific way we can express 12 as a sum of odd numbers?
We can write 12 in the form a × 2b , where a is odd. In order to recover 12, we can rewrite the
number of 3s in binary and distribute. This means that 12 will be written as 3×22 = 3+3+3+3,
4 as 1 × 22 = 1 + 1 + 1 + 1, and 2 as 1 × 21 = 1 + 1. Putting it all together, we have

25 = 12 + 5 + 3 + 4 + 2
= 3 × 22 + 5 + 3 + 1 × 22 + 1 × 21
= (3 + 3 + 3 + 3) + 5 + 3 + (1 + 1 + 1 + 1) + (1 + 1)
= 5 + 3 + 3 + 3 + 3 + 3 + 1 + 1 + 1 + 1 + 1 + 1.

Going backwards, we have

25 = 5 + 3 + 3 + 3 + 3 + 3 + 1 + 1 + 1 + 1 + 1 + 1
=5×1+3×5+1×6
= 5 × 20 + 3 × (22 + 20 ) + 1 × (22 + 21 )
= 5 × 20 + 3 × 22 + 3 × 20 + 1 × 22 + 1 × 21
= 5 + 12 + 3 + 4 + 2
= 12 + 5 + 4 + 3 + 2.

Each partition of n into distinct parts can be rewritten as a unique partition of n into odd
parts. Each partition of n into odd parts can be rewritten as a partition of n into distinct parts.
In order to fully understand this, you may have to try this procedure with some other examples
before moving on.
We may construct the following bijection:

the partitions of n into distinct parts


l
the number of partitions of n into odd parts

4
Everaise Academy (2020) Math Competitions II

Thus, the number of partitions in these sets are equal. 

Example 7.6 (Classical). Prove that the number of partitions of n into exactly k parts is
equal to the number of partitions of n in which the largest part is k.

Solution. To solve this, we are going to follow the structure of the previous example: consider
an example, make some observations, and construct a bijection.
Let’s try listing out n = 8 and k = 3:

Partitions of 8 into 3 Parts Partitions of 8 with Largest Part 3


6+1+1 3+3+2
5+2+1 3+3+1+1
4+3+1 3+2+2+1
4+2+2 3+2+1+1+1
3+3+2 3+1+1+1+1+1

Look closely at this table. Do you notice anything interesting?


One pattern you may have noticed is that the list of the largest terms (6, 5, 4, 4, 3) in the
first column correspond to the number of terms in the second column (3, 4, 4, 5, 6). This is not
coincidence! If you don’t believe it, test out some other values of n and k.
We are going to take this observation and try to build a bijection around it. In particular,
let’s try to figure out the correspondence between

5 + 2 + 1 ↔ 3 + 2 + 1 + 1 + 1.

Since the largest term is supposed to correspond to the number of terms, perhaps we should
draw out a diagram to convert between the two.

How do these dots relate the the partitions (5, 2, 1) and (3, 2, 1, 1, 1)? The number of dots
in a row corresponds to a term in (5, 2, 1); the number of dots in a column corresponds to a
term in (3, 2, 1, 1, 1). Thus, we may easily convert between a partition of n with k parts and a
partition of n with the largest part k.
We may construct the following bijection:

the partitions of n with k parts


l
the partitions of n with largest part k

Therefore, we find the number of partitions in these sets to be equal.




5
Everaise Academy (2020) Math Competitions II

In both of the examples involving partitions, we looked at smaller cases to see if we could
observe a pattern. Apply this problem-solving strategy to the next exercises to help you find a
bijection, in case you get stuck.

Exercise 7.7 (Classical). Determine the number of m-tuples of positive integers (x1 , x2 , . . . , xm )
satisfying x1 + x2 + . . . + xm = n, where n is a positive integer.

Exercise 7.8 (Classical). Prove that the number of partitions of n equals the number of
partitions of 2n with n parts.

That’s quite a bit of partitions. Let’s shift gears to try a more difficult grid-walking problem.

Example 7.9 (Classical). Determine the number of lattice paths from (0, 0) to (n, n) using
only unit steps up and right, such that the paths do not go above the main diagonal. In
other words, the paths stay in the region x ≥ y.

Solution. In the first example of this handout, the total number of lattice paths from (0, 0) to
(n, n) without this restriction is 2n
n . With this restriction, it may be tempting to take 1
2 × 2n
n
and call it a day since we are only utilizing half the grid. However, this does not work because
we didn’t consider the paths that are on both halves of the grid.
Instead, let’s consider how a path may violate this restriction.

The step that violates the restriction occurs when the path is on the main diagonal and
goes up. We call this the critical step. Perhaps using letters for the steps will make this next
observation easier to see.
We will write each path as a sequence of letters R and U , which correspond to steps right
and steps up. The critical step occurs when, reading left-to-right, there is one more step up
than steps right. Up until the critical step, if there were k steps right then there would be k + 1
steps up. This means that after the critical step, there would be n − k steps right and n − k − 1
steps up. How can we use this observation to construct a bijection that allows us to count the
number of paths that violate the restriction?
We may reflect the path after the critical step across the line y = x + 1. This means that
beyond the n − k steps right and n − k − 1 steps up after the critical step become n − k steps
up and n − k − 1 steps right, respectively. Now, the path has n − 1 steps right and n + 1 steps
up regardless of where the critical step took place.

6
Everaise Academy (2020) Math Competitions II

The reflected path goes to (n − 1, n + 1). Each path that violates the restriction, therefore,
maps onto a path that goes to (n − 1, n + 1). Great, we’ve got one part of the bijection down.
Can we go the other way – that is, take a path that goes to (n − 1, n + 1) and recover a path
that violates the restriction? Try this out on your own before reading on.
If we take a path that goes to (n − 1, n + 1), we can find the critical step and reflect back
along y = x + 1. We know that there has to be a critical step because the path contains two
more steps up than steps right. Thus, we found a biijection between the two sets:

the paths that go above the main diagonal from (0, 0) to (n, n) using only up or right steps
l
the paths from (0, 0) to (n − 1, n + 1) using only up or right steps

2n

We know that the number of paths in the second set is equal to n−1 and the total number
2n

of paths is equal to n from the first example. This means that thenumber of paths that stay
under the main diagonal from (0, 0) to (n, n) is equal to 2n 2n
n − n−1 .


Remark. In our last example, the number


 of paths that stay under the main diagonal from
(0, 0) to (n, n) is equal to 2n
n − 2n
n−1 . This expression can be simplified:

         
2n 2n 2n n 2n 1 2n
− = − =
n n−1 n n+1 n n+1 n

We call this the nth Catalan number.

Exercise 7.10 (Classical). How many ways are there to arrange n open parentheses “(” and
n closed parentheses “)” such that the pairs correctly match up? That is, as we read from
left-to-right, there are never more closed parentheses than open parentheses.
Hints: Try to find a bijection with the Catalan numbers!

We’ll finish with a tough example that offers a twist on the regular one-to-one correspondence.

Example 7.11 (2020 EGMO). A permutation of the integers 1, 2, . . . , m is called fresh if


there exists no positive integer k < m such that the first k numbers in the permutation

7
Everaise Academy (2020) Math Competitions II

are 1, 2, . . . , k in some order. Let fm be the number of fresh permutations of the integers
1, 2, . . . , m. Prove that fn ≥ n × fn−1 for all n ≥ 3.
For example, if m = 4, then the permutation (3, 1, 4, 2) is fresh, whereas the permutation
(2, 3, 1, 4) is not.

Solution. This question doesn’t seem to be asking for a direct one-to-one correspondence, since
we are trying to prove that the number of fresh permutations of length n is greater than n times
the number of fresh permutations of length n − 1. Perhaps, we should try to find a mapping
from a fresh permutation of length n − 1 to n fresh permutations of length n.
To generate n fresh permutations of length n from a fresh permutation of length n − 1, we
may want to consider the ways to insert n (the term that is going to be added). n can go in
any of the first n − 1 spots since this preserves ”freshness”, but unfortunately this statement
isn’t strong enough. Can we modify this idea so that we insert n − 1 instead of n?
Consider a fresh permutation a1 , a2 , a3 , . . . an−2 , an−1 . Note that an−1 6= n − 1, or else the
permutation isn’t fresh. Now, replace n − 1 with n and to construct a fresh permutation of
length n, we consider the ways to insert n − 1. To preserve ”freshness”, n − 1 may be placed
before any of the n−1 terms and after the last term. This gives n slots to insert n−1. Convince
yourself that this is true before moving forwards, perhaps using some casework.
This means that for each fresh permutation of length n − 1, there are n fresh permutations of
length n. This is exactly what we wanted, but we aren’t finished yet! We haven’t shown that
all of these permutations are unique. Each of these fresh permutations either had a different
starting sequence (the order of 1, 2, 3, . . . n − 3, n − 2, n) or a different placement of n − 1, so all
of these permutations must be different. Therefore, fn ≥ n × fn−1 . 

In this problem, our initial approach to insert n didn’t work out. We looked for a modification
to this approach and found that replacing n − 1 with n and inserting n − 1 does work. What if
we choose something other than n − 1, such as n − 2 or n − 3? Can you generalize this result?
If your first idea doesn’t stick, try modifying it slightly before scrapping it altogether. You
never know what you might come up with!

§7.2 Expected Value

The expected value of a random variable is the average value it attains. This is to say that
if the value of the random variable was generated over many, many trials, the average result
would begin to approach the expected value. The following definition makes this rigorous.

Definition 7.12 (Expected Value). Let X be a (discrete) random variable, and suppose X
attains the values X1 , X2 , . . . with probabilities p1 , p2 , . . ., respectively. We define the expected
value E[X] as

X
E[X] = pi Xi .
i=1

Although this definition may seem fairly intimidating, it really isn’t. The following example
will make this definition feel much more natural.

8
Everaise Academy (2020) Math Competitions II

Example 7.13. What is the expected value of the result obtained by rolling a fair, 6 sided
die?

Solution. Our random variable attains the values 1, 2, . . . , 6, each with probability 61 , so the
expected value is
6 6
X 1 1X
i= i
6 6
i=1 i=1
1
= (21)
6
7
= .
2


However, the true power of expected value comes from the following theorem. It is proven by
doing some manipulations with the definition of expected value; as the proof is not particularly
insightful, it is omitted here.

Theorem 7.14 (Linearity of Expectation). Let X and Y be discrete, potentially dependent


random variables. We have

E[X + Y ] = E[X] + E[Y ].

A corollary of this is that

E[cX] = cE[X]

for all real constants c.

This theorem allows us to break down expected value computations into bite-sized chunks,
thereby drastically simplifying them.

Example 7.15. What is the expected value of the sum of the results obtained by throwing
three fair, 6 sided dice?

Solution. We know that E[3X] = 3E[X], and that E[X] = 27 , where X is the result of rolling
one dice. Therefore E[3X], the expected value of rolling three dice, is 3 · 72 = 21
2 . 

Exercise 7.16. A quick exercise about coinflips.


1. Find the expected number of heads flipped in one flip of a fair coin.
2. Find the expected number of heads flipped in k flips of a fair coin.

We now work through several challenging examples, which show different ways in which the
above ideas can be used.

Example 7.17 (Classical). Suppose that Allen has n balls, numbered 1 through n, corre-

9
Everaise Academy (2020) Math Competitions II

sponding to n boxes, also numbered 1 through n. He tosses exactly one ball into each box
at random. What is the expected number of balls that end up in the correct box?

Solution. This is equivalent to finding the expected number of successful ball-box pairs (where
a success is when the numbers are matched up.)
So let’s find the probability that pair 1 is successful: the probability is n1 that ball 1 is tossed
into box 1. Moreover, the same holds for pair k, for any k between 1 and n.
n
X 1
Therefore the expected number of successful ball-box pairs is = 1 — each number
n
i=1
1
contributes n towards the total. 

Example 7.18 (2006 AIME I). Let S be the set of real numbers that can be represented as
repeating decimals of the form 0.abc where a, b, c are distinct digits. Find the sum of the
elements of S.

Solution. The first step in this problem is to find a better way to deal with numbers in S.
abc abc
Indeed, we find that 0.abc = 999 . Therefore, we are just looking for the sum of 999 , for distinct
a, b, c. (Note that abc now indicates that we are to read abc as a three-digit number, not as a
repeating decimal.)
Directly summing this is somewhat tedious; instead, we will attempt to find the average
element of S. This is equivalent to finding the expected value of abc, where a, b, c are distinct
digits.
The key insight is that linearity of expectation allows us to find the expected contribution of
each digit, which is quite direct. We consider a random integer abc, where a, b, c is distinct. The
1
probability that the units digit is d, for some d is 10 , by symmetry. Therefore, the expected
value of the units digit is
9
1 X 1 9 · 10
i= ·
10 10 2
i=0
9
= .
2
Similarly, the expected contribution of each of the other digits is also 92 , meaning that the
expected value of abc is 92 · 100 + 92 · 10 + 92 = 92 · 111 = 999
2 . In particular, the average value of
999
an element in S is 999 2
= 12 . As there are 10 · 9 · 8 elements in S, the sum of the elements of S
1
is 10 · 9 · 8 · 2 = 360. 

In the above example, another possible approach is to simply note that the elements of S
are symmetric about 999 2 (we can replace each digit by its complement); this is still effectively
linearity of expectation in disguise.

Example 7.19 (HMMT 2013). Values a1 , a2 , . . . , a2013 are chosen independently and at
random from the set {1, 2, . . . , 2013}. What is the expected cardinality of the set

{a1 , a2 , . . . , a2013 }?

10
Everaise Academy (2020) Math Competitions II

Solution. Blatantly trying to apply the definition of expected value will not work here —
there is no clean way to compute the number of ways where the cardinality of the set is 1000,
for example. Instead, we first try to find a better interpretation of the cardinality of the
A = {a1 , a2 , . . . , a2013 }. The idea is to forget about the ai ; instead we focus on the elements of
the set S = {1, . . . , 2013}.
Note that each element of k ∈ S contributes to A only
 if there exists i such that ai = k. This
2012 2013
implies that the probability that k ∈ A is 1 − 2013 (the second term is the probability
k 6∈ A). Therefore,
that   by linearity of expectation, we find that the expected value of |A| is
2012 2013

2013 1 − 2013 . 

The previous example is a very good example of the power of linearity of expectation – once
we find the correct way to break down the expected value we wish to compute, linearity of
expectation becomes lethal.
Before turning the reader loose on practice problems, we present one more example. In the
following example, linearity of expectation is not the main idea – there is a cute observation
required beforehand.

Example 7.20 (NIMO). Tom has a scientific calculator. Unfortunately, all keys are broken
except for one row: 1, 2, 3, + and -. Tom presses a sequence of 5 random keystrokes; at
each stroke, each key is equally likely to be pressed. The calculator then evaluates the
entire expression, yielding a result of E. Find the expected value of E.
(Note that if there are multiple signs in a row, pairs of −’s cancel out — the expression
3 + − − 2 evaluates to 5. But if there are an odd number of −’s, such as 31 + − 2, we
get a − and it becomes 29 in this case.)

Solution. The problem, at first glance, seems very difficult to work with. Instead of solving the
problem with 5 buttons pressed, we will first try a smaller case in order to glean any intuition
we can. Let us, for now, suppose that only 3 buttons pressed. We can list a few possible strings
in order to see if there are any convenient patterns.

1 − 2 = −1 1+2=3 2+3=5 2 − 3 = −1.

These examples give rise to the following observation: when we add (1 − 2) and (1 + 2), the 2’s
cancel out. This means that the only relevant portion of each string is the part before the first
operand. Aha! Going back to the initial problem, where there are 5 presses, we realize that a
similar phenomenon holds – given a string, we can switch operands in order to cancel out each
part after the first operand (if there are k signs in a row, there are 2k−1 ways the signs evaluate
to a + and 2k−1 ways the signs evaluate to a −).
For a few examples: the following pairs of strings are all “complements” of one another:

1−2+3 and 1+2−3


12 + −3 and 12 − −3
12 − +3 and 12 + +3

Thus, we need only find the expected value of the first number in the string, because when
we sum everything up, everything after the first operand will cancel with its complement! The
next observation is that, by linearity, the average digit pressed is always a 2. Therefore, the

11
Everaise Academy (2020) Math Competitions II

average 1-digit number is 2, the average 2-digit number is 22, the average 3-digit number is 222,
and etc.
Hence, we just need to find the probabilities of each of these cases. The probability that there
is 1 digit pressed before the first operand is 53 · 25 . The probability that there are 2-digits pressed
2
before the first operand is 35 · 25 . In general, the probability that there are 0 < k < 5 digits
k
pressed before the first operand is 35 · 52 . Finally, the probability that there are 5 consecutive
5
digits pressed is 35 . Thus, to find the answer, by the definition of expected value, the answer
is the following:
 2  3  4 !  
2 3 3 3 3 3 5
·2+ · 22 + · 222 + · 2222 + · 22222.
5 5 5 5 5 5

Computations reveal the answer of 1866. 

§7.3 Homework Problems

Problem 7.1. (Classical) [5] What is the maximum number of intersection points of diagonals
inside a convex n-gon?

Problem 7.2 (2006 HMMT). [6] Compute


2
X n60
X n3 X
X n2 X
n1
... 1.
n60 =0 n59 =0 n2 =0 n1 =0 n0 =0

Problem 7.3 (1993 AIME). [6] Three numbers, a1 , a2 , a3 , are drawn randomly and without
replacement from the set {1, 2, 3, . . . , 1000} . Three other numbers, b1 , b2 , b3 , are then drawn
randomly and without replacement from the remaining set of 997 numbers. Let p be the
probability that, after a suitable rotation, a brick of dimensions a1 × a2 × a3 can be enclosed in
a box of dimensions b1 × b2 × b3 , with the sides of the brick parallel to the sides of the box. If
p is written as a fraction in lowest terms, what is the sum of the numerator and denominator?

Problem 7.4 (1983 AIME). [7] For {1, 2, 3, . . . , n} and each of its non-empty subsets a unique
alternating sum sum is defined as follows. Arrange the numbers in the subset in decreasing
order and then, beginning with the largest, alternately add and subtract successive numbers.
For example, the alternating sum for {1, 2, 3, 6, 9} is 9 − 6 + 3 − 2 + 1 = 5 and for {5} it is simply
5. Find the sum of all such alternating sums for n = 7.

Problem 7.5 (Classical). [8] To triangulate a polygon means to draw diagonals dividing it into
triangles. Show that the number of ways to triangulate a convex n + 2-gon into n triangles with
n − 1 non-intersecting diagonals follows the Catalan numbers. A possible of triangulation of
n = 5 is shown.

12
Everaise Academy (2020) Math Competitions II

Problem 7.6 (2020 AIME I). [8] A club consisting of 11 men and 12 women needs to choose a
committee from among its members so that the number of women on the committee is one more
than the number of men on the committee. The committee could have as few as 1 member or
as many as 23 members. Let N be the number of such committees that can be formed. Find
the sum of the prime numbers that divide N .

Problem 7.7 (2020 CMIMC). [10] The quantity


           
2020 1010 2019 1011 1011 2019 1010 2020
+ + ... + +
1010 1010 1010 1010 1010 1010 1010 1010
can be written in the form m

n , for some integers n and m, such that n ≤ m − n. Find m + n.

Problem 7.8 (2008 IMO). [12] Let n and k be positive integers with k ≥ n and k − n an even
number. Let 2n lamps labelled 1, 2, ..., 2n be given, each of which can be either on or off.
Initially all the lamps are off. We consider sequences of steps: at each step one of the lamps is
switched (from on to off or from off to on). Let N be the number of such sequences consisting of
k steps and resulting in the state where lamps 1 through n are all on, and lamps n + 1 through
2n are all off. Let M be number of such sequences consisting of k steps, resulting in the state
where lamps 1 through n are all on, and lamps n + 1 through 2n are all off, but where none of
N
the lamps n + 1 through 2n is ever switched on. Determine M .

§7.3.1 Expected Value

Many of these homework problems will not be straightforward applications of linearity, but will
require some observations, as in the second and third examples. The reader is advised to not
try to apply linearity of expectation as a hammer — it is effective only when used with the
right setup.

Problem 7.9 (NIMO). [5] In chess, there are two types of minor pieces, the bishop and the
knight. A bishop may move along a diagonal, √as long as there are no pieces obstructing its
path. A knight may jump to any lattice square 5 away as long as it isn’t occupied.
One day, a bishop and a knight were on squares in the same row of an infinite chessboard,
when a huge meteor storm occurred, placing a meteor in each square on the chessboard inde-
pendently and randomly with probability p. Neither the bishop nor the knight were hit, but
their movement may have been obstructed by the meteors.
The value of p that would make the expected number of valid squares that the bishop can
move to and the number of squares that the knight can move to equal can be expressed as ab
for relatively prime positive integers a, b. Compute a + b.

Problem 7.10 (2016 AIME). [6] Beatrix is going to place six rooks on a 6 × 6 chessboard
where both the rows and columns are labelled 1 to 6; the rooks are placed so that no two rooks
are in the same row or the same column. The value of a square is the sum of its row number
and column number. The score of an arrangement of rooks is the least value of any occupied
square. The average score over all valid configurations is pq , where p and q are relatively prime
positive integers. Find p + q.

Problem 7.11 (2015 HMMT). [7] For positive integers x, let g(x) be the number of blocks of
consecutive 1’s in the binary representation of x. For example, g(19) = 2 since 19 = 100112
has a block of one 1 at the beginning and a block of two 1’s at the end and g(7) = 1 because
g(7) = 1112 only has a single block of 3 1’s. Compute g(1) + g(2) + g(3) + ... + g(256).

13
Everaise Academy (2020) Math Competitions II

Problem 7.12. [10] Suppose one has a random number generator G. G always generates a
finite positive integer. Is it possible for the expected value of the generated number to be
infinite? If yes, enter 0 and if no, enter 1.

Problem 7.13 (2018 HMMT). [10] Po picks 100 points P1 , P2 , · · · , P100 on a circle indepen-
dently and uniformly at random. He then draws the line segments P1 P2 , P2 P3 , . . . , P100 P1 . The
expected number of regions that have all sides bounded by straight lines can be written in the
form mn such that m and n are relatively prime. Find m + n.

Problem 7.14 (OMO). [12] Kevin has 255 cookies, each labeled with a unique nonempty
subset of {1, 2, 3, 4, 5, 6, 7, 8}. Each day, he chooses one cookie uniformly at random out of the
cookies not yet eaten. Then, he eats that cookie, and all remaining cookies that are labeled
with a subset of that cookie (for example, if he chooses the cookie labeled with {1, 2}, he eats
that cookie as well as the cookies with {1} and {2}). The expected value of the number of days
that Kevin eats a cookie before all cookies are gone can be written in the form m n such that m
and n are relatively prime. Find m + n.

14
8 Recursion and States

Recursion is one of the most powerful tools we have for solving combinatorial problems.
Intuitively, it’s based off the idea that some processes possess a lot of self-similarity — this is a
bit unclear now, but you’ll see more clearly what we’re talking about in the subsection itself.
States are a generalization of recursion that appear all the time on math competitions.
Let’s dive into some examples!

§8.1 Recursion

Example 8.1 (Classical). Suppose that we have a ten-step staircase. Liam starts at the
bottom, and every second, he may either climb one step or climb two steps. How many
ways can he ascend the staircase? (One way might be to climb two steps, then one step,
then two steps, then one steps five more times.)

Solution. This problem seems annoying to do with standard methods—we might be able to
do casework on the number of two-step climbs Liam attempts, but this is really computational.
To begin solving most math problems, it helps to consider small cases. If we deal with a
one-step staircase, there’s only one way for Liam to climb it. For a two-step staircase, Liam can
either climb one step twice or climb two steps, which makes for two ways. In a similar manner,
we can count the first few cases:

Height of Staircase Ways to Climb


1 1
2 2
3 3
4 5
5 8

(You should confirm for yourself that these numbers are correct!)
At this point, a pattern begins to emerge: the number of ways to climb the staircase appears
to follow the Fibonacci Sequence.
To see why this might be the case, we think about how the Fibonacci sequence works in the
first place: each successive term of the sequence is built on the previous two terms. Suppose
that Liam currently stands on the nth step of the staircase. He must have gotten there from
the (n − 1)th step or the (n − 2)th step, because he can only climb one or two steps at a time.
Therefore, the number of ways for Liam to climb to step n is equal to the number of ways he
can climb to step n − 2 and then climb two steps, added to the number of ways he can climb
to step n − 1 and then climb one step. (If you’re right now asking why he can’t climb to n − 2
and take a single step to n − 1, this case is addressed in the n − 1-case already!) Expressed
mathematically, if Si denotes the way for Liam to climb an i-step staircase, we have

Sn = Sn−1 + Sn−2 .

1
Everaise Academy (2020) Math Competitions II

Thus the number of distinct ways to ascend n steps is equal to the number of ways to ascend
n − 1 steps added to the number of ways to ascend n − 2 steps — which is exactly the Fibonacci
sequence, expressed differently. Now the remaining computation is easy: finishing the table
yields that if the staircase has 10 steps, then there are 89 distinct ways to ascend it. 

It would have been really difficult to do pure casework on the number of two-step ascensions,
or some other method! The idea of recursion here is that the process of climbing some number
n of steps — in this case, 10 — is linked to the process of climbing n − 1 steps or n − 2 steps.
You should try another classical exercise before moving on.

Exercise 8.2 (Classical). How many ways are there to fill in a 2 × 10 grid with 1 × 2 dominos?
Hints: Relate 2 × 10 to 2 × n for some smaller n than 10 by thinking about horizontal or vertical placement at
the end!

Let’s try a harder example.

Example 8.3 (2006 AIME I). A collection of 8 cubes consists of one cube with edge-length
k for each integer k, 1 ≤ k ≤ 8. A tower is to be built using all 8 cubes according to the
rules:

• Any cube may be the bottom cube in the tower.


• The cube immediately on top of a cube with edge-length k must have edge-length at
most k + 2.

Let T be the number of different towers than can be constructed. What is the remainder
when T is divided by 1000?

Solution. One of the biggest hints to use recursion is that 8-cube towers contain embedded
7-cube towers — towers with cubes of side length 1 through 7. Recall now that the primary
idea of recursion is to build up from smaller cases to larger ones, or trim down from larger cases
to smaller ones: in the previous example, we built up from 8 or 9 steps to 10 steps (or trimmed
down 10 steps to 8 or 9 steps!)
So in this case, let’s take an 8-cube tower, and see if we can trim it down to a working 7-cube
tower. If we take out the cube with side length 8 in a working configuration, will we be left
with a working 7-cube configuration? Try to convince yourself of this fact, and then read the
following paragraph.
Here’s a demonstration of why it works: if the cube below 8 has side length x and the cube
above it has side length y, we’ll look at the subsection

x8y

where we’re just representing vertical cube-stacking by horizontal lists of numbers. If we take
out the 8, we’re left with x y — but given that the 8 is stacked on top of the x, we can stack
anything on top of it. (Why?) As everything else in the working tower remains the same, we’ve
shown that taking the 8 out leaves us with a working 7-cube configuration, if it’s somewhere in
the middle.
If the 8 is on the left (that is, the bottom cube) or on the right (that is, the top cube),
convince yourself that we can remove it and be left with a working 7-cube tower!

2
Everaise Academy (2020) Math Competitions II

We’ve established that every 8-cube tower can be reduced to a 7-cube tower. It’s of little use
to build downwards, since we are looking to find the number of different towers with 8 cubes,
so we build upwards: consider some arbitrary 7-cube tower and see how many ways there are
to construct an 8-cube tower from it. Let’s take a look at an example:

1 3 2 4 5 7 6.

If we were to make this seven-cube tower into an 8-cube tower, we could put the 8 after the 7
or after the 6 — or we could put it at the beginning of the list. That’s three ways of doing so.
Note furthermore that this generalizes: for any sufficiently large n − 1-cube tower, there are 3
ways of putting an n-cube in so that we have a working n-tower. (In this case, sufficiently large
just means that we aren’t talking about adding a 2-cube to a 1-cube — there are only two ways
of doing so.) Think carefully about why the math in this paragraph works!
There’s only one more thing to check: given two distinct n − 1-cube towers, if we add an
n-cube, we should end up with two distinct n-cube towers. Otherwise, we might end up with
some overlaps — but it’s fairly easy to see why this can’t happen: the ordering of 1 through
n−1 remains the same when you add an n, so given two different original orderings of 1 through
n − 1 you can’t end up with the same ordering of 1 through n.
Therefore, if Sn is the number of ways to construct a working n-cube configuration, for
sufficiently large n, Sn = Sn−1 · 3. Let’s do a quick check of smaller cases: we have S1 = 1
as there’s only one way to stack 1 cube; S2 = 2 because it’s either 2 1 or 1 2. Finally, S3 = 6
because we can put the 3 between the two numbers, at the front, or at the back; this means
that from here on out, to get from Sn−1 to Sn we can just multiply by 3.
Therefore S8 = 35 · a3 = 243 · 6 = 1458, so our final answer is 458. 

Whew! That was a tough and involved problem. We proved that in general, Sn = 3 · Sn−1
— but to do that, we first considered trimming an 8-cube to a 7-cube. We then made sure that
there were exactly 3 ways to get from an n − 1-cube to an n-cube, and that distinct n − 1-cubes
always corresponded to distinct n-cubes; finally, we found a few base numbers and found S8 .
Let’s go over one more type of recursion — all the examples we’ve looked at so far are us
finding formulas for some sequence {Sn }, whether it be Sn−2 + Sn−1 = Sn (in the first example)
or Sn−1 · 3 = Sn (in the second.) In this case, we won’t only be working with one sequence.

Example 8.4 (Classical). Find the number of 8-digit binary strings with no consecutive 1s.
(A binary string is a string composed of only 0s and 1s.)

Solution. At first blush, this seems a prime target for recursion: once again, we can certainly
reduce 8-digit strings to 7-digit strings — say, just by lopping off the end number.
However, there’s a twist involved: let’s say we have a seven-digit string ending with a 1.
Then, if we’re to create a working 8-digit string, we can’t add a 1 to the end — we can only
add a 0. On the other hand, if our seven-digit string ends with a 0, we can add whatever we
want to it.
This motivates the following definition: let Sn be the number of n-digit working binary strings
ending in 1, and let Tn be the number of n-digit working binary strings ending in 0. We’ll find
formulas for both Sn and Tn based on earlier values.

3
Everaise Academy (2020) Math Competitions II

If an n-digit binary string ends in a 1, then the second-to-last digit must have been a 0.
Therefore, Sn = Tn−1 — we can get from an n − 1-digit string ending in a 0 to an n-digit string
ending in a 1 just by adding a 1, and we can reverse this process. (Indeed, it might be a good
time to think about the preceding bijections handout!)
Furthermore, Tn = Sn−1 + Tn−1 — we can append a 0 to any n − 1-digit string, because
we don’t have any conditions on 0’s. Additionally, removing a 0 from a working n-digit string
could leave us with either a string ending in 0 or a string ending in 1, so our equation holds.
Therefore our two equations Sn = Tn−1 and Tn = Sn−1 + Tn−1 allow us to substitute in
Sn−1 = Tn−2 into the second equation, and we get

Tn = Tn−1 + Tn−2 .

Beautiful! The Fibonacci sequence strikes again. Moreover, this implies that {Sn } is just the
shifted Fibonacci sequence, as Sn = Tn−1 .
It’s easy to check that T1 = 1 and that T2 = 2, so we end up with T8 = 34. Moreover,
S8 = T7 = 21 — and as we’re looking for the total number of 8-digit binary strings with no
consecutive 1’s, we’re looking for S8 + T8 . Our final answer is 34 + 21 = 55. 

One final, tough recursion problem to deal with.

Example 8.5 (2008 AIME). Consider sequences that consist entirely of A’s and B’s and
that have the property that every run of consecutive A’s has even length, and every run
of consecutive B’s has odd length. Examples of such sequences are AA, B, and AABAA,
while BBAB is not such a sequence. How many such sequences have length 14?

Solution. Once again, this seems like a problem that might fall to recursion because if we’ve
got a 14-length sequence, we can definitely consider subsequences of length less than 14.
As in the last problem, we define An to be the number of length-n subsequences following
the given properties that end in A, and define Bn similarly.
If a length-n subsequence ends in A, then the first n − 2 letters of that subsequence must be
a valid subsequence according to the given rules. Therefore

An = An−2 + Bn−2 ,

as that length-n − 2 subsequence can end in either letter.


Additionally, if a length-n subsequence ends in B, then either the first n − 1 letters comprise
a valid subsequence that ends in A, or the first n − 2 letters comprise a valid subsequence that
ends in B. (Why?) Therefore
Bn = An−1 + Bn−2 .

All that’s left for us is to compute some initial values and form the table: it’s clear that
A1 = 0, B1 = 1, A2 = 1, B2 = 0. We leave the rest of the computation to the reader; the answer
is 172. 

Exercise 8.6 (2007 AMC 12). Call a set of integers spacy if it contains no more than one out
of any three consecutive integers. How many subsets of {1, 2, 3, . . . , 12}, including the empty
set, are spacy?

4
Everaise Academy (2020) Math Competitions II

Exercise 8.7 (2019 AMC 12). How many sequences of 0s and 1s of length 19 are there that
begin with a 0, end with a 0, contain no two consecutive 0s, and contain no three consecutive
1s?

§8.2 States

Recursion is a powerful tool, but, as we saw in the previous example problem, sometimes we need
to use extra information to differentiate between the sub-problems we’ve defined. In these cases,
it is helpful to think of the problem in terms of states, which are simply intermediate stages of
an event. In the previous example problem, we considered the state where the sequence ended
in A and where the sequence ended in B. This concept might seem a bit vague, but hopefully
the following examples will clear it up.

Example 8.8 (Classical). Andrew and Brandon take turns flipping a fair coin until one of
them flips a heads, with Andrew going first. Find the probability that Andrew wins; that
is, that he flips a heads first.

Solution. The way you might approach this if you didn’t know states would probably be as
follows: Andrew has a 12 chance of winning on his first flip; if he is to win on his second flip,
then Andrew and Brandon have to flip tails and then Andrew has to flip heads, which gives him
a 18 chance of winning then. Continuing this way, you might find that his chance of winning is
1
1 1 1 2
+ + + ··· = 2 1 = ,
2 8 32 1− 4
3

by summing an infinite geometric series.


But this method is error-prone, and doesn’t generalize well. Note that there are two states
in the game: either it can be Andrew’s turn, or Brandon’s turn. Let’s suppose that A is the
probability that Andrew eventually wins if it is currently his turn, and let’s suppose that B is
the probability that Andrew eventually wins when it’s currently Brandon’s turn.
1
Andrew can either win on the spot on the first turn — with probability 2 — or he can flip a
tails and pass the turn to Brandon — also with probability 12 . Therefore

1 1
A= + B.
2 2

Now suppose it’s Brandon’s turn. Andrew can either lose on the spot — with probability 12
— or Brandon can flip a tails and pass the turn back to Andrew — also with probability 12 .
Therefore
1
B = A.
2
That is to say, the chance that Andrew wins when it’s Brandon’s turn is 12 the chance that
Andrew wins when it’s his own turn, because for Andrew to win from Brandon’s turn, Brandon
must flip a tails (with probability 12 ) and then it will be Andrew’s turn again.
Solving the system of equations, we find A = 32 , so Andrew has a 2
3 chance of winning; we
are done. 

We’ll also present an alternate method of visualizing this. See the diagram below:

5
Everaise Academy (2020) Math Competitions II

Let’s say we have a counter that starts on A, and we want to find the probability that it lands
on WIN. It moves according to the following rules: at each turn, it chooses an arrow emanating
from the spot that it’s currently in with the labeled probability — that is, if it starts at A, it
has a 12 chance of moving to B and a 12 chance of moving to WIN. Try and figure out why this
should be equivalent to the above problem!
Then the diagram actually tells us all the information we need: if we end up at LOSE, we
can never make it to WIN. Therefore, if A is the probability that we make it to WIN starting
from A, and B is the probability that we make it to WIN starting from B, we get the equations
A = 12 + 12 B and B = 21 A, as before.

Example 8.9 (2003 AIME II). A bug starts at a vertex of an equilateral triangle. On each
move, it randomly selects one of the two vertices where it is not currently located, and
crawls along a side of the triangle to that vertex. Given that the probability that the bug
moves to its starting vertex on its tenth move is m/n, where m and n are relatively prime
positive integers, find m + n.

Solution. For brevity we’ll let the vertices of the triangle be A, B, C and let the bug start at
A. One thing that should jump out at us is the symmetry — there is essentially no difference
between the bug being at B or C. We could switch the labeling of these vertices and nothing
would change. So instead of considering B and C as separate states, we’ll combine them into
N — the “not-A” state.
If the bug is in the A-state, there’s a probability of 1 that it shifts to the not-A-state during
its next move; if the bug is in the not-A-state, there’s a probability of 21 that it remains in this
state and a probability of 12 that it shifts to the A-state during the next move. Therefore, we
can actually create a table:

Move Number A not-A


0 1 0
1 0 1
2 1/2 1/2
3 1/4 3/4
4 3/8 5/8
.. .. ..
. . .

Here’s a clearer explanation of how we got these numbers: let P (n, A) and P (n, N ) denote

6
Everaise Academy (2020) Math Competitions II

the probabilities of being at the state A and the state N , respectively, after n moves. Then
1
P (n, A) = P (n − 1, N )
2
1
P (n, N ) = P (n − 1, A) + P (n − 1, N )
2
In English, essentially what this is saying is that the chance of being at A on turn n is equivalent
to half the chance of being at not-A on turn n − 1, and the chance of being at not-A on turn n
is equal to the chance of being at A on turn n − 1 added to half the chance of being at not-A
on turn n − 1. This should make sense based on the probabilities we calculated earlier — and
we used these rules to calculate the numbers for our table!
For example, P (2, A) — the entry in our table corresponding to move 2, state A — is just
1
2 of the probability that the bug is at not-A after the first turn, which is 1. On the other
hand, P (4, N ) — the entry in our table corresponding to move 4, state not-A — is just 21 of the
probability that the bug is at not-A on the third turn added to the probability that the bug is
at A on the third turn; this is 12 · 34 + 41 = 58 . Based on our initial conditions, p(0, A) = 1 and
p(0, N ) = 0, we can calculate all the numbers in the table this way!
171
We’re just looking for p(10, A), which turns out to be 512 after finishing the computations.
Our answer is 683. 

A few ideas here to keep in mind: firstly, it can be very powerful to exploit symmetry — we
only really care about whether the bug is at A or not in the end, so we made two states, A and
not-A. Next, we were able to calculate the probabilities of the bug being at each state based
on probabilities from the move before — this is why we refer to states as a sort of “generalized
recursion,” in a way. In our recursion examples from earlier this chapter, we solely moved
forward — forward through the steps of the staircase, forward through more and more cubes,
or forward through more digits of binary strings — but in this problem, we just move back and
forth between two states, with probabilities involved.
Unfortunately, we often have to deal with more than two states at once.

Example 8.10 (2014 AMC 12). In a small pond there are eleven lily pads in a row labeled
0 through 10. A frog is sitting on pad 1. When the frog is on pad N , 0 < N < 10, it will
N N
jump to pad N − 1 with probability 10 and to pad N + 1 with probability 1 − 10 . Each
jump is independent of the previous jumps. If the frog reaches pad 0 it will be eaten by a
patiently waiting snake. If the frog reaches pad 10 it will exit the pond, never to return.
What is the probability that the frog will escape being eaten by the snake?

Solution. It looks like there are 11 natural states to think about: lilypads 0, 1, 2, · · · , 9, and
10. Let’s define Pn as the probability that the frog escapes the pond uneaten from lilypad n;
clearly P0 = 0 and P10 = 1. Then, for 1 ≤ i ≤ 9, we can write the equation
i 10 − i
Pi = Pi−1 + Pi+1 ,
10 10
i
as there’s an 10 chance that the frog jumps from lilypad i to lilypad i − 1, from which it has a
Pi−1 chance of survival, and a 10−i
10 chance that it jumps from lilypad i to lilypad i + 1, from
which it has a Pi+1 chance of survival.
Now, this looks like a 9-variable system of equations — which would be very difficult to
solve in any ordinary case. However, there’s another tool we can take advantage of: symmetry.
Consider P5 — we know that P5 = 21 P4 + 12 P6 .

7
Everaise Academy (2020) Math Competitions II

4 6 4 6
However, P4 = 10 P3 + 10 P5 , and P6 = 10 P7 + 10 P5 . Essentially, what these last three equations
we’ve written mean is that when you’re at lilypad 5, you have an equal chance of going towards
6
each direction; when you’re at lilypad 6, the draw towards lilypad 5, the middle, is 10 ; so is the
draw towards lilypad 5 from lilypad 4. We can make the same symmetry argument for lilypads
3 and 7; 2 and 8; 1 and 9 — this means that the draw from lilypad 5 towards lilypads 0 and 10
is equal. This is a bit vague, but make sure you understand why P5 = 21 !
So it follows that we can calculate P1 using a system of four equations, rather than nine: we
i
can use Pi = 10 Pi−1 + 10−i 63
10 Pi+1 for i = 1, 2, 3, and 4, and we end up with P1 = 146 . 

Exercise 8.11. Do the computation for the above example yourself to verify our answer!

Exercise 8.12 (Adapted from AIME 1985). We won’t present this problem as an example,
but none of the examples we present in this section deal purely with computing the number of
ways to do something, so we’ll let the reader work through the main steps with our help as an
exercise.
Let A, B, C, and D be the vertices of a regular tetrahedron, each of whose edges measures
1 meter. A bug, starting from vertex A, observes the following rule: at each vertex it chooses
one of the three edges meeting at that vertex, each edge being equally likely to be chosen, and
crawls along that edge to the vertex at its opposite end. Find the number of distinct 7-meter
paths that the bug can take that end at vertex A.
1. If the bug ends up at A after 7 meters, where must it have been after 6 meters?
2. Define SA,n to be the number of n-meter paths that end at A. Define SB,n , SC,n , and SD,n
similarly. Show that SA,n = SB,n−1 + SC,n−1 + SD,n−1 , and that similar equations hold
for SB,n , SC,n , and SD,n .
3. Find SA,1 , SB,1 , SC,1 , and SD,1 , and use these initial values to build your way up to SA,7 .

Exercise 8.13 (HMMT 2004). In a game similar to three card monte, the dealer places three
cards on the table: the queen of spades and two red cards. The cards are placed in a row,
and the queen starts in the center; the card configuration is thus RQR. The dealer proceeds to
move. With each move, the dealer randomly switches the center card with one of the two edge
cards (so the configuration after the first move is either RRQ or QRR). What is the probability
that, after 8 moves, the center card is the queen?

States can also be used to find elegant solutions to expected-value problems.

Example 8.14 (Classical). Find the expected number of tosses it takes to flip two consec-
utive heads using a fair coin.

Solution. We could try using the weighted-probability approach for expected-value, but things
get messy very quickly. It is possible, for arbitrary n, to compute the number of ways to flip a
coin n times where the first occurrence of consecutive heads happens on the (n − 1)th and nth
tosses (hint: recursion). However, summing these values in an infinite series is unnecessarily
painful.
Instead, let’s define Ex to be the expected number of tosses to flip two consecutive heads,
given that the previous x flips were heads. E2 is trivially 0, so we are left to find E0 and E1 .
First we look at E0 . If our previous flip was tails or we haven’t flipped at all, then we will
remain in the current state if our next flip is tails or we will advance to E1 if our next flip is

8
Everaise Academy (2020) Math Competitions II

heads, each with probability 12 . This gives


1 1
E0 = E0 + E1 + 1.
2 2

If our previous flip was heads, then we will either return to E0 if we flip tails or we will
advance to E2 . Thus
1 1
E1 = E0 + E2 + 1.
2 2
The +1’s are used to account for the toss used to get to the next state. Our answer will be
E0 , which can be found from the system of equations to be 4. 

We’ll finish with a difficult expected-value problem that would be nearly impossible to solve
without states.

Example 8.15 (2016 AIME I). Freddy the frog is jumping around the coordinate plane
searching for a river, which lies on the horizontal line y = 24. A fence is located at the
horizontal line y = 0. On each jump Freddy randomly chooses a direction parallel to one
of the coordinate axes and moves one unit in that direction. When he is at a point where
y = 0, with equal likelihoods he chooses one of three directions where he either jumps
parallel to the fence or jumps away from the fence, but he never chooses the direction that
would have him cross over the fence to where y < 0. Freddy starts his search at the point
(0, 21) and will stop once he reaches a point on the river. Find the expected number of
jumps it will take Freddy to reach the river.

Solution. The tip-off to use states in this problem is that we have a sort of process that involves
our frog jumping from one “state” to another — that is, from y-values to other y-values. (If
you read and understand the problem carefully, you’ll see that the x-values don’t matter at all!)
So let’s make some states: let Si be the expected value of the number of jumps it’ll take
Freddy to reach the river when his y-coordinate is i. It follows that S24 = 0, and that we don’t
have to deal with i ≥ 25 or i < 0.
Now let’s deal with the case where 1 ≤ i ≤ 23. (We’ll handle i = 0 separately.) If Freddy is
at (n, i), then he has a 21 chance of jumping to either (n + 1, i) or (n − 1, i); on the other hand,
he has a 14 chance of jumping to (n, i − 1) and a 14 chance of jumping to (n, i + 1). But if he
lands at state i, once again the expected number of moves he has left to get to y = 24 is Si ;
if he lands at state i + 1, the expected number of moves he has left is Si+1 , and similarly, for
state i − 1, the expected number of moves he has left is Si−1 .
These relations between the states give us the equations
1 1 1
Si = 1 + Si + Si+1 + Si−1
2 4 4
for all 1 ≤ i ≤ 23. Note that we’ve got an added 1 because moving to a new state does take us
a jump. Simplifying the equations, we get
1 1 1
Si = 1 + Si+1 + Si−1
2 4 4
2 1
Now let’s deal with S0 : this time, he has a 3 chance of staying on y = 0, and 3 chance of
moving to y = 1. Therefore
2 1
S0 = 1 + S0 + S1 .
3 3

9
Everaise Academy (2020) Math Competitions II

Now all that all the states have been accounted for, we essentially have a 24-variable system
of equations to deal with.
Thankfully, it’s not impossible to handle this. Exploiting the inherent symmetry of the
system, we add up the equations for 1 ≤ i ≤ 23, yielding
23
1X 1 1 1
Si = 23 + (S0 + S2 ) + (S1 + S3 ) + · · · + (S22 + S24 )
2 4 4 4
i=1
22
1 1X
= 23 + (S0 + S1 + S23 + S24 ) + Si
4 2
i=2

so miraculously our terms cancel, and as S24 = 0 we’re left with


1 1
(S1 + S23 ) = 23 + (S0 + S1 + S23 ).
2 4
But we also have the equation S0 = 1 + 23 S0 + 13 S1 , or equivalently, 31 S0 = 1 + 13 S1 . Simplifying
these two equations yields the system

S1 + S23 = 92 + S0
S0 = 3 + S1 .

Recall now that Freddy starts at (0, 21), so we’re trying to find S21 . The two equations above
give us S23 = 95. From here, it’s not hard to use the equation 21 Si = 1 + 14 Si+1 + 14 Si−1 to find
S21 = 273, as desired. 

This problem was really hard — finding the states was only half the battle! Recall the tipoff
for using states: you have some process that possesses some sort of self-similarity; in this case,
the fact that you can go up and then return to the same point should be an indicator that states
might be successful.
Once we figured out that we should use states, we found the 23 total states and set up a giant
system of equations. As in most systems with many, many equations, we found a way to put
them all together at once, and then solved for S21 .

§8.3 Homework Problems

Problem 8.1 (Classical). [3] Suppose Liam may climb up either one, two, or three steps in
each move in the our first example of this handout. How many ways can he ascend the ten-step
staircase?

Problem 8.2 (2019 AMC 12). [3] There are lily pads in a row numbered 0 to 11, in that order.
There are predators on lily pads 3 and 6, and a morsel of food on lily pad 10. Fiona the frog
starts on pad 0, and from any given lily pad, has a 12 chance to hop to the next pad, and an
equal chance to jump 2 pads. The probability that Fiona reaches pad 10 without landing on
either pad 3 or pad 6 can be expressed as m
n , where m and n are relatively prime integers. Find
m + n.

Problem 8.3 (2015 AIME II). [5] There are 210 = 1024 possible 10-letter strings in which each
letter is either an A or a B. Find the number of such strings that do not have more than 3
adjacent letters that are identical.

10
Everaise Academy (2020) Math Competitions II

Problem 8.4 (2019 AIME II). [4] Lily pads 1, 2, 3, . . . lie in a row on a pond. A frog makes
a sequence of jumps starting on pad 1. From any pad k the frog jumps to either pad k + 1 or
pad k + 2 chosen randomly and independently with probability 21 . The probability that the frog
visits pad 7 is pq , where p and q are relatively prime positive integers. Find p + q.

Problem 8.5 (1993 AIME). [6] Alfred and Bonnie play a game in which they take turns tossing
a fair coin. The winner of a game is the first person to obtain a head. Alfred and Bonnie play
this game several times with the stipulation that the loser of a game goes first in the next game.
Suppose that Alfred goes first in the first game, and that the probability that he wins the sixth
game is m/n, where m and n are relatively prime positive integers. What are the last three
digits of m + n?

Problem 8.6 (Classical). [6] Albert is standing on a number line, at the coordinate 1. On each
turn, he moves either 1 to the left or 1 to the right, each with probability 12 . If he ever reaches
4, he moves left by 1 with probability 1 on his next turn. Find the expected number of turns
he’ll take before he reaches 0.

Problem 8.7 (2020 CMIMC). [7] Seven cards numbered 1 through 7 lay stacked in a pile
in ascending order from top to bottom (1 on top, 7 on bottom). A shuffle involves picking a
random card of the six not currently on top, and putting it on top. The relative order of all
the other cards remains unchanged. The probability that, after 5 shuffles, 6 is higher in the pile
than 3 is m/n, where m and n are relatively prime positive integers. Find m + n.

Problem 8.8 (2018 AIME I). [10] Let SP1 P2 P3 EP4 P5 be a heptagon. A frog starts jumping
at vertex S. From any vertex of the heptagon except E, the frog may jump to either of the two
adjacent vertices. When it reaches vertex E, the frog stops and stays there. Find the number
of distinct sequences of jumps of no more than 12 jumps that end at E.

Problem 8.9 (Mandelbrot). [10] You and I each have $14. I flip a fair coin repeatedly. If it
comes up heads, I give you a dollar, but if it comes up tails, you give me a dollar. What is the
expected number of flips until one of us runs out of money?

Problem 8.10 (2019 AIME I). [7] A moving particle starts at the point (4, 4) and moves until
it hits one of the coordinate axes for the first time. When the particle is at the point (a, b), it
moves at random to one of the points (a − 1, b), (a, b − 1), or (a − 1, b − 1), each with probability
1
3 , independently of its previous moves. The probability that it will hit the coordinate axes at
(0, 0) is 3mn , where m and n are positive integers, and m is not divisible by 3. Find m + n.

Problem 8.11 (2019 HMMT). [8] Contessa is taking a random lattice walk in the plane,
starting at (1, 1). (In a random lattice walk, one moves up, down, left, or right 1 unit with
equal probability at each step.) If she lands on a point of the form (6m, 6n) for m, n ∈ Z, she
ascends to heaven, but if she lands on a point of the form (6m + 3, 6n + 3) for m, n ∈ Z, she
descends to hell. The probability she will ascend to heaven is m/n, where m and n are relatively
prime positive integers. Find m + n.

Problem 8.12 (1995 AIME). [12] Let p be the probability that, in the process of repeatedly
flipping a fair coin, one will encounter a run of 5 heads before one encounters a run of 2 tails.
Given that p can be written in the form m/n where m and n are relatively prime positive
integers, find m + n.

11
9 Generating Functions and Induction

§9.1 Induction

Now we’re going to have a quick look at induction in a general sense. Tomorrow we’re going to
look in more depth at its applications to combinatorics problems, so make sure you read and
understand this section!
Induction is a powerful tool for proving statements involving the natural numbers, as it allows
us to build up from smaller examples to get a more general statement.
Almost all induction arguments are composed of two main parts:
1. Proving the desired statement for the smallest case that we want to consider (this is usually
called the base case). We’ll usually take n = 1 for this step, although it is sometimes more
convenient or necessary to use another value of n.
2. Proving that the statement holding for n means that it also holds for n + 1 (or something
else that enables us to see that the statement holds for all necessary inputs). This is
known as the inductive step.
This then proves that the argument holds for all natural numbers.
Why? An intuitive way to see this is to choose the smallest number larger than the base case
m that it doesn’t hold for. But then it must have held for m − 1, and the inductive step tells
us the statement must also hold for m, so we have a contradiction.
We can think of the inductive process a bit like climbing a staircase: if we can prove that we
can get onto the bottom step and that we can climb from one step to the next, we can climb
arbitrarily many stairs.

Remark. Note that induction only works for proving statements about the natural numbers
(or some subset of the naturals) - not about the rationals or the reals. As such, induction
is a good place to start when trying to prove statements about the integers, but should
almost always be avoided when trying to prove statements about the rationals or reals.

If you found that description confusing, hopefully this example induction proof of a familiar
exercise will help clear things up:

n(n+1)
Example 9.1. The sum of the first n natural numbers is 2 .

Solution. Note that we’re looking at a condition on the natural numbers, which makes this a
natural proof to do by induction.
The first thing we’re going to need to establish is our base case. When n = 1, we take the
sum of only the first natural number, which is 1. We also have that:
n(n + 1) 2
= =1
2 2
so the result holds when n = 1.

1
Everaise Academy (2020) Math Competitions II

Now we’ve established the base case, let’s move on to the inductive step.
k(k+1)
Suppose that we know that the sum of the first n = k natural numbers is 2 . Then the
sum of the first n = k + 1 natural numbers must be
 
k(k + 1) k
+ (k + 1) = (k + 1) +1
2 2
which we can then rearrange to get
 
k+2 (k + 1)(k + 2)
(k + 1) =
2 2
so the result also holds for n = k + 1.
Then by induction, we’re done! 

Remark. This structure (with the base case first and the induction step second) is generally
a good way to go about writing induction proofs. A dummy variable (in this case k) is
generally used to improve clarity and avoid variable abuse.

Okay, so we’re starting to understand how to use induction. Let’s look at another similar
example.

n(n+1)(2n+1)
Example 9.2. Prove that the sum of the first n square numbers is 6 .

Solution. This seems like a nice candidate for induction, so let’s do just that!
Base case: When n = 1, the sum of the first n square numbers is 1. Also, we have that:
n(n + 1)(2n + 1) 1(2)(3)
= =1
6 6
so the condition holds when n = 1.
Now let’s move on to our inductive step. Assume it holds true for n = k. Then the sum of
the first k squares is
(k)(k + 1)(2k + 1)
.
6
For n = k + 1, we then get that the sum of the first n squares is
k(k + 1)(2k + 1)
+ (k + 1)2 .
6
Let’s simplify this. Factoring out k + 1 gives us
k(2k + 1) + 6(k + 1)
(k + 1) ·
6
which can be simplified to
2k 2 + 7k + 6 (2k + 3)(k + 2)
(k + 1) · = (k + 1) ·
6 6
and so the sum of the first k + 1 square numbers is
(k + 1)(k + 2)(2k + 3)
6
so the result also holds true for n = k + 1.
Thus the desired statement is true by induction. 

2
Everaise Academy (2020) Math Competitions II

Exercise 9.3. Using induction, prove that the sum of the first n odd numbers is given by n2 .

Exercise 9.4. Using induction, prove that the sum of the first n cubes is given by
 2
n(n + 1)
.
2

Remark. Notice 2 things the above examples had in common:


1. Smaller cases were incredibly easy to check.
2. It was reasonably easy to know how to move from one case to another, but not as
easy to know how to deal with each case directly.
As we get further on, doing either of these steps may become more complicated but both
of these are good signs that a problem will be suitable for induction.
It’s good to be able to spot when a problem may be doable with induction - try looking
over your week 2 notes again, could you have used induction anywhere? This is also a
good exercise for week 4 as induction can be really useful in number theory problems and
getting used to spotting the signs now can save you a lot of time in competitions later on.

Now let’s look at a slightly different example.



φn −(1−φ)n 1+ 5
Example 9.5. Prove that the nth Fibonacci number Fn = √
5
, where φ = 2 .

Solution. Why is this a good candidate for induction? Well, the only way we currently know
(without the stated formula) to get Fn is by using a recurrence relation. This gives us a way to
build up from what we know about the smaller cases to the nth case. Sound familiar?
Let’s start with the base case of n = 1. F1 = 1 and we note that
√ √
φ − (1 − φ) = 1 + 5 − 1 = 5

so the formula gives us that √


5
F1 = √ = 1
5
and we have the equality that we need.
Are we done with the base case yet? Not quite. To show the induction step, we’ll likely
use Fn = Fn−1 + Fn−2 . This means that we will need to have a stronger assumption – if the
condition holds for n − 2 and n − 1, then it must also hold for n. We’re going to need 2 base
cases!
Okay, so let’s consider the base case of n = 2. Then F2 = 1 and we have

φ2 − (1 − φ)2 = (φ − (1 − φ))(φ + (1 − φ)) = 5.

We can then see that √


5
F2 = √ = 1
5
so the formula also holds for n = 2.

3
Everaise Academy (2020) Math Competitions II

Okay, we’ve now established both of our base cases, now for the inductive step!
Let’s assume the result holds true for n = k − 1 and n = k − 2. Then, for n = k we have

Fn = Fn−1 + Fn−2

and we can use the assumption to re-write this as


φn−1 + (1 − φ)n−1 φn−2 + (1 − φ)n−2
Fn = √ + √
5 5
which can be simplified as
φn−1 + φn−2 + (1 − φ)n−1 + (1 − φ)n−2
√ .
5
Now’s the time to use the fact that φ2 − φ − 1 = 0 and (1 − φ)2 − (1 − φ) − 1 = 0. (If you
haven’t seen this before, check it. Note that we’d think of doing this in an olympiad essentially
because we need this to be true - if it wasn’t, our result wouldn’t hold!)
Rearranging these equations gives us

φn = φn−1 + φn−2

and
(1 − φ)n = (1 − φ)n−1 + (1 − φ)n−2 .

Subbing these into the previous equation gives us


φn + (1 − φ)n
Fn = √
5
so the equation holds for n = k, as desired.
By induction, the result holds. 

Remark. This example shows that it is sometimes necessary to have multiple base cases. It
is important to be able to make modifications like this to the induction method to improve
its versatility.

That’s it for the basics of induction! We will cover some more difficult induction examples
tomorrow.

Exercise 9.6. Using induction, prove that Fn+2 + Fn + Fn−2 = 4Fn . Hints: How many base cases
do you want? What should your first base case be?

Exercise 9.7. Prove that every positive integer can be written uniquely as the sum of one or
more distinct powers of 2.

§9.2 Generating Functions

Some complicated counting problems can be simplified with the use of a generating function,
which allows us to encode sequences into the coefficients of a polynomial. These polynomials
may not always be finite; infinite polynomials are called power series.

4
Everaise Academy (2020) Math Competitions II

For example, if our sequence happens to be the triangular numbers 1, 3, 6, 10, 15, 21, . . ., we
may have the following generating function:

1 + 3x + 6x2 + 10x3 + 15x4 + 21x5 + . . .

This is just a simple example, but it shows the concept of a embedding a sequence into a poly-
nomial. Throughout the next few examples, we will see how we can apply algebraic techniques
to solve counting problems.

Example 9.8. How many ways can we roll three tetrahedral dice (sides have values 1, 2,
3, 4) to get a sum of 5?

Solution. If we roll a standard tetrahedral die, there is 1 way to roll a 1, 1 way to roll a 2, and
so forth. Thus, the generating function associated with rolling one die is

x + x2 + x3 + x4 .

We use the degree of a term to represent the outcome on the die and the coefficient of a term to
represent the number of ways to get that outcome. Our generating function is not too exciting,
but we have to find a way to ”roll” it three times. How can we do that?
The question is asking how many ways we can get a sum of 5, so we want to add the degrees.
This is the same as multiplying the polynomials! Thus, we are looking for the coefficient of the
x5 term of the following generating function:
3
x + x2 + x3 + x4

Since we don’t know any techniques to simplify this expression to find the coefficient of the x5
term, we’re going to have to manually expand it.

3
x + x2 + x3 + x4
3
= x3 1 + x + x2 + x3
2
= x3 1 + x + x2 + x3 1 + x + x2 + x3


= x3 1 + 2x + 3x2 + 4x3 + 3x4 + 2x5 + x6 1 + x + x2 + x3


 

= x3 1 + 3x + 6x2 + 10x3 + 12x4 + 12x5 + 10x6 + 6x7 + 3x8 + x9




= x3 + 3x4 + 6x5 + 10x6 + 12x7 + 12x8 + 10x9 + 6x10 + 3x11 + x12

Whew! That was very messy. There are better ways of computing the coefficient of x5 that we
will see in the future, so don’t worry. In the meantime, we found that the coefficient of x5 is 6,
so there are 6 ways to roll a sum of 5. 

Example 9.9. Find the number of integer solutions to a + b + c + d = 6, where a must be


even, b must be odd, and 0 ≤ a, b, c, d ≤ 4.

Solution. Applying a similar technique as the previous example, we may write the possibilities
for a, b, c, and d as generating functions. Since a must be even, the corresponding generating
function is

1 + x2 + x4 .

5
Everaise Academy (2020) Math Competitions II

For b to be odd, we have

x + x3 .

c and d don’t have any restrictions other than 0 ≤ c, d ≤ 4, so the generating functions are the
same and equal to

1 + x + x2 + x3 + x4 .

To sum the variables, we must multiply the generating functions:


2
1 + x2 + x4 x + x3 1 + x + x2 + x3 + x4
 

= x 1 + 2x2 + 2x4 + x6 1 + 2x + 3x2 + 4x3 + 5x4 + 4x5 + 3x6 + 2x7 + x8 .


 

Instead of completely expanding the expression out, we can just consider what the coefficient
of x6 will be. There is a factor of x at the front, so we are really asking what the coefficient of
x5 will be in the following expression:

1 + 2x2 + 2x4 + x6 1 + 2x + 3x2 + 4x3 + 5x4 + 4x5 + 3x6 + 2x7 + x8 .


 

We can ignore all of the terms with degree greater than 5, so we are left with:

1 + 2x2 + 2x4 1 + 2x + 3x2 + 4x3 + 5x4 + 4x5 .


 

This is much easier to work with! If we pick the constant term, 1, from the first polynomial,
we have to multiply by 5x4 , contributing 1 × 5 = 5. If we pick the 2x2 term from the first
polynomial, we have to multiply by 4x3 , contributing 2 × 4 = 8. Finally, if we pick the 2x4 term
from the first polynomial, we have to multiply by 2x, contributing 2 × 2 = 4. This means that
the coefficient of x6 in the original expression will be 5 + 8 + 4 = 17. Thus, there are 17 integer
solutions to a + b + c + d = 6, where a must be even, b must be odd, and 0 ≤ a, b, c, d ≤ 4. 

Before we try more examples, make sure you understand the techniques that we are using
by doing the following exercise. We must emphasize that you should use generating functions!
The problem is not very difficult with the standard counting techniques.

Exercise 9.10. Three sisters Nat, Pat, and Kat want to buy their mother a cake. They are
trying to figure out how to split the $10. As the youngest sister, Nat thinks that she should
not have to contribute more than $3. If they all pay with dollar bills, how many ways can they
split the bill?

To gain some more insight about how generating functions work, let’s consider the Binomial
Theorem as a generating function through an example.

Example 9.11. Harry is ordering 3 distinct cupcakes and has enough money for 4 toppings.
If there are 5 different toppings in total, how many different ways can he top his cupcakes?

Solution. On each individual cupcake there is 50 = 1 way to have 0 toppings, 51 = 5 ways


 

to have 1 topping, and so forth. Thus the generating function for each cupcake is

1 + 5x + 10x2 + 10x3 + 5x4 + x5 .

6
Everaise Academy (2020) Math Competitions II

Do the coefficients of this remind you of anything? They are the same as the binomial expansion
of (x + 1)5 ! Thus, the generating function that shows the number of ways to choose toppings
for all 3 cupcakes is:
 3
(1 + x)5 = (1 + x)15

To find the number of ways to top the 3 cupcakes, with 4 toppings in total, is the same as
finding the coefficient of x4 . By applying the Binomial Theorem, we may quickly find that
15

value to be 4 = 1365. 

As promised earlier, let’s see an example that simplifies the computation.

Example 9.12. Find the number of solutions in non-negative integers to the equation
a + b + c = 34.

Solution. Applying the technique we used earlier, we would have to expand the following
expression:
3
1 + x + x2 + . . . + x33 + x34

Unfortunately, this is going to be messy. Let’s see if we can find a better way to solve this
problem. First, instead of writing the generating function as 1 + x + x2 + . . . + x33 + x34 , let’s
let this expression go off to infinity. As in, let the generating function for the value of a be
1 + x + x2 + . . ., since the algebra will be much easier and it preserves the coefficient of x34 –
convince yourself of this before reading on. Now, we are trying to cube an infinite polynomial.
How do we do that? We can start by squaring it first:

1 + x + x2 + . . . 1 + x + x2 + . . .
 

We can start off small and try to find the coefficients for 1, x, x2 , . . ., simply by multiplying the
expressions out. We find that the expression is equal to:

1 + 2x + 3x2 + 4x3 + . . .

This is because the xk term in the product is formed by selecting one term with degree less
than or equal to xk from the first polynomial. There are k + 1 options, so we can confirm that
squaring the infinite polynomial gives our original equation. We can multiply this expression
by a third infinite polynomial:

1 + 2x + 3x2 + 4x3 + . . . 1 + x + x2 + . . .
 

Once again, we can collect term by term to find that the expression is equal to:

1 + 3x + 6x2 + 10x3 + . . .

This is because the xk term in the product is formed by selecting one term xi with degree
less than or equal to xk from the first polynomial, which has a coefficient of i + 1. Summing
the coefficients will give us (k+1)(k+2)
2 , so we have our equation. Then the coefficient for x34 is
simply
(34 + 1) (34 + 2) 35 × 36
= = 35 × 18 = 630
2 2
Thus, the answer to our original problem is 630. 

7
Everaise Academy (2020) Math Competitions II

In our last example, we saw what happened when we cubed the infinite polynomial 1 + x +
x2 + x3 + . . .. What happens if we raise this polynomial to the nth power?
n
So far, we have seen what happens to 1 + x + x2 + x3 + . . . when n = 1, 2, 3:
∞  
2 3
1 X k k
1 + x + x + x + ... = x
0
k=0
∞  
2 3
2 X k+1 k
1 + x + x + x + ... = x
1
k=0
∞  
2 3
3 X k+2 k
1 + x + x + x + ... = x
2
k=0

We have a clear pattern, so we may make the following conjecture:


∞  
2 3
n X n+k−1 k
1 + x + x + x + ... = x
n−1
k=0

The proof of this will be left as a homework problem, but before we move on, let’s consider
one final algebraic manipulation.
We can write 1 + x + x2 + x3 + . . . as a geometric series, to get the following result:

!n
X 1
xk =
(1 − x)n
k=0

You might be thinking – this is only possible if |x| < 1! We won’t deal with proving this formally,
but you can just think of x as a placeholder to simplify calculations. This result is known as
the negative binomial theorem, and we will see an application of it in the next example!

Example 9.13 (2007 HMMT). Let S denote the set of all triples (i, j, k) of positive integers
where i + j + k = 17. Compute
X
ijk.
(i,j,k)∈S

Solution. There are two main differences between this example and the previous one. First,
the variables are positive integers, instead of non-negative integers. Second, we are asked to
find the sum of the products of triples, in place of just the number of triples. Instead of defining
a generating function for each variable, let’s start by defining a generating function for the sum
of the products of triples.
P
Let sn = i+j+k=n ijk and encode the sequence into a generating function:

X
sn xn .
n=0

To simplify this expression, we have to consider exactly what sn is. sn is the sum of the product
of possible triples. This is similar to a coefficient of a product of polynomials, which is the
sum of many products of coefficients. This motivates us to consider the following generating
function corresponding to the value of the variable i:

X
nxn
n=1

8
Everaise Academy (2020) Math Competitions II

We can use the same generating function for j and k. To take the sum of the products of the
triples, we only have to multiply these three infinite polynomials. Thus, we have:
∞ ∞
!3
X X
n n
sn x = nx
n=0 n=1
P∞ n−1 1
We know from before that n=1 nx = (1−x)2
, so we see that the desired expression is


!3 3
x3

X
n x
nx = = .
n=1
(1 − x)2 (1 − x)6

m+5−3 19
We know that the coefficient of xm in the last expression is equal to
 
5 = 5 = 11628. 

Exercise 9.14. Shelby is going shopping for apples, bananas, and oranges. She wants to
purchase n pieces of fruit, but her family some strange preferences:
• Her husband is allergic to bananas, so she can purchase at most three.
• She has four children and they like to fight over the oranges, so the number of oranges
must be divisible by four.
In terms of n, how many ways can Shelby fill her basket?

§9.3 Homework Problems

Problem 9.1 (Classical). [3] Prove that 1 · 1! + 2 · 2! + 3 · 3! + . . . + n · n! = (n + 1)! − 1.

1
Problem 9.2 (Adapted from 2020 Yale Girls in Math). [4] Let a0 = 1, and let an = 1 + an−1
for all integers n ≥ 1. Find the value of a1 a2 a3 · · · a15 , and prove that your answer works.

Problem 9.3 (Classical). [8] If F0 = 0, F1 = 1, and Fk = Fk−1 + Fk−2 , then prove that
Pn
1. i=0 Fi = Fn+2 − 1,
2
2. Fn Fn+2 = Fn+1 + (−1)n+1 ,

Problem 9.4 (2013 IMO). [8] Prove that for any pair of positive integers k and n, there exist
k positive integers m1 , m2 , ..., mk (not necessarily different) such that

2k − 1
    
1 1 1
1+ = 1+ 1+ ... 1 + .
n m1 m2 mk

Problem 9.5 (2012 EGMO). [7] Let n be a positive integer. Find the greatest possible integer
m, in terms of n, with the following property: a table with m rows and n columns can be filled
with real numbers in such a manner that for any two different rows

[a1 , a2 , ..., an ]

and
[b1 , b2 , ..., bn ]
the following holds:
max (|a1 − b1 |, |a2 − b2 |, ..., |an − bn |) = 1.

9
Everaise Academy (2020) Math Competitions II

Problem 9.6 (2013 AIME I). [4] Find the number of five-digit positive integers, n, that satisfy
the following conditions:

(a) the number n is divisible by 5,


(b) the first and last digits of n are equal, and
(c) the sum of the digits of n is divisible by 5.

Problem 9.7 (2010 AIME I). [5] Jackie and Phil have two fair coins and a third coin that
comes up heads with probability 74 . Jackie flips the three coins, and then Phil flips the three
coins. Let m
n be the probability that Jackie gets the same number of heads as Phil, where m
and n are relatively prime positive integers. Find m + n.

Problem 9.8 (Classical). [6] Find all possible combinations of dice, A and B, that bear only
positive integers, and, when rolled, give a result with the same probability distribution as the
sum of the rolls of two standard 6-sided dice. Hints: What is the generating function for two standard
dice rolls? Factor, then redistribute to find some new dice!

Problem 9.9. [8] Prove the negative binomial power series using induction, which says:

!n ∞  
1 X
k
X k+1 k
= x = x .
(1 − x)n n−1
k=0 k=0

Problem 9.10 (2001 AIME I). [10] A mail carrier delivers mail to the nineteen houses on the
east side of Elm Street. The carrier notices that no two adjacent houses ever get mail on the
same day, but that there are never more than two houses in a row that get no mail on the same
day. How many different patterns of mail delivery are possible?

10
10 Intro to Olympiad Combinatorics

§10.1 Induction in Combinatorics

Now we’re going to look at a few applications of induction within combinatorics.

Example 10.1. Prove that, given any permutation of the natural numbers {1, 2, . . . , n}, it
is possible to achieve the permutation 1, 2, . . . , n using a finite number of pair swaps that
swap adjacent numbers.
(For example, if we were given 1, 4, 3, 2, we could proceed in the following manner:
1, 4, 3, 2 → 1, 3, 4, 2 → 1, 3, 2, 4 → 1, 2, 3, 4.)

Solution. This is a question that asks us to prove that we can do something for all natural
numbers, so it’s not a bad idea to try induction.
We note that the base case of n = 1 will be trivial, as any permutation is necessarily just 1
and we’re done.
Now how can we do the inductive step? Well, we know we can get the elements 1, . . . , n − 1
in order, if we only have those elements. If we could somehow get the element n out of the way
we could use this fact.
So let’s try and move the element n to the final place in the line! We can just do pair swaps,
each time moving n one place further right, until it’s at the end of the line.
Then, ignoring the n, we have a permutation of {1, ..., n − 1} which we can then order using
pair swaps. Note that this won’t affect the placing of n as the pair swaps only need to be carried
out within the first n − 1 elements.
So, if we can order n − 1 elements, we can also order n elements. And, by induction, we’ve
proved it. 

Now we’re going to look at two examples that use induction to prove we have a construction
for all n, a common technique in combinatorics.

Example 10.2 (IMO 1997, modified). An n x n matrix whose entries come from the set
S = {1, 2, ..., 2n − 1} is called silver matrix if, for each i = 1, 2, ..., n, the ith row and the
ith column together contain all elements of S. Show that silver matrices exist for infinitely
many values of n.

Exercise 10.3. Try and construct a silver matrix for n = 1, 2, 3, 4. What do you notice? What
values of n do you think will work?

Exercise 10.4. Attempt to construct a matrix of the next biggest size you think will work.
Can you do this? If so, what do you notice about the matrices you’ve created?

Solution. We’re going to attempt to prove that there exists a silver matrix for all powers of 2,
via induction.

1
Everaise Academy (2020) Math Competitions II

The first important thing that we’re going to have to consider is how each matrix links
together and how we’re going to construct each new matrix. For example, let the matrix for
n = 2 be  
1 2
,
3 1
let the matrix for n = 4 be  
1 2 4 5
3 1 5 4
 ,
6 7 1 3
7 6 2 1
and let the matrix for n = 8 be
 
1 2 4 5 8 9 10 11
3 1 5 4 9 8 11 10
 
6 7 1 3 14 15 12 13
 
7 6 2 1 15 14 13 12
 
.
12 13 10 11 1 3 6 7

 
13 12 11 10 2 1 7 6
 
14 15 8 9 5 4 1 2
15 14 9 8 4 5 3 1

Can we spot any patterns in these?


There’s a couple of things that we can notice that we might want to hold true in the 2n × 2n
case:
1. If we take the 2n−1 × 2n−1 matrices at the top left and bottom right, we can see that
these are transposes of each other. (That is, they’re the same after reflection over the
top-left-to-bottom-right diagonal.)
2. In the 8 × 8 case, the 4 × 4 matrices in the bottom left and top right are just reflections of
each other (over the bottom-left-to-top-right diagonal) — we might wonder whether this
pattern is going to continue and if it’s something that we would want.
3. The top left matrix is the same matrix that we used for the previous case.
4. There are lots of quite simple 2 × 2 matrices, where we’ve just got elements swapped.
This kind of stuff could give us a way to produce a new matrix from the previous one.

Exercise 10.5. Which of the points above do you think will be the most helpful in trying to
construct a larger silver matrix? Try and construct a 16 × 16 matrix to see if your intuition was
right.

So what do we want to use? Well, the third point looks to be the most useful as something
to use in the inductive step as it allows us to use what we know about a smaller case in our
new, larger case. The transpose thing also looks helpful, so let’s combine those two facts to fill
in the top left and bottom right of our matrix.
We then just have to fill in the remaining gaps and we’re hoping that the other two points
will give us a way to do this while ensuring that the matrix is a silver matrix.
Okay, so now we’re going to split our induction proof in to two parts:
1. Producing an inductive construction.
2. Proving that, given the previous case working, our construction for this case also works.

2
Everaise Academy (2020) Math Competitions II

Our inductive construction is what you’ve hopefully been expecting, given the exercises above.
Let us assume we can do it in the case n = 2a (where a ≥ 3). Then, for the case n = 2a+1 ,
we aim to prove that we can also create a silver matrix. We’re going to do the construction as
follows:
1. Take the matrix for the n = 2a case (and let this matrix be called A). Put this matrix in
the top left corner and it’s transpose in the bottom right corner.
2. Now we need to ensure that each of the new elements we’re placing only occurs once in
each cross. Split the remaining elements into 2 groups and then arrange each group into
a 2a × 2a matrix, with each element occurring once in each row and column.
3. Call one of these matrices B and the other one B 0 . Put B in the top right corner and B 0
in the bottom left corner.
Then the matrix formed is:  
A B
.
B 0 AT

Remark. Here’s an example for step 3 when a = 4: Let the 8 remaining elements be
a1 , a2 , · · · a8 . Then we could have
 
a1 a2 a3 a4
a4 a1 a2 a3 
B=
a3

a4 a1 a2 
a2 a3 a4 a1

and  
a5 a6 a7 a8
a8 a5 a6 a7 
B0 = 

.
a7 a8 a5 a6 
a6 a7 a8 a5

Exercise 10.6. Using the above construction as a hint, prove that we can always produce a
matrix matching the conditions for B.

Note how this incorporates some of the things we noticed about moving from smaller cases
to bigger cases. Now we need to prove that the construction that we have given above actually
produces a silver matrix.
So let’s consider what we have in the ith row and the ith column. How can we use the
inductive hypothesis?
Taking i modulo a, we’ll see that the matrix A being silver means that the set of entries we
take from A or AT will contain one of each number from 1 to 2a − 1. Then we just have to
prove that we get the right entries from the second and third steps in the construction.
Well, why did we do the construction the way we did it?
Note that if an element appears in B, it’ll appear in every column and row of B and won’t
appear in B 0 , and the reverse for every element in B 0 . So if i ≤ 2a , then if the element was from
B then it’ll appear in that row once and if the element was from B 0 it’ll appear in that column
once. We can say roughly the same thing for i ≥ 2a , just with rows and columns switched.

3
Everaise Academy (2020) Math Competitions II

But this means that whatever i we pick, we’ll get exactly 1 of this element. Combining this
with the inductive hypothesis gives us that each element appears once in the ith row or column.
This completes the proof, as we just need the base cases which are just the n = 1 matrix,
outlined above.
The important thing about this construction was that we filled in the top right and bottom
left elements to ensure that we had a silver matrix. Essentially anything that distributed these
elements would be fine, we were just trying to create an easy way to ensure that a matrix had
this property and that’s what we came up with. 

Note. Think about the construction given above. Did you notice the same things about the
given matrices? What things could you have noticed instead? How could this have lead to a
different construction?

Exercise 10.7. Try and give a different construction for the above example and try and prove
whether it works. How important was it to notice those four things?

Remark. It’s always really important in construction problems to both give a construction
(or prove that there must exist a construction) and then prove that it works. Both of these
parts must be there in order for the proof to be complete.
It’s actually more common, especially in construction problems that require you to find
an upper or lower bound, to miss out the first step. This is similar to checking the equality
case in inequalities.

Now that we’ve seen how to do an inductive construction, let’s look at a less intuitive example.

Example 10.8 (EGMO 2017). Let n ≥ 2 be an integer. An n-tuple (a1 , a2 , ..., an ) of not
necessarily different positive integers is expensive if there exists a positive integer k such
that
(a1 + a2 )(a2 + a3 ) · · · (an−1 + an )(an + a1 ) = 22k−1 .
Prove that for every odd positive integer m there exists an integer n ≥ 2 such that m
belongs to an expensive n-tuple.

Exercise 10.9. If a1 = 1, write down 3 possibilities for a2 . Do the same for a1 = 3 and a1 = 5.
What do you notice?

Exercise 10.10. Try seeing if you can find examples for 1, 3, 5 and 7. Can you notice anything?
Can you find anything that might help you build up to bigger examples?

Solution. At the start, this may not seem like a good candidate for induction. Sure, we’re
only working with the odd positive integers but there doesn’t seem to be any easy way to get
from one positive integer to another.
So let’s just try and construct a solution directly. Without loss of generality, we can let
a1 = m. For the whole product to be a power of 2, each bracket is going to need to be a power
of 2 so a2 = 2b − m for some natural number a.
What should b be? We’ve got quite a bit of freedom here but let’s make the numbers as easy
to deal with as possible. Let 2b be the smallest possible power of 2 larger than m where m 6= 1.
Then we’ve got to make the same decision for an so let both a2 and an be 2b − m.

4
Everaise Academy (2020) Math Competitions II

Let’s note a couple of things here. First, we have that 2b − m is also odd as m ≥ 3 and we
should also note that m < 2b − m as otherwise we could pick a smaller number for b.
Let’s try and fill in the rest of the numbers. We want

2b (a2 + a3 ) · · · (an−1 + a2 )2b = 22k−1

so we should note that (a2 , . . . , an−1 ) must be an expensive n-tuple. Does this give us an idea
of how to proceed?
Well, if we had been doing a proof by induction, we could just use the inductive hypothesis
to finish our construction here. But there’s no easy way of linking m and 2b − m ... right?
This is where we’re going to consider a different inductive step to usual, one which is very
powerful in construction problems. We consider the statement “given that I can do it for all
m < k, I can do it for k” as our induction step. It’s clear that this would finish the problem we
have in mind, and it’s also clear that it comes for free with our usual idea of induction.
So we’ll proceed by strong induction.
Base case: Use whichever construction you gave for m = 1. If you didn’t find one, note that
(1, 1, 1) works.
Inductive step: Assume we can construct such an n-tuple for all odd integers less than m.
Then take the smallest power of 2, greater than m, and call it 2b . Outline the construction as
above. We note that this works as we have

2b (a2 + a3 ) · · · (an−1 + a2 )2b = 22b (a2 + a3 ) · · · (an−1 + a2 )

so this also multiplies to an odd power of 2, by the inductive hypothesis, and our new construc-
tion works. So we’ve also got a construction for m!
Thus we are done by induction. 

§10.2 Pigeonhole Principle

Let’s suppose that you have 12 pigeons, and you wanted to place them in 11 boxes. Could you
place the pigeons in a way that no two pigeons are in the same box?
The answer is no, which is simply by observing that having 11 boxes, each of which has a
maximum capacity of 1 pigeon will gives us a total of 11 pigeons. Since, we have 12 pigeons,
this task is impossible.
This intuition is then generalized by Dirichlet and was known as the Pigeonhole Principle,
here are several other variants as well:

Theorem 10.11 (Pigeonhole Principle). If more than n objects are distributed into n boxes,
then at least one box must have at least two objects.

Theorem 10.12 (Second Form of Pigeonhole Principle). For any positive integers n and t,
if tn + 1 or more objects are placed in n boxes, then at least one box will contain more than
t objects.

5
Everaise Academy (2020) Math Competitions II

Theorem 10.13 (Third Form of Pigeonhole Principle). If the average of n positive numbers
is t, then at least one of the numbers is greater than or equal to t. Further, at least one of
the numbers is less than or equal to t.

Theorem 10.14 (Fourth Form of Pigeonhole Principle). Let q1 , q2 , . . . , qn be positive integers.


If
Xn
qi − n + 1
i=1

objects are put into n boxes, either the first box contains at least q1 objects, or the second
box contains at least q2 objects, . . . , or the nth box contains at least qn objects.

Example 10.15. There are 2020 people at a party and some of them exchange handshakes.
Prove that there are 2 people who have shaken hands with the same number of people.

Solution. To use the pigeonhole principle, we need to follow two steps:


1. Find what our items and boxes are going to be.
2. Prove that we have more items then boxes.
Here we want to prove that there are 2 people who have shaken hands with the same number
of people. This is similar to the wording of the pigeonhole principle where we say that there
must be 2 or more items (here people) in one box (here number of people that you’ve shaken
hands with).
So it’s probably a good idea to try this as our items and boxes first. Now all that remains to
do is to prove that there are more people then ’boxes’.
What’s the maximum number of handshakes that any person could have had? Well they can
shake hands with anyone other than themselves so 2019. (They can’t possibly shake hand with
themselves.)
What’s the minimum number of handshakes that any person could have had?
Well someone could have shaken hands with no other people. That seems to ruin our idea of
using the pigeonhole principle, as then there are 2020 items and 2020 boxes.
But note that if someone has shaken hands with everyone else, there can’t also be a person
at the party who has shaken hands with nobody and vice versa.
So there can only be one of the end boxes at a time, for a total of 2019 boxes.
Now we have 2020 people and 2019 different possible values for the number of handshakes
so, by the pigeonhole principle, 2 people must have shaken hands with the same number of
people. 

Exercise 10.16. Show that at least 19 subsets of {1, 2, . . . , 10} have the same sum.

Remark. The same result holds true for 21 subsets instead of 19. Try to prove this.

6
Everaise Academy (2020) Math Competitions II

Example 10.17 (UK MOG 2012). Let S = {a1 , a2 , ..., an } where the ai are different positive
integers. The sum of the elements of each non-empty proper subset of S is not divisible by
n. Show that the sum of all elements of S is divisible by n.
(Note that a proper subset of S consists of some, but not all, of the elements of S.)

Solution. In this problem, we want to show that something is divisible by n. If we use the
pigeonhole principle, our boxes are probably going to be related to divisibility by n – let’s make
our boxes the different remainders after division by n!
If our items are the sums of non-empty subsets of n, the problem becomes trying to show
that the box with remainder 0 contains an item. If that item is the sum of all elements of S,
we are done and if it isn’t, we have a contradiction. However, proving that there has to be an
item in the box with remainder 0 is difficult. Is there a way in which we can transform this
statement?
Let’s try to find n subsets that all have to have different remainders. If we proceed in this
way, we know that there will have to be an item in the box with remainder 0. To find such sets,
we could start by considering the simplest subsets:
{a1 }, {a2 }, {a3 }, . . . , {an }
Unfortunately, there isn’t anything connecting these subsets, so they could be in the same boxes.
We need to have something connecting the subsets so we can control which boxes they go into.
To approach this, we can start small and try to find 2 subsets that have to be in different
boxes. If we consider simpler subsets, we may want to try
{a1 }, {a1 , a2 }.

Can these subsets be in the same box? Well, if their sums have the same remainder when
divided by n, that means we have
a1 + cn = a1 + a2
for some integer c. Then we can rearrange this to get
cn = a2
which implies that the sum of the elements in {a2 } is divisible by n. We know this isn’t true
because of the conditions in the question.
Awesome, we found 2 subsets that have to be in different boxes. How can we build on that?
Well, waht aspect of the subsets forced them to be in different boxes in the first place?
When we were cancelling the equations, we got the sum of a proper subset on one side and
a term that was divisible by n on the other. This happened because all of the terms on one
side of the equation were also on the other, which was because one subset was contained in the
other.
Keeping that in mind, we try a group of subsets that build on each other, like:

{a1 }, {a1 , a2 }, {a1 , a2 , a3 }, ..., {a1 , ..., an }

For a contradiction, suppose that they weren’t all in separate boxes. Then, we could do the
same thing as above, setting up the equation
a1 + a2 + ... + ai + cn = a1 + a2 + ... + aj

7
Everaise Academy (2020) Math Competitions II

then cancelling terms of both sides to get

cn = ai+1 + ... + aj

and noting that {ai+1 , ..., aj } is a proper subset so this contradicts the condition given in the
question.
Great! We have n subsets, which all have to go in different boxes. This means that there has
to be a subset that is divisible by n. Following the conditions of the problem, we know that the
sum of the elements of the set S has to be divisible by n. 

Remark. The difficulty in the above problem was determining what items we can consider.
It’s often worth playing around with a couple of different ideas for items and boxes, to try
and get some idea about what’s going to work and what’s not going to give you what you
need.

§10.3 Invariants & Monovariants

There aren’t many formulas to develop here.

Definition 10.18. An invariant is something that stays the same throughout some process
or algorithm.
A monovariant is something that never increases or never decreases throughout some process
or algorithm.

You might have already seen a lot of these obvious invariants or monovariants, but the hard
part of this is actually to determine which one will be useful for the problem.
Let’s take a look at the following example.

Example 10.19. You are given 3 piles of stones: A, B and C. Each of which has 2020
stones. Now, choose two piles of stones and take 1 stone each from the two piles and add
1 stone to the other pile. Can we eventually get only 1 stone?

Solution. Let’s see an obvious monovariant here:

The number of stones decrease by 1 every turn.

Logically, using this observation, we should get to 1 stone. We should have finished by now...
Wait, hold on a second. The answer is actually no, we can’t do this. Checking small cases
should do the job on guessing the answer. Now, we should just think about what invariant or
monovariant should we consider that might be useful?
Let’s start with a few observation with random switches.

(2020, 2020, 2020) → (2021, 2019, 2019).

(2021, 2019, 2019) → (2022, 2018, 2020).


(2022, 2018, 2020) → (2021, 2017, 2021).
We should be able to notice that iff E denotes an even number and O denotes an odd number,

8
Everaise Academy (2020) Math Competitions II

The parity of each state in each transformation is (O, O, O) or (E, E, E).

Is this a coincidence?
Not really, let’s prove this. Notice that a process turns (a, b, c) → (a + 1, b − 1, c − 1).
Furthermore, notice that if a ≡ b ≡ c (mod 2), then we have

a + 1 ≡ a − 1 ≡ b − 1 ≡ c − 1 (mod 2)

which means that it will swap between (O, O, O) and (E, E, E) after each process.
Since the parity of each process is either (E, E, E) or (O, O, O) and we started with (E, E, E),
therefore throughout the whole process we will always have (E, E, E) or (O, O, O). Now, notice
that if we were to have 1 stone left, then it must be (1, 0, 0), which means the last configuration
should be (E, E, O), which is impossible. 

Example 10.20. Suppose a, b, c, d are four real numbers such that not all of them are equal.
Start with (a, b, c, d) and repeatedly replace

(a, b, c, d) → (a − b, b − c, c − d, d − a)

Prove that at least one component of the quadruple will eventually become arbitrarily
large.

Solution. Another strange operation. One could easily notice that

(a − b) + (b − c) + (c − d) + (d − a) = 0.

This actually tells us that whatever the first four numbers are, after the first operation,

The sum of the quadruples will be 0 throughout.

Let’s rephrase the problem: suppose that (an , bn , cn , dn ) is the quadruple at time n (we start
at time 0). We’ll prove that
max(an , bn , cn , dn ) ≥ C
for any large enough n and any constant C. (Make sure you understand why this is the same
problem as the original!)
The sum of the components won’t directly help us prove that one of them gets arbitrarily
large; let’s use a trick here and consider the sum of the squares of the components. We have

a2n+1 + b2n+1 + c2n+1 + d2n+1 = (an − bn )2 + (bn − cn )2 + (cn − dn )2 + (dn − an )2


= 2(a2n + b2n + c2n + d2n ) − 2(an + cn )(bn + dn )

Notice that we have an + bn + cn + dn = 0 for all n ≥ 1. Therefore,

a2n+1 + b2n+1 + c2n+1 + d2n+1 = 2(a2n + b2n + c2n + d2n ) − 2(an + cn )(bn + dn )
= 2(a2n + b2n + c2n + d2n ) + 2(an + cn )2
≥ 2(a2n + b2n + c2n + d2n )

This seems like good progress. Let K be some large constant; we have

a2n+K + b2n+K + c2n+K + d2n+K ≥ 2K (a2n + b2n + c2n + d2n )

9
Everaise Academy (2020) Math Competitions II

This is helpful because


4 max(a2n+K , b2n+K , c2n+K , d2n+K ) ≥ 2K (a2n + b2n + c2n + d2n )
giving us
max(a2n+K , b2n+K , c2n+K , d2n+K ) ≥ 2K−2 (a2n + b2n + c2n + d2n ).
We’re done if a2n + b2n + c2n + d2n > 0, since 2K−2 can be arbitrarily large. But what if it equals
0? That’s bad news for us.
We’ll prove that there won’t be any issue.

Claim 10.21. At any time n of the process, (an , bn , cn , dn ) 6= (0, 0, 0, 0).

Proof. Remember that we haven’t used the given information that a0 , b0 , c0 , d0 are not all equal.
This gives us that for n = 0, the claim is true.
For the sake of contradiction, suppose there exists an index i ≥ 1 such that (ai , bi , ci , di ) =
(0, 0, 0, 0). We’ll prove that if (ai , bi , ci , di ) = (0, 0, 0, 0) for n ≥ 2, then (ai−1 , bi−1 , ci−1 , di−1 ) =
(0, 0, 0, 0) as well.
To prove this recall that
0 = ai = ai−1 − bi−1 ⇒ ai−1 = bi−1
0 = bi = bi−1 − ci−1 ⇒ bi−1 = ci−1
0 = ci = ci−1 − di−1 ⇒ ci−1 = di−1
Furthermore, ai−1 + bi−1 + ci−1 + di−1 = 0 since i ≥ 2. Therefore, all of them must be 0.
Eventually, we will get that (a1 , b1 , c1 , d1 ) = (0, 0, 0, 0). But this gives us a0 = b0 = c0 = d0 ,
which is not the case. 

It thus follows that


max(a2n+K , b2n+K , c2n+K , d2n+K ) ≥ 2K−2 (a2n + b2n + c2n + d2n )
implies that a component of the sequence grows arbitrarily large, so we are done. 

§10.4 Homework Problems

Problem 10.1 (British MO 2011, Modified). [3] Initially there are m balls in one bag, and n
in the other, where m, n > 0. Two different operations are allowed:
1. Remove an equal number of balls from each bag;
2. Triple the number of balls in one bag.
Is it always possible to empty both bags after a finite sequence of operations?

Problem 10.2 (Hungary 1947). [3] Prove that among 6 people you can always find 3 people
who are all friends or 3 people who are all not friends.

Problem 10.3 (British MO 1998). [4] A booking office at a railway station sells tickets to 200
destinations. One day, tickets were issued to 3800 passengers. Show that there are (at least)
6 destinations at which the passenger arrival numbers are the same and that this statement
becomes false if ‘6’ is replaced by ‘7’.

10
Everaise Academy (2020) Math Competitions II

Problem 10.4. [4] Prove that every positive integer can be written uniquely as the sum of one
or more Fibonacci numbers, no two of which are consecutive Fibonacci numbers.

Problem 10.5. [4] Remove the first digit of the number 72016 , and then add it to the remaining
number. Repeat this unttil a 10-digit number remains. Prove that this number has at least 2
equal digits.

Problem 10.6. [5] There is an integral number in each cell of an n by n table. In each move,
we may change the signs of all the numbers in any row or column. Prove that after a finite
number of such moves, it is possible to have the sum of the numbers in each row and column
to be non-negative.

Problem 10.7 (ISL 2012). [7] Several positive integers are written in a row. Iteratively, Alice
chooses two adjacent numbers x and y such that x > y and x is to the left of y, and replaces the
pair (x, y) by either (y + 1, x) or (x − 1, x). Prove that she can perform only finitely many such
iterations. Hints: What would make an obvious invariant? What does change? Consider the maximum and
minimum values in the set of numbers. How do these change?

Problem 10.8. [5] Show √that given any set A of 13 distinct real numbers, there exist x, y ∈ A
x−y
such that 0 < 1+xy ≤ 2 − 3. Hint: What trigonometric formula does this look like?

Problem 10.9 (British MO 2000). [7] Find a set A of ten positive integers such that no six
distinct elements of A have a sum which is divisible by 6. Is it possible to find such a set if
“ten” is replaced by “eleven”?

Problem 10.10 (Indonesia 2020). [3] Megumin has the numbers 1, 2, 3, 4, 5, 6 on the board.
Every turn, she chooses any two distinct positive integers x and y, and turn them into

xy max{x, y}
and
|x − y| 2
2
Can Megumin get the number less than 5 some point?

Problem 10.11. [5] 9 cells of a 10×10 table are contaminated. Every second all cells that
neighbour at least two contaminated cells also become contaminated. Is it possible that the
infection spreads across the entire table?

Problem 10.12 (ISL 2002). [8] Let n be a positive integer. Each point (x, y) in the plane,
where x and y are non-negative integers with x + y < n, is coloured red or blue, subject to the
following condition: if a point (x, y) is red, then so are all points (x0 , y 0 ) with x0 ≤ x and y 0 ≤ y.
Let A be the number of ways to choose blue points with distinct x-coordinates, and let B be
the number of ways to choose blue points with distinct y-coordinates. Prove that A = B.

11
11 Fundamentals

§11.1 Similar Triangles

Similar triangles are incredibly important and show up everywhere. There are three main
ways to determine triangle similarity, very much like the ways to determine congruence:
1. Side-Side-Side: If ratios of all three pairs of corresponding sides are all equal, then the
triangles are similar. However, this is not very common to spot.
2. Side-Angle-Side: If the corresponding angles are the same and both pairs of its neighboring
sides are proportional with the same ratio, then the triangles are similar.
3. Angle-Angle: This is the most common indicator. If two corresponding pairs of angles are
the same, the third angle should also be the same, thus determining similarity.

Theorem 11.1. If two triangles ABC and DEF are similar (ABC ∼ DEF in that specific
order of angles), then
∠A = ∠D, ∠B = ∠E, ∠C = ∠F
and
AB BC AC
= = = k.
DE EF DF
We call k the scale factor.

We can solve plenty of difficult problems with just similar triangles.

Example 11.2 (2019 AIME II). Triangle ABC has side lengths AB = 120, BC = 220, and
AC = 180. Lines `A , `B , and `C are drawn parallel to BC, AC, and AB, respectively, such
that the intersection of `A , `B , and `C with the interior of 4ABC are segments of length
55, 45, and 15, respectively. Find the perimeter of the triangle whose sides lie on `A , `B ,
and `C .

Solution. Label points as in the diagram on the next page. Note that triangle AA1 A2 is similar
to triangle ABC. Thus,

1
Everaise Academy (2020) Math Competitions II

AB BC AC 120 220 180


AA1 = A1 A2 = AA2 =⇒ AA1 = 55 = AA2 .

This means that AA1 = 30 and AA2 = 45. By the same reasoning, we find BB1 = 55,
BB2 = 30, CC1 = 22.5, and CC2 = 27.5 — make sure to confirm for yourself that this works!
Now, by subtracting lengths, we get that A1 B2 = 60, B1 C2 = 137.5, and C1 A2 = 112.5.
But there are more similar triangles to work with — one example being triangles AA1 A2 and
B2 A1 Z. Pause for a moment and see if you can find the others.
Because 4AA1 A2 ∼ 4B2 A1 Z, we have B 2Z A1 Z B2 A1
AA2 = A1 A2 = AA1 , from which we find A1 Z = 110
and B2 Z = 90. From the other similar triangle pairs, we deduce that Y A2 = 137.5, Y C1 = 75,
XB1 = 112.5, and XC2 = 75. We now have all of the lengths to complete the problem!
Our answer is

XY + Y Z + ZX = ZA1 + A1 A2 + A2 Y + Y C1 + C1 C2 + C2 X + XB1 + B1 B2 + B2 Z
= 110 + 55 + 137.5 + 75 + 15 + 75 + 112.5 + 45 + 90
= 715

so we are done. 

The above problem is somewhat rare — similar triangles are basically given to you and you
have a straightforward approach with some tedious computation. However, similar triangles are
typically “hidden” in a problem, like the example below.

Example 11.3 (2018 AMC 10). Two circles of radius 5 are externally tangent to each other
and are internally tangent to a circle of radius 13 at points A and B. The distance AB
can be written in the form m
n , where m and n are relatively prime positive integers. What
is m + n?

Solution. It doesn’t look like there are any triangles here — just circles. However, a general
principle you can apply in these sorts of tangent-circle problems is to connect centers. In
particular, if two circles are tangent — either internally or externally — the line connecting
their centers will always pass through the tangency point.
Letting O be the center of the circle with radius 13 and letting A1 and B1 be the centers of
the smaller circles, we’ll draw a diagram.

There we go — because ∠AOB is shared with the two triangles and equal side lengths A1 A
and B1 B are appended to equal side lengths OA1 and OB1 (implying an equal proportion for
those pairs of sides and thus an SAS case), triangles OA1 B1 and OAB are similar. Thus

OA1 OA 8 13
= =⇒ = .
A1 B1 AB 10 AB

2
Everaise Academy (2020) Math Competitions II

65
Thus, AB = 4 and 69 is our answer. 

Look out for similar triangles whenever there are parallel lines or whenever there are angle
equalities — and in fact, they’re so powerful that if you don’t have any given to you, try drawing
in new lines to create some.

Exercise 11.4. Rectangle ABCD has AB = 5 and BC = 4. Point E lies on AB so that


EB = 1, point G lies on BC so that CG = 1, and point F lies on CD so that DF = 2.
Segments AG and AC intersect EF at Q and P , respectively. What is the value of PEF
Q
?

Example 11.5 (Angle Bisector Theorem). Let ABC be a triangle, and suppose that D lies
on BC such that ∠BAD = ∠CAD. Prove that AB DB
AC = DC .

Solution. It doesn’t look like we have any similar triangles yet, but we do have two equal
angles — ∠BAD and ∠CAD. Maybe we can somehow construct a pair of similar triangles.
We like parallel lines because they work rather well with equal angles. Suppose that AD
meets the line through C parallel to AB at E, as shown below.

There we go: triangles ABD and ECD are clearly similar, so we’ll be able to build some
ratios. We’d like to have DB DB AB
DC , and we want AB involved, so we have DC = CE . So all that’s
left is to prove CE = AC.
Here’s the key observation: since ∠BAD = ∠CED and ∠BAD = ∠CAD, triangle ACE is
isosceles with ∠CAE = ∠CEA! Therefore CA = CE, and we’re done. 

One last difficult example.


Example 11.6 (2018 AIME II). Triangle ABC has sides AB = 9, BC = 5 3, and AC = 12.
Points A = P0 , P1 , P2 , . . . , P2450 = B are on segment AB with Pk between Pk−1 and Pk+1
for k = 1, 2, . . . , 2449, and points A = Q0 , Q1 , Q2 , . . . , Q2450 = C for k = 1, 2, . . . , 2449.

3
Everaise Academy (2020) Math Competitions II

Furthermore, each segment Pk Qk , k = 1, 2, . . . , 2449, is parallel to BC. The segments cut


the triangle into 2450 regions, consisting of 2449 trapezoids and 1 triangle. Each of the
2450 regions have the same area. Find the number of segments Pk Qk , k = 1, 2, . . . , 2450,
that have rational length.

Solution. Given that there are at least 2450 segments Pk Qk , drawing a complete diagram
seems difficult. You should try to draw a small case on your paper; say, k = 7.
Observe that all triangles of the form APk Qk are similar, and that each trapezoid Pk Pk+1 Qk+1 Qk
has the same area as triangle AP1 Q1 . Since we’re trying to find the length of Pk Qk , let’s begin
by setting up a proportion that involves areas. We have
√ !2
[ABC] 5 3
=
[APk Qk ] Pk Qk

because the ratio of the areas of similar figures is equal to the ratio of their corresponding
lengths, squared. (Here [XY Z] denotes the area of triangle XY Z.)
1
Now note that [APk Qk ] = k · [AP1 Q1 ] = k · 2450 [ABC]. It follows that the left-hand-side of
the equation above becomes 2450
k . Thus

√ !2
2450 5 3
= .
k Pk Qk

q
Since we’re trying to figure out if Pk Qk is rational, let’s solve for it: we have Pk Qk = 17 3k
2 .
q
Therefore Pk Qk is rational if and only if 3k 2 is, or equivalently, when k is 6 times a perfect
square.
Our answer is thus 20, because 6 · 12 , 6 · 22 , · · · , 6 · 202 are the only numbers of this form less
than 2450, and we are done. 

§11.2 Dilations

Now we’ll will discuss dilations, a generalization of similar triangles. A dilation is a type of
plane transformation; it has a center point, P , and a scale factor, k.
If k is positive, the image of a point X 6= P under the dilation is the point X 0 lying on line
P X such that P does not lie between X and X 0 and such that P X 0 = k · P X. For example,
if the center of some dilation D is (0, 0) and its scale factor is 5, then the point A = (1, 1) is
mapped to A0 = (5, 5).

Exercise 11.7. Find where the points (2, 3) and (7, −1) are mapped to under the dilation D
described above. Where does the segment joining (2, 3) and (7, −1) get mapped to?

You can think about dilations as a sort of expansion or shrinking from a point; zooming in
or zooming out, if you will. For an example of the shrinking case, suppose that the center of
some dilation D is (3, 0) and that its scale factor is 21 ; then the semicircle centered at (3, 6) with
radius 2 maps to the semicircle centered at (3, 3) with radius 1, as shown below.

4
Everaise Academy (2020) Math Competitions II

Exercise 11.8. Let ABC be a triangle, and let M be the midpoint of BC. Find the image of
M under a dilation centered at A with scale factor 23 .

Dilations preserve plenty of useful properties: in particular, they preserve similarity. That
is, if a dilation D has center P and maps some figure A1 A2 · · · An to B1 B2 · · · Bn , then figures
A1 A2 · · · An and B1 B2 · · · Bn are similar.

Here’s an incomplete list of the properties they preserve:


• Parallel lines — if a dilation maps A to A0 and B to B 0 , then it maps the entirety of
segment AB to the segment A0 B 0 and AB k A0 B 0 ;
• Angles — if a dilation maps ∠BAC to ∠B 0 A0 C 0 , then ∠BAC = ∠B 0 A0 C 0 ;

5
Everaise Academy (2020) Math Competitions II

• Corresponding parts of figures — if a dilation maps triangle ABC to triangle A0 B 0 C 0 ,


then it maps the incenter I of triangle ABC to the incenter I 0 of triangle A0 B 0 C 0 .

Essentially, dilations do pretty much everything we want them to do except preserve actual
lengths — and with regards to lengths, they just act as a multiplier. In order to determine the
center of dilation between two similar figures, simply draw lines connecting the corresponding
vertices of the two figures — they will intersect at the center of dilation.
Let’s quickly address the negative case, too; it will also prove to be quite helpful at times. If
a dilation D centered at P has scale factor −k, where k is a positive real, then a point X will be
mapped to the point X 0 such that P lies between X and X 0 , and P X 0 = k · P X. For example,
if the center of a dilation D is (0, 0) and its scale factor is −5, then the point (1, 1) is mapped
to (−5, −5).

Exercise 11.9. Find the image of (2, 1) under a dilation centered at (1, 0) with scale factor
−3.

Example 11.10. Let ABC be a triangle with centroid G, and let D, E, and F be the
midpoints of BC, CA, and AB, respectively. Show that there exists a negative dilation at
G mapping triangle DEF to triangle ABC, and find its scale factor.

Solution. If we can find a dilation centered at G mapping D to A, E to B, and F to C, then


we’re done — after all, it will follow that triangle DEF is mapped to triangle ABC.

6
Everaise Academy (2020) Math Competitions II

Now note that by well-known centroid ratios we have GA = 2GD, GB = 2GE, and GC = 2GF .
Therefore the dilation D centered at G with scale factor −2 maps triangle DEF to triangle
ABC, and we are done. 

Example 11.11. Let ABCD be a trapezoid with AD k BC, and let DB and AC meet at E
and DC and AB meet at F . Let M and N be the midpoints of AD and BC, respectively.
Prove that F, E, M, and N are collinear.

Solution. This problem looks like similar triangles — that’s because that’s essentially all it is;
we’ll just give the dilation approach to hopefully clarify some of the questions you might have
in the above section.
Note firstly that there exists a dilation centered at F mapping segment AD to segment BC.
Therefore, it maps the midpoints of those segments to each other, as those are corresponding
parts; thus F, M, and N are collinear. Moreover, there exists a negative dilation centered at E
mapping segment AD to segment CB, as A is mapped to C under a dilation with scale factor
− EC
EA , and D is mapped to B under that same dilation. (Keep in mind that vertex order is
important here!)

AM CN
Now, as M D = N B , M and N are corresponding parts on segments AD and CB, so they are
mapped to each other. Thus M, E, and N are collinear, and F, E, M, and N are collinear as
desired. 

AM 0 BN 0
Remark. Be very careful about vertex labelling! Say that M 0 D = a and N 0 C = a for some

points M and N on AD and BC, respectively. Then M would map to N 0 under the
0 0 0

dilation centered at F described above, but not necessarily under the dilation centered at
CN 0
E described above — we would need N 0 B = a for that to be the case!

Exercise 11.12. Convince yourself that in the diagram below, the center of the dilation with
positive scale factor mapping circle ω1 with center O1 to circle ω2 with center O2 is the point
H+ , and that the center of the dilation with negative scale factor mapping ω1 to ω2 is the point
H− . These points are the intersections of the common external and internal tangents to ω1 and
ω2 , respectively.

7
Everaise Academy (2020) Math Competitions II

We haven’t done any examples yet that truly shows the power of our new tool — everything
so far has been quite doable with similar triangles. Let’s change that.

Example 11.13 (Classical). Let ABC be a triangle. Construct a square DEF G such that
points D and E lie on side BC, and points F and G lie on sides CA and AB, respectively.

Solution. This might seem a lot like magic if it’s your first time seeing this! We’ll build a
square outside triangle ABC by constructing points X and Y such that BXY C is a square
that does not contain triangle ABC.

Now, for our finishing step. Let’s say that AX and AY meet BC again at D and E, respec-
AD AE
tively. Then the dilation centered at A with scale factor k = AX = AY must map points B and
0 0 0 0
C to points B and C such that B DEC is a square, as dilations preserve the shape of figures.
But points B 0 and C 0 must lie on AB and AC, by definition, so setting B 0 = G and C 0 = F
gives us our desired square DEF G. 

8
Everaise Academy (2020) Math Competitions II

Exercise 11.14. Explain how, in the example above, we can construct a rectangle whose length
is twice its width that is inscribed in triangle ABC.

One final example to demonstrate the power of dilations.

Example 11.15 (Mandelbrot). Two circles are internally tangent at point A. The larger
circle has radius 3 and the smaller circle has radius 1. Find the maximum area of a triangle
that has the point of tangency as a vertex and one vertex on each of the small and large
circles.

Solution. Let’s suppose that B is a vertex on the smaller circle and that C is a vertex on
the larger circle. Since we’re given two internally tangent circles, we have a natural dilation:
consider the dilation D centered at A mapping the smaller circle to the larger circle. Then it
must map B to some point B 0 , the second intersection of AB and the larger circle.

But as B 0 is the image of B under the dilation, AB 0 = 3 · AB, so the area of triangle ABC is
one-third of the area of triangle AB 0 C. So the problem is equivalent
√ to maximizing the area of
0 0 27 3
triangle AB C! This occurs when AB C is equilateral with area 4 , so the maximum possible

9 3
area of a triangle ABC as described in the problem is 4 . 

Exercise 11.16 (2016 AMC 10B). A dilation of the plane—that is, a size transformation with
a positive scale factor—sends the circle of radius 2 centered at A(2, 2) to the circle of radius 3
centered at A0 (5, 6). What distance does the origin O(0, 0), move under this transformation?

§11.3 Angle Chasing

Angle-chasing shows up all the time, in both computational and proof-based contests. Let’s
state the most important result to keep in mind.

9
Everaise Academy (2020) Math Competitions II

Proposition 11.17. If A1 A2 · · · An is an n-sided polygon, than the total sum of its interior
angle measures is 180(n − 2)◦ .

When a problem requires angle chasing, the following method works well:
1. Assign an angle you don’t know some variable.
2. In terms of that variable, determine other angle measures. For example, if one acute angle
of a right triangle is x◦ , the other leg angle will be (90 − x)◦ .
3. Continue this process until you can reach any conclusions about the measurements of
some angles.
Now we will demonstrate this process.

Example 11.18 (2020 AIME I). In 4ABC with AB = AC, point D lies strictly between
A and C on side AC, and point E lies strictly between A and B on side AB such that
AE = ED = DB = BC. Find the degree measure of ∠ABC.

Solution. As AB = AC and AE = ED = DB = BC, we have plenty of isosceles triangles.


Since we’re looking for ∠ABC, let’s begin by splitting it into two parts: let ∠DBC = x◦ and
∠DBA = y ◦ .

Let’s try to find an expression for y in terms of x. We’ll do so by noting that ∠DCB can be
expressed just in terms of x, as triangle DCB is isosceles. This yields ∠DCB = 90◦ − 12 ∠DBC,
so therefore
1
(90 − x)◦ = (x + y)◦
2
and we get y = 90 − 32 x.
Our next move is to use triangle BDE, which is also isosceles. From this follows ∠DEB =
(90 − 23 x)◦ and ∠EDB = 3x◦ . Now let’s put our last isosceles triangle into play: we know that
∠AED must be (90 + 23 x)◦ , so therefore ∠ADE = ∠DAE = (45 − 34 x)◦ .

10
Everaise Academy (2020) Math Competitions II

But as ∠CDA is a straight angle, we have

∠CDA = ∠CDB + ∠BDE + ∠EDA


1 3
= (90 − x)◦ + (3x)◦ + (45 − x)◦
2 4
7 ◦
= (135 + x)
4
so 74 x = 45, and x = 180
7 .
We’re not quite done yet: the original problem asks for the degree measure of ∠ABC, which
is 90 − 12 x. Our final answer is 90 − 12 · 180 540
7 = 7 . 

Our next example will combine concepts from this section and the previous section. Using
similar triangles is often a big part of angle chasing.

Example 11.19 (2019 AMC 10B). In 4ABC with a right angle at C, point D lies in the
interior of AB and point E lies in the interior of BC so that AC = CD, DE = EB, and
the ratio AC : DE = 4 : 3. What is the ratio AD : DB?

Solution. First, since no lengths are given in the problem and the question asks for a ratio,
we can assign arbitrary lengths. Thus, when the diagram is drawn, we can say, without loss of
generality, that AC = DC = 4 and DE = BE = 3. (We say “without loss of generality” in this
case because ratios and angles remain the same no matter how much we scale the figure up or
down by!)

Now the angle-chasing begins. Let ∠A = x◦ ; immediately we get ∠B = ∠BDE = (90 − x)◦
and ∠CDA = x◦ . Miraculously, this yields ∠CDE = 90◦ ; there’s a hidden 3 − 4 − 5 right
triangle here!

It follows that CE = 5 so BC = 8, and therefore triangle ABC is a 1 − 2 − 5 triangle scaled
up by a factor of 4. This seems useful! Time to use similar triangles: drop perpendiculars from
C and E to AB, and call those points F and G, as shown below.

11
Everaise Academy (2020) Math Competitions II

We’d like to obtain AD : DB, so let’s try and find AF and BG, as AF : BG = AD : DB.
By angle-angle similarity, we know that triangles AF C, EGB, and ACB are similar. It follows
that
AF AC BG BC
= and = .
AC AB BE AC

Recall now that AC : CB : AB = 1 : 2 : 5. Therefore AF = √45 and GB = √65 , so
AF : GB = 2 : 3 and we are done. 

Exercise 11.20 (1995 BMO). Triangle ABC has a right angle at C. The internal bisectors of
angles BAC and ABC meet BC and CA at P and Q respectively. The points M and N are
the feet of the perpendiculars from P and Q to AB. Find angle M CN .

§11.4 Area and Perimeter

Everyone knows the basics of area and perimeter, but in this section we’ll go a bit beyond that.

Theorem 11.21. The area of triangle ABC, denoted by [ABC], can be expressed as
1
bc sin ∠A
2
where ∠A = ∠BAC, b = AC, and c = AB.

Proof. The key to many geometry problems is to reduce what you have to something you
already know. You should already be familiar with the formula [ABC] = 21 bh, where b is a base
of triangle ABC and h is the corresponding altitude. Our expression 12 bc sin ∠A should remind
you of that a bit — the 12 s are the same, after all!
So let’s draw a diagram.

Let’s make side AB here the base. Then the height would be the altitude CD, as shown
above. But its length is just AC sin ∠A by right-angle trigonometry on triangle ADC, so the

12
Everaise Academy (2020) Math Competitions II

area of triangle ABC is


1 1
· AB · CD = · AB · (AC sin A)
2 2
1
= bc sin A
2
as desired. 

This formula is especially useful when dealing with right triangles, where we can derive the
sine of an angle easily. Here’s an example.

Example 11.22 (2019 AIME I #3). In 4P QR, P R = 15, QR = 20, and P Q = 25. Points
A and B lie on P Q, points C and D lie on QR, and points E and F lie on P R, with
P A = QB = QC = RD = RE = P F = 5. Find the area of hexagon ABCDEF .

Solution. Although finding the area of the hexagon by itself might be a bit tricky, it’s actually
just a matter of computing the area of the large triangle P QR and subtracting the areas of
F P A, BQC, and DRE. In short,

[ABCDEF ] = [P QR] − [F P A] − [BQC] − [DRE].

It’s important to note that since sides P R : QR : P Q exist in a 3 : 4 : 5 ratio, we know that
P QR is a right triangle with right angle at ∠P RQ. This means that we can quickly find the
area of P QR as follows:
15 · 20
[P QR] = = 150
2
We can also find the area of DRE fairly easily, since ∠DRE is also a right angle and DR =
RE = 5:
5·5 25
[DRE] = =
2 2
Further, since P QR is a right triangle, we can compute the areas of F P A and BQC using
the 12 bc sin ∠A formula we derived above. For F P A, we already know the two side lengths
P F = P A = 5. Thus we need to find sin ∠F P A = sin ∠RP Q = PRQ 20 4
Q , which is equal to 25 = 5 .
Therefore the area of F P A is
1 1 4
[F P A] = · P F · P A sin ∠F P A = · 5 · 5 · = 10
2 2 5

13
Everaise Academy (2020) Math Competitions II

We can find the area of BQC in the exact same way! Note that since sin ∠BQC = sin ∠P QR =
3
5, the area of BQC is 12 · 5 · 5 · 35 = 15 2 . Now that we have found the areas of all the
triangles we wanted, we can now compute the area of our desired hexagon. Plugging into
[ABCDEF ] = [P QR] − [F P A] − [BQC] − [DRE], we have that
15 25
[ABCDEF ] = 150 − 10 − − = 120
2 2
and we are done. 

Exercise 11.23 (2015 PUMaC). For her daughter’s 12th birthday, Ingrid decides to bake a
dodecagon pie in celebration. Unfortunately, the store does not sell dodecagon shaped pie pans,
so Ingrid bakes a circular pie first and then trims off the sides in a way such that she gets the
largest regular dodecagon possible. If the original pie was 8 inches in diameter, the area of pie
that she has to trim off can be represented in square inches as aπ − b where a, b are integers.
What is a + b?

We can also use the perimeter of a triangle to help compute the desired area, such as with
the next two formulas.

Proposition 11.24. In triangle ABC, the area of ABC can be expressed as

rs

where s is the semiperimeter of ABC and r is the radius of the inscribed circle of ABC.
(The semiperimeter of a triangle is half its perimeter.)

Proof. Let I be the incenter of ABC, and let X, Y, Z be the points of tangency between the
incircle of ABC to sides AC, BC, AB respectively. Note that XI = Y I = ZI = r, where r is
the radius of the incircle. Further, XI, Y I, ZI are perpendicular to AC, BC, AB respectively
due to tangency.
Then, we can note that the area of ABC can be represented as follows:

[ABC] = [AIB] + [BIC] + [CIA]

We can find the area of [AIB] by using ZI as the height of the triangle and AB as the base:

r · AB
[AIB] =
2

14
Everaise Academy (2020) Math Competitions II

Similarly we can find that the area of BIC is r·BC


2 , and the area of [CIA] is
r·AC
2 . Then we
have that
r · AB r · BC r · AC
[ABC] = + +
2 2 2
AB + BC + AC
=r·
2
AB+BC+AC
Since s, the semiperimeter, is equal to 2 , we can substitute it in to get
[ABC] = rs,
as desired. 

Got it? Now let’s try an example.

Example 11.25 (2018 ABMC Speed Round). 4P QR is drawn such that the distance from
P to QR is 3, the distance from Q to P R is 4, and the distance from R to P Q is 5.
The angle bisector of ∠P QR and the angle bisector of ∠P RQ intersect at I. What is the
distance from I to P R?

Solution. First, it’s important to note that the angle bisectors of a triangle intersect at its
incenter, so I is the incenter of P QR. That means that the distance that we’re trying to
find, from I to P R, is actually just the radius of the incircle of P QR. Further, the distances
mentioned in the problem are all altitudes of P QR, which makes it seem like area will be helpful
in this question.
Let us say that P Q = x. Then, we can solve for the side lengths of P QR in terms of x and
find the area of P QR in two ways in order to find the length of r. Then [P QR] can be expressed
in terms of P Q and the altitude to P Q, which has length 5. Thus
5x
[P QR] = .
2
5x
Then we can solve for QR and RP in terms of P Q using the relation [P QR] = 2 . For instance,
5x QR · 3
[P QR] = = ,
2 2
RP ·4
so QR = 5x 3 . Further, [P QR] = 2 , so RP = 5x
4 . Then, since we know that [P QR] = sr, we
can solve for r as follows:
5x
[P QR] 2 1 60
r= = 1 5x 5x
= 1 1 1 =
s 2 3 + 4 +x 3 + 4 + 5
47
and we are done. 

Remark. Fun fact: the sum of the reciprocals of the lengths of the altitudes of a triangle is
always equal to 1r , where r is the length of the inradius.

Exercise 11.26 (Andrew Wu). Let ABC be a triangle with AB = 13, BC = 14, and CA = 15.
Suppose that D is the foot of the altitude from A to BC, and that IB and IC are the incenters of
triangles ADB and ADC, respectively. Suppose that the incircles of triangles ADB and ADC
meet AD at P and Q, respectively. If the area of the quadrilateral IC QIB P can be expressed
a
as for relatively prime positive integers a and b, then find a + b.
b

15
Everaise Academy (2020) Math Competitions II

We can also express the area of a triangle in terms of its sides in another way, also involving
its semiperimeter.

Theorem 11.27 (Heron’s formula). In triangle ABC, where s is the semiperimeter and
a = BC, b = AC, c = AB, the area of ABC is equal to
p
s(s − a)(s − b)(s − c).

Exercise 11.28. Find the area of a triangle with side lengths 13, 14, and 15.

Finally, here’s one last way to compute area, this time using the circumradius and sides of
the triangle.

Theorem 11.29. In triangle ABC, where R is the radius of the circumcircle of ABC and
a = BC, b = AC, c = AB, the area of ABC is equal to
abc
.
4R

Exercise 11.30. Find the circumradius of a triangle with side lengths 13, 14, and 15.

§11.5 Homework Problems

Problem 11.1 (2018 AMC 10A). [3] All of the triangles in the diagram below are similar to
isosceles triangle ABC, in which AB = AC. Each of the 7 smallest triangles has area 1, and
4ABC has area 40. What is the area of trapezoid DBCE?

Problem 11.2 (2017 CMIMC). [3] Let ABC be a triangle with ∠BAC = 117◦ . The angle
bisector of ∠ABC intersects side AC at D. Suppose 4ABD ∼ 4ACB. Compute the measure
of ∠ABC, in degrees.

Problem 11.3 (2017 AMC 10A). [4] A square with side length x is inscribed in a right triangle
with sides of length 3, 4, and 5 so that one vertex of the square coincides with the right-angle
vertex of the triangle. A square with side length y is inscribed so that one side of the square
lies on the hypotenuse of the triangle. What is the sum of the numerator and denominator of
x
y in lowest terms?

16
Everaise Academy (2020) Math Competitions II

Problem 11.4 (2017 AMC 12B). [4] The diameter AB of a circle of radius 2 is extended to a
point D outside the circle so that BD = 3. Point E is chosen so that ED = 5 and the line ED
is perpendicular to the line AD. Segment AE intersects the circle at point C between A and E.
The area of 4ABC can be expressed as m n , where m and n are relatively prime. Find m + n.

Problem 11.5 (2008 AIME II). [5] In trapezoid ABCD with BC k AD, let BC = 1000 and
AD = 2008. Let ∠A = 37◦ , ∠D = 53◦ , and M and N be the midpoints of BC and AD,
respectively. Find the length M N .

Problem 11.6 (2018 AIME I). [6] In 4ABC, AB = AC = 10 and BC = 12. Point D lies
strictly between A and B on AB and point E lies strictly between A and C on AC so that
p
AD = DE = EC. Then AD can be expressed in the form , where p and q are relatively prime
q
positive integers. Find p + q.

Problem 11.7 (2015 AIME II). [5] Triangle ABC has side lengths AB = 12, BC = 25, and
CA = 17. Rectangle P QRS has vertex P on AB, vertex Q on AC, and vertices R and S on
BC. In terms of the side length P Q = w, the area of P QRS can be expressed as the quadratic
polynomial
Area(P QRS) = αw − β · w2 .
m
Then the coefficient β = n, where m and n are relatively prime positive integers. Find m + n.

Problem 11.8 (2018 AMC 10). [4] Triangle ABC with AB = 50 and AC = 10 has area 120.
Let D be the midpoint of AB, and let E be the midpoint of AC. The angle bisector of ∠BAC
intersects DE and BC at F and G, respectively. What is the area of quadrilateral F DBG?

Problem 11.9 (HMMT). [6] In rectangle ABCD, points E and F lie on sides AB and CD
respectively such that both AF and CE are perpendicular to diagonal BD. Given that BF and
DE separate ABCD into three polygons with equal area, and that EF = 1, find the square of
the length of BD.

Problem 11.10 (PUMaC). [4] Let AD be a diameter of a circle. Let point B be on the circle,
point C be on AD such that A, B, C form a right triangle with right angle at C. The value of
the hypotenuse of the triangle is 4 times the square root of its area. If BC has length 30, what
is the length of the radius of the circle?

Problem 11.11 (2004 AIME I). [6] Let ABC be a triangle with sides 3, 4, and 5, and DEF G
be a 6-by-7 rectangle. A segment is drawn to divide triangle ABC into a triangle U1 and a
trapezoid V1 and another segment is drawn to divide rectangle DEF G into a triangle U2 and
a trapezoid V2 such that U1 is similar to U2 and V1 is similar to V2 . The minimum value of
the area of U1 can be written in the form m/n, where m and n are relatively prime positive
integers. Find m + n.

Problem 11.12 (2016 AMC 10A). [4] In rectangle ABCD, AB = 6 and BC = 3. Point E
between B and C, and point F between E and C are such that BE = EF = F C. Segments
AE and AF intersect BD at P and Q, respectively. The ratio BP : P Q : QD can be written
as r : s : t where the greatest common factor of r, s, and t is 1. What is r + s + t?

Problem 11.13 (2007 AMC 10B). [3] Right 4ABC has AB = 3, BC = 4, and AC = 5. Square
XY ZW is inscribed in 4ABC with X and Y on AC, W on AB, and Z on BC. The side length
of the square can be written as m
n , where m and n are relatively prime integers. Find m + n.

17
Everaise Academy (2020) Math Competitions II

Problem 11.14 (2013 AIME I). [8] Triangle AB0 C0 has side lengths AB0 = 12, B0 C0 = 17,
and C0 A = 25. For each positive integer n, points Bn and Cn are located on ABn−1 and ACn−1 ,
respectively, creating three similar triangles 4ABn Cn ∼ 4Bn−1 Cn Cn−1 ∼ 4ABn−1 Cn−1 . The
area of the union of all triangles Bn−1 Cn Bn for n ≥ 1 can be expressed as pq , where p and q are
relatively prime positive integers. Find q.

18
12 Circles

The majority of geometry problems are centered about triangles and circles, the first of which
you explored yesterday. In today’s handout, we will be covering circles, and you’ll see why they
appear so often.

§12.1 Angle Chasing in Circles

A circle is the set of all points in a plane that are a fixed distance r away from a fixed point.
This point is known as the center of the circle and r is the radius of the circle. The central
angle of an arc, or a portion of the circumference, is the angle formed by the endpoints of the
arc and the center of the circle at the vertex of the angle. An inscribed angle of an arc is
defined as the angle formed by the two endpoints and any point on the circle not on the arc as
the vertex of the angle.
For example, in the diagram below, ∠ACB is the inscribed angle of the arc AB d (marked
blue) not containing C and ∠AOB is the central angle of the same arc (marked red).

Proposition 12.1. In a circle with center O with arc AB


d and inscribed angle ∠ACB,

∠AOB = 2∠ACB.

That is, the central angle of any arc is twice the measure of an inscribed angle of that arc.

Proof. We’ll prove this in the case of the diagram given above, and briefly discuss the other
cases at the end.
Draw in radius OC. We’ll try and relate ∠AOB and ∠ACB by making use of isosceles

1
Everaise Academy (2020) Math Competitions II

triangles AOC and BOC, as OA = OB = OC. Observe that


∠ACB = ∠ACO + ∠BCO
1 1
= (180◦ − ∠AOC) + (180◦ − ∠BOC)
2 2
1 ◦
= (360 − (∠AOC + ∠BOC))
2
1
= ∠AOB
2
as desired.
Note that if C lies on the other side of BO or on the other side of AO, we’ll have subtraction
instead of addition in some cases — but everything is similar. 

Exercise 12.2. Using Proposition 12.1, prove the following two properties:

Theorem 12.3. (Thales’ Theorem) If AB of 4ABC is the diameter of the triangle’s


circumcircle, then ∠ACB = 90◦

Proposition 12.4. Any two inscribed angles of a given arc are congruent.

Remark. The converse of Thales’ Theorem holds as well; that is, if ∠ACB = 90◦ , AB is
the diameter of the circumcircle of 4ABC.

Remark. Proposition 12.4 is incredibly important. If four points A, B, C, D lie on a circle


centered at O, in that order, then ∠BAC = ∠BDC — both are equal to 12 ∠BOC.

Example 12.5. Let M be the midpoint of AB in triangle ABC. If AB = 6 and M C = 3,


then find ∠ACB.

Solution. This problem doesn’t give us much to work with — but it turns out that we can use
these lengths to our advantage. The key observation is that AB = 2M C, or M A = M B = M C.
This means that M is actually the circumcenter of 4ABC, and since M, A, B are collinear, AB
must be the diameter of the circumcircle of 4ABC. Then by Thales’ Theorem, ∠ACB = 90◦ ,
which is exactly what we wanted. 

Here are some more (less common, but useful) angle properties:

2
Everaise Academy (2020) Math Competitions II

Proposition 12.6. Define the measure of arc AB


d to be the measure of the central angle of
the arc. Then
1 d d
(AB + CD) = ∠AEB = ∠DEC
2
and
1 d d
(AB − CD) = ∠AF B.
2

Here’s one more very important fact — it’s often referred to as “Angle by Tangent.”

Proposition 12.7 (Angle by Tangent). Let D be a point outside of the circumcircle of


triangle ABC such that DA is tangent to the circumcircle and D and B lie on opposite
sides of AC. Then ∠CAD = ∠CBA.

Let’s wrap this section up with one more example:

Example 12.8 (Unknown Source). Suppose circle ω is internally tangent to circle Ω at A,


and AB is the diameter of Ω. Let the tangent from B to ω intersect ω at C and Ω again
d = 82◦ , then what is the measure of AD?
at D. If AC intersects Ω again at E and EB d

Solution. If we want to find AD,d we can instead just find 2∠ABD — by inscribed arcs these
two quantities are equivalent. It’s hard to deal with this angle by itself, so we’ll draw in O, the
center of ω; this allows us to use properties of tangent lines. We have ∠ABD = 90◦ − ∠COB.
To find ∠COB, note that ∠COB = 180◦ − ∠AOC, and moreover that AOC is an isosceles
triangle. Therefore we can find ∠OAC or ∠OCA — but note that ∠OAC = ∠BAE = 12 · 82◦ =
41◦ .
It follows that ∠AOC = 98◦ , and thus that ∠COB = 82◦ . Finally, we obtain ∠OBC = 8◦
d = 16◦ .
and thus AD 

3
Everaise Academy (2020) Math Competitions II

§12.2 Cyclic Quadrilaterals

Although triangles are fairly common, quadrilaterals appear often when circles arise as well. A
cyclic quadrilateral is a quadrilateral that can be inscribed in a circle, meaning there exists
a circle that passes through all four vertices.
We can use our two results to discover interesting properties of cyclic quadrilaterals:

Proposition 12.9. In cyclic quadrilateral ABCD, the angles opposite each other sum to
180◦ . That is,
∠ABC + ∠CDA = ∠BAD + ∠BCD = 180◦ .

Proof. Let O be the center of the circumcircle of ABCD. From Proposition 12.1, we have that
2∠BAD = ∠BOD (marked in blue) and 2∠BCD = ∠BOD, but with ∠BOD “flipped” this
time (marked in red) due to A and C lying on opposite sides of BD! Since these two central
angles are “opposite” each other, they sum to 360◦ . That is,

2∠BAD + 2∠BCD = 360◦ =⇒ ∠BAD + ∠BCD = 180◦

which is what we claimed. ∠ABC + ∠ADC = 180◦ follows by analogous reasoning. 

Proposition 12.10. Let the diagonals AC and BD of cyclic quadrilateral ABCD intersect
at E. We have
4AED ∼ 4BEC
4AEB ∼ 4DEC.

Proof. We’ll prove the first similarity, and the second will follow from analogous reasoning.
From vertical angles, we have ∠AED = ∠BEC. From Proposition 12.4, we also have ∠DAC =
∠CBD. Note that ∠DAC = ∠DAE and ∠CBD = ∠CBE, so ∠DAE = ∠CBE. Thus, we’re
done by AA similarity. 

Always keep these two properties in mind when you see cyclic quadrilaterals! These will be
your best friends. Due to these unique properties, cyclic quadrilaterals greatly simplify angle
and length conditions in many problems. We will now apply these to solve a problem.

4
Everaise Academy (2020) Math Competitions II

Example 12.11. Suppose circles ω and Ω intersect at points P and Q. If A and B lie on
ω and C and D lie on Ω such that A, Q, C and B, Q, D are collinear, in that order, then
prove that 4P AB ∼ 4P CD.

Solution. We will show this using AA similarity. The key idea is to use Q to consider cyclic
quadrilaterals P BAQ and P CDQ. Note that
∠BAP = ∠BQP = 180◦ − ∠P QD
with the last equality coming from the fact that B, Q, D collinear. Remembering that opposite
angles sum to 180◦ in cyclic quadrilaterals,
∠BAP = 180◦ − ∠P QD = ∠P CD.
We can go through a similar process once more:
∠P BA = 180◦ − ∠P QA = ∠P QC = ∠P DC
so we are done by AA similarity. 

Exercise 12.12. Using the same point definitions as the previous example, show that 4P BD ∼
4P AC.

Hopefully this example showed you how convenient these cyclic quadrilateral angle properties
can be. Also, remember this configuration! This similarity actually shows up more often than
you might think.
Here’s one more example to finish off this section with:

Example 12.13 (2015 PUMaC). Cyclic quadrilateral ABCD satisfies ∠ADC = 2·∠BAD =
80◦ and BC = CD. Let the angle bisector of ∠BCD meet AD at P . What is the measure,
in degrees, of ∠BP D?

Solution. Note that because ABCD is cyclic, we know ∠BAD +∠BCD = 180◦ , which implies
that ∠BCD = 140◦ . Since CP bisects ∠BCD, we know ∠DCP = 21 ∠DCB = 70◦ . Thus,
∠DP C = 180◦ − 80◦ − 70◦ = 30◦ .
Now, we’re stuck if we only use our angle properties. We need to be able to relate them in other
ways. Note that we haven’t yet used BC = CD — if we combine that with ∠DCP = ∠P CB,
we can use SAS congruency to find that 4DCP ∼ = 4BCP ! Therefore ∠BP D = 2∠CP D =

60 . 

5
Everaise Academy (2020) Math Competitions II

§12.3 Lengths in Cyclic Quadrilaterals

The properties we’ve mentioned so far all pertain to angles, so let’s work some lengths into the
mix. Let’s introduce the idea of the power of a point with respect to a circle:

Definition 12.14. The power of point P with respect to a circle ω with center O and radius
r is defined as Pow(ω, P ) = OP 2 − r2 . In particular,
• Pow(ω, P ) < 0 if P lies inside ω.
• Pow(ω, P ) = 0 if P lies on ω.
• Pow(ω, P ) > 0 if P lies outside ω.

This may not be the definition you’re familiar with, or the one you learned in school, but
we’ll see why the two definitions are essentially equivalent. Note that by difference of squares,
we have Pow(ω, P ) = (OP + r)(OP − r). This naturally motivates extending OP to meet ω
at two points A and B — suppose furthermore that P A < P B. Now would be a good time to
draw a diagram.
Because OA = OB = r, we have that OP + r = P O + OB = P B and OP − r = OP − OA =
−P A. Thus, Pow(ω, P ) = (P B)(−P A) = −P A · P B! Note that the sign matches up with what
we claimed previously.
You may have learned in school that the power of point P in this scenario would be P A · P B,
rather than −P A · P B. It turns out that for consistency reasons it makes more sense for us to
define it as above.

Exercise 12.15. Show that if P lies outside of ω and that if P O meets ω at points A and B,
then Pow(ω, P ) = P A · P B.

Proposition 12.16. Suppose there is now another line from P that now intersects ω at C
and D. Then,
P A · P B = P C · P D.

Proof. Note that A, B, C, and D all lie on ω, meaning ABCD is a cyclic quadrilateral. Then,
∠P BC = ∠ABC = 180◦ − ∠ADC = ∠P DA and ∠P CB = ∠DCB = 180◦ − ∠DAB = ∠P AD,
which implies that 4P AD ∼ 4P CB by AA Similarity.
We can then relate lengths using similarity to finish.
PA PC
= =⇒ P A · P B = P C · P D
PD PB
as desired. 

Note that the secant intersecting C and D can be any secant, meaning the relation P A·P B =
P C · P D holds for any two secant lines! Importantly, it’s also possible that if P is outside ω,
that points C and D are the same — that is, P C is tangent to ω. Then P C 2 = P A · P B.

Theorem 12.17 (Ptolemy’s Theorem). If ABCD is a cyclic quadrilateral, then

AB · CD + BC · DA = AC · BD.

6
Everaise Academy (2020) Math Competitions II

Proof. The main idea is to construct the point E on segment AC such that ∠ABD = ∠CBE.
This actually gives us two sets of similar triangles.

Exercise 12.18. Prove that 4ABD ∼ 4EBC and 4ABE ∼ 4DBC.

Using similarity ratios, we have that


AD EC
= =⇒ BC · AD = EC · DB
DB BC
AB DB
= =⇒ AB · DC = AE · DB
AE DC
=⇒ AB · DC + BC · AD = EC · DB + AE · DB = (EC + AE)DB = AC · DB
as claimed. 

Remark. For those of you who are familiar with olympiad geometry √ already, the most
standard proof of Ptolemy’s Theorem is actually with inversion. A bc inversion is actually
what motivates our construction of E!

Ptolemy’s Theorem is often useful when numerous side lengths are given but Power of a Point
is difficult to apply. Here’s a good example of when this is the case.

Example 12.19. Let ABC be an equilateral triangle with circumcircle ω. Let point P be
any point on minor arc BC.
d Show that P A = P B + P C.

Solution. There really isn’t a way we can do this with Power of a Point, because most inter-
sections in the problem aren’t very easy to work with. Let’s give Ptolemy’s a try!
By Ptolemy’s theorem, we know that

AB · P C + AC · P B = BC · P A.

Since 4ABC is equilateral, we also have that AB = BC = CA, so dividing that out we are left
with P C + P B = P A, which is what we wanted to show. 

Lets try a problem that’s a bit more involved.

7
Everaise Academy (2020) Math Competitions II


Example 12.20 (2016 AMC 12A). A quadrilateral is inscribed in a circle of radius 200 2.
Three of the sides of this quadrilateral have length 200. What is the length of the fourth
side?

Solution. Let O be the center of the circle, and let ABCD be the inscribed quadrilateral, with
AB = BC = CD = 200. We want to find AD.
Let’s first see if we can use Power of a Point. We can look for intersections, but there aren’t
many, making it hard to relate lengths without adding a bunch of extra points.
So let’s try Ptolemy’s Theorem! Applying Ptolemy’s Theorem gives us the following:

2002 + 200 · AD = AC · BD.

All we have to do is find AC and BD, solve the equation from Ptolemy’s, and we’re done!
The equation actually simplifies even more though. Since AC and BD correspond to two
arcs that are the same length, we know AC = BD. So, after we find either AC or BD, the
problem is essentially done.
Remember that the line passing through the midpoint of arc AB
d and the center of a circle
is perpendicular to line AB. Thus, we know that AC is perpendicular to OB, and half of the
length of AC is the altitude of 4OAB, meaning that OB ∗ AC 2 = AB ∗ OM , where M is the
√ 4OBC is isosceles, we can simply use Pythagorean’s
midpoint of AB. Since √ theorem to find
OM : as OB = 200 2 and M B = 100, it follows that OM = 100 7.

Plugging that into our earlier equation, we get that AC = 100 14. Now that we have AC,
we can solve for AD in the equation we got from Ptolemy’s! Doing so gives us the following:
√ √
2002 + 200 · AD = 100 14 · 100 14,

which reduces to
200 · AD = 100000
and so
AD = 500.
We are done. 

§12.4 Recognizing Cyclic Quadrilaterals

Unfortunately, we won’t always be given that four points form a cyclic quadrilateral. How-
ever, we can combine the knowledge we used from our three sections and consider their con-
verses:

Proposition 12.21. The given quadrilateral ABCD in the diagram below is cyclic if any
one of the following conditions is true:
• ∠BAC = ∠BDC and analogous cases (such as ∠ADB = ∠ACB).
• ∠ABC + ∠CDA or ∠BCD + ∠DAB equal 180◦ .
• P A · P C = P B · P D, where P is the intersection of the diagonals AC and BD.

8
Everaise Academy (2020) Math Competitions II

• P A · P B = P C · P D, where P is the intersection of AB and CD.


• P A · P D = P B · P C, where P is the intersection of AD and BC.

Let’s try to apply these in an old USAMO problem:

Example 12.22 (1998 USAMO). Let C1 and C2 be concentric circles, with C2 in the interior
of C1 . From a point A on C1 one draws the tangent AB to C2 (B ∈ C2 ). Let C be the
second point of intersection of AB and C1 , and let D be the midpoint of AB. A line passing
through A intersects C2 at E and F in such a way that the perpendicular bisectors of DE
and CF intersect at a point M on AB. Find, with proof, the ratio AM/M C.

Solution. This is a pretty tough problem. Let’s begin by drawing a diagram.

We have that the perpendicular bisectors of DE and CF meet at a point M on AB. That’s a
weird condition — one thing to think about here is that the circumcenter of a triangle, or any
polygon inscribed in a circle, can be found by drawing the perpendicular bisectors of all of its
sides. That should lead us to believe that there’s a possibility that DEF C could be a cyclic
quadrilateral — that would give us a circumcenter.

9
Everaise Academy (2020) Math Competitions II

So let’s try and prove that DEF C is cyclic. We might think about angles, but we’re essentially
given zero information regarding angle measures; rather, we are handed a bunch of midpoints,
so let’s use Power of a Point. The point A is given to us, so let’s try and show that AD · AC =
AE · AF .
It’s natural, then, to begin with Power of a Point with respect to circle C2 . As AB is tangent
to C2 , we know that AE · AF = AB 2 , so it suffices to show that AB 2 = AD · AC. But B is the
midpoint of AC and D is the midpoint of AB, so AD = 12 AB and AC = 2AB — and therefore
AD · AC = AB 2 , as desired.
Now we know that M must be the circumcenter of cyclic quadrilateral DEF C, so M C =
1
2 CD= 12 ( 34 AC) = 38 AC. Therefore AM = 85 AC, so our answer is 53 , and we are done. 

Remark. A few important points regarding the previous example: firstly, Power of a Point
is extremely useful for proving points are concyclic if you aren’t given anything in terms of
angles! Secondly if you’re given perpendicular bisectors, you automatically ought to think
about circumcenters.

Let’s finish with one more example from Italy TST:

Example 12.23 (2001 Italy TST). The diagonals AC and BD of a convex quadrilateral
ABCD intersect at point M . The bisector of ∠ACD meets the ray BA at K. Given that
M A · M C + M A · CD = M B · M D, prove that ∠BKC = ∠CDB.

Solution. The given condition, M A · M C + M A · CD = M B · M D, looks quite weird, so let’s


first look at what we’re trying to prove. The angle condition ∠BKC = ∠CDB is actually
equivalent to showing that quadrilateral BKDC is cyclic, as shown above.
One technique that is often helpful in geometry problems is assuming what you want to prove
is true, and “working backwards” from there. In this case, let’s assume that BKDC is cyclic;
that, in conjunction with CK bisecting ∠ACD, would yield ∠KBD = ∠KCD = ∠ACP , which
would imply that ABCP is cyclic. Moreover, these steps are reversible, so to show that BKDC
is cyclic we can instead show that BAP C is cyclic.
Since our given condition is a length condition, we should probably use the angle bisector

10
Everaise Academy (2020) Math Competitions II

theorem. We have
CD PD
= =⇒ P M · CD = P D · CM.
CM PM
Note that we actually have both of M C and CD in this relation, so if we multiply both sides
by M A, then
PD
M A · CD · P M = M A · M C · P D =⇒ M A · CD = · M A · M C.
PM

This means we can express the left hand side of our given condition in terms of one product!
Substituting this in,
PD
M A · M C + M A · CD = M A · M C + · MA · MC
 M
P 
PD + PM
= MA · MC ·
PM
MD
= MA · MC · = MB · MD
PM
where the last line follows from our given condition, and the preceding ones follow from some
manipulation.
Miraculously, it follows from this equation that M A · M C = M B · M P , which is exactly
Power of a Point — and thus ABCP is cyclic and we are done. 

Remark. The important takeaway here is that you can sometimes look at what you want to
prove first, assume that, and make some observations from there. That can help motivate
future steps. Moreover, some given conditions will allow you to make multiple observations
— our angle bisector served as a way to chase angles but also as a way to generate a length
condition.

§12.5 Homework

Problem 12.1 (1971 Canada MO). [3] DB is a chord of a circle, and point E lies on segment
DB such that DE = 3 and EB = 5. Let O be the center of the circle. Join OE and extend OE
to cut the circle at C. Given EC = 1, find the radius of the circle.

Problem 12.2 (2013 AMC 10A). [5] In 4ABC, AB = 86, and AC = 97. A circle with center
A and radius AB intersects BC at points B and X. Moreover BX and CX have integer lengths.
What is BC?

Problem 12.3 (Andrew Wu). [4] Let ABCD be a rectangle with AB = CD = 6. Suppose
that E and F lie on side AB such that AE = EF = F B = 2. Let G denote the intersection of
lines EC and BD; let H denote the intersection of lines F C and BD. Suppose that E, F, G,
and H lie on a common circle. Find BC 2 .

Problem 12.4 (Western PA ARML Lecture). [4] Suppose that ABC is a right triangle with
∠B = 90◦ and ∠A = 17◦ . Point D lies on AB and point E is the foot of the perpendicular
from D to AC. Suppose that ∠EBA = 23◦ . Find ∠BCD.

11
Everaise Academy (2020) Math Competitions II

Problem 12.5 (Andrew Wu). [5] Suppose that triangle ABC is isosceles with AB = AC
and BC = 36. Point T lies on BC such that the circumcircle of triangle AT C is tangent to
AB. Suppose that BT = 25. If cos ∠BAT = pq for some positive integers p and q such that
gcd(p, q) = 1, then find p + q.

Problem 12.6 (Classical). [6] Let M be the midpoint of arc XY


d on circle Ω. Suppose that P
is a variable point on the arc XY
d not containing M , and suppose that M P meets XY at Q.
d , the quantity M P · M Q remains constant.
Show that as P traverses the arc XY

Problem 12.7 (2012 HMMT). [7] There are circles ω1 and ω2 . They intersect in two points,
one of which is the point A. B lies on ω1 such that AB is tangent to ω2 . The tangent to ω1
at B intersects ω2 at C and D, where D is closer to B, such that BD = 3 and CD = 13. AD
EB 2
intersects ω1 again at E. If ED can be expressed as m

n , where m and n are relatively prime
positive integers, find m + n.

Problem 12.8 (2019 AIME I). [6] In convex quadrilateral KLM N side M N is perpendicular
to diagonal KM , side KL is perpendicular to diagonal LN , M N = 65, and KL = 28. The line
through L perpendicular to side KN intersects diagonal KM at O with KO = 8. Find M O.

Problem 12.9 (2013 AIME II). [6] A hexagon that is inscribed in a circle has side lengths 22,

22, 20, 22, 22, and 20 in that order. The radius of the circle can be written as p + q, where p
and q are positive integers. Find p + q.

Problem 12.10 (2020 CMIMC). [8] Two circles ωA and ωB have centers at points A and B
respectively and intersect at points P and Q in such a way that A, B, P , and Q all lie on
a common circle ω. The tangent to ω at P intersects ωA and ωB again at points X and Y
respectively. Suppose AB = 17 and XY = 20. The sum of the radii of ωA and ωB can be

expressed in the form m n, where m and n are positive integers, and n is not divisible by the
square of any prime. Find m + n.

Problem 12.11 (2016 PUMaC). [8] Let ABCD be a cyclic quadrilateral with circumcircle ω
and let AC and BD intersect at X. Let the line through A parallel to BD intersect line CD at
E and ω at Y 6= A. If AB = 10, AD = 24, XA = 17, and XB = 21, then the area of M DEY
can be written in simplest form as m
n . Find m + n.

Problem 12.12 (2017 AMC 12A). [7] Quadrilateral ABCD is inscribed in circle O and has
sides AB = 3, BC = 2, CD = 6, and DA = 8. Let X and Y be points on BD such that
DX 1 BY 11
= and = .
BD 4 BD 36
Let E be the intersection of intersection of line AX and the line through Y parallel to AD. Let
F be the intersection of line CX and the line through E parallel to AC. Let G be the point on
circle O other than C that lies on line CX. What is XF · XG?

Problem 12.13 (Miquel Point of a Triangle). [6] Let D, E, F lie on segments BC, CA, AB
of triangle ABC, respectively. Show that the circumcircles of the triangles AEF , BF D, and
CDE all go through a common point.
Hint: Let K be the intersection of (AEF ) and (BF D) other than F : show that CDKE is cyclic.

12
Everaise Academy (2020) Math Competitions II

Problem 12.14 (2020 AIME I). [10] Let ABC be an acute triangle with circumcircle ω and
orthocenter H. Suppose the tangent to the circumcircle of 4HBC at H intersects ω at points

X and Y with HA = 3, HX = 2, HY = 6. The area of 4ABC can be written as m n, where
m and n are positive integers, and n is not divisible by the square of any prime. Find m + n.
Hint: Prove that the reflection of H lies on the circumcircle of triangle ABC!

13
13 Triangle Centers

Today we’ll go over the most common triangle centers — their properties and their applica-
tions, to both computational and olympiad math. We’ll devote a section each to the centroid,
orthocenter, and incenter; the circumcenter is the only “main” triangle center we won’t be
spending an entire section on.
As before, unless otherwise specified, in a triangle ABC, ∠A = ∠BAC, ∠B = ∠CBA, and
∠C = ∠ACB. Dilations will feature rather frequently in this handout; if you don’t feel that
comfortable with that material from day 1, please review it.

§13.1 The Centroid and Circumcenter

Everyone knows what the centroid is, but we’ll prove its existence and do some nice centroid
problems, too.

Theorem 13.1. Let ABC be a triangle, and let M, N, and P be the midpoints of sides
BC, CA, and AB. Then
1. AM, BN, and CP concur at some point G, called the centroid of triangle ABC;
2. AG : GM = BG : GN = CG : GP = 2 : 1;
3. The areas of triangles AGP, BGP, BGM, CGM, CGN, and AGN are equal; and
4. Triangle M N P is called the medial triangle of triangle ABC, and G is also the
centroid of triangle M N P .

Proof. Suppose that BN and CP meet at G; we’ll show that AM also passes through G by
first showing the second property above.
Let N 0 and P 0 be the midpoints of BG and CG, respectively. This makes N 0 P 0 the G-midline
of triangle GBC, so therefore N 0 P 0 k BC and N 0 P 0 = 21 BC. However, we also know that
N P = 12 BC and N P k BC; it follows that N P N 0 P 0 is a parallelogram.
Therefore its diagonals bisect each other, and N G = N 0 G and P G = P 0 G. It follows that
BG : GN = 2 : 1 and CG : GP = 2 : 1, so CP cuts BN into a 2 : 1 ratio.
However, since we chose B and C arbitrarily, that means that AM must also cut BN into a

1
Everaise Academy (2020) Math Competitions II

2 : 1 ratio — by the same logic as above, if we’d started with medians AM and BN . Therefore
AM also passes through G, and AG : GM = 2 : 1, as desired.
For our area equality: observe firstly that as triangle BGM and CGM have the same altitude
— from G to BC — and as they have the same base length (why?), then triangles BGM and
CGM are equal in area. Furthermore, triangle BGP and AGP have the same area, as do
triangles AGN and CGN , by similar logic.
Therefore it suffices to show that triangles AP G and AN G have the same area; the rest
will fall by symmetry. Note that triangles AP M and M N A are congruent, as AP M N is a
parallelogram; thus the altitudes from P and AM and N to AM have the same length. It
follows that as AN G and AP G share a base that they have the same area, and we are done.
As for the fourth property: observe that AM bisects P N as AP M N is a parallelogram, and
the rest falls instantly. 

Let’s go through some problems involving the centroid. It turns out 2018 was a very good
year for those.

Example 13.2 (2018 AMC 12B). Square ABCD has side length 30. Point P lies inside the
square so that AP = 12 and BP = 26. The centroids of 4ABP , 4BCP , 4CDP , and
4DAP are the vertices of a convex quadrilateral. What is the area of that quadrilateral?

Solution. Let’s suppose that W, X, Y, and Z be the midpoints of AB, BC, CD, and DA; let’s
suppose that G, H, I, and J be the centroids of triangles AP B, BP C, CP D, and DP A.

This means that P G : GW = 2 : 1, and similar relations hold for the rest of the centroid-
midpoint pairs. Therefore, GHIJ is simply the result of dilating square W XY Z by a factor of

2
Everaise Academy (2020) Math Competitions II

2
3 from point P . As its side lengths must be 23 ’s those of square W XY Z, its area, then, must
be ( 23 )2 = 49 of the area of W XY Z, which has area 450. Our answer is 200. 

Exercise 13.3 (2018 AMC 12B). Line segment AB is a diameter of a circle with AB = 24.
Point C, not equal to A or B, lies on the circle. As point C moves around the circle, the centroid
(center of mass) of 4ABC traces out a closed curve missing two points. To the nearest positive
integer, what is the area of the region bounded by this curve?

Example 13.4 (Adapted from 2010 Mock USAJMO). Suppose that M, N, and P are the
midpoints of sides BC, CA, and AB, respectively, of triangle ABC. Suppose that G is the
centroid of triangle ABC. If points A, P, G, and N are concyclic, then find AM in terms
of BC.

Solution. We’re essentially given a cyclic quadrilateral, so it might be time to think about our
theorems from yesterday. In particular, Power of a Point seems promising: if we let AG and
N P meet at X, we might be able to use Power of a Point on X.

We know that XP = XN = 12 N P = 14 BC, as we know that AG bisects N P . Now let’s try


and find XG and XA: by similar triangles it’s clear that XA = 12 AM . Moreover, as G is the
centroid of M N P , we get XG = 13 XM = 16 AM .
1 2 1 2
It follows that by Power of a Point, XG · XA = XN · XP , or equivalently, 12 AM = 16 BC .

3
Therefore AM 2 = 34 BC 2 , and AM = 2 BC, and we are done. 

In the above problem, we were trying to find AM in terms of BC; that is, we were trying to
work with lengths. That should have tipped us off to using Power of a Point: often when we
work with cyclic quadrilaterals we turn to angles, but in this case the problem was tailor-made
for the method we demonstrated above.

Example 13.5 (Adapted from 2018 PUMaC). In right triangle 4ABC, a square W XY Z is
inscribed such that vertices W and X lie on hypotenuse AB, vertex Y lies on leg BC, and
vertex Z lies on leg CA. Let AY and BZ intersect at some point P . If the length of each
side of square W XY Z is 12, the length of the hypotenuse AB is 60, compute the distance
between point P and point G, where G denotes the centroid of 4ABC.

3
Everaise Academy (2020) Math Competitions II

Solution. Before reading on, we strongly recommend drawing a diagram and making some
conjectures about some of the points in the problem.
That being said, our first instinct should be to wonder why the problem is asking for P G.
That’s a weird length to ask for, especially when the centroid seems to come out of nowhere.
The presence of the centroid strongly suggests adding points M, N, and O, the midpoints of
AC, CB, and AB, respectively.

It looks like C, P, G, and O are collinear! Of course, we already know that C, G, and O are
collinear, but let’s try to prove that P lies on this line, too.
If you know Ceva’s theorem, this is not hard. But we’ll present an alternative proof that
C, P, and O are collinear. Let T be the midpoint of ZY . Then T, P, and O are collinear, as
triangles ZY P and P AB are similar. But C, T, and O are also collinear, by similar triangles
CZY and CAB, so indeed we know that C, T, P, G, and O are collinear.

Our path now becomes more clear. We’d like to find CG and CP , because that will give us
P G instantly. Let’s begin with CG.
We know that CG = 23 CO by centroid properties, so can we find CO? Remembering that
ACB is a right triangle, we actually know that OA = OC = OB = 30! Then CG = 32 · 30 = 20.
Now let’s find CP . We’ll handle this with similar triangles, too. Letting T P = x, we see that
ZY
P O = 5x, as AB = 15 . Moreover, we know that CO
CT
= 51 , so CT = 6.
Therefore T O = 24 = 6x, so x = 4. It follows that CP = CT + T P = 6 + 4 = 10, so
P G = 20 − 10 = 10. We are done. 

Exercise 13.6. Let’s start by supposing that p, q, and r are complex numbers with p+q+r = 0.
1. Draw the complex plane, and plot two arbitrary points p and q in it. Find where p + q
must be, geometrically — remember the parallelogram law!
2. Remember that r = −p − q, and thus identify r on the complex plane.
3. Using just geometry, show that 0 is the centroid of p, q, and r. (As a sidenote, this actually
generalizes quite nicely: if p, q, and r are arbitrary complex numbers, their centroid is
p+q+r
3 . You can prove this by a translation of p, q, and r!)

4
Everaise Academy (2020) Math Competitions II

Let’s go over the circumcenter now.

Theorem 13.7. Let ABC be a triangle. Then there exists a circle Ω such that A, B, and
C lie on Ω.

Proof. You’ve probably used this fact many, many times; we’ll go over a quick proof as to why
the circumcircle exists. Suppose that the perpendicular bisectors of AB and AC meet at O,
such that OA = OB and OB = OC. Then OA = OC, so therefore the circle centered at O
with radius OA = OB = OC is desired circle Ω, and O is called the circumcenter of triangle
ABC. 

Exercise 13.8. If ABC is a triangle with circumcenter O and M is the midpoint of BC, show
that ∠BOM = ∠COM = ∠A.

Exercise 13.9 (Three Cyclic Quadrilaterals). Let ABC be a triangle with circumcenter O and
let M, N, and P be the midpoints of BC, CA, and AB, respectively.
1. Show that quadrilateral AN OP is cyclic, and find two more quadrilaterals that, by sym-
metry, must also be cyclic.
2. (2011 AMC 12) Triangle ABC has AB = 13, BC = 14, and AC = 15. The points D, E,
and F are the midpoints of AB, BC, and AC respectively. Let X 6= E be the intersection
of the circumcircles of 4BDE and 4CEF . What is XA + XB + XC?

Unfortunately, there isn’t that much we can do specifically with the circumcenter alone. But
you’ll see some more examples that involve it in the next section.

§13.2 The Orthocenter

You should all be familiar with the basics of the orthocenter, but in this section we’ll go over
some of its more advanced properties.

Theorem 13.10. Let ABC be a triangle, and let D, E, and F be the feet of the altitudes
from A, B, and C to sides BC, CA, and AB, respectively. Then AD, BE, and CF concur
at some point H, called the orthocenter of triangle ABC.

Proof. We’ll actually prove this theorem by referencing the circumcenter. The important prop-
erty to keep in mind here is that the circumcenter of a triangle ABC is the point common to
the perpendicular bisectors of BC, CA, and AB.
Here’s the inspired step: construct points X, Y, and Z such that triangle ABC is the medial
triangle of triangle XY Z. We can do this by constructing parallel lines to BC, CA, and AB
through A, B, and C, respectively.

5
Everaise Academy (2020) Math Competitions II

But that means that the perpendiculars from A to Y Z, B to ZX, and C to XY — that is,
the lines AD, BE, and CF — concur at some point H, the circumcenter of triangle XY Z. We
are done. 

In this configuration, triangle DEF is called the orthic triangle of triangle ABC — that
is, the triangle with vertices at the feet of the altitudes.

Exercise 13.11 (Six Cyclic Quadrilaterals). This is a very important exercise, and you shouldn’t
hesitate to ask for help if you’re not getting it. Let ABC be a triangle with orthocenter H, and
let D, E, and F be the feet of the A, B, and C-altitudes.
1. Show that quadrilateral BF EC is cyclic. Identify two more cyclic quadrilaterals that we
know, by symmetry, must also be cyclic.
2. Show that quadrilateral AF HE is cyclic. Identify two more cyclic quadrilaterals that we
know, by symmetry, must also be cyclic.

Exercise 13.12. Let ABC be a triangle with orthocenter H, and let D, E, and F be the feet
of the A, B, and C-altitudes.
1. Show that HA · HD = HB · HE = HC · HF .
2. Show that AF · AB = AH · AD = AE · AC.
Hint: Use the previous exercise!

Let’s prove one of the most important properties of the orthocenter, which shows up all the
time in Olympiad and pre-Olympiad problems.

Theorem 13.13 (Orthocenter Reflections). Let ABC be a triangle with orthocenter H, and
let M be the midpoint of BC. Then
• the reflection of H over BC lies on the circumcircle of triangle ABC, and
• the reflection of H over M lies on the circumcircle of triangle ABC, and is diamet-
rically opposite to A.

Proof. Let HA be the reflection of H over BC. We essentially want to show that ABHA C is a
cyclic quadrilateral, so let’s try and show that ∠BAC + ∠BHA C = 180◦ .

6
Everaise Academy (2020) Math Competitions II

We know that ∠BHA C = ∠BHC, by properties of reflections — thus it suffices to show


that ∠BHC + ∠A = 180◦ . To compute ∠BHC, we’ll use triangle BHC: its other two angles
are ∠HBC and ∠HCB. Letting E and F be the feet of the B and C-altitudes, we obtain
∠HBC = 90◦ − ∠C and ∠HCB = 90◦ − ∠B, by right triangles BEC and CF B. Thus

∠BHC = 180◦ − ∠HBC − ∠HCB


= 180◦ − (90◦ − ∠C) − (90◦ − ∠B)
= ∠C + ∠B

and it follows that ∠BHC + ∠A = ∠C + ∠B + ∠A = 180◦ , as desired.


As for the reflection of H over M : let’s call it A0 . We know that HBA0 C is a parallelogram as
its diagonals bisect each other, so ∠BHC = ∠BA0 C falls out immediately; thus, as ∠BHA C =
∠BHC, we get ∠BHA C = ∠BA0 C and therefore A0 lies on the circumcircle of ABC.

To prove that AA0 is a diameter is slightly harder. We’ll show that ∠ABA0 = 90◦ by breaking
it up into smaller, more manageable pieces.
Note that ∠ABA0 = ∠ABC + ∠CBA0 , and that as HBA0 C is a parallelogram, ∠CBA0 =

7
Everaise Academy (2020) Math Competitions II

∠BCH. Therefore

∠ABA0 = ∠B + ∠BCH
= ∠B + (90◦ − ∠B)
= 90◦

and we are done. 

Remark. A common strategy in angle-chasing problems is to reduce what you don’t know
into what you do know. In particular, in the above example point A0 was a bit wonky; we
didn’t know much about it other than the fact that it was on the circumcircle of ABC.
Therefore, to show that ∠ABA0 = 90◦ , we got rid of A0 by splitting ∠ABA0 into two pieces
— ∠ABC and ∠CBA0 — and noting that the latter piece was equal to ∠BCH. We could
then work with ∠BCH much easier than we could have worked with either ∠ABA0 or
∠CBA0 .
As a note, many angle-chasing problems reduce to showing certain angles at points not
A, B, or C are equal to angles related to ∠A, ∠B, and ∠C. Reduce what you don’t know
into what you do know.

Exercise 13.14. Using theorem 13.13, conclude if ABC is a triangle with orthocenter H,
circumcircle Ω, and circumradius R, then
1. the circumcircles of triangles HBC, HCA, and HAB are reflections of Ω over BC, CA,
and AB, respectively, and
2. all three of the aforementioned circumcircles have radii of length R.

Exercise 13.15 (2019 HMMT). Let ABC be a triangle with AB = 13, BC = 14, CA = 15.
Let H be the orthocenter of ABC. Find the radius of the circle with nonzero radius tangent to
the circumcircles of AHB, BHC, CHA.

Example 13.16 (Length of AH). Let ABC be a triangle with orthocenter H. We will show
that AH = 2R cos ∠A, where R is the length of the circumradius of triangle ABC.
1. First, show that, that triangles AEF and ABC are similar with similarity ratio cos A.
(You might find the first part of Exercise 13.11 helpful here!)
2. Show that if A0 is the antipode of A on the circumcircle of ABC, then H and A0
are corresponding points with respect to similar triangles AEF and ABC. (Recall
that the antipode of a point is the point diametrically opposite that point.)
3. Conclude that as the similarity ratio between triangles AEF and ABC is cos A that
AH = 2R cos A.

Solution. We know that BF EC is cyclic by Exercise 13.11. It follows that ∠B = 180◦ −


∠F EC = ∠AEF , so by angle-angle similarity triangles AEF and ABC are similar.

8
Everaise Academy (2020) Math Competitions II

Their similarity ratio is just the ratio of corresponding sides: in this case, AE and AB clearly
AE
correspond. Thus indeed AB = cos A, by using the adjacent-hypotenuse definition in triangle
AEB, and we’re done with the first part of the problem.
Next, we know that A0 is diametrically opposite A on the circumcircle of triangle ABC.
Therefore, to show that H and A0 correspond, it suffices to show that H is diametrically
opposite A on the circumcircle of triangle AEF .

But we know that ∠AEH = ∠AF H = 90◦ , so indeed H and A correspond. There goes the
second part.
As for the last part, we know that now that as H and A0 correspond that AH
AA0 = cos A. But
AA0 = 2R, so indeed AH = 2R cos A, as desired. 

Exercise 13.17. Show using AH = 2R cos A that in a triangle ABC with circumcenter O and
orthocenter H, AO = AH if and only if ∠A = 60◦ .

As you can see, the orthocenter possesses plenty of properties with real depth; we’ll make use
of them in the following examples.

9
Everaise Academy (2020) Math Competitions II

Example 13.18 (Classical). Show that if ABC is a triangle with orthocenter H and cir-
cumcenter O, and M and N are the midpoints of BC and AH, respectively, then AN M O
is a parallelogram.

Solution. Since AN and M O are both perpendicular to BC, we have two options: we can
either show that AO and N M are parallel, or that AN = M O.
It seems kind of hard to deal with angles relating to midpoints; midpoints make us want
to use lengths. Let’s show that AN = M O. Using the previous example, we know that
AN = 12 AH = R cos A, so it suffices to show that M O = R cos A.

But this isn’t that hard. Naturally, let’s draw in OB; we see that ∠BOM = ∠A, so therefore
OM = R cos A, as desired. 

Let’s go over another important property of the orthocenter configuration.

Example 13.19 (Three Tangents). Let ABC be a triangle with orthocenter H, and suppose
that D, E, and F are the feet of the A, B, and C-altitudes, respectively. Let M be the
midpoint of BC. Show that M E, M F , and the line through A parallel to BC are all
tangent to the circumcircle of triangle AEF .

Solution. By the Angle by Tangent theorem, to show that M F is tangent to the circumcircle
of triangle AEF it suffices to show that ∠M F E = ∠A.
The important observation here is that as BF EC is a cyclic quadrilateral with diameter
BC, then M is the center of its circumscribed circle. It follows that ∠F M E = 2∠F BE =
2(90◦ − ∠A) = 180◦ − 2∠A.

10
Everaise Academy (2020) Math Competitions II

So therefore ∠M F E + ∠M EF = 2∠A, and as M E = M F it follows that ∠M F E = ∠A, as


desired. By symmetry, we also see that M E is tangent to the circumcircle of triangle AEF .
The third tangency is easier: note that the circumcircle of AEF has diameter AH, which is
perpendicular to BC, so therefore the parallel to BC through A is tangent to that circumcircle.
We are done. 

Time for a few tough examples.

Example 13.20 (Adapted from 2020 OTSS Mock AIME). Let ABC be a triangle with
altitudes AD, BE, and CF that meet at the orthocenter H. Line AH intersects the
circumcircle of triangle BHC at a point A0 6= H. Given that A0 D − AH = 3, BD = 4, and
CD = 6, find the area of quadrilateral AEHF .

Solution. Our condition A0 D − AH = 3 seems like the weirdest one, so let’s begin by attacking
that. We know that A0 is the intersection of AH and the circumcircle of BHC. But as the
circumcircle of BHC is the reflection of the circumcircle of ABC over the line BC (by Exercise
13.11), it follows that A0 is the reflection of A over BC.
Indeed, we get A0 D = AD, so HD
√ = 3. From this the Pythagorean Theorem immediately
implies that BH = 5 and CH = 3 5.
Now, we’d like to be able to compute AH; if so, we can immediately get F H and EH by
Exercise 13.12. Knowing that we have lengths and a circle, we’ll turn to Power of a Point: if
HA is the reflection of H over BC, then we know that HA lies on the circumcircle of triangle
ABC and that HD = HA D. Thus

BD · CD = HA D · DA

and therefore 4 · 6 = 3 · AD, so AD = 8 and AH = 5.

11
Everaise Academy (2020) Math Competitions II


It follows that F H = 5 and EH = 3, by the first√part of this problem. Thus, by the
Pythagorean Theorem, we see that AE = 4 and AF = 2 5, so

[AEF H] = [AF H] + [AEH]


= 11

where brackets denote area. We are done. 

Example 13.21 (2018 CMIMC). Let ABC be a triangle with AB = 9, BC = 10, CA = 11,
and orthocenter H. Suppose point D is placed on BC such that AH = HD. Compute
AD.

Solution. Let P be the foot of the A-altitude. Let’s think about this problem backwards: if we
want to find AD, it suffices to find AP and P D; furthermore, AP is easy to obtain as it’s just
the length of an altitude. So to find P D, we could find DH and HP and use the Pythagorean
Theorem — but DH = AP − AH, and HD = AH.

Therefore it makes a lot of sense to begin by finding AP , and then find AH — perhaps by
using our AH = 2R cos A formula
√ from before. By Heron’s
√ Formula, we may easily obtain the
area of triangle ABC as 30 2; we then obtain AP = 6 2.

33 2
We can then calculate the circumradius R with abc 4R , which yields R = 8 . As for the
AQ
cosine of ∠A, we know that it is equal to AC , where Q is the foot of the C-altitude. Moreover,

12
Everaise Academy (2020) Math Competitions II

20 2
CQ = 3 , as 12 AB · CQ = [ABC]. It follows that

AQ2 = AC 2 − CQ2
800
= 121 −
9
289
=
9
17 17/3 17
so AQ = 3 , and cos A = 11 = 33 .
√ √
This yields AH = 2R cos A = 2( 338 2 )( 33
17
), so everything cancels and AH = 17 2
4 . Great!

√ √
17 2

7 2

17 2
This, finally, yields HP = AP = AH = 6 2 −√ 4 = 4 . Now, as
√ HD = 4 also,
we get by the Pythagorean Theorem
√ that P D = 30. Now, as AP = 6 2 we find from the
Pythagorean Theorem that AD = 102, and we are done. 

Remark. The key method to solving this problem was to work backwards: we wanted AD.
We knew by the Pythagorean Theorem that it would be enough to find AP and P D, and
we also knew that to find P D we could find HD and HP — the rest fell out after some
computation.

One last super-cool result.

Theorem 13.22 (Nine-Point Circle). Suppose that ABC is a triangle with orthocenter H,
and that D, E, and F are the feet of the A, B, and C-altitudes. Let M, N, and P be the
midpoints of sides BC, CA, and AB, and let X, Y, and Z be the midpoints of AH, BH,
and CH, respectively. Show that D, E, F, M, N, P, X, Y, and Z all lie on a circle.

Proof. We know that HA , HB , and HC , the reflections of H over BC, CA, and AB, all lie on the
circumcircle of triangle ABC. Moreover, if A0 , B 0 , and C 0 are the reflections of H over M, N,
and P , respectively, then A0 , B 0 , and C 0 lie on the circumcircle of triangle ABC.

13
Everaise Academy (2020) Math Competitions II

Consider a dilation D with center H and scale factor 12 . That dilation maps HA , HB , and
HC to D, E, and F , respectively; it maps A0 , B 0 , and C 0 to M, N, and P , respectively; and
finally, it maps A, B, and C to X, Y, and Z, respectively. Therefore as there exists a circle
passing through A, B, C, A0 , B 0 , C 0 , HA , HB , and HC , there must exist a circle passing through
X, Y, Z, M, N, P, D, E, and F , as desired. 

§13.3 The Incenter and Excenters

Again, we expect familiarity with basic properties of the incenter, but we’ll go over some more
advanced material here.

Theorem 13.23. Let ABC be a triangle. Then the bisectors of ∠A, ∠B, and ∠C concur
at a point I. Furthermore, I is the center of a circle ω that can be inscribed within triangle
ABC, such that BC, CA, and AB are all tangent to ω.

Proof. Suppose that the angle bisectors of ∠B and ∠C meet at I, and suppose that the feet of
the perpendiculars from I to BC, CA, and AB are D, E, and F , respectively.

Then triangles BID and BIF are congruent as ∠DBI = ∠F BI and ∠BDI and ∠BF I are
both right, and they share the side BI. It follows that ID = IF . Similarly, ID = IE, so it
follows that I is the center of a circle ω with radius ID = IE = IF such that ω is inscribed
within triangle ABC.

14
Everaise Academy (2020) Math Competitions II

To show that ∠BAI = ∠CAI, just note that IE = IF and the triangles IF A and IEA share
side IA, so triangles IF A and IEA are congruent by hypotenuse-leg congruence. 

In this configuration, triangle DEF is called the intouch triangle of triangle ABC — that
is, the triangle with vertices at the points where the incircle touches the sides. Those points are
generally called the intouch points.
There are roughly two different tacks we can take at this point: there are length properties we
can analyze in this configuration, and there are angle properties. Let’s begin with the lengths.

Example 13.24. Let ABC be a triangle, and suppose that its incircle ω meets BC, CA,
and AB at points D, E, and F , respectively.
Show that AE = AF = s − a, BF = BD = s − b, and CD = CE = s − c, where a, b, and
c are the lengths of sides BC, CA, and AB, and where s = a+b+c
2 is the semiperimeter.

Solution. The key observation here is that AE and AF are tangent to ω; this means that we
can let AE = AF = x. Similarly, let BF = BD = y, and CD = CE = z.

It follows that the perimeter of triangle ABC is 2(x + y + z), so x + y + z = s. Therefore, as


y + z = a, we have
s − a = (x + y + z) − a
= (x + y + z) − (y + z)
=x
and as AE = AF = x, we’re done. The rest follows by symmetry. 

If ABC is a triangle with incircle ω, and ω meets BC, CA, and AB at D, E, and F , respec-
tively. one strategy we’ll often use is to let AE = AF = x, BF = BD = y, and CD = CE = z,
as in the above proof. This will often help us deal with lengths.

Example 13.25 (1952 Moscow MO). In a convex quadrilateral ABCD, let AB + CD =


BC + AD. Prove that the circle inscribed in ABC is tangent to the circle inscribed in
ACD.

Solution. Suppose that the incircle of triangle ABC is tangent to AC at E. It suffices to show
that the incircle of triangle ADC is also tangent to AC at E.

15
Everaise Academy (2020) Math Competitions II

We have, by the above example, that AE = sABC −BC, where sABC denotes the semiperime-
ter of triangle ABC. Moreover, we have sABC = AB+BC+CA
2 , so AE = AB+CA−BC
2 .
Now we need to show that AE = sACD − DC, as the right-hand-side would be the length
of the tangent from A to the incircle of triangle ACD. We know that sACD = AC+CD+DA
2 , so
AC+DA−CD
sACD − DC = 2 .
Thus we just need to prove that the quantities AB + CA − BC and AC + DA − CD are
equal. But this is equivalent to the given condition, AB + CD = BC + AD; we are done. 

To explore lengths more fully, we’ll introduce another triangle center.

Theorem 13.26. Let ABC be a triangle. Then there exists a circle ΩA tangent to BC,
and the extensions of sides AB and AC beyond B and C, respectively. Its center is called
the A-excenter; the B and C-excenters are defined similarly.

Proof. Suppose that the external bisectors of angles ∠B and ∠C — that is, the bisectors of the
angles supplementary to ∠B and ∠C at those points — meet at IA . We will show that IA is
the A-excenter.

Let P, Q, and R be the feet of the perpendiculars from IA to BC, CA, and AB, respectively,
as shown above. As BIA and CIA are bisectors of angles ∠P BR and ∠P CQ, respectively, it
follows that IA P = IA R and IA P = IA Q, respectively. Thus IA P = IA Q = IA R and therefore

16
Everaise Academy (2020) Math Competitions II

there exists a circle ΩA tangent to the extensions of rays AB and AC, and to side BC; its center
is IA .
Note furthermore that as IA Q = IA R that IA lies on the bisector of angle ∠BAC. 

Example 13.27 (Excircle Lengths). Let ABC be a triangle, and suppose that its incircle
ω meets BC at D and that its A-excircle ΩA meets BC at P . Show that BP = CD and
BD = P C.

Solution. First, a diagram.

We’ve already taken the liberty of adding in the rest of the tangency points; ω meets CA and
AB at E and F , and ΩA meets CA and AB at Q and R.
Since we have tons of tangents, we’ll want a way to make use of them. Note that AR = AQ,
so therefore AB + BP = AC + CP .
That means that AB + BP is half the perimeter of triangle ABC, or that AB + BP = s!
Therefore s − AB = s − c = BP , but we already know that CD = s − c. Therefore BP = CD,
and it clearly follows that BD = P C, too. 

Exercise 13.28 (Top Points). Let ABC be a triangle, and suppose that its incircle ω meets
BC at D and that its A-excircle ΩA is tangent to BC at P . Let X be diametrically opposite
D on ω. Show that A, X, and P are collinear.
Hint: Consider the dilation centered at A mapping ω to ΩA ! Can you prove that points X and P correspond?

Now we’ll pivot to angles. You should draw your own diagrams for the next two examples,
which are very short.

Example 13.29. Let A, B, and C be three points on a circle. Then the angle bisector of
∠BAC passes through the midpoint of arc BC
d not containing A.

17
Everaise Academy (2020) Math Competitions II

Solution. This isn’t a hard result, but it’s important to show: suppose that the angle bisector
of ∠BAC meets the circle again at MA . Then ∠MA AB = ∠MA AC, so it follows that M \ AB =
M
\ A C, and M A is indeed the midpoint of arc BC
d not containing A. 

Example 13.30 (Angles About the Incenter). Show that if ABC is a triangle with incenter
I, then ∠BIC = 90◦ + 21 ∠A.

Solution. Note that

∠BIC = 180◦ − ∠IBC − ∠ICB


1 1
= 180◦ − ∠B − ∠C
2 2
◦ 1
= 90 + ∠A
2
where the last equality follows from the fact that 1
2 (∠A + ∠B + ∠C) = 90◦ . Make sure you
understand why this is the case! 

These two results set us up perfectly for our next result, which is very important.

Proposition 13.31 (The Incenter-Excenter Lemma). Let ABC be a triangle with incenter
I, A-excenter IA , and circumcircle Γ, and suppose that MA is the midpoint of arc BC
d not
containing A on Γ. Then IBIA C is cyclic, and the center of its circumcircle is MA . In
particular, MA B = MA C = MA I = MA IA .

Proof. Again, we’ll start by drawing a diagram.

The first thing to note is that as MA is the midpoint of arc BC


d not containing A, the A-angle
bisector passes through MA , and it also passes through I and IA so those three points are
collinear.
Next, we will show that MA is the circumcenter of triangle BIC, by showing that MA B =
MA I; then it will follow that MA B = MA I = MA C.

18
Everaise Academy (2020) Math Competitions II

Note that if we want to show that MA B = MA I, we can instead show that ∠MA IB =
∠MA BI. We have ∠MA IB = 180◦ − ∠AIB, but ∠AIB = 90◦ + 21 ∠C by the above example.
Therefore
1
∠MA IB = 180◦ − (90◦ + ∠C)
2
1
= 90◦ − ∠C
2
1 1
= ∠A + ∠B
2 2
= ∠CAMA + ∠IBC
= ∠CBMA + ∠IBC
= ∠IBMA

as desired. Note that we used the fact that ∠CBMA = ∠CAMA = 12 ∠A.
Great — all that’s left to show is that IA lies on the circumcircle of BIC. Observe that
∠CBIA = 21 (180◦ − ∠B), so ∠IBIA = ∠IBC + ∠CBIA = 21 ∠B + 90◦ − 12 ∠B = 90◦ . Similarly,
∠ICIA = 90◦ , so therefore IBIA C is cyclic with diameter IIA and center MA , as desired. 

Example 13.32 (Adapted from 2016 AIME I). In 4ABC let I be the center of the inscribed
circle, and let the bisector of ∠ACB intersect AB at L. The line through C and L intersects
the circumscribed circle of 4ABC at the two points C and D.
1. Show that DL · DC = DA2 = DB 2 .
p
2. If LI = 2 and LD = 3, then IC = q, where p and q are relatively prime positive
integers. Find p + q.

Solution. Let’s begin by drawing a diagram. Observe that D is the midpoint of arc BA
d not
containing C, so DA = DB.

19
Everaise Academy (2020) Math Competitions II

To prove that DL · DC = DA2 , we’d love to be able to use Power of a Point, but it’s unclear
as to how to do so since D lies on the boundary of the circle. Therefore we’ll do the next best
thing: we’ll try and use similar triangles to get a helpful ratio.
DL DA
Observe that we just want to show that DA = DC , which is equivalent to demonstrating that
triangles DAL and DCA are similar. But they share ∠ADL, and furthermore, ∠DAL = ∠DCA
as they cut off arcs BD
d and DA,
d which are equal. We are done with part 1.
As for the second part: since we have an arc midpoint, we’ll use the Incenter-Excenter Lemma.
Observe that DA = DI = DB, and by the first part of the problem we have DA2 = DL · DC.
Therefore DI 2 = DL · DC.
25 25
But we already have DL = 3 and DI = DL + LI = 5, so DC = 3 . Therefore IC = 3 −5 =
10
3 ,and our answer is 13. 

Example 13.33 (2013 HMMT). Let ABC be a triangle with incenter I satisfying 2BC =
AB +AC. Let D be the midpoint of arc BC
d not containing A. Show that I is the midpoint
of AD.

Solution. We have a cyclic quadrilateral with diagonals drawn in, and we’re trying to prove
something length-related. This problem is screaming Ptolemy.

By Ptolemy’s Theorem, we have DB · AC + DC · AB = DA · BC. The let-hand side becomes


DB · (AC + AB), as DB = DC. But AB + AC = 2BC, so it further reduces to 2DB · BC.
Therefore DA = 2DB. But DB = DI by the Incenter-Excenter Lemma, so we are done. 

20
Everaise Academy (2020) Math Competitions II

Exercise 13.34 (Andrew Wu). Let ABC be a triangle with incenter I, circumcircle Ω, and
incircle ω. Let MB and MC be the midpoints of arcs AC
d and BA d on Ω not containing B and
1
C, respectively. Suppose that MB I : IB = 1 and MC I : IC = 2 , and that BC = 20.
1. We see a bunch of lengths and ratios, so we should be thinking either Power of a Point or
Ptolemy’s Theorem — and in this case, both. Let MC I = x. Use Power of a Point and
the Incenter-Excenter Lemma to find the lengths of CI, BI, IMB , MC B, MC A, MB A, and
MB C in terms of x.
2. Look out for special triangles! Make sure to check a few of the triangles in your diagram
and see if their lengths indicate any interesting properties.
3. Since you know AMC , MC B, BI, IMB , and MB A, this seems like a perfect target for
Ptolemy’s Theorem — use it on quadrilateral AMC BMB . Do the same for AMB CMC .
Does this give you anything about AB
AC ?
4. Find the area of triangle ABC.

§13.4 Homework Problems

We’ve thrown an incredibly large amount of material at you today. Please feel free to ask for
help on any of the problems — we would actually encourage you to do so.
The things we’ve covered today are mostly about individual triangle centers. In the problem
set, we’ll have quite a few problems that ask you to relate them. Don’t be afraid to skip around
the problem set today — there’s a lot of material which is somewhat disjoint. Additionally, a
few important things to remember before starting: orthocenter reflections are always helpful
when orthocenters are involved, the Incenter-Excenter Lemma is a godsend, and dilations are
a very powerful tool.

Problem 13.1. [3] Let ABC be a triangle with incenter I, orthocenter H, and circumcenter
O. Suppose that ∠A = 52◦ .
1. [1] Find ∠BOC.
2. [1] Find ∠BHC.
3. [1] Find ∠BIC.

Problem 13.2. [4] Let ABC be a triangle with ∠A = 60◦ and let O, I, and H be its circum-
center, incenter, and orthocenter, respectively. Show that ∠BOC = ∠BIC = ∠BHC, and
conclude that B, C, O, I, and H are concyclic.

Problem 13.3 (Combinations of Centers). [15] It is not necessary to do all — or even any! —
of these problems, but they’re all very nice results concerning one or more triangle centers.
1. [5] Let ABC be a triangle with orthocenter H, and let D, E, and F be the feet of the
A, B, and C-altitudes, respectively, and let HA , HB , and HC be the reflections of H over
BC, CA, and AB, respectively. Show that H is the incenter of both triangle DEF and
triangle HA HB HC .
2. [4] Let ABC be a triangle with incenter I, and let MA , MB , and MC be the midpoints
of arcs BC,
d CA,
d and AB d not containing A, B, and C, respectively. Show that I is the
orthocenter of triangle MA MB MC . Hint: Use the Incenter-Excenter Lemma!

21
Everaise Academy (2020) Math Competitions II

3. [6] Let ABC be a triangle with centroid G, circumcenter O, and orthocenter H. Prove
that H, G, and O are collinear, and GO : GH = 1 : 2. Hint: Consider the dilation D centered
at G with scale factor −2 mapping the medial triangle to triangle ABC. What’s the image of O under
this dilation? It might help to look back at how we proved that the orthocenter exists.

Problem 13.4 (2013 AMC 10B). [4] In 4ABC, medians AD and CE intersect at P , P E = 1.5,
P D = 2, and DE = 2.5. What is the area of AEDC, rounded to the nearest integer?

Problem 13.5 (Art of Problem Solving Forums). [5] Fix a circle Ω and a point H inside the
circle. Prove that there exist infinitely many triangles ABC with circumcircle Ω and orthocenter
H. Hint: Try to make a single one first! Remember orthocenter reflections — they’ll come in handy not only
here, but also throughout the rest of the problem set.

Problem 13.6 (2015 HMMT). [6] Let ABC be a triangle with orthocenter H; suppose AB =
13, BC = 14, CA = 15. Let GA be the centroid of triangle HBC, and define GB , GC similarly.
If the area of triangle GA GB GC can be expressed as ab for relatively prime positive integers a
and b, then find a + b.

Problem 13.7 (2012 CGMO). [6] The incircle of ABC is tangent to sides AB and AC at D
and E respectively, and O is the circumcenter of BCI. Prove that ∠ODB = ∠OEC.

Problem 13.8 (2001 AIME I). [6] Triangle ABC has AB = 21, AC = 22, and BC = 20.
Points D and E are located on AB and AC, respectively, such that DE is parallel to BC and
contains the center of the inscribed circle of triangle ABC. Then DE = m/n, where m and n
are relatively prime positive integers. Find m + n.

Problem 13.9 (Andrew Wu). [7] Triangle M OH is equilateral with side length 6. Let triangle
ABC be such that O and H are its circumcenter and √
orthocenter, and M is the midpoint of
side BC. If the area of 4ABC can be expressed as a b for positive integers a and b with b
squarefree, then find a + b.

Problem 13.10 (PUMaC 2017). [7] Rectangle HOM F has HO = 11 and OM = 5. Triangle
ABC has orthocenter H and circumcenter O. M is the midpoint of BC and altitude AF meets
BC at F . Find the length of BC.

Problem 13.11 (2012 NIMO). [8] In cyclic quadrilateral ABXC, ]XAB = ]XAC. Denote
by I the incenter of 4ABC and by D the projection of I on BC. If AI = 25, ID = 7, and
BC = 14, then XI can be expressed as ab for relatively prime positive integers a, b. Compute
100a+b. Hint: Let E be the foot of the perpendicular from I to AC. Find AE, and knowing that AE = s−a,
find b + c, where a, b, and c are the lengths of sides BC, CA, and AB, respectively. Keep Ptolemy’s Theorem in
mind!

Problem 13.12 (2007 APMO). [8] Let ABC be an acute angled triangle with ∠BAC = 60◦
and AB > AC. Let I be the incenter, and H the orthocenter of the triangle ABC. Prove that
2∠AHI = 3∠ABC.

Problem 13.13 (2012 AIME I). [10] Complex numbers a, b and c are the zeros of a polynomial
P (z) = z 3 + qz + r, and |a|2 + |b|2 + |c|2 = 250. The points corresponding to a, b, and c in the
complex plane are the vertices of a right triangle with hypotenuse h. Find h2 . Hint: Check out
Exercise 13.6!

22
Everaise Academy (2020) Math Competitions II

Problem 13.14 (2018 AIME II). [10] Octagon ABCDEF GH with side lengths AB = CD =
EF = GH = 10 and BC = DE = F G = HA = 11 is formed by removing four 6 − 8 − 10
triangles from the corners of a 23 × 27 rectangle with side AH on a short side of the rectangle,
as shown. Let J be the midpoint of HA, and partition the octagon into 7 triangles by drawing
segments JB, JC, JD, JE, JF , and JG. Find the area of the convex polygon whose vertices
are the centroids of these 7 triangles.

Problem 13.15 (2002 AIME I). [12] In triangle ABC the medians AD and CE have lengths
18 and 27, respectively, and AB = 24. Extend CE to intersect the circumcircle of ABC at F .

The area of triangle AF B is m n, where m and n are positive integers and n is not divisible
by the square of any prime. Find m + n.

23
14 Trigonometry

Trigonometry is an invaluable tool for AIME-level geometry and beyond. In this handout
we’ll first examine trigonometry problems by themselves, and then see how trigonometry can
be applied to solve geometry problems.

§14.1 Trigonometric Identities

Identities can be very helpful for solving all sorts of geometry problems. Let’s go over the
most common trig identities.

(i) Pythagorean Identities:


sin2 (x) + cos2 (x) = 1
tan2 (x) + 1 = sec2 (x)
cot2 (x) + 1 = csc2 (x)
These are the simplest identities, mostly because they can be derived through right-
triangle relationships. Try deriving them yourself!
(ii) Complementary and Supplementary Identities:

sin(x) = cos(90◦ − x), cos(x) = sin(90◦ − x)


sin(x) = sin(180◦ − x), cos(x) = − cos(180◦ − x)

These identities follow through a basic examination of the unit circle, or from the angle
addition and subtraction identities.
(iii) Double Angle Identities:
sin(2x) = 2 sin(x) cos(x)
cos(2x) = cos2 (x) − sin2 (x) = 2 cos2 (x) − 1 = 1 − 2 sin2 (x)
2 tan(x)
tan(2x) =
1 − tan2 (x)
These are helpful when you are presented with an angle bisector or any other form of
congruent angles.
(iv) Angle Addition Identities:

sin(x + y) = sin(x) cos(y) + sin(y) cos(x)

cos(x + y) = cos(x) cos(y) − sin(x) sin(y)


tan(x) + tan(y)
tan(x + y) =
1 − tan(x) tan(y)
These can be of great use with situations when you have a cevian. Note too that subtrac-
tion identities can be easily derived from these, and that the double-angle identities are a
special case of these identities.

1
Everaise Academy (2020) Math Competitions II

(v) Sum-to-Product Identities:


   
x+y x−y
sin(x) + sin(y) = 2 sin cos
2 2
   
x+y x−y
cos(x) + cos(y) = 2 cos cos
2 2
Applications of these are less common than the above identities, but when they are used,
they can be extremely useful. Difference-to-Product identities can be determined based
off the above as well the Product-to-Sum identities.

Exercise 14.1. Simplify sin(x + 90◦ ) and tan(x + 180◦ ).

Exercise 14.2. Prove the Sum-to-Product identities using the angle addition identities.

Exercise 14.3. There is a subclass of identities referred to as half angle identities, but they
can be easily derived from the double angle identities. Determine expressions for sin( x2 ), cos( x2 ),
and tan( x2 ).

Now that that is out of the way, let’s try these on some examples.

Example 14.4 (2006 AIME I). Find the sum of the values of x such that cos3 3x + cos3 5x =
8 cos3 4x cos3 x, where x is measured in degrees and 100 < x < 200.

Solution. The right hand side of this equation looks like a perfect cube, so let’s try to look
specifically at that. Knowing this, we see that
cos3 (3x) + cos3 (5x) = (2 cos(4x) cos(x))3 .

The expression 2 cos(4x) cos(x) looks awfully similar to the right hand side of the Sum-to-
Product identities, so let’s try converting this product to a sum. That yields
2 cos(4x) cos(x) = cos(3x) + cos(5x).

Substituting this into the original equation, we get that


cos3 (3x) + cos3 (5x) = (cos(3x) + cos(5x))3 .
Making the substitutions cos(3x) = a and cos(5x) = b, we get that a3 + b3 = (a + b)3 , or
ab(a + b) = 0. Reversing the substitutions, we get that
cos(3x) cos(5x)(cos(3x) + cos(5x)) = 0 =⇒ 2 cos(x) cos(3x) cos(4x) cos(5x) = 0.

Therefore, we need cos(x) = 0, cos(3x) = 0, cos(4x) = 0, or cos(5x) = 0. By finding zeroes for


each equation in the range 100 < x < 200, we get six solutions: x = {112.5, 126, 150, 157.5, 162, 198}.
These solutions sum to 906. 

Example 14.5. For π ≤ θ < 2π, let

1 1 1 1 1 1 1
P = cos θ − sin 2θ − cos 3θ + sin 4θ + cos 5θ − sin 6θ − cos 7θ + · · ·
2 4 8 16 32 64 128
and

2
Everaise Academy (2020) Math Competitions II

1 1 1 1 1 1 1
Q=1− sin θ − cos 2θ + sin 3θ + cos 4θ − sin 5θ − cos 6θ + sin 7θ + · · ·
2 4 8 16 32 64 128

P 2 2
so that Q = 7 . Then sin θ = − m
n where m and n are relatively prime positive integers.
Find m + n.

Solution. Both P and Q have a combination of sines and cosines, leading us to believe that
there must be some involvement with the angle addition formula. Let’s try multiplying P by
sin θ:
1 1 1 1 1
P sin θ = sin θ cos θ − sin θ sin 2θ − sin θ cos 3θ + sin θ sin 4θ + sin θ cos 5θ + · · ·
2 4 8 16 32
If we multiply Q by cos θ:
1 1 1 1 1
Q cos θ = cos θ − sin θ cos θ − cos θ cos 2θ + sin 3θ cos θ + cos θ cos 4θ − sin 5θ cos θ +· · ·
2 4 8 16 32
and add P sin θ to that, several terms cancel out and several others can combine:
1 1
P sin θ + Q cos θ = cos θ + (sin θ cos θ − sin θ cos θ) − (sin θ sin 2θ + cos θ cos 2θ) + · · ·
2 4
If we continually combine terms via the angle addition/subtraction formulas, we get that
1 1 1 1
P sin θ + Q cos θ = cos θ − cos θ + sin 2θ + cos 3θ − sin 4θ + · · ·
4 8 16 32
Look back at the value of P . We can make a clever substitution:
P
P sin θ + Q cos θ = cos θ − .
2
At this point, we can hypothesize that we can get another unique equation by multiplying P
by cos θ, multiplying Q by sin θ, and then adding the two together. Sure enough, we get that
1 1 1 1
P cos θ + Q sin θ = sin θ + cos 2θ − sin 3θ − cos 4θ + sin 5θ + · · ·
2 4 8 16
(Verify the above equation.) Using another substitution, we get that

P cos θ + Q sin θ = −2(Q − 1).

From the first substitution, we get that


P
P sin θ + + Q cos θ = cos θ =⇒ P (2 sin θ + 1) + 2Q cos θ = 2 cos θ.
2
From the second substitution, we get that

P cos θ + Q sin θ + 2Q − 2 = 0 =⇒ P cos2 θ + Q cos θ(sin θ + 2) = 2 cos θ.

By subtracting the second result from the first, we get that

P (2 sin θ + 1) + 2Q cos θ = P cos2 θ + Q cos θ(sin θ + 2).

When we rearrange this, we get that



P cos θ 2 2
= = .
Q sin θ + 2 7

3
Everaise Academy (2020) Math Competitions II

We are so close! By squaring both sides of the equation, we get


cos2 θ 8 1 − sin2 θ 8
2 = =⇒ 2 = =⇒ 57 sin2 θ + 32 sin θ − 17 = 0.
sin θ + 4 sin θ + 4 49 sin θ + 4 sin θ + 4 49
17
Solving this, we get that sin θ = − 19 (since we discard the positive root.) The final answer is
then 17 + 19 = 36. 

That was a lot! There are simpler ways to do this problem (which the exercise below asks for)
but this solution helps highlight multiple identities at a time and demonstrate their usefulness
given the circumstances.

Exercise 14.6. Find a solution to Example 14.5 that uses the Sum-to-Product formulas.

Exercise 14.7 (2019 ARML). In parallelogram ARM L, points P and Q are the midpoints
of sides RM and AL, respectively. Point X lies on segment P Q, and P X = 3, RX = 4, and
P R = 5. Point I lies on segment RX such that IA = IL. Compute the maximum possible
[P QR]
value of .
[LIP ]

§14.2 Trigonometry in Triangles

You likely know how to use trigonometry in right triangles (via SOH-CAH-TOA), but it is also
applicable to any regular triangle.

Theorem 14.8 (Law of Cosines). In 4ABC with lengths a, b, and c opposite their corre-
sponding angle and ∠BAC = θ,

a2 = b2 + c2 − 2bc cos θ

The left hand side and part of the right hand side look identical to the Pythagorean theorem.
This formula should make some sense given that if ∠BAC = 90◦ , the term with the cosine
turns to zero. This equation is one of the most useful tools you have when solving a geometry
problem. When you have two known sides of a triangle, this equation is useful.

Example 14.9 (2012 AIME I). Let 4ABC be a right triangle with right angle at C. Let D
and E be points on AB with D between √A and E such that CD and CE trisect ∠C. If
DE 8 m p
BE = 15 , then tan B can be written as n , where m and n are relatively prime positive
integers, and p is a positive integer not divisible by the square of any prime. Find m+n+p.

Solution. Let CB = x. Also, let DE = 8k and BE = 15k. Because of the Angle Bisector
Theorem, we can apply the following proportion to 4CDB:
x CD 8x
= =⇒ CD =
15 8 15
Let us now use Law of Cosines on 4DCB.
(DB)2 = (CD)2 + (CB)2 − 2(CD)(CB) cos(∠DCB)
64x2 8x
= + x2 − 2 · · x · cos(60)
225 15
169x2 13x
= =⇒ DB = .
225 15

4
Everaise Academy (2020) Math Competitions II

Now it might be helpful to gain some information on angle B. Let’s use Law of Cosines again,
but on ∠B:
(CD)2 = (CB)2 + (DB)2 − 2(CB)(DB) · cos(B)
so
64x2 169x2 13x
= x2 + −2·x· · cos(B)
225 225 15
and thus
11
cos(B) =.
13
Since we know the cosine of ∠B, we should figure out the sine, too:
r √
p 121 4 3
sin(B) = 1 − cos2 (B) =⇒ sin(B) = 1 − =⇒ sin(B) =
169 13
Since we know the sine and cosine, the tangent should be obvious:

4 3 √
13 = 4 3
11 11
13
and we are done. 

Example 14.10 (Adapted from 2013 AIME II). Let A, B, C be angles of an obtuse triangle
with ∠B > 90◦ with
15
cos2 A + cos2 B + 2 sin A sin B cos C = and
8
14
cos2 B + cos2 C + 2 sin B sin C cos A = .
9
There are positive integers p, q, r, and s for which

p−q r
cos2 C + cos2 A + 2 sin C sin A cos B = ,
s
where p + q and s are relatively prime and r is not divisible by the square of any prime.
Find p + q + r + s.

Solution. Let x = cos2 C +cos2 A+2 sin C sin A cos B. Interestingly, the given equations faintly
resemble the Law of Cosines. Let’s try to change cos2 (θ) into 1 − sin2 (θ) for all three statements
in order to maintain consistency:
15
(1 − sin2 (A)) + (1 − sin2 (B)) + 2 sin A sin B cos C =
8
14
(1 − sin2 (B)) + (1 − sin2 (C)) + 2 sin B sin C cos A =
9
(1 − sin2 (C)) + (1 − sin2 (A)) + 2 sin C sin A cos B = x.

After simplifying, we have


15
2 − (sin2 (A) + sin2 (B) − 2 sin A sin B cos C) =
8
2 2 14
2 − (sin (B) + sin (C) − 2 sin B sin C cos A) =
9
2 2
2 − (sin (C) + sin (A) − 2 sin C sin A cos B) = x.

5
Everaise Academy (2020) Math Competitions II

Now we should try something creative. Imagine a triangle with side lengths sin(A), sin(B),
and sin(C) with opposite angles A, B, and C respectively. The bottom three expressions have
instances of the Law of Cosines for this imaginary triangle. Let’s simplify them now:
15
2 − sin2 (C) =
8
14
2 − sin2 (A) =
9
2 − sin2 (B) = x.

Note that the last statement can be manipulated as follows:

2 − sin2 (B) = 2 − sin2 (A + C) = 2 − (sin A cos C + sin C cos A)2 .

At this point, it is just computation since we


√ know all the quantities. The rest is left as an
111 − 4 35
exercise to the reader. The answer is , or 222. 
72

Theorem 14.11 (Law of Sines). In any triangle ABC,

a b c
= = = 2R
sin A sin B sin C
where R is the radius of the circumcircle of the triangle.

Example 14.12. Triangle ABC has sides AB, BC, and CA of length 43, 13, and 48,
respectively. Let ω be the circle circumscribed around 4ABC and let D be the intersection
of ω and the perpendicular bisector of AC that is not on the same side of AC as B. The

length of AD can be expressed as m n, where m and n are positive integers and n is
not divisible by the square of any prime. Find the greatest integer less than or equal to

m + n.

Solution. Let M be the midpoint of AC, let O be the center of ω, and let F be the intersection
of ray M O with ω. Note that OD passes through M and that F D is a diameter. Let’s use
Power of a Point with two segments that intersect at M : we have

(AM )(CM ) = (DM )(F M )

which yields
24 · 24 = (DM )(2R − (DM ))
and thus
(DM )2 − 2R(DM ) + 576 = 0.

We also see by Pythagorean Theorem on 4AM D,

576 + (DM )2 = (AD)2 .

Now we have to somehow find R. We can try using the Law of Cosines on angle BAC:

132 = 432 + 482 − 2 · 43 · 48 · cos(BAC)

6
Everaise Academy (2020) Math Competitions II

which yields
83
cos(BAC) = .
86
Now we can use the Law of Sines:
BC 13 86
2R = =s =√
sin(BAC) 
83 2
 3
1−
86

43 3
This means that R = . Now we can substitute into the quadratic for DM and use the
3 √
quadratic formula to find that DM = √ 18 3. We can substitute this into the Pythagorean
theorem expression to find that AD = 6 43, giving us a final answer of 12. 

Exercise 14.13 (2012 AIME I). Let 4ABC be a right triangle with right angle at C. Let D
and E be points on AB with D between A and E such that CD and CE trisect ∠C. If DE 8
BE = 15 ,

m p
then tan B can be written as n , where m and n are relatively prime positive integers, and p
is a positive integer not divisible by the square of any prime. Find m + n + p.

Exercise 14.14 (2019 AIME II). Triangle ABC has side lengths AB = 7, BC = 8, and CA = 9.
Circle ω1 passes through B and is tangent to line AC at A. Circle ω2 passes through C and is
tangent to line AB at A. Let K be the intersection of circles ω1 and ω2 not equal to A. Then
AK = m n , where m and n are relatively prime positive integers. Find m + n.

§14.3 Trigonometry Bashing

Trig bashing is using primarily trigonometry to solve geometry problems, similar to the examples
in the previous section, but in more diverse ways. When trig bashing, always be looking for ways
to apply Law of Sines, Law of Cosines, and trigonometric identities to help solve the problem.
One thing that is absolutely crucial to understand is that you can rarely solve problems
with purely trigonometry alone. You almost always have to make synthetic observations
(usually with the conditions given in the problem) to set up the bash that will extract the
answer (this extends to other types of bash as well).
With that in mind, let’s look at several ways of using trig to solve problems!

Example 14.15 (2016 CMIMC). Suppose ABCD is a convex quadrilateral satisfying AB =


BC, AC = BD, ∠ABD = 80◦ , and ∠CBD = 20◦ . What is ∠BCD in degrees?

Solution. Whenever you’re presented with questions that primarily give angle conditions, you
should always have Law of Sines on your mind (Law of Cosines doesn’t work as well since it
relies on complicated length relations). Also, keep an eye out for any nice angles you can chase,
namely, the multiples of 30◦ .
First, let’s have AC and BD intersect at E. From AB = BC, we know that ABC is isosceles.
Combining this with ∠ABC = ∠ABD + ∠CBD = 100◦ , ∠BAC = ∠BCA = 40◦ . What other
angles can we find? Since we know the angles that BD splits ∠ABC into, we easily find that
∠BEA = 60◦ and ∠BEC = 120◦ ! This is an indication that we want to somehow use these
angles in particular.

7
Everaise Academy (2020) Math Competitions II

Since we want ∠BCD let ∠BCD = θ. If we’re going to use Law of Sines, we should use a
triangle that has an angle equal to some expression of θ, as well as side lengths that we know
have nice relations to other lengths. This is why 4BCD is a good candidate: after all, it has
∠BCD and we are given length conditions that involve BC and BD. Using Law of Sines,
BD sin(∠BCD) sin θ
= =
BC sin(∠BDC) sin(160◦ − θ)
From BD = AC, and the fact that AC = 2BC cos 40◦ (which you can see by just dropping an
altitude from B to AC),
sin θ BD AC 2 cos 40◦ BC
= = = = 2 cos 40◦
sin(160◦ − θ) BC BC BC
It suffices to solve this trigonometric equation. What we could do is cross multiply and apply
product-sum formulas, but that would just leave us with three trigonometric expressions, when
we just want two. We need to somehow convert the 2 cos 40◦ into a fraction of two trigono-
metric values so that we can solve for θ by inspection of angles. This motivates the following
transformation:
sin θ ◦ cos 40◦ cos 40◦
= 2 cos 40 = =
sin(160◦ − θ) 1
2
sin 30◦
Remember this trick! It can be extremely useful when you’re stuck with a random coefficient.
Changing the cosine to sin 50◦ , we can see from inspection that θ = 130◦ . This of course isn’t
the most rigorous way, but there are only two cases to check: when θ = 50◦ or 130◦ , which
comes from the fact that sin θ = sin(180◦ − θ). 

Now let’s look at an application of Law of Cosines, and the idea of looking at the cosine of
an angle two different ways.

Example 14.16 (Golden Gate Math Tournament). 4ABC satisfies AB = 5 and AC = 7.


The incircle of 4ABC is tangent to AB at F . Given that the reflection of F over BC lies
on the circumcircle of 4ABC, find the square of the area of 4ABC.

Solution. Let the reflection of F over BC be F 0 : since reflections preserve angles, we know
that
∠BF C = ∠BF 0 C = 180◦ − ∠BAC
so ∠CF A = 180◦ − ∠BF C = ∠BAC, meaning 4ACF is isosceles with AC = CF = 7.
Since F is an intouch point, we can use the properties derived yesterday to express AF in
terms of the sides of ABC. Let BC = 2a, which makes the semiperimeter s = 5+7+2a2 = 6 + a.
We chose to use 2a instead of a so that the expression for s is nice. We now have that AF =
s − BC = 6 + a − 2a = 6 − a.
At this point, you should be able to see that all we need is a, since we can simply use Heron’s
formula to finish. What relations do we know that have a in them? Well, from Law of Cosines
we have that
52 + 72 − 2(5)(7) cos A = (2a)2 .
This introduces a new variable, cos A, so we just need one more equation that relates cos A and
a: this is where our isosceles triangle 4ACF comes into play. Dropping an altitude from C to
AF and using the definition of cosine, we have the relation
1
2 AF 6−a 6−a
cos A = = = .
AC 2(7) 14

8
Everaise Academy (2020) Math Competitions II

Subbing that into our Law of Cosines equation and working through calculations, we are left
with 4a2 − 5a − 44 = 0, giving the solutions a = 4, − 11 4 , of which only
√ the former makes
sense.
√ 2Thus, BC = 2a = 8, and Heron’s formula gives the area to be 10 3, making the answer
10 3 = 300. 

Not only does trig bashing work extremely well in triangles, but cyclic quadrilaterals lend
themselves nicely to trig too. This should make sense, since we have a ton of nice angle properties
and length relations to work with in cyclic quads.
Let’s look at a basic example:

Example 14.17. In cyclic quadrilateral ABCD, AB = 2, BC = 3, CD = 4, DA = 5. Find


the lengths of AC.

Solution. Note that AC is common between 4ABC and 4ADC. Moreover, ∠ABC = 180◦ −
∠ADC, so we actually have cos(∠ABC) = − cos(∠ADC)! This relation is extremely important,
always keep it in mind when trig bashing with cyclic quadrilaterals! Given the common length
and the nice cosine relation, we can use Law of Cosines on both triangles:

22 + 32 − 2(2)(3) cos(∠ABC) = AC 2 = 42 + 52 − 2(4)(5) cos(∠ADC)

=⇒ 22 + 32 − 2(2)(3) cos(∠ABC) = 42 + 52 + 2(4)(5) cos(∠ABC)


7
which is a linear equation for cos(∠ABC). Solving this gives cos(∠ABC) = − 13 , and plugging
q
2 2 253 253
this into our Law of Cosines equation for AC gives AC = 13 , or AC = 13 . 

This means that once we have the sidelengths of a cyclic quadrilaterals, we can find the diagonals
for free with a more or less 2 minute computation, which can be extremely useful, especially
when paired with Ptolemy’s theorem.
We’ll finish with a more involved example. This example should give you an idea of how
flexible trigonometry is, and it just takes experience to know how to do it well.

Example 14.18 (2020 USMCA Challenger, Modified). Let Γ be a circle centered at O with
chord AB. The tangents to Γ at A and B meet at C. A secant from C intersects chord AB
at D and Γ at E such that D lies on segment CE. Given that ∠BOD + ∠EAD = 180◦ ,
AE = 1, and BE = 2, find AB.

Solution. First, we need to deal with that weird angle condition (always best to try to un-
derstand conditions before attacking a problem). For simplicity of notation, let ∠AEB = E,
∠EAB = A, ∠EBA = B. We know that ∠AOB = 2E =⇒ ∠OBA = ∠OBD = 90◦ − E.
Also, ∠BOD = 180◦ − A = B + E, so ∠ODB = 90◦ − B. Now we have all the angles for
4BOD. At this point, it seems that there are no more meaningful angles that are findable, so
moving onto lengths seems like a good step.
Since we have angles, we can use Law of Sines to get some length ratios. Which lengths do
we want in 4BOD? We probably don’t want OD since it seems to be floating with no purpose.
Moreover, OB is just the circumradius (let this be denoted as R) and BD lies on AB, so finding
BD
OB seems like a good idea:
BD sin(B + E) sin A
=
OB sin(90◦ − B) cos B

9
Everaise Academy (2020) Math Competitions II

R sin A
=⇒ BD =
cos B

where we use the fact that sin(B + E) = sin(180 − A) = sin A. From extended Law of Sines,
BE = 2R sin A = 2, so R sin A = 1. Plugging this into our ratio, BD = cos1 B .
EA 2
Here, we’ll cite a well known fact that EC splits AB into ratio EB 2 : you are not expected
AD
to know this as the handouts have not covered it. This means that DB = 14 , and combining
this with BD = cos1 B gives AB = 4 cos 5
B . How can we solve for cos B? Well, the fact that it is
cosine should give us the hint that Law of Cosines is the way to go. In fact, this gives a magical
cancellation:
 2  
2 2 2 5 5
EB + AB − 2(EB)(AB) cos B = EA ⇐⇒ 4 + − 2(2) =1
4 cos B 4 cos B
 2 √
5 5 2
⇐⇒ = 2 =⇒ cos B =
4 cos B 8
where we take the positive value√of cos B because B must be acute (or else D wouldn’t lie
between C and E.) Thus, AB = 2, which is our answer. 

Exercise 14.19. In triangle ABC, let M be the midpoint of BC and let D be the intersection
AB 2
of the reflection of AM over the angle bisector of ∠BAC and BC. Prove that BD
DC = AC 2 .

Hint: Use the fact that reflected angles remain unchanged and take advantage of the fact that we have a median
using Law of Sines.

Remark. This exercise actually proves the well known length ratio cited in the previous
example. The reflection of the median over the corresponding angle bisector is known as
the symmedian, and in the configuration presented in the problem, it is well known that
CE is actually the E−symmedian of 4EAB: proving this, however, is another story. For
those of you that want a challenge, use this knowledge to solve the original version of the
example, which asks for the length of CE.

§14.4 Homework Problems

Problem 14.1 (2001 AIME I). [2] In triangle ABC, angles A and B measure 60 degrees and
45 degrees, respectively. The bisector of angle A intersects BC at T , and AT = 24. The area of

triangle ABC can be written in the form a + b c, where a, b, and c are positive integers, and
c is not divisible by the square of any prime. Find a + b + c.

Problem 14.2 (Art of Problem Solving Forums). [3] In triangle ABC, cevian BD is drawn.
If ∠A = 30◦ , ∠C = 12◦ , ∠ABD = 132◦ , ∠CBD = 6◦ , and BC = 4, what is the length of AD?

Problem 14.3 (2016 ARML). [5] Square ARM L has sides of length 11. Collinear points X, Y ,
and Z are in the interior of ARM L such that√4LXY and 4RXZ are equilateral. Given that
Y Z = 2, [RLX] can be written in the form a c b . Find a + b + c.

Problem 14.4 (2014 AIME II). [6] Suppose that the angles of 4ABC satisfy cos(3A) +
cos(3B) + cos(3C) = 1. Two sides of the triangle have lengths 10 and 13. There is a positive

integer m so that the maximum possible length for the remaining side of 4ABC is m. Find
m.

10
Everaise Academy (2020) Math Competitions II

Problem 14.5 (2005 AIME II). [5] In triangle ABC, AB = 13, BC = 15, and CA = 14. Point
D is on BC with CD = 6. Point E is on BC such that ∠BAE ∼ = ∠CAD. Given that BE = pq
where p and q are relatively prime positive integers, find q.

Problem 14.6 (2010 AIME II). [8] Triangle ABC with right angle at C, ∠BAC < 45◦ and
AP
AB = 4. Point P on AB is chosen such that ∠AP C = 2∠ACP and CP = 1. The ratio BP can

be represented in the form p + q r, where p, q, r are positive integers and r is not divisible by
the square of any prime. Find p + q + r.

Problem 14.7 (2020 AOIME). [8] Convex pentagon ABCDE has side lengths AB = 5, BC =
CD = DE = 6, and EA = 7. Moreover, the pentagon has an inscribed circle (a circle tangent
to each side of the pentagon). Find the area of ABCDE.

Problem 14.8 (2020 AIME I). [9] Point D lies on side BC of 4ABC so that AD bisects
∠BAC. The perpendicular bisector of AD intersects the bisectors of ∠ABC and ∠ACB in
points E and F , respectively.
√ Given that AB = 4, BC = 5, and CA = 6, the area of 4AEF
m n
can be written as p , where m and p are relatively prime positive integers, and n is a positive
integer not divisible by the square of any prime. Find m + n + p.

Problem 14.9 (1996 AIME). [10] In parallelogram ABCD, let O be the intersection of diag-
onals AC and BD. Angles CAB and DBC are each twice as large as angle DBA, and angle
ACB is r times as large as angle AOB. Find the greatest integer that does not exceed 1000r.

11
15 An Introduction to Olympiad Geometry

§15.1 Some Harder Angle-Chasing

In Day 2 of this unit, we covered a lot of basic angle-chasing with circles, and in Day 3, we
explored how to use those techniques to find some angles and properties related to triangle
centers. We’ll put that all together today and take on some tough angle-chasing problems.

Example 15.1 (Miquel). Let ABC be a triangle, and suppose that points D, E, and F lie on
sides BC, CA, and AB, respectively. Show that the circumcircles of triangles AEF, BF D,
and CDE share a common point.

Solution. Note that D, E, and F are arbitrarily selected points on sides BC, CA, and AB, so
there’ll be nothing special going on here — just good old-fashioned angle-chasing.

Let’s begin by supposing that the circumcircles of triangles BDF and CDP meet at P , and
we’ll show that A, E, P, and F are concyclic. This is often easier than trying to directly show
that three objects pass through the same point — suppose that a point is the intersection of
two of them, and that the point satisfies another property.
So we want to show that AEP F is a cyclic quadrilateral. Since we know that CDP E and
BDP F are cyclic, it’s natural to try and use angles related to those circles: let’s try and show
that ∠AF P and ∠AEP are supplementary.
But knowing that ∠BF P + ∠AF P = 180◦ and ∠AEP + ∠CEP = 180◦ , we may note that
it suffices to show that ∠BF P and ∠CEP are supplementary.
Now let’s invoke our cyclic quadrilaterals. As BF P D and CDP E are cyclic,

∠BF P = 180◦ − ∠BDP


= ∠P DC
= 180◦ − ∠CEP

so we have indeed shown that ∠BF P and ∠CEP are supplementary, and thus AF P E is cyclic,
as desired. 

1
Everaise Academy (2020) Math Competitions II

Example 15.2 (Spiral Similarity). Suppose that two circles Ω1 and Ω2 intersect at points P
and Q, and suppose that points W and Y lie on Ω1 , points X and Z lie on Ω2 , and that
W X and Y Z meet at Q. Show that triangles P W Y and P XZ are similar.

Solution. We did cover this earlier this unit, but this is such a prototypical example of cyclic-
quadrilateral angle-chasing that we had to bring it up again. There are a few possible other
configurations of the given points, but we’ll work with the one in the diagram below.

Since we’re not given anything to do with lengths, it makes sense to try and show that the
two given triangles share two angles. Let’s begin by attempting to show ∠P W Y = ∠P XZ.
Invoking our cyclic quadrilaterals, we see that ∠P W Y = 180◦ − ∠P QY = ∠P QZ = ∠P XZ,
giving us one angle equality. Let’s get one more: to show that ∠P Y W = ∠P ZX, we note that
∠P Y W = ∠P QW = 180◦ − ∠P QX = ∠P ZX, and we are done. 

Exercise 15.3. Show also that triangles P W X and P Y Z are similar.

Example 15.4 (Simson Line). Let A, B, C, and D be points on a circle, and suppose that
the feet of the perpendiculars from D to BC, CA, and AB are X, Y, and Z, respectively.
Show that X, Y, and Z are collinear.

Solution. Try drawing a diagram for yourself this time — don’t read ahead until you’ve done
so.
We’re trying to show that points X, Y, and Z are collinear. In the diagram we provide below,
it’s clear that it suffices to show that angles ∠AY Z and CY X are equal: this will yield the
desired collinearity.

2
Everaise Academy (2020) Math Competitions II

Well, how do we show this angle equality? In the past two examples, we were handed cyclic
quadrilaterals on a platter, which we used to effectively angle-chase; in this scenario, there
aren’t any obvious cyclic quadrilaterals involving the angles ∠CY X or ∠AY Z.
At this point, take a step back and conjecture as to what quadrilaterals in the diagram above
might be cyclic. Don’t read on until you’ve done so!
The important condition given in the problem is that X, Y, and Z are the feet of perpendic-
ulars from D to BC, CA, and AB. That means that we have a lot of 90◦ angles, which gives
us cyclic quadrilaterals off the bat. Indeed, we have ∠DY C = ∠DXC = 90◦ , giving us that
DY XC is cyclic with diameter DC. Similarly, we have ∠DY A = ∠DZA = 90◦ , giving us that
DY AZ is cyclic with diameter DA.
Now our path is clearer: we have ∠CY X = ∠CDX and ∠AY Z = ∠ADZ, so it suffices
to show that ∠CDX = ∠ADZ. While these angles don’t seem to be attached to cyclic
quadrilaterals, they are attached to right triangles: we have ∠ADZ = 90◦ − ∠ZAD and
∠CDX = 90◦ − ∠DCX. Thus we just need to show ∠DCX = ∠DAZ.
But here we bring in the last condition, the only one we haven’t used yet — that ABCD is
cyclic. Thus ∠DCX = 180◦ − ∠DAB = ∠DAZ, and we are done. 

Remark. Often it’s unproductive to try and just angle-chase “forwards” — if you want to
show that two angles ∠A and ∠B are equal, for example, it’s usually better to find some
intermediary angles that ∠A and ∠B are equal to so that you can “meet in the middle.”

Example 15.5 (Symmedian). Let ABC be a triangle satisfying AB < AC with circumcircle
Ω, and let the tangent from A to Ω meet BC at T . Suppose that D 6= A lies on Ω such
that T D is tangent to Ω, and let M be the midpoint of BC. Show that ∠BAM = ∠CAD.

Solution. Draw some diagrams for yourself this time — we won’t be providing any.
At first blush this problem has to look somewhat weird. We haven’t really seen how midpoints
of sides work with angles yet — it’s obvious how altitudes and angle bisectors work with angles,
but we’re dealing with midpoints and tangents here.
If you’ve drawn a good enough diagram, you might conjecture that triangles AM B and
ACD are similar. Note that ∠ABM = ∠ADC as both angles cut off CA,d so it follows that
we need to show that ∠AM B = ∠ACD. Furthermore, by Angle by Tangent, we know that
∠ACD = ∠ADT — this is where the tangent comes into play.
As M, B, and T are collinear, it follows that we just need to show that AM DT is cyclic. Now
we’ll bring in the other tangent: as AT is tangent to Ω, it follows that if O is the center of Ω,
then A, O, D, and T lie on a circle. (Why?)
But now our path is clear: as ∠OAT = ∠OM T = 90◦ , it follows that A, O, M, D, and T are
concyclic, and thus ∠AM B = ∠ADT , as desired. 

In some sense, the last four problems have been “pure angle-chasing” — that is, angle-chasing
without big configurations involved. In most olympiad problems you have to angle-chase in
configurations involving triangle centers, or you have to do some additional lifting with Power
of a Point, or some other, more complex ideas.

3
Everaise Academy (2020) Math Competitions II

Example 15.6 (2010 ISL). Let ABC be an acute triangle with D, E, F the feet of the
altitudes lying on BC, CA, AB respectively. One of the intersection points of the line EF
and the circumcircle is P. The lines BP and DF meet at point Q. Prove that AP = AQ.

Solution. Note that in this problem, as mentioned before, we have a triangle center involved.
That will help us angle-chase.
Begin, as always, by drawing your own diagram. Note that there are two possibilities for P .
We’ll only cover one of them in the following solution — the one where P and B are on the
same side of AD.
Again, one of the most important things in Olympiad Geometry is the art of making conjec-
tures — and before you read on, try and make some of your own. Do any quadrilaterals look
cyclic? Do any nontrivial combinations of three points look collinear?

Since we want to show that AP = AQ, and we’re not really given anything about lengths,
let’s try and show that ∠AQP = ∠AP Q. Perhaps we could find a cyclic quadrilateral involving
P and Q — that would give us some angles.
The only one that really makes any sense from the diagram is AF P Q. Maybe we can show
that it’s cyclic. Since we want to show that AF P Q is cyclic, we could proceed by trying to
show that ∠AQP + ∠AF P = 180◦ , for example. But that doesn’t seem very likely to succeed:
in particular, we have no information about ∠AQP .
So let’s try to show instead that ∠AP Q = ∠AF Q. Since D lies on line F Q, we can imme-
diately tie ∠AF Q back to angles we’re more familiar with, and since ∠AP Q and ∠AP B are
supplementary, we can tie ∠AP Q back to the circumcircle of triangle ABC. We’ve emphasized
this before in this course, but angle-chasing is often the art of relating stuff you don’t know
back to stuff you do know.
So if we want to show that ∠AP Q = ∠AF Q, let’s begin by tying these angles back to angles
“closer” to the original triangle, in some sense. We have ∠AP Q = 180◦ − ∠AP B = ∠ACB

4
Everaise Academy (2020) Math Competitions II

and ∠AF Q = ∠BF D. Miraculously, as AF DC is cyclic with diameter AC, ∠BF D = 180◦ −
∠AF D = ∠ACB, so AF P Q is indeed a cyclic quadrilateral!
Great. Now let’s prove that ∠AP Q = ∠AQP . Since we know that AF P Q is cyclic, we
can finally deal with ∠AQP ; we have ∠AQP = 180◦ − ∠AF P = ∠AF E, and we’ve succeeded
in relating our weird angle back to angles we know better how to deal with. Furthermore,
∠AP Q = 180◦ − ∠AP B = ∠ACB, so we just need to show that ∠AF E = ∠ACB. But this
follows as BF EC is cyclic with diameter BC, as desired. 

Note that we wanted to show that ∠AQP = ∠AP Q from the very beginning, but we didn’t
know how to deal with ∠AQP , so we had to look for cyclic quadrilaterals. Once we found a
quadrilateral which we thought could be cyclic, we related the angles in it back to angles we
were more familiar with — angles involved with the orthocenter configuration. This is one of
the most common techniques we use when we angle-chase.

Example 15.7 (2017 USAJMO). Let O and H be the circumcenter and the orthocenter
of an acute triangle ABC. Points M and D lie on side BC such that BM = CM and
∠BAD = ∠CAD. Ray M O intersects the circumcircle of triangle BHC in point N . Prove
that ∠ADO = ∠HAN .

Solution. First, a diagram — although you should also draw one for yourself.

The first important thing you might notice about this problem is that, well, it looks super
weird. The desired angle equality, ∠ADO = ∠HAN , seems to come out of nowhere. We have a
somewhat random-looking orthocenter, a foot of an angle bisector, the circumcircle of triangle
BHC — this problem seems almost detached from reality.
So let’s explore some ways to relate the weird things in this problem to things we understand
better. First things first: since D is the foot of the A-angle bisector, we know that AD passes
through MA , the midpoint of arc BC d not containing A. Moreover, we know that O, M, and N
must also pass through this point, so adding in MA makes a lot of sense.

5
Everaise Academy (2020) Math Competitions II

Well, this seems like it might be helpful. Let’s take a look at what we’re trying to prove: we
want to show that ∠ADO = ∠HAN . Of course, as AH and OM are parallel, we know that
∠HAN = ∠AN O, so it suffices to show that ADN O is a cyclic quadrilateral — that would
immediately imply ∠ADO = ∠AN O.
Now our point MA might come into play: to show that ADN O is a cyclic quadrilateral, we
could show that MA N · MA O = MA D · M A. Now our challenge is “identifying” point N : points
O, A, and D are points we’re familiar with, whereas N is kind of weird.
We’ll pull in the orthocenter H: it is known that the circumcircles of triangles ABC and
BHC are reflections of each other over BC — go review day 3 if you don’t remember why!
Therefore N and MA are actually reflections in BC.
Let’s construct one final point: L, the midpoint of arc BAC.
\ Why? We’d like to be able
to use the fact that M is the midpoint of MA N , so as MA M = 21 MA N , it would follow that
MA N · MA O = MA M · MA L, as O is the midpoint of L.

Since we know that MA M · MA L = MA N · MA O, and we want to show that MA N · MA O =


MA D · MA A, it would suffice to show that MA M · MA L = MA D · MA A. But that is equivalent
to showing that quadrilateral M DAL is cyclic — can we do that?

6
Everaise Academy (2020) Math Competitions II

Note that MA L is a diameter of the circumcircle of triangle ABC, so ∠DAL = 90◦ . But
∠DM L = 90◦ , too! Therefore DALM is cyclic with diameter DL, and we are done. 

Remark. Let’s go over the process in solving this tough problem again: first, we realized
that a lot of points seemed kind of random, so we added in MA to “connect” the point
D with the rest of the diagram. Next, we wanted some way to deal with point N , so
we recalled how it was defined and used prior knowledge of the orthocenter to identify it.
Finally, we took advantage of our newfound understanding of point N to get it out of the
picture and essentially replace it with point L, a point we understand much better, and we
finished the problem with a brief angle-chase to show that DM LA was cyclic.

Let’s cover one last tough example, from a semi-recent IMO.

Example 15.8 (2015 IMO). Triangle ABC has circumcircle Ω and circumcenter O. A circle
Γ with center A intersects the segment BC at points D and E, such that B, D, E, and C
are all different and lie on line BC in this order. Let F and G be the points of intersection
of Γ and Ω, such that A, F , B, C, and G lie on Ω in this order. Let K be the second
point of intersection of the circumcircle of triangle BDF and the segment AB. Let L be
the second point of intersection of the circumcircle of triangle CGE and the segment CA.
Suppose that the lines F K and GL are different and intersect at the point X. Prove
that X lies on the line AO.

Solution. This is a truly difficult problem, with plenty going on.

So where and how do we even begin, with this many points, lines, and circles involved? First
things first: point X lies on AO is a bit of a weird condition. Let’s find some way to simplify it
— otherwise we might have to prove something like ∠F AX = ∠F AO, which seems really hard;
getting arbitrary angles is always difficult.
Try to figure out what else we should try before you read ahead! We reiterate: it’s very
important to get used to trying to conjecture things for yourself. Familiarize yourself with the

7
Everaise Academy (2020) Math Competitions II

given information, and try to get a “feel” for the problem — this is often one of the most
important things to do when you come across an olympiad problem.
Done making conjectures yet?
In this case, we’re handed AF = AG on a platter, and as O is the center of Ω we know that
OF = OG. Thus OA is actually the perpendicular bisector of F G! So we might want to try
showing XF = XG instead — or, in terms of angles, ∠XF G = ∠XGF .
But we can’t angle-chase with arbitrary angles. There are no arcs being cut off. So we’ll have
to take matters into our own hands: perhaps we could extend F X and GX to hit Ω again, and
create arcs that way. However, since we’re given cyclic quadrilaterals F KDB and GLEC, it
might make a bit more sense to let F G meet the circumcircles of those quadrilaterals again at
points Y and Z, respectively.

Note that something great has happened: since we only need to show that ∠KF Y = ∠LGZ
to show that XF = XG, we have no need for points X and O anymore. They served as disguises
for this angle equality, which we now need to demonstrate.
Time to make some more conjectures of your own. Remember: look for collinear points;
concyclic points; similar triangles; anything out of the ordinary. Draw a few different diagrams
on your own papers — preferably with compass and ruler — and get a good grip on the structure
of the problem.
Made any good guesses?
One thing that might have jumped out to you is that not only do angles ∠KF Y and ∠LGZ
look equal, but triangles KF Y and LGZ look similar. This motives looking at ∠LZG and
∠KY F , as another corresponding pair of angles; we can see that ∠LZG = ∠ACG and ∠KY F =
∠ABF . But these angles cut off arcs F
d A and AG
d respectively, and as AF = AG they are equal.
Thus it suffices now to show that ∠ZLG = ∠Y KF .
The natural thing to do is to try and get rid of even more points: as ∠F KY = 180◦ − ∠F BY
and ∠GLZ = 180◦ − ∠GCZ, we can eliminate the need for points K and L entirely. It suffices
to show that ∠F BY = ∠GCZ.
Well, this is nice and symmetric, but it doesn’t look like we can show this angle equality
directly. Let’s introduce something less symmetric: as ZGCE is cyclic, we can show instead

8
Everaise Academy (2020) Math Competitions II

that ∠F BY = ∠ZEG. Take another moment to make some more conjectures. How can we
show this angle equality?
If you spent long enough looking at the diagram, or if you drew multiple diagrams with
different configurations, you might have conjectured that lines F B and ZE are parallel, and
that lines BY and EG are parallel, too. If you did, congratulate yourself, even if you weren’t
able to prove it; making the right guesses is half of the difficulty.
Indeed, we’ll begin by showing that F B and ZE are parallel. It’s natural to try and show
that ∠F BD = ∠ZEC, because those are angles of cyclic quadrilaterals; indeed, ∠F BD =
180◦ − ∠ZGC = ∠ZEC, so indeed F B and ZE are parallel.
What about the other pair of parallel lines? We’ll show that ∠Y BD = ∠GEC — again, we
want to work with angles in circles. We have ∠Y BD = ∠Y F D = ∠GEC, where the last step
comes from the cyclic quadrilateral F DEG.
But that’s it — we’re done! Since F B and ZE are parallel, and since BY and EG are parallel,
it follows that ∠F BY = ∠ZEG — which is what we wanted to show. 

Remark. Yes, our solution to the above problem was incredibly long. But think about the
main points: we reduced the complexity of the problem, step by step. We got rid of points
O and X by realizing that AO was the perpendicular bisector of F G; we got rid of points
K and L by translating one angle condition into a different one; at long last, we made some
important conjectures as to possible parallel lines in a problem to finish an angle-chase.
This was a tough problem; read through it a few times if you think you have to!

Exercise 15.9. In the configuration of the previous example, prove that


1. quadrilateral BY ZC is cyclic, and
2. quadrilateral Y DEZ is cyclic.

§15.2 Radical Axis

On day 2 of this week, we covered Power of a Point. Today we’ll introduce an important
related result, called the Radical Axis.

Proposition 15.10. Suppose that Γ1 and Γ2 are circles centered at O1 and O2 , respectively.
Then the set of points P such that pow(P, Γ1 ) = pow(P, Γ2 ) is a line perpendicular to
O1 O2 , called the Radical Axis of Γ1 and Γ2 .
Moreover, if Γ1 and Γ2 intersect at two points X and Y , then the radical axis of Γ1 and
Γ2 is the line XY . If Γ1 and Γ2 don’t intersect, then they lie on opposite sides of their
radical axis.

We won’t prove this result — the method is quite computational and somewhat tedious —
but it’s an extremely useful tool in olympiad geometry.

9
Everaise Academy (2020) Math Competitions II

The diagram above depicts the case where the circles — let’s call them Γ1 and Γ2 , with
centers O1 and O2 — intersect. As P lies on XY , the radical axis of the two circles, it follows
that pow(P, Γ1 ) = pow(P, Γ2 ), so P A · P B = P C · P D.

The diagram above depicts the case where the circles don’t intersect. Again, let’s suppose
that the circle centered at O1 is Γ1 , and that the circle centered at O2 is Γ2 . The dashed line
is the radical axis of Γ1 and Γ2 , and P lies on it. As given in the diagram, P Q and P R are
tangent to Γ1 and Γ2 , respectively, so as pow(P, Γ1 ) = pow(P, Γ2 ), it follows that P Q2 = P R2 .
Let’s present what might be the most important result regarding the radical axis.

Proposition 15.11 (Radical Lemma). Suppose that Γ1 and Γ2 are circles with radical axis
`. Suppose that points X and Y lie on Γ1 , and that points W and Z lie on Γ2 , such that
XY and W Z meet on `. Then X, Y, W, and Z are concyclic. Moreover, the converse holds;
that is, if X, Y, W, and Z are concyclic with X and Y lying on Γ1 and W and Z lying on
Γ2 , then XY and W Z meet on `.

Proof. Suppose that XY, W Z, and ` meet at P . Then pow(P, Γ1 ) = pow(P, Γ2 ), so P X · P Y =


P W · P Z so X, Y, W, and Z are concyclic.
We won’t give a proof of the converse — we’ll leave that as an exercise to the reader. 

For the proof above we strongly recommend drawing multiple diagrams to visualize the pos-
sible cases: it could happen that Γ1 and Γ2 intersect and P lies strictly on their common chord.
Or it could happen that they don’t intersect and that P lies “far away” from the circles. Make
sure you understand the possibilities!

10
Everaise Academy (2020) Math Competitions II

Theorem 15.12 (Radical Center). Suppose that Γ1 , Γ2 , and Γ3 are circles. Then their
pairwise radical axes concur or are all parallel to one another.

Proof. Suppose that `1 is the radical axis of Γ2 and Γ3 , and that `2 is the radical axis of Γ1 and
Γ3 . If `1 and `2 intersect, suppose they meet at some point P .

Here the circles centered at O1 , O2 , and O3 are Γ1 , Γ2 , and Γ3 , respectively. Then, as P


lies on `1 , we know that pow(P, Γ2 ) = pow(P, Γ3 ). Moreover, P lying on `2 implies that
pow(P, Γ1 ) = pow(P, Γ3 ). Therefore by transitivity pow(P, Γ2 ) = pow(P, Γ1 ), so P lies on `3 , as
desired.
On the other hand, what if `1 and `2 don’t intersect? It follows that if O1 , O2 , and O3 are
the centers of Γ1 , Γ2 , and Γ3 that `1 ⊥ O2 O3 and `2 ⊥ O1 O3 . Thus `1 k `2 implies that O1 , O2 ,
and O3 are collinear, from which the conclusion follows. 

The Radical Center and Radical Lemma are essentially equivalent results — feel free to cite
them interchangeably; the only real difference is that the Radical Center takes into account the
possibility that the radical axes are parallel to one another.

Exercise 15.13 (Construction of the Radical Axis). Given two nonintersecting circles Ω1 and
Ω2 , give a method to construct their radical axis.
Hints: Construct a third circle that intersects both of them, and use Theorem 15.12!

Exercise 15.14. Let Ω1 and Ω2 be externally tangent circles at R, and let ` be one of their
common external tangents such that ` meets Ω1 at P and Ω2 at Q. Show that ∠P RQ = 90◦ .

Let’s jump into some tough example problems. Rarely do Olympiad problems contain only
one theme, so there will be lots of angle-chasing involved, too. Make sure you’re very much
familiar with the previous section.

Example 15.15 (1995 IMO). Let A, B, C, D be four distinct points on a line, in that order.
The circles with diameters AC and BD intersect at X and Y . The line XY meets BC at
Z. Let P be a point on the line XY other than Z. The line CP intersects the circle with
diameter AC at C and M , and the line BP intersects the circle with diameter BD at B
and N . Prove that the lines AM, DN, XY are concurrent.

Solution. The first thing to do is to draw a diagram, as usual.

11
Everaise Academy (2020) Math Competitions II

Let’s begin by using the Radical Lemma to make a handful of observations — this is clearly
motivated because we’re given a radical axis off the bat:
• As CM and BN meet on XY , it follows that N M CB is cyclic.
• If we want to show that AM, DN, and XY are concurrent, it’s equivalent to showing that
AN M D is cyclic.
In case you’re not completely there on why these things hold, we’ll go over the justification
again. The first fact holds because P lies on the radical axis of the circles, so therefore P N ·
P B = P M · P C; the second fact holds because if DN and M A meet at some point Q, then
QN · QD = QM · QA would follow if AN M D is cyclic, which would imply that Q lies on XY .
The rest falls to an angle-chase: note that to show that AN M D is cyclic, it would suffice to
demonstrate that ∠M N D = ∠M AD. We’ll now take advantage of the fact that we’re given
that the circles have diameters AC and BD: this yields

∠M AD = ∠M AC
= 90◦ − ∠M CA
= 90◦ − ∠M N P

where the last step follows as M CBN is cyclic.


Let’s finish off the problem: as ∠BN D = 90◦ because BD is a diameter, we know that
∠P N D = 90◦ . Thus 90◦ − ∠M N P = ∠M N D, so ∠M AD = ∠M N D and M N AD is cyclic, as
desired. 

In this next example, the radical axis will be somewhat less obvious.

Example 15.16 (2013 IMO). Let ABC be an acute triangle with orthocenter H, and let
W be a point on the side BC, lying strictly between B and C. The points M and N are
the feet of the altitudes from B and C, respectively. Denote by ω1 is the circumcircle of
BW N , and let X be the point on ω1 such that W X is a diameter of ω1 . Analogously,
denote by ω2 the circumcircle of triangle CW M , and let Y be the point such that W Y is
a diameter of ω2 . Prove that X, Y and H are collinear.

12
Everaise Academy (2020) Math Competitions II

Solution. First things first: draw a diagram by yourself, preferably with a ruler and compass.
Maybe try drawing a few different triangles; maybe try drawing the point W in different places
each time.
One of the most important things to do if you want to become good at Olympiad geometry —
or math in general, really — is to become good at making conjectures. In geometry specifically,
you’ll want to look for points that look collinear, or concyclic; maybe this point looks like a
midpoint, or maybe it looks like this other point could be special in this way or that.
So take a moment and look at your diagram(s) before continuing to read on. What conjectures
can you make? Does anything pop out? Try to prove your conjectures, too.
Alright, let’s get to the solution. If you drew a good enough diagram, it might look something
like this:

Off the bat, it should look suspiciously like the line containing X, H, and Y contains the
second intersection of ω1 and ω2 ; let us let P be that second intersection.
We’ll begin by noting that to prove that X, P, and Y are collinear, we can prove that ∠XP W
and ∠Y P W are supplementary angles — this seems promising because both these angles cut off
arcs of circles. As it stands, as W X and W Y are diameters, we have ∠XP W = ∠Y P W = 90◦ ,
so indeed X, P, and Y are collinear.
Now, if we could prove that ∠W P H = 90◦ , we would know that H lies on the line containing
X, P, and Y , and we’d be done with the problem. Here’s where you might have made another
conjecture: it seems like A lies on W P .
But we know that this is true! Observe that BN M C is a cyclic quadrilateral with diameter
BC — after all, M and N are feet of altitudes — and thus it follows by the Radical Lemma
that A lies on the radical axis ω1 and ω2 . That is, if Γ is the circumcircle of BN M C, then the
pairwise radical axes of {Γ, ω1 , ω2 } are {BN, CM, W P }, so W, P, and A are collinear.
Now if we want to show that ∠W P H = 90◦ , it also suffices to show that ∠AP H = 90◦ . But
this would be equivalent to showing that P lies on the circle with diameter AH. But we already
know that ∠AN H = ∠AM H = 90◦ , so A, M, H, and N are concyclic with diameter AH —
therefore we just need to show that P lies on the circumcircle of triangle AM N .
But that was the first example in the angle-chasing section for today — that’s Miquel’s
theorem! Therefore P lies on the circumcircle of triangle AM N with ∠AP H = 90◦ , so thus
∠W P H = ∠W P X = ∠W P Y = 90◦ and X, H, and Y are collinear. We are done. 

13
Everaise Academy (2020) Math Competitions II

Let’s go over one last cute application of the radical axis.

Example 15.17 (2012 USAJMO). Given a triangle ABC, let P and Q be points on segments
AB and AC, respectively, such that AP = AQ. Let S and R be distinct points on segment
BC such that S lies between B and R, ∠BP S = ∠P RS, and ∠CQR = ∠QSR. Prove
that P, Q, R, S are concyclic (in other words, these four points lie on a circle).

Solution. Our first job should probably be to figure out what to do with the given angle
condition.

Note that by Angle by Tangent, the circumcircle of triangle P RS is tangent to AB. Similarly,
the circumcircle of triangle QSR is tangent to AC. This seems quite useful, as we’d like to prove
that P, Q, S, and R are concyclic.
Take a moment to think to yourself — what should we do now to prove that all four of the
points lie on the same circle?
Don’t read ahead until you’ve spent a bit of time. Remember that we’re learning about the
radical axis in this section.
Okay, hopefully you’ve made some conjectures, or tried to solve the problem — it’s time for
the big reveal. Suppose that the circumcircles of triangles QRS and P SR are distinct. Then
they both pass through R and S, so RS must be their radical axis.
Miraculously, we’re given AP = AQ, and we know that AP and AQ are tangent to the
circumcircles of triangles P SR and QRS, respectively. It follows that A lies on the radical axis
of these two circles! But A cannot lie on RS, contradiction.
Therefore the circumcircles of triangles QRS and P SR are not distinct, and P, Q, R, and S
are concyclic. 

§15.3 Homework Problems

Problem 15.1. [3] Let ABC be a triangle, and suppose that D, E, and F are the feet of the
altitudes from A, B, and C to BC, CA, and AB, respectively. Show that the reflections of D
over AB and AC lie on EF .

Problem 15.2 (The Orthocenter Configuration). [6] Let ABC be a triangle with orthocenter
H, and suppose that E and F are the feet of the B and C-altitudes. Suppose that the cir-
cumcircle of triangle AEF meets the circumcircle of triangle ABC again at K. Let M be the
midpoint of BC.

14
Everaise Academy (2020) Math Competitions II

1. [3] Show that K, H, and M are collinear. Hint: Do H and M remind you of anything?
2. [3] Show that AK, EF, and BC are concurrent lines. Hint: Radical center!

Problem 15.3. [4] Let ABC be a triangle. A pair of points P, Q are said to be isogonal
conjugates if ∠BAP = ∠CAQ, ∠ACP = ∠BCQ, and ∠CBP = ∠ABQ. Show that the
orthocenter and circumcenter of a triangle are isogonal conjugates.
Hint: The notation is disguising something which isn’t that complicated!

Problem 15.4. [5] Let ABC be a triangle. Suppose that ΓB is the circle passing through A
and B tangent to AC, and suppose that ΓC is the circle passing through A and C tangent to
AB. Let D 6= A lie on ΓB and ΓC . If DB = 4 and DC = 9, then find DA.
Hint: Look for similar triangles!

Problem 15.5. [6] Let ABC be a triangle with incenter I, incircle ω, and circumcircle Ω, and
suppose that ω meets BC, CA, and AB at D, E, and F . Suppose that the circle with diameter
AI and Ω meet at two points A and K. Show that KD bisects angle ∠BKC.
Hint: Example 15.2 is really useful here, although the diagrams might not look similar!

Problem 15.6 (2020 APMO). [6] Let Γ be the circumcircle of 4ABC. Let D be a point on
the side BC. The tangent to Γ at A intersects the parallel line to BA through D at point E.
The segment CE intersects Γ again at F . Suppose B, D, F , E are concyclic. Prove that AC,
BF , DE are concurrent.

Problem 15.7 (2012 TSTST). [6] In scalene triangle ABC, let the feet of the perpendiculars
from A to BC, B to CA, C to AB be A1 , B1 , C1 , respectively. Denote by A2 the intersection
of lines BC and B1 C1 . Define B2 and C2 analogously. Let D, E, F be the respective midpoints
of sides BC, CA, AB. Show that the perpendiculars from D to AA2 , E to BB2 and F to CC2
are concurrent.
Hint: Look back at Problem 15.2!

Problem 15.8 (2013 USAJMO). [8] In triangle ABC, points P , Q, R lie on sides BC, CA, AB
respectively. Let ωA , ωB , ωC denote the circumcircles of triangles AQR, BRP , CP Q, respec-
tively. Given the fact that segment AP intersects ωA , ωB , ωC again at X, Y , Z, respectively,
prove that Y X/XZ = BP/P C.
Hint: Look back at Example 15.1!

Problem 15.9 (2010 USAJMO). [8] Let AXY ZB be a convex pentagon inscribed in a semi-
circle of diameter AB. Denote by P , Q, R, S the feet of the perpendiculars from Y onto lines
AX, BX, AZ, BZ, respectively. Prove that the acute angle formed by lines P Q and RS is half
the size of ∠XOZ, where O is the midpoint of segment AB.
Hint: Look back at Example 15.4!

Problem 15.10 (2020 USAJMO). [10] Let ABCD be a convex quadrilateral inscribed in a
circle and satisfying DA < AB = BC < CD. Points E and F are chosen on sides CD and AB
such that BE ⊥ AC and EF k BC. Prove that F B = F D.

15
16 Fundamentals

§16.1 Bases

We all know how our normal base-10 integers work: for example, the number 427 is equal to
four hundred and twenty seven, or 4 · 102 + 2 · 10 + 7 · 1. Other bases work in a similar manner.
For example, 3156 = 3·62 +1·6+5 = 119. We can also use decimals and bases in conjunction:
for example, 0.79 = 97 , and 3.15 = 3 + 15 + 25
1
+ · = 3 + 41 = 13
4 .

Example 16.1 (2019 AMC 12A). For some positive integer k, the repeating base-k repre-
7
sentation of the (base-ten) fraction 51 is 0.23k = 0.232323...k . What is k?

Solution. We know that


2 3 2 3
0.23k = + 2 + 3 + 4 + ···
k
 k k k
  
2 2 3 3
= + + ··· + + + ···
k k3 k2 k4
2/k 3/k 2
= +
1 − k12 1 − k12
7 1 2 3
by the infinite geometric series sum formula, so therefore 51 · (1 − k2
) = k + k2
. Solving this
equation yields k = 16, and we are done. 

Exercise 16.2 (2016 Finland). Suppose that y is a positive integer equal to (11 . . . 11)9 , such
that each digit in its base-9 decimal representation is a 1. Prove that y is a triangular number;
that is, there exists a positive integer n such that the number y is the sum of the n natural
numbers from 1 to n.

Sometimes we can get bases involved even when there aren’t any given to us.

Example 16.3 (1986 AIME). The increasing sequence 1, 3, 4, 9, 10, 12, 13 · · · consists of all
those positive integers which are powers of 3 or sums of distinct powers of 3. Find the
100th term of this sequence.

Solution. Given the emphasis on powers of 3 in the problem, we might think to use base
numbers. So let’s consider base-3: what do the numbers 1, 3, 4, · · · look like in base 3? They’re
13 , 103 , 113 , 1003 , 1013 , 1103 , 1113 ; at this point, you might have noticed a pattern — it’s just
the numbers with only 1s and 0s as digits in base 3.
Of course — the reason there are no 2s is because the problem reads distinct powers of 3!
Therefore we need to find the 100th element of the sequence 13 , 103 , 113 , · · · consisting of all
the integers with no 2s in their base-3 representation.
Note that there’s one number with one digit (13 ), two numbers with two digits (103 , 113 ),
four numbers with 3 digits (1003 , 1013 , 1103 , 1113 ), and so on. This is because the first digit

1
Everaise Academy (2020) Math Competitions II

must be 1, and all the other digits can be either 0 or 1, so we have 2n−1 choices if there are n
digits. Moreover, 100 . . . 003 , where there are k zeroes, will be the 2k th number in our sequence.
Try this with k = 1, 2, and 3!
Therefore the 64th number is 10000003 , and it’s not hard to see that the 96th number must
be 11000003 . Thus the 100th number is 11001003 = 981. 

Exercise 16.4. From the previous example, notice that 11001002 = 100, and we were looking
for the 100th term of this sequence. Show that this is not a coincidence.

We don’t always have to deal with exactly the strict base-number form.

Example 16.5 (2008 AIME II). There exist r unique nonnegative integers n1 > n2 > · · · > nr
and r unique integers ak (1 ≤ k ≤ r) with each ak either 1 or −1 such that

a1 3n1 + a2 3n2 + · · · + ar 3nr = 2008.

Find n1 + n2 + · · · + nr .

Solution. This looks a lot like the base-3 representation of 2008 — except instead of 0, 1, and
2 being the digits, we have each ak being either 1 or −1. We’ll express 2008 in base 3 and try
to alter this representation to one with coefficients of 1 or −1.
We have 2008 = 22021013 = 1 + 1 · 32 + 2 · 33 + 2 · 35 + 2 · 36 , so we need to express 2 · 36 , 2 · 35 ,
and 2 · 33 differently — preferably as sums and differences of powers of 3.
Here’s the key observation: we have that 2 · 3n = 3n+1 − 3n . That means that our expression
is actually equal to

1 + 1 · 32 + 1 · 34 − 1 · 33 + 1 · 36 − 1 · 35 + 1 · 37 − 1 · 36

which reduces to 37 − 35 + 34 − 33 + 32 + 30 , so our answer is 21. 

§16.2 Primes, Factors, and Divisibility

First, we’ll quickly go over a few definitions you should be familiar with.

Definition 16.6. An integer a is said to be a factor (or divisor) of an integer b if there exists
some integer k such that ak = b. We then say that a divides b.

For example: 6 is a factor of 42 because 6 · 7 = 42. Usually we’ll deal with positive factors,
and you should assume that “factors” refers to positive factors.

Definition 16.7. A prime number is a positive integer p that has only two positive integer
factors: 1 and p.

One key result is the following theorem.

Theorem 16.8 (Fundamental Theorem of Arithmetic). Each positive integer n has a unique
prime factorization n = pe11 pe22 · · · pekk , where p1 , p2 , · · · , pk are primes and e1 , e2 , · · · , ek

2
Everaise Academy (2020) Math Competitions II

are positive integers.

Exercise 16.9 (Some Divisibility Properties). Here we’ll list out a few properties and ask you
to prove them.
1. Show that if a | b and b | c, then a | c.
2. Show that if a | b and a | c, then a | mb + nc where m and n are any integers.
3. Show that if a | c and b | c with a, b relatively prime, then ab | c.

We can use the prime factorization of an integer to learn more about its factors in general.

Proposition 16.10 (Number of Factors). Suppose that n = pe11 pe22 · · · pekk , where p1 , p2 , · · · , pk
are primes and e1 , e2 , · · · , ek are positive integers. Then the number of factors of n is

(e1 + 1)(e2 + 1) · · · (ek + 1).

Proof. Note that any factor a of n satisfies a = pf11 pf22 · · · pfkk , where 0 ≤ fi ≤ ei for all i between
1 and k.
Therefore there are e1 + 1 choices for f1 , e2 + 1 choices for f2 , and so on — our expression
for the total number of factors, then, is (e1 + 1)(e2 + 1) · · · (ek + 1), as desired. 

Example 16.11. Find the number of factors of 720, then find the number of factors of 720
that are divisible by 8.

Solution. Our first move is to prime-factorize 720; we see that 720 = 24 · 32 · 5, so there are
(4 + 1) · (2 + 1) · (1 + 1) = 5 · 3 · 2 = 30 total factors.
Let’s adapt our method above to finding the number of factors divisible by 4. In particular,
if a factor is divisible by 8, the exponent of 2 in that factor’s prime factorization is at least 3;
therefore, any factor a of 720 divisible by 8 must be equal to either 2f1 · 3f2 · 5f3 , where f1 is
either 3 or 4, f2 ranges between 0 and 2, and f3 ranges between 0 and 1. Therefore there are
2 · 3 · 2 = 12 factors divisible by 8. 

Example 16.12 (1988 AIME). Let m/n, in lowest terms, be the probability that a randomly
chosen positive divisor of 1099 is an integer multiple of 1088 . Find m + n.

Solution. We know that 1099 = 299 · 599 , and furthermore, each positive divisor of 1099 must
be equal to 2f1 · 5f2 for 0 ≤ f1 ≤ 99 and 0 ≤ f2 ≤ 99. The key to this problem is that any integer
multiple of 1088 that is a factor of 1099 , then, must have the form 2g1 · 5g2 for 88 ≤ g1 ≤ 99 and
88 ≤ g2 ≤ 99, so there are 12 choices each for g1 , g2 and 12 · 12 = 144 multiples of 1088 that are
divisors of 1099 .
On the other hand, there are 100 · 100 = 10000 total factors of 1099 . Our expression is
144 9
= 625
10000 , and our answer is 634. 

Exercise 16.13 (2010 AIME I). Maya lists all the positive divisors of 20102 . She then randomly
selects two distinct divisors from this list. Let p be the probability that exactly one of the

3
Everaise Academy (2020) Math Competitions II

m
selected divisors is a perfect square. The probability p can be expressed in the form n, where
m and n are relatively prime positive integers. Find m + n.

We can also find an expression for the sum of the factors of a positive integer.

Example 16.14 (Sum of Factors). Suppose that n = pe11 pe22 · · · pekk , where p1 , p2 , · · · , pk are
primes and e1 , e2 , · · · , ek are positive integers. Then the sum of the factors of n is

S = (1 + p1 + p21 + · · · + pe11 )(1 + p2 + p22 + · · · + pe22 ) · · · (1 + pk + p2k + · · · + pekk ).

Proof. Let’s say that a is a factor of n. Then a = pf11 pf22 · · · pfkk for some fi s all satisfying
0 ≤ fi ≤ ei . Consider the expansion above: it’s clear that a is one of the terms in the full
expansion of S, because we can take pf11 from the first term, pf22 from the second, and so on.
Now we just need to show that every term of the expansion of S is also a factor of n. But
that isn’t that bad: each term of the full expansion of S is of the form b = pg11 pg22 · · · pgkk for
some gi s satisfying 0 ≤ gi ≤ ei , so therefore b is a factor of n, as desired. We may conclude that
every term in the expansion of S corresponds to a factor of n, and every factor of n is a term
in the expansion of S. We have a one-to-one correspondence, so we know that we have counted
each factor exactly once. Thus, S is the sum of the factors of n. 

Exercise 16.15 (Adapted from Art of Problem Solving Forums). Let A(n) denote the sum of
the positive factors of a positive integer n. For how many values of n satisfying n ≤ 500 is An
odd?

Let’s talk about gcd and lcm now.

Definition 16.16. The greatest common divisor of two integers m and n is the greatest
positive integer p such that p | m and p | n. The least common multiple of two integers m
and n is the least positive integer q such that m | q and n | q. We say that p = gcd(m, n) and
q = lcm(m, n).

For example, gcd(12, 18) = 6 and lcm(12, 18) = 36.

Exercise 16.17. Show that gcd(m, n) · lcm(m, n) = mn by letting m = pe11 pe22 · · · pekk and
n = pf11 pf22 · · · pfkk . In this case, the primes p1 , p2 , · · · , pk should just be all the primes that
appear in either the prime factorization of m or n. For example, if m = 60 and n = 42, then
m = 22 · 31 · 51 · 70 and n = 21 · 31 · 50 · 71 .

Example 16.18 (2018 AMC 10B). How many ordered pairs (a, b) of positive integers satisfy
the equation
a · b + 63 = 20 · lcm(a, b) + 12 · gcd(a, b),
where gcd(a, b) denotes the greatest common divisor of a and b, and lcm(a, b) denotes their
least common multiple?

Solution. We’ll use the fact that gcd(a, b) · lcm(a, b) = ab. Let p = gcd(a, b) and q = lcm(a, b),
so that
pq + 63 = 12p + 20q.

4
Everaise Academy (2020) Math Competitions II

Moving all the terms to one side and using Simon’s Favorite Factoring Trick, we get

(p − 20)(q − 12) = 177.

Since 177 = 3 · 59, and as p ≤ q, we see that the possible pairs (p − 20, q − 12) are (3, 59)
or (1, 177). This means that the possible pairs (p, q) are (23, 71) and (21, 189). But if p = 23
and q = 71, we can’t possibly find working a, b as it would follow that gcd(a, b) = 23 and
lcm(a, b) = 71, and 23 and 71 are distinct primes. Therefore (p, q) = (21, 189).
It follows that as 21 = 3 · 7 and 189 = 33 · 7 that (a, b) = (21, 189) or (a, b) = (189, 21). Verify
to see that these are the only two pairs. 

Example 16.19 (1987 AIME). Let [r, s] denote the least common multiple of positive integers
r and s. Find the number of ordered triples (a, b, c) of positive integers for which [a, b] =
1000, [b, c] = 2000, and [c, a] = 2000.

Solution. It’s clear that a, b, and c can only have 2 and 5 in their prime factorizations; therefore
let a = 2e1 5e2 , b = 2f1 5f2 , and c = 2g1 5g2 . As [b, c] = [c, a] = 2000, we must either have 1)
g1 = 4, or if g1 6= 4, then 2) e1 = f1 = 4. However, the second case is impossible as [a, b] = 1000,
so g1 = 4.
Now, at least one of e1 and f1 must be 3; if both are less than 3, then [a, b] = 1000 will be
impossible because the lcm of a and b will have an exponent of at most 2. Therefore there are
7 choices for (e1 , f1 ): (0, 3), (1, 3), (2, 3), (3, 3), (3, 2), (3, 1), and (3, 0).
Now we deal with the powers of 5. Observe that at least two of e2 , f2 , and g2 must be equal
to 3 (why?). Therefore we get 10 choices for (e2 , f2 , g2 ) — choose two of them to be 3 and there
are four choices for the last one, which gives us 12, and then we subtract our overcounting of
(3, 3, 3) to get 10.
Our answer is 7 · 10 = 70. 

§16.3 Linear Diophantine Equations

From elementary school division with remainders, we have the following result: for any two
integers a and b with b 6= 0, there exist unique integers q and r such that a = bq + r and
0 ≤ r ≤ |b|. This is called Euclidean division.
One important result is a method of computing the gcd of two integers.

Theorem 16.20 (Euclidean Algorithm). For a, b, q, r ∈ Z, if a = bq + r then gcd(a, b) =


gcd(b, r). By repeating this procedure, gcd(a, b) is the last nonzero remainder.

For example, gcd(759, 239) = gcd(239, 42) = gcd(42, 29) = gcd(29, 13) = gcd(13, 3) =
gcd(3, 1) = 1.
We can use this theorem to solve some interesting problems. Here are some examples:

21n+4
Example 16.21 (1959 IMO). Prove that the fraction 14n+3 is irreducible for every natural
number n.

5
Everaise Academy (2020) Math Competitions II

Solution. To prove that the fraction is irreducible, we will have to show that gcd(21n+4, 14n+
3) = 1. We don’t know much about n, but perhaps we can use the Euclidean algorithm to
simplify. Thus, we have

gcd(21n + 4, 14n + 3) = gcd(7n + 1, 14n + 3)


= gcd(7n + 1, 1)
=1

21n+4
Since gcd(21n + 4, 14n + 3) = 1, it follows that 14n+3 is irreducible. 

Now, let’s move on to a more involved example.

Example 16.22 (1985 AIME). The numbers in the sequence 101, 104, 109, 116,. . . are of
the form an = 100 + n2 , where n = 1, 2, 3, . . . For each n, let dn be the greatest common
divisor of an and an+1 . Find the maximum value of dn as n ranges through the positive
integers.

Solution. Let’s try to find a general expression for the greatest common divisor of an and an+1 .
We have

gcd(an , an+1 ) = gcd(100 + n2 , 100 + n2 + 2n + 1)


= gcd(100 + n2 , 2n + 1)

It’s not possible to get rid of either the quadratic or linear term using only the Euclidean
Algorithm, so let’s see if there’s anything else we can do. We could eliminate the quadratic
term if we were able to somehow transform 100 + n2 into (2n + 1)2 + k, where k is some constant
term; that would allow us to subtract out the (2n + 1)2 part entirely.
We know that 2n + 1 is odd for all integers n, so we may multiply 100 + n2 by any power of
2 without changing the gcd. Let’s multiply by 4, since (2n + 1)2 = 4n2 + 4n + 1. Thus

gcd(100 + n2 , 2n + 1) = gcd(400 + 4n2 , 2n + 1)


= gcd(4n2 + 4n + 1 − 4n + 399, 2n + 1)
= gcd((2n + 1)2 − 4n + 399, 2n + 1)
= gcd(−4n + 399, 2n + 1)
= gcd(−4n + 399 + 2(2n + 1), 2n + 1)
= gcd(401, 2n + 1)

This means that dn must divide 401 for every n. Thus, the largest possible value of dn is 401,
and it can be attained when 2n + 1 = 401 or n = 200. 

Using the Euclidean Algorithm, we can also solve linear Diophantine equations of the form
ax + by = c where a, b, c ∈ Z. Note that such an equation only has integer solutions when
gcd(a, b) | c.

Proposition 16.23 (Bezout’s Lemma). Let a and b be two nonzero integers. There exist
integers x and y such that ax + by = gcd(a, b).

6
Everaise Academy (2020) Math Competitions II

Proof. By repeatedly applying the Euclidean division algorithm to a and b, we have:

a = bq1 + r1 , 0 < r1 < |b|


b = r1 q2 + r2 , 0 < r2 < r1
...
rn−1 = rn qn+1 + rn+1 , 0 < rn+1 < rn
rn = rn+1 qn+2 ,

where rn+1 is the last nonzero remainder. This makes rn+1 the greatest common divisor of a
and b. We may back-substitute to write rn+1 as a linear combination of rn and rn−1 , write rn
as a linear combination of rn−1 and rn−2 , and so forth. This means we can eventually write
rn+1 is a linear combination of a and b, proving Bezout’s Identity. 

Let’s see how we may apply Bezout’s Lemma in some examples.

Example 16.24. Consider the equation 424x − 74y = 4. Solve for all integer solutions
(x, y).

Solution. Firstly, we may divide both sides of the equation by 2: 212x − 37y = 2. Since it’s
not immediately clear to find an initial solution to this equation by inspection, we will have to
use a method similar to the Euclidean algorithm.

212 = 5 × 37 + 27
37 = 1 × 27 + 10
27 = 2 × 10 + 7
10 = 1 × 7 + 3
7=2×3+1

Now, we use back substitution.

7−2×3=1
7 − 2(10 − 1 × 7) = 1 → −2 × 10 + 3 × 7 = 1
−2 × 10 + 3(27 − 2 × 10) = 1 → 3 × 27 − 8 × 10 = 1
3 × 27 − 8(37 − 1 × 27) = 1 → −8 × 37 + 11 × 27 = 1
−8 × 37 + 11(212 − 5 × 37) = 1 → 11 × 212 − 63 × 37 = 1

We may multiply both sides of this equation by 2 to get 22 × 212 − 126 × 37 = 2. Thus, the
initial solution is (22, 126). The general solution is (22 + 37k, 126 + 212k), for any integer k. 

Note that if we were to find non-negative solutions, we could solve for integer values of k that
satisfy 22 + 37k ≥ 0 and 126 + 212k ≥ 0. Now, let’s try an example from the AIME.

7
Everaise Academy (2020) Math Competitions II

Example 16.25 (2008 AIME I). Ed and Sue bike at equal and constant rates. Similarly,
they jog at equal and constant rates, and they swim at equal and constant rates. Ed covers
74 kilometers after biking for 2 hours, jogging for 3 hours, and swimming for 4 hours, while
Sue covers 91 kilometers after jogging for 2 hours, swimming for 3 hours, and biking for 4
hours. Their biking, jogging, and swimming rates are all whole numbers of kilometers per
hour. Find the sum of the squares of Ed’s biking, jogging, and swimming rates.

Solution. It’s natural to start off by assigning variables to the speeds at which Ed and Sue
jog, swim, and bike. Let those speeds be j, s, and b respectively, all in km / h.
The two conditions give us two equations:

3j + 2b + 4s = 74 (1)
2j + 4b + 3s = 91. (2)

We may eliminate one of the variables, b, by subtracting (2) from 2 × (1) to get

2(3j + 2b + 4s) − (2j + 4b + 3s) = 2(74) − 91

so 4j + 5s = 57.
This looks like our linear Diophantine equation! Since the numbers are rather small, we
can find the initial solution using guess-and-check and modify to find the rest. Thus, the
non-negative solutions for (j, s) are (3, 9), (8, 5), and (13, 1).
Plugging these values back in to solve for b, we find that (3, 9) and (13, 1) give a non-integral
value of b. Thus, j = 8, s = 5, and b = 15, so j 2 + s2 + b2 = 314. 

§16.4 Introduction to Modular Arithmetic

Definition 16.26. Let m be a positive integer. Two integers a and b are said to be congruent
modulo m, if and only if m | (a − b). If m - (a − b), we write a 6≡ b (mod m).

There are several useful properties of congruence. Using the same definitions as earlier,
suppose a ≡ b (mod m), and let c and k be positive integers. We have:

1. a + c ≡ b (mod m)
2. a − c ≡ b − c (mod m)
3. ac ≡ bc (mod m)
4. ac ≡ bc (mod m)
5. a + b ≡ (a mod m) + (b mod m) (mod m)
6. ab ≡ (a mod m)(b mod m) (mod m)
7. If gcd(c, m) = 1 and dc ≡ ec (mod m), then d ≡ e (mod m).
a b m
8. If k | a, k | b, and k | m, then k ≡ k (mod k ).

Try proving some of these properties to ensure that you have a solid understanding of modular
arithmetic before moving forward to the exercise and examples.

8
Everaise Academy (2020) Math Competitions II

Exercise 16.27. Prove the divisibility rule for 9, which states that if the sum of the digits of
a number is divisible by 9, then the number is divisible by 9. Hint: Write out the number as the
sum of multiples of powers of 10!

Example 16.28 (2017 AMC 10A). Let S(n) equal the sum of the digits of positive integer
n. For example, S(1507) = 13. For a particular positive integer n, S(n) = 1274. Which of
the following could be the value of S(n + 1): 1, 3, 12, 1239, 1265?

Solution. Note that the sum of the digits of a number is congruent to that number modulo 9
– the proof of this quickly follows from the previous exercise. Mathematically, this means that
n ≡ S(n) (mod 9).
Since S(n) = 1274, we know that n ≡ S(n) ≡ 5 (mod 9). Thus, S(n + 1) ≡ 6 (mod 9). The
only option that satisfies this condition is 1239. 

Example 16.29 (2011 HMMT). Determine the remainder when


1×2 2×3 2011×2012
2 2 +2 2 + ... + 2 2

is divided by 7.

Solution. Perhaps the best way to start attacking this problem is to compute some smaller
values:
1×2
2 2 ≡2 (mod 7)
2×3
2 2 ≡1 (mod 7)
3×4
2 2 ≡1 (mod 7)
4×5
2 2 ≡2 (mod 7)

Notice a pattern? Hopefully, you saw that 23 ≡ 1 (mod 7) so we only have to consider the
exponents modulo 3. This means that the all of the remainders will follow 1, 0, 0, 1, 0, 0, . . ..
Thus, we may simplify the expression as follows:
1×2 2×3 2011×2012
2 2 +2 2 + ... + 2 2 ≡ 21 + 2 0 + 2 0 + 2 1 + . . . + 2 0 + 2 1
2010 1
≡ (2 + 20 + 20 ) + 21
3
≡ 670 × 4 + 2
≡5×4+2
≡1 (mod 7).

1×2 2×3 2011×2012


After all of that computation, we find that the remainder when 2 2 +2 2 +...+2 2

is divided by 7 is 1. 

Exercise 16.30 (2010 AIME I). Find the remainder when 9 × 99 × 999 × · · · × 99 · · · 9} is divided
| {z
999 9’s
by 1000.

9
Everaise Academy (2020) Math Competitions II

Exercise 16.31 (2013 HMMT). Find the remainder when 12 + 32 + 52 + . . . + 992 is divided
by 1000.

We haven’t had to worry about division yet. Let’s investigate about how to divide modulo
n, for some integer n.
When solving for a variable x, we need to divide by the coefficient of x so that the coefficient
of x becomes 1. Division by a modulo m is defined as multiplication by the multiplicative
inverse of a, assuming that it exists. The multiplicative inverse of a modulo m is an integer b
such that ab ≡ 1 (mod m). A useful way of thinking about it might be by analogy to the real
numbers: division by n is equivalent to multiplication by n1 , the multiplicative inverse of n (the
number that we can multiply by n to yield 1).

Proposition 16.32 (Multiplicative Inverse). Let a be an integer with 1 ≤ a ≤ m − 1. The


multiplicative inverse of a exists if and only if gcd(a, m) = 1.

Proof. If there exists an integer b such that ab ≡ 1 (mod m), then there is an integer solution x
to the equation ab − 1 = mx. This can be rearranged as ab + m(−x) = 1, which has an integer
solution for x if gcd(a, m) = 1.
If gcd(a, m) = 1, there exist integers b and x such that ab + m(−x) = 1. This can be
rearranged as ab − 1 = mx, so there exists an integer b such that ab ≡ 1 (mod m). 

Note that to find an explicit value of the multiplicative inverse, we may use the method from
the previous section to solve ab + m(−x) = 1. Let’s take a look out how we might use the
multiplicative inverse in an example.

Example 16.33 (2017 AMC 12A). Last year, Isabella took 7 math tests and received 7
different scores, each an integer between 91 and 100, inclusive. After each test she noticed
that the average of her test scores was an integer. Her score on the seventh test was 95.
What was her score on the sixth test?

Solution. At first glance, it might be tempting to start finding possible sequences of Isabella’s
test scores since we know that the average of her tests were an integer after every test. This is,
unfortunately, quite messy and rather unproductive — how can we use the condition that her
score on the seventh test was 95?
Let n be Isabella’s average after the first six tests. Since Isabella’s average after the seven
tests is an integer, we know that 6n + 95 is divisible by 7. Thus, we have 6n + 95 ≡ 0 (mod 7)
so 6n ≡ 3 (mod 7). By inspection, the multiplicative inverse of 6 mod 7 is 6, so we find that
n ≡ 4 (mod 7). The only possible value between 91 and 100 that satisfies this expression is
n = 95, so the average of Isabella’s first six tests is 95.
Let a be Isabella’s average after the first five tests and b be Isabella’s sixth test score. Since
5a + b = 6 · 95, we may solve for b to find that b = 5 × (114 − a). Thus, b must be a multiple of
5, so b = 100. 

We can also use modular arithmetic to solve some non-linear equations. Let’s try a couple of
examples involving a quadratic and a cubic!

10
Everaise Academy (2020) Math Competitions II

Example 16.34 (Adapted from 2016 CMIMC). Determine the smallest positive integer n
which satisfies the congruence

n + n−1 ≡ 25 (mod 143)

Here, n−1 as usual denotes multiplicative inverse.

Solution. It’s difficult to work with n−1 , so why don’t we multiply everything by n? Doing so,
we have n2 + 1 ≡ 25n (mod 143). We can rearrange this expression to to get n2 − 25n + 1 ≡ 0
(mod 143). Now, if we were to solve this equation normally, we would likely plug it into the
quadratic formula. Unfortunately, we can’t do that in modular arithmetic since we are only
able to work with integers. But we can add multiples of 143 to the equation, so let’s try that!
n2 − 25n + 144 factors very nicely into (n − 9)(n − 16)! Thus, we have (n − 9)(n − 16) ≡ 0
(mod 143). Note that n = 9, 16 are trivial solutions to this congruence relation, but are there
any solutions smaller than 9? We can quickly check n = 1, 2, . . . 7, 8 to find that n = 9 is the
smallest such positive integer. 

The original question asked for the smallest prime integer p — stay tuned to see the solution
of this question in a later handout!

Example 16.35 (2001 JBMO). Solve the equation a3 + b3 + c3 = 2001 in positive integers.

Solution. This question may appear a little daunting at first, because there doesn’t seem to
be a lot of restrictions – where do we even start our search? Maybe we could try solving this
equation modulo n, for some integer n?
Note that for all positive integers n, the value n3 ≡ −1, 0, 1 (mod 9) — test this out yourself.
Further, if n3 ≡ −1, 0, 1 (mod 9), n ≡ −1, 0, 1 (mod 3) respectively. You’ll learn more about
convenient numbers to take modulo, but for now, start with primes and powers of primes. Now,
since 2001 ≡ 3 (mod 9), we find that a3 , b3 , c3 ≡ 1 (mod 9). This is because if a3 , b3 , c3 take
on other values, we can’t get a3 + b3 + c3 ≡ 3 (mod 9). This means that a, b, c ≡ 1 (mod 3).
Since we are trying to solve this equation in positive integers, the only possible values for n
are 1, 4, 7, and 10. We went from an entire sea of possibilities to just four values! With some
clever bounding, this question can be finished. Try it out on your own, and confirm that your
solutions are (10, 10, 1), (10, 1, 10), and (1, 10, 10). 

§16.5 Homework

Problem 16.1 (1970 AHSME). [3] The number 10! (10 is written in base 10), when written
in the base 12 system, ends in exactly k zeroes. Find the value of k.

Problem 16.2 (1990 AIME). [4] Let n be the smallest positive integer that is a multiple of 75
and has exactly 75 positive integral divisors, including 1 and itself. Find n/75.

Problem 16.3 (2000 AIME II). [4] What is the smallest positive integer with six positive odd
integer divisors and twelve positive even integer divisors?

11
Everaise Academy (2020) Math Competitions II

Problem 16.4 (2006 AIME I). [5] Let S be the set of real numbers that can be represented
as repeating decimals of the form 0.abc where a, b, c are distinct digits. Find the sum of the
elements of S.

Problem 16.5 (2014 AIME II). [5] The repeating decimals 0.ababab and 0.abcabcabc satisfy
33
0.ababab + 0.abcabcabc = ,
37
where a, b, and c are (not necessarily distinct) digits. Find the three-digit number abc.

Problem 16.6 (2013 AMC 12B). [7] Bernardo chooses a three-digit positive integer N and
writes both its base-5 and base-6 representations on a blackboard. Later LeRoy sees the two
numbers Bernardo has written. Treating the two numbers as base-10 integers, he adds them to
obtain an integer S. For example, if N = 749, Bernardo writes the numbers 10,444 and 3,245,
and LeRoy obtains the sum S = 13, 689. For how many choices of N are the two rightmost
digits of S, in order, the same as those of 2N ?

Problem 16.7 (1986 AIME). [5] What is that largest positive integer n for which n3 + 100 is
divisible by n + 10?

Problem 16.8. [5] Colin the coin collector has 10 nickels, 10 dimes, and 10 quarters. How
many ways can he pay his friend Fred $1.00?

Problem 16.9 (1995 AIME). [6] For how many ordered pairs of positive integers (x, y), with
y < x ≤ 100, are both xy and x+1
y+1 integers?

Problem 16.10 (2011 HMMT). [4] Determine the remainder when 1 + 2 + . . . + 2014 is divided
by 2012.

Problem 16.11 (2008 HMMT). [6] Determine the last two digits of 1717 , written in base 10.

Problem 16.12 (2017 CMIMC). [6] For how many triples of positive integers (a, b, c) with
1 ≤ a, b, c ≤ 5 is the quantity

(a + b)(a + c)(b + c)

not divisible by 4?

Problem 16.13 (2001 AIME II). [7] How many positive integer multiples of 1001 can be
expressed in the form 10j − 10i , where i and j are integers and 0 ≤ i < j ≤ 99?

Problem 16.14 (1969 CMO). [8] Show that there are no integers a, b, c for which a2 +b2 −8c = 6.

Problem 16.15 (2013 HMMT). [8] Find the number of positive integer divisors of 12! that
leave a remainder of 1 when divided by 3.

12
17 More Advanced Modular Arithmetic

In the previous handout, we introduced the concept of modular arithmetic. We are going to
further our exploration by looking at some famous theorems and their applications.

§17.1 Fermat’s Little Theorem

One key result is Fermat’s Little Theorem, which gives us a way to reduce large powers quickly
modulo a prime.

Theorem 17.1 (Fermat’s Little Theorem). Let p be a prime number, and a be an integer
with a 6≡ 0 (mod p). Then
ap−1 ≡ 1 (mod p).

Proof. First, we claim that every element of {a, 2a, . . . , (p − 1)a} (mod p) is unique.
Assume, for the sake of contradiction, that this claim does not hold. That is, there exists a
j and k such that j 6≡ k (mod p) and ja ≡ ka (mod p). Since gcd(a, p) = 1, a has an inverse
modulo p, so we may multiply both sides of ja ≡ ka (mod p) by a−1 to get j ≡ k (mod p).
This is a contradiction, so every element of {a, 2a, . . . , (p − 1)a} (mod p) is unique.
As none of those elements are 0 (mod p) and there are p − 1 elements in the above set, it
follows that each element corresponds to a single element in {1, 2, . . . , p − 1} (mod p). That is,
{a, 2a, . . . , (p − 1)a} ≡ {1, 2, . . . p − 1} (mod p).

Since the sets are permutations of each other, we can multiply all of the elements in each set
to get
(p − 1)! ≡ (p − 1)! × ap−1 (mod p).

As (p − 1)! 6= 0 (mod p), it follows that (p − 1)! has an inverse. Multiplying both sides by
the inverse of (p − 1)!, we find that ap−1 ≡ 1 (mod p). 

Let’s take a look at how to use Fermat’s Little Theorem in practice.

Example 17.2 (2017 AMC 10B). An integer N is selected at random in the range 1 ≤ N ≤
2020. What is the probability that the remainder when N 16 is divided by 5 is 1?

Solution. This question begs us to use Fermat’s Little Theorem: we are taking a number to a
high power, modding by a prime, and trying to find those that are congruent to 1. Thus, it is
natural to rewrite N 16 = (N 5−1 )5−1 = (N 4 )4 .
By Fermat’s Little Theorem, we know that if N 6≡ 0 (mod 5) then (N 4 )4 ≡ 14 (mod 5).
Obviously, if N ≡ 0 (mod 5) then (N 4 )4 6≡ 1 (mod 5). Therefore, we are looking for the
proportion of all positive integers N less than or equal to 2020 such that N is not divisible by
5. Thus, the probability is 54 . 

1
Everaise Academy (2020) Math Competitions II

100
Example 17.3 (Joseph Zoller). A googolplex is 1010 . If today is Sunday, what day of the
week will be a googolplex days from now?

Solution. The week cycles every 7 days, so essentially, the question is asking us to compute
100
1010 (mod 7). By Fermat’s Little Theorem, 106 ≡ 1 (mod 7). Thus, we are looking to
compute 10100 (mod 6). This simplifies to 4100 (mod 6). Try simplifying this expression on
your own before reading on.
After trying some smaller cases, you should notice that 42 ≡ 4 (mod 6). Thus, 4100 ≡ 4
(mod 6). Going back to the original expression, we have:

100
1010 ≡ 104 (mod 7)
4
≡3 (mod 7)
≡ 81 (mod 7)
≡4 (mod 7)

After a googolplex days, it’ll be Thursday. 

Sometimes, Fermat’s Little Theorem will used in the context of the following corollary.

Corollary. If p is a prime number, then np ≡ n (mod p).

Try your hand at proving it before moving onward.

Exercise 17.4. Prove the corollary of Fermat’s Little Theorem.

With this in mind, let’s move on to some more difficult examples.

Example 17.5 (1989 AIME). One of Euler’s conjectures was disproved in the 1960s by
three American mathematicians when they showed there was a positive integer such that
1335 + 1105 + 845 + 275 = n5 . Find the value of n.

Solution. This problem may seem intimidating at first, but by taking some prime mods and
bounding, we are quickly able to reduce the answer choices.
We can immediately notice that n has to be even. This is because the the LHS consists of
the sum of two even and two odd integers. By Fermat’s Little Theorem, we know that n5 is
congruent to n modulo 5. Thus, if we take the equation modulo 5, we find:

3+0+4+2≡n (mod 5)
4≡n (mod 5).

Further, we can take the equation modulo 2 and 3, to find that n is divisible by 6.
Now, as n is divisible by 6 and leaves a remainder of 4 when divided by 5, since n > 133, we
can start testing at n = 134. We quickly find that n = 144 works, and after a little bit more

2
Everaise Academy (2020) Math Competitions II

work, we find that other solutions for n are greater than 174. This trial-and-error method may
feel slightly tedious, but bear with me – we’ll see a faster technique in the next section. From
here, we can approximate the value of n to find that 174 is too large. Thus, n = 144. 

Example 17.6 (David Altizio and Evan Fang). Let p be a prime, and suppose a is an integer
such that p does not divide a. Use Fermat’s Little Theorem to show that ap(p−1) ≡ 1
(mod p2 ).

Solution. It’s not clear how to approach this question, since Fermat’s Little Theorem only
applies to primes. Perhaps converting the conclusion to a divisibility statement will give us
more to work with.
We want to show that ap(p−1) − 1 | p2 , or in other words, there exists an integer k such
that ap(p−1) − 1 = kp2 . From here, we would like to apply ap−1 ≡ 1 (mod p) to simplify this
equation. Let’s rewrite this into a divisibility statement, as well, so we have that there exists
an integer m such that ap−1 − 1 = mp.
With this in mind, we may factor our expression:

ap(p−1) − 1 = (ap−1 − 1)(a(p−1)(p−1) + a(p−1)(p−2) + . . . + ap−1 + 1)


= mp(a(p−1)(p−1) + a(p−1)(p−2) + . . . + ap−1 + 1)

It is enough to show that a(p−1)(p−1) + a(p−1)(p−2) + . . . + ap−1 + 1 is divisible by p, so let’s


consider the expression modulo p:

a(p−1)(p−1) + a(p−1)(p−2) + . . . + ap−1 + 1 ≡ (ap−1 )p−1 + (ap−1 )p−2 + . . . + (ap−1 )1 + 1 (mod p)


p−1 p−2 1
≡1 +1 + ... + 1 + 1 (mod p)
≡p (mod p)
≡0 (mod p)

Wow! After applying Fermat’s Little Theorem, that worked out nicely. Thus, we may say
that there exists an integer j such that a(p−1)(p−1) + a(p−1)(p−2) + . . . + ap−1 + 1 = jp. Putting
this back into the original equation, we find that ap(p−1) − 1 = mp × jp = mj × p2 . Thus, let
k = mj to find that ap(p−1) − 1 | p2 . The result follows from here. 

Notice that in the previous problem, the original problem was considering modulo p2 where
p is a prime. We still managed to apply Fermat’s Little Theorem – try this technique with the
following exercise.

Exercise 17.7 (Joseph Zoller). Suppose that p and q are distinct primes, ap ≡ a (mod q), and
aq ≡ a (mod p). Prove that apq ≡ a (mod pq).

With Fermat’s Little Theorem, we were able to find some value of k such that ak ≡ 1 (mod n)
when n is prime and gcd(a, p) = 1. This value of k is exactly p − 1, but this raises the following
question: are we able to find a smaller value of k? This gives rise to orders modulo a prime.

3
Everaise Academy (2020) Math Competitions II

The order of a (mod p) is defined to be the smallest integer m such that am ≡ 1 (mod p).
Try listing out the orders of integers modulo 7 or 11. It is easy to notice that all of these orders
will divide p − 1, and in fact, it is true in general that if aN ≡ 1 (mod p), then the order of a
(mod p) divides N . You may try your hand at proving it, but note that this will be explored
in a later handout.

§17.2 Euler’s Theorem

Naturally, some questions arise. What if we could apply the concepts from the previous section
to a modulo m where m is not prime? Does the concept of orders exist for nonprime m? As
we’ll see later, we can prove an arguably stronger result that applies for all modulos m: Euler’s
Theorem.
But first off, let’s apply an analogous definition of orders. Let a be a positive integer such that
a and m are relatively prime. Then the order of a modulo m is the smallest exponent e such
that e is a positive integer and ae ≡ 1 (mod m). One more thing — φ(m), also known as known
as Euler’s totient function, is the number of integers from 1 and m that are relatively prime
to m. This is an important quantity that we will explore in more depth in the next section!
Now we can prove a stronger version of Fermat’s Little Theorem that holds modulo composite
numbers, also known as Euler’s Theorem:

Theorem 17.8. (Euler’s Theorem) Let m be a positive integer, and a be a positive integer
such that a and m are relatively prime. Then

aφ(m) ≡ 1 (mod m).

Proof. This proof is similar to the proof of Fermat’s Little Theorem. Let b1 , b2 , . . . , bφ(m) be
the φ(m) numbers from 1 and m that are relatively prime to m. Then we prove the following
lemma.

Lemma 17.9. Let m be a prime number, and a be a positive integer such that a and m are
relatively prime. Then the sets {b1 , b2 , b3 , . . . , bφ(m) } (mod m) and {ab1 , ab2 , ab3 , . . . , abφ(m) }
(mod m) are equal.

Proof. Since there are only φ(m) distinct non-zero values modulo m, this means that each
element of {ab1 , ab2 , ab3 , . . . , abφ(m) } (mod m) must be distinct – otherwise the sets cannot be
equal. We claim that every element of {ab1 , ab2 , ab3 , . . . , abφ(m) } (mod m) is unique. We can
proceed with a proof by contradiction. Let’s assume for contradiction that there exists numbers
ja and ka in the set {ab1 , ab2 , ab3 , . . . , abφ(m) } (mod m) such that

ja ≡ ka (mod m)

and
j 6≡ k (mod m).
However, since a is relatively prime to m, a has a multiplicative inverse a−1 , so then we can
multiply both sides of
ja ≡ ka (mod m)

4
Everaise Academy (2020) Math Competitions II

with a−1 . The resulting equivalence is j ≡ k (mod m), which is a contradiction, because we
had said earlier that j 6≡ k (mod m)! Thus, our assumption was false, and every element of
{ab1 , ab2 , ab3 , . . . , abφ(m) } (mod m) is unique. Then the set contains φ(m) distinct non-zero
values, as desired. Thus the sets {b1 , b2 , b3 , . . . , bφ(m) } (mod m) and {ab1 , ab2 , ab3 , . . . , abφ(m) }
(mod m) must be equal.


We know that the sets are equal. Then we can multiply the elements in each of the sets,
Qφ(m)
and these products will be equal. Let k=1 bk be the product of {b1 , b2 , b3 , . . . , bφ(m) }, and
Qφ(m)
k=1 abk (mod m) be the product of {ab1 , ab2 , ab3 , . . . , abφ(m) }. Then we know that

φ(m) φ(m)
Y Y
bk ≡ abk (mod m).
k=1 k=1
Qφ(m)
Let us call B = k=1 bk . Then, substituting in B, we have

B ≡ B · aφ(m) (mod m).

Since B and m are relatively prime, we know that we can multiply by B −1 on both sides to
obtain
aφ(m) ≡ 1 (mod m)
as desired. 

Remark. When m is a prime, we have that φ(m) = m − 1. Hence, Euler’s theorem is just
a stronger version of Fermat’s Little Theorem, which states ap−1 ≡ 1 (mod p).

Okay, so Euler’s Theorem is a great extension of Fermat’s Little Theorem, and can come in
handy during competitions. However, it won’t be useful without an efficient way of finding the
value of φ(m). Let’s start with prime primes. After all, we already know that φ(p) = p − 1.

Proposition 17.10 (Totient Function Formula for pk ). If p is a prime and k ≥ 1, then

φ(pk ) = pk − pk−1 .

Proof. Let’s start with all of the integers a from 1 to pk . Then, φ(pk ) counts all of the integers
a that are relatively prime to pk , so thus these integers must be relatively prime to p.
pk
Let’s use complementary counting. There are pk numbers from 1 to pk , and there are p =
pk−1 integers from 1 to pk that are divisible by p, so we have that

φ(pk ) = pk − pk−1 ,

as desired. 

What if m is the product of two prime powers? Let’s see if you observe anything interesting.

Exercise 17.11. Calculate φ(4), φ(5), then φ(20). Calculate φ(7), φ(3), then φ(21). Do you
notice a pattern?

After that exercise, you may have been able to conjecture the following:

5
Everaise Academy (2020) Math Competitions II

Proposition 17.12 (Multiplicative Property of Totient Function). If gcd(m, n) = 1, then


φ(mn) = φ(m)φ(n).

This property will be explored in greater depth in the next section. For now, let’s combine
the two properties to obtain a formula for φ(m).

Theorem 17.13 (Totient Function Formula). Let m be a positive integer with p1 , p2 , . . . , pr


as the distinct primes that divide m. Then the formula for φ(m) is the following:
    
1 1 1
φ(m) = m 1 − 1− ··· 1 − .
p1 p2 pr

Proof. If m has the distinct prime factors p1 , p2 , . . . , pr , then we can express m as the following:

m = pe11 pe22 . . . perr

where each ek is the corresponding exponent for pk . Then, because of the totient function’s
multiplicative property, we know that

φ(m) = φ(pe11 )φ(pe22 ) . . . φ(perr )

since each prime power is relatively prime to the other prime powers. Then, since we know that
the totient formula for pk is φ(pk ) = pk − pk−1 , we can write

φ(m) = (pe11 − pe11 −1 )(pe22 − pe22 −1 ) · · · (perr − perr −1 ).

Further, for each prime p, φ(pk ) can be rewritten as the following:


 
1
φ(pk ) = pk − pk−1 = pk 1 − .
p

We can express φ(m) as


     
1 1 1
φ(m) = pe11 1− e2
p2 1 − er
· · · pr 1 − .
p1 p2 pr

Substituting in m = pe11 pe22 . . . perr , we have that


    
1 1 1
φ(m) = m 1 − 1− ··· 1 − ,
p1 p2 pr

as desired. 

Now that we’ve proved Euler’s theorem and how to find the totient of a number, let’s apply
these concepts to some competition questions!

Example 17.14 (1983 AIME). Let an = 6n + 8n . Determine the remainder upon dividing
a83 by 49.

6
Everaise Academy (2020) Math Competitions II

Solution. Our goal is to determine the value of

a83 ≡ 683 + 883 (mod 49).

Since 6 and 8 are both relatively prime to 49, it looks like we can apply Euler’s theorem! First,
6
φ(49) = 49 · = 42.
7
Thus,
683 + 883 ≡ 684 · 6−1 + 884 · 8−1 .
Since 84 = 2 · 42, we know that 884 and 684 have a remainder of 1 (mod 49). Simplifying results
in
a83 ≡ 6−1 + 8−1 (mod 49).

But as 6 · 8 = 48, it follows that 6 · 8 ≡ −1 (mod 49) and 6−1 ≡ −8. Similarly, 8−1 ≡ −6, so
6−1+ 8−1 ≡ −14 ≡ 35 (mod 49), and our answer is 35. 

√ √
Example 17.15 (2009 Math Prize for Girls). When the integer ( 3 + 5)103 − ( 3 − 5)103 is
divided by 9, what is the remainder?

Solution. First, note that


√ √ √ √
( 3 + 5)103 − ( 3 − 5)103 = (5 + 3)103 + (5 − 3)103 .
√ √
Then, let’s expand (5 + 3)103 and (5 − 3)103 out using the Binomial theorem, and see what
will cancel out. We have that
√ 103 √ √
 
103 102 103
(5 + 3) = 5 + 103 · 5 · 3 + · 5101 · 3 + · · · + 103 · 5 · 351 + ( 3)103 ,
2

and that
√ √ √
 
103
(5 − 3)103 = 5103 − 103 · 5102 · 3+ · 5101 · 3 + · · · + 103 · 5 · 351 − ( 3)103 .
2
√ √
When we add (5 + 3)103 and (5 − 3)103 , all of the irrational terms cancel out, leaving us with
√ 103 √ 103
   
103 103 101 51
(5 + 3) + (5 − 3) = 2 5 + · 5 · 3 + · · · + 103 · 5 · 3 .
2

Now we need to determine the value of this expression modulo 9. Conveniently, all of the
terms (excluding the first two) of 5103 + 103
 101
2 · 5 · 3 + · · · + 103 · 5 · 351 are divisible by 9, so
       
103 103 101 51 103 103 101
2 5 + · 5 · 3 + · · · + 103 · 5 · 3 ≡2 5 + ·5 ·3 (mod 9).
2 2
2
This looks like a great opportunity to apply Euler’s theorem! Since φ(9) = 9 · 3 = 6, we know
that
5103 ≡ 5 (mod 9)
and
5101 ≡ 5−1 ≡ 2 (mod 9).

7
Everaise Academy (2020) Math Competitions II

Substituting back into our given expression, we have that


     
103 103 101 103
2 5 + ·5 ≡ 2(5 + · 2 · 3) (mod 9).
2 2

Further, 103 = 103·102 103


 
2 2 = 51 · 103, so it is divisible by 3. Thus, the expression 2 · 2 · 3 is
divisible by 9, so it is equivalent to 0 (mod 9). Finally, that gives us
 
103
2(5 + · 2 · 3) ≡ 2(5 + 0) ≡ 10 ≡ 1 (mod 9).
2
√ √
Therefore, the remainder of ( 3 + 5)103 − ( 3 − 5)103 is 1. 

Exercise 17.16. For every m ≥ N, φ(m) is even. Determine the value of N and explain why
φ(m) remains even if m ≥ N.

Lastly, to end this section, we have a proof of a really cool property involving the sum of
totient functions of the divisors of a number. First, let’s try and verify this property numerically.

Exercise 17.17. What is the value of φ(1) + φ(2) + φ(4)? What is the value of φ(1) + φ(2) +
φ(7) + φ(14)?

Hopefully you noticed the following:

Example 17.18. Show that X


φ(d) = n.
d|n

m
Solution. First, let us consider all fractions n such that 1 ≤ m ≤ n:

1 2 3 n−1 n
, , ,··· , , .
n n n n n
There are n such fractions. Then, when we simplify these fractions to their most reduced form,
each fraction is in the form dp , where d is a divisor of n, p ≤ d, and gcd(p, d) = 1. There are φ(d)
such numbers, by definition, where the simplified fraction is of the form dp . Thus,
P
φ(d) = n.
For example, let’s consider this for n = 9. We write out the fractions as follows:
1 2 3 4 5 6 7 8 9
, , , , , , , ,
9 9 9 9 9 9 9 9 9
and these can be simplified as
1 2 1 4 5 2 7 8 1
, , , , , , , , .
9 9 3 9 9 3 9 9 1
There are φ(9) = 6 fractions with the denominator 9 when simplified, there are φ(3) = 2
fractions with the denominator of 3, and φ(1) = 1 fraction with denominator 1. 

§17.3 Chinese Remainder Theorem

Another useful result is the Chinese Remainder Theorem, which allows us to solve systems of
congruence relations when the modulos are relatively prime.

8
Everaise Academy (2020) Math Competitions II

Theorem 17.19 (Chinese Remainder Theorem). Let m and n be relatively prime positive
integers. For all integers a and b, the pair of congruences x ≡ a (mod m) and x ≡ b
(mod n) has a unique solution modulo mn.

Proof. The first congruence tells us that there exists y ∈ Z such that x = a + my. Thus,
we substitute x in the second congruence to get a + my ≡ b (mod n). We rearrange to get
my ≡ b − a (mod n). Since gcd(m, n) = 1, m has a unique inverse modulo n, say m−1 . We
multiply both sides by m−1 to get y ≡ m−1 (b − a) (mod n). This congruence tells us that there
exists a z ∈ Z such that y = m−1 (b − a) + nz. Substituting this back into the equation for x,
we have:
x = a + my = a + m(m−1 (b − a) + nz) = a + mm−1 (b − a) + mnz
We may quickly check that x satisfies the initial congruences:
a + mm−1 (b − a) + mnz ≡ a (mod m)
a + mm−1 (b − a) + mnz ≡ a + b − a ≡ b (mod n).
Thus, there exists a unique solution for x modulo mn. 

Although the proof only covers solving for a unique value of x with two congruences, the
theorem can easily be extended. Try it out for yourself in the following exercise.

Exercise 17.20. Solve the following system of congruences:


x≡4 (mod 11)
x≡3 (mod 17)
x≡6 (mod 18).

Although the Chinese Remainder Theorem allows us to find a unique x modulo mn such that
x ≡ a (mod m) and x ≡ b (mod n), most of the applications involve splitting modulos. This
idea sounds a little abstract, so let’s try out some examples.

Example 17.21 (2017 AMC 12B). Let N = 123456789101112 . . . 4344 be the 79-digit num-
ber that is formed by writing the integers from 1 to 44 in order, one after the other. What
is the remainder when N is divided by 45?

Solution. 45 can be broken down into two relatively prime factors: 5 and 9. Thus, if we can
find what N is congruent to modulo 5 and 9, we will be able to find N . Clearly, N ≡ 4 (mod 5),
so it remains to compute N modulo 9.
Since N is congruent to the sum of its digits modulo 9, we have
123456789101112 . . . 4344 ≡ 1 + 2 + 3 + . . . + 4 + 3 + 4 + 4 (mod 9)
≡ 1 + 2 + 3 + . . . + 43 + 44 (mod 9)
44 × 45
≡ (mod 9)
2
≡ 0 (mod 9)

Thus, N ≡ 0 (mod 9). We look for the unique solution modulo 45, and by inspection, we see
that N ≡ 9 (mod 45). Thus, the remainder when N is divided by 45 is 9. 

9
Everaise Academy (2020) Math Competitions II

If you aren’t convinced that this works, try solving for N using the method in the proof of
the Chinese Remainder Theorem.

Example 17.22 (2017 HMMT). Find the number of integers n with 1 ≤ n ≤ 2017 so that
(n − 2)(n − 0)(n − 1)(n − 7) is an integer multiple of 1001.

Solution. Applying a similar technique, let’s break 1001 down into relatively prime factors
that are easier to work with. We have 1001 = 7 × 11 × 13, so (n − 2)(n − 0)(n − 1)(n − 7) must
be a multiple of 7, 11 and 13.
There are 3 possible values of n modulo 7 (since n ≡ n − 7 (mod 7)), 4 possible values of n
modulo 11, and 4 possible values of n modulo 13. By the Chinese Remainder Theorem, this
means that there are 4 × 4 × 3 = 48 values of n with 1 ≤ n ≤ 1001. We may also say that there
are 48 values of n with 16 ≤ n ≤ 1016 and 48 values of n with 1017 ≤ n ≤ 2017. We have 96
values of n between 16 ≤ n ≤ 2017, so it remains to check n = 1, 2, 3, . . . , 15.
The final check is straightforward and left to the reader. Confirm that 3 values work, so the
total number of integers n with 1 ≤ n ≤ 2017 is 96 + 3 = 99. 

Try out the following exercises, which involve splitting and recombining modulos.

Exercise 17.23 (2011 AMC 10B). What is the hundreds digit of 20112011 ?

Exercise 17.24 (2012 AIME II). For a positive integer p, define the positive integer n to be
p-safe if n differs in absolute value by more than 2 from all multiples of p. For example, the set
of 10-safe numbers is {3, 4, 5, 6, 7, 13, 14, 15, 16, 17, 23, . . .}. Find the number of positive integers
less than or equal to 10, 000 which are simultaneously 7-safe, 11-safe, and 13-safe.

With the Chinese Remainder Theorem in mind, we may revisit finish an example from a
previous handout.

Example 17.25 (2016 CMIMC). Determine the smallest positive prime p which satisfies the
congruence

p + p−1 ≡ 25 (mod 143)

Here, p−1 as usual denotes multiplicative inverse.

Solution. In the earlier handout, we multiplied both sides by p and manipulated to get (p −
9)(p − 16) ≡ 0 (mod 143). We found that p = 9, 16 are trivial solutions to the congruence, but
there are more!
In particular, since 143 is not prime, we may have p − 9 ≡ 0 (mod 11) and p − 16 ≡ 0
(mod 13) to get p ≡ 42 (mod 143) with the Chinese Remainder Theorem. Also, we may have
p − 9 ≡ 0 (mod 13) and p − 16 ≡ 0 (mod 11) to get p ≡ 126 (mod 143).
Since 9, 16, 42, and 126 are all composite, we add 143 to all of them to get the next set: 152,
159, 185, and 269. We test each of these and find that the first three are composite, but 269 is
prime. Thus, 269 is the smallest prime satisfying these conditions. 

The Chinese Remainder Theorem can also be used to prove that the totient function is
multiplicative. To end off, let’s see how we may go about proving this.

10
Everaise Academy (2020) Math Competitions II

Proposition 17.26 (Multiplicative Property of Totient Function). If gcd(m, n) = 1, then


φ(mn) = φ(m)φ(n).

Proof. We can prove this by counting the number of elements in two sets: one that has φ(mn)
elements, and another that has φ(m)φ(n) elements. If we can show that these sets have the
same number of elements, then we can prove that φ(mn) = φ(m)φ(n). The first set is simply
the set of all positive integers a such that a ≤ mn and gcd(a, mn) = 1. By definition, this set
must have φ(mn) elements.
Then, let the second set be the collection of all ordered pairs (b, c) such that b is between 1
and m and gcd(b, m) = 1 along with c being between 1 and n and gcd(c, n) = 1. Since there
are φ(m) choices for b and φ(n) choices for c, the set of all ordered pairs (b, c) has φ(m)φ(n)
elements.
If we can show that a bijection, or one-to-one mapping, exists between the two sets, then we
know that both sets have the same number of elements. In order to do this, we need to check
two statements:
1. Different a in the first set correspond to different (b, c) in the second set (this is called an
injection);
2. Every pair (b, c) in the second set corresponds to some number a in the first set (this is
called a surjection).
To check the first statement, let us suppose that a1 and a2 in the first set correspond to the
same pair (b1 , c1 ) in the second yet. This means that

a1 ≡ a2 ≡ b1 (mod m)

and
a1 ≡ a2 ≡ c1 (mod n).
Because this is true, we know that a1 −a2 is divisible by both m and n, and since gcd(m, n) = 1,

a1 − a2 ≡ 0 (mod mn)

as well. In other words, we have that a1 ≡ a2 (mod mn), so a1 and a2 are the same element in
the first set. This proves the first statement.
The second statement is a rephrase of the Chinese Remainder Theorem, which we have
previously proved. Thus, a one-to-one correspondence exists between the two sets, so the two
sets have the same number of elements. Therefore, we have that

φ(mn) = φ(m)φ(n)

as desired. 

§17.4 Homework Problems

Problem 17.1 (David Santos). [4] Find all primes p such that p divides 2p + 1.

Problem 17.2. [5] Find all integers x such that x86 ≡ 6 (mod 29).

11
Everaise Academy (2020) Math Competitions II

Problem 17.3 (Wilson’s Theorem). [6] In this problem, we prove Wilson’s Theorem: Let p ∈ Z
with p ≥ 1 then p is a prime if and only if (p − 1)! ≡ −1 (mod p).
(a) Prove that if p is not a prime then (p − 1)! 6≡ −1 (mod p).
(b) Prove that if p is a prime then (p − 1)! ≡ −1 (mod p).

Problem 17.4 (Joseph Zoller). [7] Find all positive integers x such that 22x+1 + 2 is divisible
by 17.

Problem 17.5 (2012 HMMT). [8] Given any positive integer, we can write the integer in base
12 and add together the digits of its base 12 representation. We perform this operation on the
21
5 43
number 76 repeatedly until a single base 12 digit remains. Find this digit.

Problem 17.6 (2019 Acton-Boxborough Math Competition). [6] What are the last four digits
of 21000 ?

Problem 17.7 (Joseph H. Silverman). [6] Find all values of n that solve the following equations:
n
(a) φ(n) = 2
n
(b) φ(n) = 3
n
(c) φ(n) = 6

Problem 17.8. [5] Let p be an odd prime. Show that a2p−1 ≡ a (mod 2p).

Problem 17.9. [5] Let a and b be relatively prime integers greater than or equal to 1. Show
that aφ(b) + bφ(a) ≡ 1 (mod ab).

Problem 17.10 (2016 HMMT). [6] For each positive integer n and non-negative integer k,
define W (n, k) recursively by
(
nn k=0
W (n, k) =
W (W (n, k − 1), k − 1) k > 0.

Find the last three digits in the decimal representation of W (555, 2).

Problem 17.11 (2010 AMC 12 A). [7] The number obtained from the last two nonzero digits
of 90! is equal to n. What is n?

Problem 17.12 (IMO 1989). [8] Prove that for every positive integer n, there exists n consec-
utive positive integers such that none of them is a power of a prime.

Problem 17.13 (CMIMC 2016). [10] Define a tasty residue of n to be an integer 1 ≤ a ≤ n


such that there exists an integer m > 1 satisfying am ≡ a (mod n). Find the number of tasty
residues of 2016.

Problem 17.14. For each nonnegative integer n we define An = 23n + 36n+2 + 56n+2 .
(a) [4] What’s the value of A0 ?
(b) [7] (1999 JBMO) Find the greatest common divisor of the numbers A0 , A1 , . . . , A1999 .

12
18 Orders and Primitive Roots

§18.1 Modular Inverses

Before we start developing theories about orders and primitive roots, let’s first review the
concept of a modular inverse.

Definition 18.1. We define the modular inverse of a (mod m) as an integer k, with 0 ≤ k < m,
such that ak ≡ 1 (mod m). In this case, we write k = a−1 mod m.

Note. This is analogous to the definition of a multiplicative inverse, where a number multiplied
by its multiplicative inverse equals 1.

As an example, 3 and 2 are inverses modulo 5 as 3 · 2 ≡ 1 (mod 5). In this case, we write
2 = 3−1 (mod 5) and 3 = 2−1 (mod 5).

Question. What is 4−1 (mod 6)?

From our definition, we’re looking for an integer k such that 4k ≡ 1 (mod 6). However, no
such integer exists: 4k is always even, and anything congruent to 1 (mod 6) must be odd. This
example shows that modular inverses don’t necessarily exist. In fact, the modular inverse a−1
(mod m) exists if and only if gcd(a, m) = 1 (can you show why?).

Using the language of modular inverses is often a useful step in solving challenging problems in
number theory. Let’s take a look at an example from the International Math Olympiad:

Example 18.2 (2005 IMO). Determine all positive integers relatively prime to all terms of
the infinite sequence an = 2n + 3n + 6n − 1 for n ≥ 1.

Solution. Let’s try to figure out when a certain prime number p will divide the expression.
When dealing with powers mod a prime, Fermat’s Little Theorem is a useful tool: it tells us

ap−1 ≡ 1 (mod p)

when a is not divisible by p. In particular, as long as p is not 2 or 3, we can apply this theorem
to a = 2, 3, 6. This gives us 2p−1 ≡ 1 (mod p), and so on.
Notice that 2−1 + 3−1 + 6−1 = 1. This motivates us to think about modular inverses: in fact,
since we’ve stipulated that p 6= 2, 3, the modular inverses 2−1 , 3−1 , 6−1 all exist mod p (as 2, 3, 6
are coprime to p)! Therefore, we can multiply 2p−1 ≡ 1 (mod p) by 2−1 on both sides to get
2p−2 ≡ 2−1 (mod p), and similarly for 3 and 6. Adding these equations up, we get:

2p−2 + 3p−2 + 6p−2 ≡ 2−1 + 3−1 + 6−1 ≡ 1 (mod p)

Or in other words, ap−2 ≡ 0 mod p. For all primes p 6= 2, 3, we’ve found a term in the
sequence that’s a multiple of p; for p = 2, 3, we can choose a2 = 48. Therefore, only 1 is
relatively prime to every term in the sequence. 

1
Everaise Academy (2020) Math Competitions II

§18.2 Orders

Definition 18.3. Let m be an integer and take a such that gcd(a, m) = 1. We define the order
of a modulo m as the smallest positive integer k such that

ak ≡ 1 (mod m).

In this case, we write ordm (a) = k.

Note. By Euler’s Theorem, we know aϕ(m) ≡ 1 (mod m), so such a k must exist.

Example 18.4. Two quick examples.


1. Find the order of 2 modulo 5.
2. Find the order of 2 modulo 65.

Solution. The first part is not difficult: we see that 21 ≡ 2, 22 ≡ 4, 23 ≡ 3, and 24 ≡ 1 (mod 5),
so therefore ord5 (2) = 4.
The second part is a bit trickier: after all, it seems tiresome to list out more and more powers
of 2. Rather, let’s note that 26 = 64 ≡ −1 (mod 65). That means that 212 ≡ 1 (mod 65), so it
seems that ord65 (2) = 12. There’s only one thing left to check — that 2n 6≡ 1 (mod 65) when
n = 1, 2, . . . , 11, which we leave to the reader as an exercise. 

Theorem 18.5 (Fundamental Theorem of Orders). Let ordm (a) = k. Then

aN ≡ 1 (mod m) ⇐⇒ k|N.

In particular, k will be a divisor of φ(m).

Proof. Assume aN ≡ 1 (mod m). We can apply the division algorithm to write N = dk + r
where 0 ≤ r < k and d ∈ Z. Therefore,

1 ≡ aN ≡ adk+r ≡ (ak )d (ar ) ≡ ar (mod m)

where we get the last equality since ak ≡ 1 mod m. Now if r > 0, then this contradicts the fact
that k is defined to be the smallest positive integer satisfying ak ≡ 1 mod m. So we must have
r = 0, meaning k|N as desired.
Showing the other direction (k|N =⇒ aN ≡ 1 (mod m)) is easy; we’ll leave that to you. 

Remark. What this theorem is really saying is that if ordm (a) = k, then for any N such
that aN ≡ 1 (mod m), then N is a multiple of k. Sometimes it can be useful to write
things down in words if symbols get a bit confusing!

Let’s try an example! This was Problem 14 on a recent AIME.

Example 18.6 (2019 AIME I). Find the least odd prime factor of 20198 + 1.

2
Everaise Academy (2020) Math Competitions II

Solution. We’re looking for an odd prime such that 20198 ≡ −1 (mod p). Squaring gives
201916 ≡ 1 (mod p), so the order of 2019 mod p must divide 16. However, the order can’t be
1, 2, 4, or 8, since then we’d have 20198 ≡ 1 (mod p). So ordp (2019) = 16; that is, the minimal
k such that 2019k ≡ 1 (mod p) is k = 16.
By the Fundamental Theorem of Orders, 16 must divide φ(p) = p − 1. Equivalently, p ≡ 1
(mod 16). We can verify that p = 17 doesn’t work, but the next smallest candidate, p = 97 ,
does work. 

Remark. The moral of the story is to not be afraid of those late AIME number theory
problems! Most of them boil down to having a solid understanding of the fundamental
concepts we’ve covered so far.

Example 18.7. Find all integers (a, b, c) which satisfy a11 + 11b11 + 111c11 = 0.

Solution. When solving an equation over the integers, you’ll almost always have to take the
equation modulo some carefully chosen number to simplify some of the terms. Here, we see
that all the terms are taken to the 11th power, so Fermat’s Little Theorem comes to mind.
We know ap−1 ≡ 1 mod p when p - a and p is prime. We’d love to substitute p = 12 to
get a11 in our expression, but this isn’t possible as 12 isn’t prime. We do the next best thing:
substitute p = 23 to get a22 = (a11 )2 ≡ 1 mod 23. Therefore, when 23 - a, a11 ≡ ±1 mod 23.
When 23 | a, we of course have a11 ≡ 0 mod 23.
This seems promising! Taking the given equation mod 23 gives a11 +11b11 +19c11 ≡ 0 mod 23,
where a11 , b11 , c11 are all either −1, 0, or 1 mod 23. After checking a few cases, we can see this
modular congruence is only satisfied when a11 ≡ b11 ≡ c11 ≡ 0 mod 23. If this is the case, then
23|a, b, c, and we can let a = 23a0 , b = 23b0 , c = 23c0 for integers a0 , b0 , c0 .
Then, our equation becomes 2311 (a011 + 11b011 + 111c011 ) = 0. Dividing through by 2311 ,
we obtain the same equation as we started with! This means that once again, either all the
variables are divisible by 23, or there’s no solution. So, either we can keep dividing by 23 until
one of the corresponding a, b, c terms is not divisible by 23, in which case, taking the equation
mod 23 will yield no solutions, or we have a = b = c = 0. Thus, (a, b, c) = (0, 0, 0) is the only
integer solution. 

Remark. The method we used at the end (infinitely reduce to smaller solutions) is known as
Infinite Descent, and is a useful problem-solving tool when solving Diophantine Equations.

Example 18.8 (Naoki Sato). Show that ord101 (2) = 100.

Solution. In this type of problem, we have two steps: first, we must show that 2100 ≡ 1
(mod 101). Next, we must show that there cannot exist k < 100 such that 2k ≡ 1 (mod 101).
The first step is rather obvious: note that 2100 ≡ 1 (mod 101) by Fermat’s Little Theorem.
As for the next step: if k = ord2 (101) < 100, it would follow that 250 ≡ 1 (mod 101) or 220 ≡ 1
(mod 101) — this is because k clearly must be a factor of 100, by the Fundamental Theorem
of Orders, and so therefore if k 6= 100 it must be a factor of 50 or 20.

3
Everaise Academy (2020) Math Competitions II

But we can confirm that 220 ≡ −6 (mod 101) and 250 ≡ −1 (mod 101), so we are done. 

Let’s go over one last tough, involved Olympiad problem — hopefully you’ll be very familiar,
if not confident, with orders by the end of this. Get a few blank sheets of paper. This one’s a
long one, and you’ll need to really keep track of what’s going on.

Example 18.9 (2014 Bulgaria). Find all pairs of prime numbers p, q for which:

p2 | q 3 + 1 and q 2 | p6 − 1.

Solution. The condition p2 | q 3 +1 implies that kp2 = q 3 +1 for some k, so therefore taking the
equation modulo p2 yields q 3 ≡ −1 (mod p2 ). Since we want to use orders, it’s better to square
both sides, yielding q 6 ≡ 1 (mod p2 ). In a similar manner, we can derive p6 ≡ 1 (mod q 2 ).
Therefore ord(p2 ) q | 6 and ord(q2 ) p | 6. Moreover, as q 3 ≡ −1 (mod p2 ), it follows that
ord(p2 ) q 6= 1, 3. Why? Take some time to try and work it out for yourself.
Assuming you’ve thought about that for a moment, take a look: if ord(p2 ) q = 1 or 3, then
q3 ≡ 1 (mod p2 ). But we already know that q 3 ≡ −1 (mod p2 ), so p2 ≡ 1 or 2, an obvious
contradiction.
Therefore ord(p2 ) q = 2 or ord(p2 ) q = 6.
Case 1. ord(p2 ) q = 2. Then we have subcases to deal with, because we haven’t used the
condition that ord(q2 ) p | 6.
Case 1a. ord(q2 ) p = 1. Then p ≡ 1 (mod q 2 ), so p > q 2 . Moreover, from our assumption
that ord(p2 ) q = 2, we see that q 2 ≡ 1 (mod p2 ), so q 2 > p2 . This implies the inequality chain
p > q 2 > p2 , clearly absurd, so there are no working pairs (p, q) in this case.
Case 1b. ord(q2 ) p = 2. Then p2 ≡ 1 (mod q 2 ), so p2 > q 2 . Again, q 2 > p2 by assumption,
leading to another contradiction.
Case 1c. ord(q2 ) p = 3. Then p3 ≡ 1 (mod q 2 ) and q 2 ≡ 1 (mod p2 ). The same inequality trick
as before doesn’t work, unfortunately, but here’s a new method: note that q 2 − 1 ≡ 0 (mod p2 ),
so therefore
(q − 1)(q + 1) ≡ 0 (mod p2 ).

Therefore 1) q − 1 must be a multiple of p2 , 2) q + 1 must be a multiple of p2 , or 3) both


q + 1 and q − 1 must be multiples of p. Make sure you understand why this is the case! It’s
clear that q − 1 cannot be a multiple of p2 , as that would reduce to Case 1. Moreover, they
cannot both be multiples of p unless p = 2; if that is true, the ordq2 2 = 3 implies that 23 ≡ 1
(mod q 2 ), which clearly gives no solutions.
Thus q ≡ −1 (mod p2 ). That means that we get to do our inequality trick again: we have
q ≥ p2 − 1 from the above work, and p3 − 1 ≥ q 2 from the assumption made in this case.
Therefore
p3 − 1 ≥ q 2 ≥ (p2 − 1)2
and it’s not hard to check that this inequality never holds when p ≥ 2. Therefore there are no
solutions in this case.
Case 1d. ord(q2 ) p = 6. Thus p6 ≡ 1 (mod q 2 ), and as in Case 1c we find that q ≡ −1
(mod p2 ).

4
Everaise Academy (2020) Math Competitions II

We’ll do our factoring trick again: we see that p6 − 1 ≡ 0 (mod q 2 ), so (p3 − 1)(p3 + 1) ≡ 0
(mod q 2 ). As p3 6≡ 1 (mod q 2 ) — by the definition of order, and handled in Case 1c — it
follows that once again, either p3 − 1 and p3 + 1 are multiples of q or that p3 + 1 ≡ 0 (mod q 2 ).
In the former case, we would get q = 2, which would clearly contradict q ≡ −1 (mod p2 ). In
the latter case, p3 + 1 ≡ 0 (mod q 2 ), so we obtain

p3 + 1 ≥ q 2 ≥ (p2 − 1)2

where we have used the fact that q ≥ p2 − 1, which comes from q ≡ −1 (mod p2 ).
The above inequality clearly holds only when p = 2. Then ord(q2 ) p = 6 implies 26 ≡ 1
(mod q 2 ), so q 2 | 63 implies q = 3. We can check that (p, q) = (2, 3) satisfies the given
conditions, so we’ve found a solution.
Whew! That exhausts all the cases for which ord(p2 ) q = 2. We’ll leave it as a pair of exercises
to the reader to deal with the case where ord(p2 ) q = 6 now. 

Exercise 18.10. Show that when ord(p2 ) q = 6 and p 6= 2 that q 3 ≡ −1 (mod p2 ).

Exercise 18.11. Finish off the previous example problem by considering the following cases:
1. ord(q2 ) p = 1. You should end up with no solutions in this case — use the inequality
method.
2. ord(q2 ) p = 2. This is very similar to Case 1d — you should end up with one solution.
3. ord(q2 ) p = 3. Factor q 3 ≡ −1 (mod p2 ) further! Use that to obtain something about
q 2 − q + 1, and use that to obtain inequalities that prove that there are no solutions in
this case.
4. ord(q2 ) p = 6. More inequalities — there should be no solutions in this case.
Conclude that the only possible ordered pairs (p, q) are (2, 3) and (3, 2).

§18.3 Primitive Roots

We’ve learned that the order of a mod m is a divisor of ϕ(m). What happens when the order
of a is actually equal to ϕ(m)? These numbers are of special interest, as we’ll soon find out.

Definition 18.12. Suppose that gcd(g, m) = 1 and that ordm (g) = φ(m). Then we say that g
is a primitive root modulo m.

An important special case when our modulus is a prime p, in which case a generator is just
something with order p − 1. Let’s look at an example.

Example 18.13. 3 is a primitive root mod 7.

To verify this, we can list out the powers of 3 in the following table:

k 1 2 3 4 5 6
3k (mod 7) 3 2 6 4 5 1

5
Everaise Academy (2020) Math Competitions II

As expected, k = 6 is the smallest positive integer such that 3k ≡ 1 (mod 7), so 6 is the order
of 3 mod 7. Since φ(7) = 6, 3 is indeed a primitive root mod 7.

The table also reveals an interesting pattern: the powers of 3 cover all possible residues mod
7, with the exception of 0. This makes sense, as there are p − 1 possible residues modulo p
excluding 0, and none of the first p − 1 powers can repeat (why?). Formally, we’d write this
observation as:

Corollary 18.14. Let g be a primitive root modulo p. Then the set

A = {0} ∪ {g i | 1 ≤ i ≤ p − 1}

is a complete residue class modulo p.

This is why we denote a primitive root as g, because raising it to powers generates all nonzero
residues modulo p! In fact, primitive roots are sometimes referred to as generators.

Here are a couple fundamental facts about primitive roots, which you’re encouraged to prove
in the bonus exercises.

Theorem 18.15 (Existence of Primitive Roots). There exists a primitive roots g modulo a
if and only if a = 2, 4, pk , 2pk for any odd prime number p and k ≥ 1.

Theorem 18.16. Let n be a positive integer with a primitive root. Then n has ϕ(ϕ(n))
primitive roots.

The existence of a primitive root mod a prime p can be used to nuke a lot of challenging prob-
lems. We’ll present a couple examples—try to solve them before reading the solutions!

Theorem 18.17 (n2 +1 lemma). Let p be an odd prime. Then there exists a natural number
n such that p|n2 + 1 if and only if p ≡ 1 mod 4.

Proof. Let p be an odd prime dividing n2 + 1. Then n2 ≡ −1 mod p. Squaring gives us n4 ≡ 1


mod p, so ordp (n) = 4. By Theorem 18.2, ordp (n)|p − 1, therefore 4|p − 1, so p ≡ 1 mod 4.
For the reverse direction, we assume p is a prime congruent to 1 mod 4. Let g be a primitive
p−1
root mod p. We claim that n = g 4 satisfies p|n2 + 1. We can see this is true as n4 = g p−1 ≡ 1
mod p, so p|(n4 − 1) = (n2 − 1)(n2 + 1). Since g is a primitive root mod p, we cannot have
p−1
p|n2 − 1, or else this would imply g 2 ≡ 1 mod p. Thus, we must have p|n2 + 1. 

Example 18.18. Let p be a prime and n < p − 1 a positive integer. Prove that
p−1
X
in ≡ 0 (mod p).
i=1

6
Everaise Academy (2020) Math Competitions II

Solution. By Lemma 18.8, we have


{1, ..., p − 1} = {g i | 1 ≤ i ≤ p − 1}
in some order, so we can rewrite p−1
P n
Pp−1 ni
i=1 i as i=1 g mod p. This is now a geometric series with
n p−1 −1
common ratio g and first term g . Evaluating the sum, we obtain p−1
n n ni = g n · (g )
P
i=1 g g n −1 .
By Fermat’s Little Theorem, we know that p|(g ) n p−1 n
− 1, and since n < p − 1, p - g − 1, so the
numerator has a factor of p which is not cancelled by the denominator, thus the sum is divisible
by p. 

§18.4 The Smallest Prime Trick

In this section, we discuss a more advanced trick that appears often in olympiad problems, by
looking at a motivating example.

Example 18.19. Find all positive integers n such that n|2n − 1.

Solution. The most natural thing to do is to begin by plugging in a few values of n. After a
few choices of n, you will probably convince yourself that no values of n other than 1 work. But
how do you prove this?
We consider orders once again. Let p be a prime dividing n. Clearly p > 2 since 2n − 1
is odd. Then since p|n|2n − 1, we have 2n ≡ 1 mod p, so ordp (2)|n. We also know that
ordp (2)|φ(p) = p − 1. Why is this important? Well, if we had p|n such that gcd(p − 1, n) = 1,
then we’d have ordp (2) = 1. However, this would mean 2 ≡ 1 mod p, which is impossible.
So now we have reduced the problem to showing that we can always choose a prime factor p
of n > 1 such that gcd(p − 1, n) = 1. If this is the case, then any n > 1 cannot divide 2n − 1.
Now how do we choose a p for which this is true? Try experimenting with n = 3 · 5, 5 · 7, 3 · 5 · 7.
See if you can reason why we can always choose a p which works.
The answer is we choose p to be the smallest prime divisor of n. Since p − 1 is less than all
prime factors of n, p − 1 must be relatively prime to n. Since this can be done for all n > 1,
the only n for which n|2n − 1 is 1. 

The trick here was to consider the smallest prime factor of n, and use its existence to show a
contradiction. This is known as the smallest prime trick, and is something worth considering
for problems involving orders. Let’s try another example.

Example 18.20 (China TST 2006). Find all pairs (a, n) of positive integers such that
n|(a + 1)n − an .

Solution. Clearly all pairs (a, 1) work, so we assume n > 1. Let p be the smallest prime divisor
of n. Since (a + 1)n ≡ an mod p, we must have p - a, or else this would imply p|a + 1 as well,
which is impossible because a and a + 1 are relatively prime. By similar reasoning, we must
also have p - a + 1. Therefore, (a + 1)n ≡ an mod p, and Fermat’s Little Theorem also gives us
(a + 1)p−1 ≡ ap−1 mod p. It follows that (a + 1)gcd(n,p−1) ≡ agcd(n,p−1) mod p, but since p is the
smallest prime factor of n, p − 1 and n are relatively prime (why?). Consequently, we obtain
a + 1 ≡ a mod p, which is a contradiction. Thus, there are no solutions for n > 1, so the only
(a, n) which work are (a, 1). 

7
Everaise Academy (2020) Math Competitions II

§18.5 Problems

Note: When solving problems involving orders, it is often helpful to think about properties of
exponents in general. Not all problems here necessarily use orders in their solutions, but are
included as practice to become comfortable using exponents. Problems are ordered roughly
in terms of difficulty. Additionally, we cannot stress enough: these problems are hard; in
particular, the bonus problems are quite challenging, so don’t be discouraged if you are unable
to solve a problem after spending a long time. Lastly, good luck, and have fun solving!

Problem 18.1 (2001 AIME II). [6] How many positive integer multiples of 1001 can be ex-
pressed in the form 10j − 10i , where i and j are integers and 0 ≤ i < j ≤ 99?

Problem 18.2. [6] Prove that for any positive integers a, n with a > 1, we have

n|ϕ(an − 1).

Problem 18.3 (2007 ISL N2). [8] Let b, n > 1 be integers. Suppose that for each k > 1 there
exists an integer ak such that b − ank is divisible by k. Prove that b = An for some integer A.

Problem 18.4 (2015 PUMaC). [5] Find the smallest positive integer n such that n15 ≡ 20
mod 29.

Problem 18.5 (2018 AIME I). [7] Find the least positive integer n such that when 3n is written
in base 143, its two right-most digits in base 143 are 01.

Problem 18.6 (1996 Romania TST). [10] Find all primes p, q such that ∀ n ∈ N, 3pq|n3pq − n.

Problem 18.7 (2005 USAMO). [10] Prove that the system of equations

x6 + x3 + x3 y + y = 147157
x3 + x3 y + y 2 + y + z 9 = 157147
has no integer solutions.

Problem 18.8 (2016 HMMT February). [8] For positive integers n, let cn be the smallest
positive integer such that 210|ncn − 1, if such a positive integer exists, and cn = 0 other wise.
Find 210
P
i=1 ci .

Problem 18.9 (2014 HMMT November). [8] Determine all positive integers 1 ≤ m ≤ 50 for
which there exists an integer n such that m|nn+1 + 1.

Problem 18.10 (2019 HMMT February). [10] Find the least two positive integers n such that
ordn (m) < ϕ(n)
10 ∀ m ∈ N relatively prime to n.

8
19 Squares, Sums of Two Squares,
Quadratic Residues

19.1 Sums of Two Squares


19.1.1 Factorization in the Gaussian Integers

The set of Gaussian Integers, denoted Z[i], is defined as the set of complex numbers of the
form a + bi, where a, b are integers. The norm of a Gaussian Integer z = a + bi is denoted
N (z), and is equal to a2 + b2 . We can think of this as a measure of “size,” and we’ll see soon
that it has some very convenient properties.
In the integers (Z), we’re taught that every number has a unique prime factorization up to
fundamental unit elements, which are ±1. For example, 6 = 2 · 3 = −2 · −3. In the late 18th
century, it was a question of considerable interest to determine whether the set of Gaussian
Integers has similar properties: can we define primes and prime factorizations in a similar way
as we have done for integers?
The integers and Gaussian Integers are examples of mathematical structures that we call
commutative rings, which are sets where addition and multiplication between elements are
defined and some other properties like commutativity, associativity, and distributivity hold.
It’s important to note that multiplicative inverses don’t necessarily have to exist in a ring (for
example, there is no inverse of 2 in Z, as there does not exist another integer n such that
2n = 1.) For the elements that do have multiplicative inverses, we call them units.

Exercise 19.1. Verify that the unit elements in Z are ±1. What are the unit elements in
Z[i]?

Definition 19.2. In a ring, we say that a number p is prime if p is not 0 or a unit, and
p | ab implies p | a or p | b. Multiplying a prime by a unit element yields another prime in
the ring (why?).

Remark. This may be a little different from how you’ve typically seen primes defined before for
integers: try playing around with some numbers and convince yourself that the two definitions are
equivalent.

The natural question is, what are the primes in Z[i]? It would be nice if the primes in Z were
also primes in Z[i], but this is false! For example, consider

2 = (1 + i) · (1 − i).

Here, 2 divides the product, but it doesn’t divide each of the factors. So 2 is a prime in Z, but
not in Z[i]. We could also try to identify primes by “factorizing” Gaussian Integers, but when
would we know that a factor can’t be broken down anymore?

1
Everaise Academy (2020) Math Competitions II

This is where the idea of the norm comes in. A crucial fact about the norm is that it’s
multiplicative: that is, if z and w are Gaussian Integers, then N (zw) = N (z) · N (w).

Exercise 19.3. Prove, via algebraic manipulation, that the norm is multiplicative.

This statement looks pretty benign at first, but it actually provides crucial insight to identi-
fying exactly what the Gaussian primes are!

Theorem 19.4. Let p = a + bi be a Gaussian integer. Then p is a Gaussian prime if it


meets the following conditions:
• If a, b 6= 0, then p is a prime in Z[i] iff N (p) = a2 + b2 is a prime in Z.
• If a = 0, then p = bi is prime in Z[i] iff |b| is a prime in Z congruent to 3 mod 4.
• If b = 0, then p = a is prime in Z[i] iff |a| is a prime in Z congruent to 3 mod 4.

In section 19.1.2, we’ll show exactly why the 3 mod 4 condition is necessary for the second
and third statements. The first statement makes intuitive sense, given the multiplicativity of
the norm. If N (p) is prime in Z, then any factorization p = q ·r must satisfy N (p) = N (q)·N (r).
But since N (p) is prime, we must have either N (q) = 1 or N (r) = 1, which means that either q
or r is one of {±1, ±i}. However, this set is precisely the set of units in Z[i], so it follows that
p is prime in Z[i].
We’ve managed to show that N (p) being a prime in Z is a sufficient condition for p being
prime in Z[i], but we haven’t yet shown that it’s necessary (given a, b 6= 0). In particular, if we
have N (p) = a2 + b2 be a composite number in Z with a, b 6= 0, what breaks down? We’ll leave
this one to you to think about, as it’s not directly a motivating factor for our next sections.
However, it is a very interesting exercise, and you should spend time trying to figure it out!

19.1.2 Fermat’s Two Squares Theorem

To prove the last part of our theorem on Gaussian primes, we have to address the cases where
p is either purely imaginary or purely real. The first thing to notice is that both of these cases
are exactly the same! The only difference is multiplication by i, which doesn’t change whether
something is prime, since i is a unit in Z[i]. So we limit our focus on looking at seeing when
regular integers are prime in Z[i].
It’s clear that an integer must be prime in order to also be prime in Z[i], as any factorization
in Z is also a factorization in Z[i]. Now the fundamental question is: what primes p ∈ Z stay
prime in Z[i]?
If p wasn’t prime in Z[i], then we would have a decomposition p = z · w in Z[i], where neither
z and w are units. Taking the norm of each side, we have p2 = N (p) = N (zw) = N (z) · N (w).
Since N (z) and N (w) can’t be 1 (why?), we must have N (z) = N (w) = p. That is, letting
z = a + bi, we need a2 + b2 = p (and similarly for w). To proceed, we need to figure out which
primes p ∈ Z can be expressed as a2 + b2 , where a and b are integers.

Exercise 19.5. Try this for small numbers! Make a conjecture about what primes can be
expressed as a sum of two squares.

We can gain some inroads by taking the equation mod 4, which is a standard thing to do with
squares. Note that a2 and b2 can only be 0, 1 mod 4, so a2 + b2 can only be 0, 1, or 2 mod 4.

2
Everaise Academy (2020) Math Competitions II

For this to equal a prime, either p = 2, or p ≡ 1 mod 4. Although we haven’t proven it yet, it
turns out that these are the only primes that work!

Theorem 19.6 (Fermat’s Two Squares Theorem). Let p be an odd prime. Then p can be
(uniquely) expressed as the sum of two integer squares iff p ≡ 1 mod 4.

Assuming that this statement is true, it immediately completes our proof of Theorem 19.4
(classifying Gaussian primes):

Corollary 19.7. Let p be a prime in Z. It is a prime in Z[i] iff p ≡ 3 mod 4.

Proof. The proof of this corollary readily follows from the theorem: if p ≡ 1 mod 4, then we
can write p = a2 + b2 by the theorem. Then (a + bi) · (a − bi) is a nontrivial factoring of p in
Z[i], so p isn’t prime in Z[i]. Conversely, if p ≡ 3 mod 4, then it cannot be expressed as the sum
of two integer squares, meaning it cannot be the norm of any complex number. Therefore, any
factorization p = z · w in Z[i] must have either N (z) = 1 or N (w) = 1 (why?), so p is prime in
Z[i]. 

Alright, now let’s get to the proof of the big theorem. We’ve already shown one direction (by
taking the equation mod 4). Now it remains to show that all 1 mod 4 primes work.

Proof. Let p ≡ 1 mod 4 be a prime. The key fact is that −1 is a quadratic residue mod p,
which means that there exists some x such that x2 ≡ −1 mod p. (This is because of Euler’s
Criterion, which is covered in the next section.) So p | x2 + 1 = (x − i)(x + i).
However, since p does not divide either of the factors x − i or x + i, it follows that p cannot be
prime in Z[i] by definition. Therefore, p must factor as p = z · w in Z[i] where N (z), N (w) 6= 1.
Since N (p) = p2 = N (z) · N (w), the only possibility is N (z) = N (w) = p. It follows that
{z, w} must be complex conjugates with norm p (why?), so denoting them as x + yi and x − yi
we have the identity p = (x + yi)(x − yi) = x2 + y 2 as desired. 

Exercise 19.8. Prove the claim omitted in the last proof. That is, show that p = z · w
and N (z) = N (w) = p implies that z and w must be complex conjugates. (Hint: write out
explicit forms for z and w and actually do the multiplication!)

19.1.3 Uniqueness

As we discussed in the last section, Fermat’s Two Squares Theorem gives us what we need to
completely characterize Gaussian primes. It turns out that the ring of Gaussian integers, like
Z, is a unique factorization domain (UFD). This means that every element has a unique
prime factorization (up to multiplication by units.)
You may have noticed that Fermat’s Two Squares Theorem had “uniquely” in parentheses.
It turns out that the representation given by Theorem 19.6 is in fact unique, though we haven’t
proven it yet. This is a critical piece of information that we need in order to prove unique
factorization, and we’ll dedicate this section to proving it.

3
Everaise Academy (2020) Math Competitions II

Proposition 19.9. Let p ≡ 1 mod 4 be a prime. By Theorem 19.6, p can be expressed as


the sum of two integer squares. Such an expression is unique.

We’ll need the two following lemmas, which aren’t hard to prove (try it!).

Lemma 19.10 (Lagrange’s Identity). The following useful factorization holds:

(x2 + w2 )(y 2 + z 2 ) = (xz − yw)2 + (xy + zw)2 .

Lemma 19.11 (Four Number Theorem). Let a, b, c, d be integers such that ab = cd. Then
there exist integers x, y, z, w such that xy = a, zw = b, xz = c, yw = d.

Now, let’s get onto the proof.

Proof. Suppose we had p = a2 +b2 = c2 +d2 where p is a 1 mod 4 prime and a, b, c, d are positive.
Rewriting the second equality using difference of squares, we have (a − c)(a + c) = (d − b)(d + b).
By Lemma 19.11, there exist integers x, y, z, w such that xy = a − c, zw = a + c, xz = d + b,
yw = d − b. Solving the first two equations for a and the second two equations for b, we have
a = xy+zw
2 and b = xz−yw
2 . Substituting into the equation p = a2 + b2 , we have:

(xz − yw)2 + (xy + zw)2 (x2 + w2 )(y 2 + z 2 )


p= =
4 4
where the last equality is true by Lagrange’s Identity. So now we have:

4p = (x2 + w2 )(y 2 + z 2 ).

Since p is prime, it has to divide one of {x2 + w2 , y 2 + z 2 }. This means the other factor must
divide 4; without loss of generality, let’s say it’s x2 + w2 . Since x, w can’t be 0 (or else we’d
have one of a, b, c, d be 0), we must have x = w = 1. It readily follows that {a, b} = {c, d}. 

Exercise 19.12. Prove Lemma 19.10 in at least two different ways.

Exercise 19.13. Prove Lemma 19.11.

19.2 Quadratic Residues


19.2.1 Prelude

Definition 19.14. We define a to be a quadratic residue modulo m if and only if there


exists an integer x such that
x2 ≡ a (mod m)

4
Everaise Academy (2020) Math Competitions II

Otherwise, call it a quadratic non-residue.

Exercise 19.15. Prove that a is a quadratic residue modulo p if and only if a can be written
as g 2k for some integer k, where g is a generator mod p.

p−1
Theorem 19.16. Let p be an odd prime number. There are 2 quadratic residues modulo
p in the set {1, 2, . . . , p − 1}.

19.2.2 Legendre Symbol


 
a
Definition 19.17. Given a prime number p and an integer a, Legendre’s symbol p is
defined as 
  
a 0 if a is divisible by p;

= 1 if a is a quadratic residue modulo p;
p 

-1 otherwise;

Here are a list of properties of the Legendre’s symbol:

Theorem 19.18 (Properties of Legendre’s symbol). Here are a list of properties you should
know:
1. If a ≡ b (mod p) and ab is not divisible by p, then
   
a b
=
p p

2. Legendre’s symbol is multiplicative:


    
ab a b
=
p p p

for all integers a, b and prime numbers p ≥ 3.

Exercise 19.19. Prove Properties 1 and 2.

19.2.3 Theorems

These properties are all very important, and they deserve their own section. We’ll provide
proofs for many of them, too, although we’ll leave some as exercises.

5
Everaise Academy (2020) Math Competitions II

Theorem 19.20 (Euler’s Criterion). If a 6≡ 0 (mod p) and p 6= 2, then


 
a p−1
=a 2 (mod p)
p

p−1
Proof. To prove this, we attempt to observe the behavior of a 2 modulo p.
If a is a QR modulo p, then there exists an integer x such that a ≡ x2 (mod p). Therefore,
 2  
p−1
p−1 x a
a 2 ≡x ≡1= = (mod p)
p p

Otherwise, suppose a is not a QR. Then if 1 ≤ x ≤ p − 1, there is a unique y in the same range
such that xy ≡ a (mod p). This is true since we can choose y ≡ a · x−1 (mod p) for every x.
Also, notice that x 6= y (why?). Therefore, the product of all the elements between 1 and p − 1
can be broken up into p−12 pairs of products of the form xy. Rewriting (p − 1)! in this form and
using Wilson’s Theorem, we have:
 
a p−1
= −1 ≡ (p − 1)! ≡ (x1 y1 )(x2 y2 ) . . . (x p−1 y p−1 ) ≡ a 2 (mod p).
p 2 2

Corollary 19.21. If p is an odd prime, then


 
−1 p−1
= (−1) 2
p

Exercise 19.22. Prove the statement above.

The next lemma gives an interesting criterion for an integer to be a quadratic residue.

Lemma 19.23 (Gauss’s Lemma). Let p be an odd prime, and let a be a fixed integer coprime
to p. Consider the set
p−1
S = {ka (mod p) | 1 ≤ k ≤ }.
2
Let n be the number of elements of S that are larger than p2 . Then
 
a
= (−1)n .
p

Proof. We’ll prove this using double counting (computing the same thing in two different ways).
Let P be the product of all numbers in S, taken mod p: by direct multiplication it is
     
p−1 p−1 a p−1
P =a 2 · !≡ · ! (mod p)
2 p 2

where the congruence came from Euler’s Criterion.

6
Everaise Academy (2020) Math Competitions II

We can also count the product in a different way: for all elements x ∈ S larger than p2 , replace
x with p − x (and each time we do this, P will be multiplied by −1). There are n elements
larger than 2, so the product of the elements in the new set will be (−1)n · P . The elements in
the new set are all distinct (why?), so they must be some ordering of {1, 2, . . . , p−1
2 }. Therefore,
we have:  
n p−1
(−1) · P = !
2
and combining this with our previous evaluation of P , we get the desired result. 

Remark. Double counting is also a useful strategy in combinatorics problems! Generally, proofs by
double counting work when you want to prove the equation a = b, and there’s a third thing c that
you can easily relate both a and b to.

Lemma 19.24 (Eisenstein’s Lemma). For distinct odd primes p, q, we have


 
q
= (−1)n
p

where n denotes  
X qu
p
2≤u≤p−1,u is even

Exercise 19.25. Mimic the proof of Gauss’s Lemma, prove the Eisenstein’s Lemma.

Theorem 19.26 (Quadratic Reciprocity Law). Let p and q be distinct odd prime numbers,
then   
p q (p−1)(q−1)
= (−1) 4
q p

Proof. We’ll now give a proof which uses Eisenstein’s Lemma.


Notice that the sum  
X qu
p
2≤u≤p−1,u is even

counts the number of lattice points with even x-coordinate in the interior of the triangle 4ABC
where its sides are parallel with the x and y-axis with length AB = p and BC = q.
Similar in fashion, we can deduce that
   
X qu X pu
+
p q
2≤u≤p−1,u is even 2≤u≤p−1,u is even

counts the number of points in the rectangle with even x and y-coordinates.
Now, since the number of such points in the rectangle is
  
p−1 q−1
2 2

7
Everaise Academy (2020) Math Competitions II

Therefore,
   j k P j k
p q P pu qu
2≤u≤p−1,u is even q + 2≤u≤p−1,u is even p
p−1 q−1
= (−1) = (−1)( 2 )( 2 ).
q p

and we have the desired result.




Lemma 19.27. If p 6= 2, then  


2 p2 −1
= (−1) 8
p

19.3 Homework Problems


Problem 19.1. [4] Is −3 a quadratic residue of 5?

Problem 19.2. [5] Is 37 a quadratic residue of 73?

Problem 19.3. [6] Does there exist a positive integer x such that x2 ≡ 12345 (mod 13337)?

Problem 19.4. [4] Does there exist positive integers a, b 6≡ 0 (mod 7) such that 7 | a2 +2ab−b2 ?

Problem 19.5. [7] Let p be a prime. Suppose that a and b are primitive roots modulo p. Prove
that ab is a quadratic residue modulo p.

Problem 19.6. [8] Let m be odd. Prove that a is a quadratic residue modulo m if and only if
gcd(a, m) = 1 and a is a quadratic residue modulo p for each prime p that divides m.

Problem 19.7. [10] Prove that 8k + 1 is a quadratic residue modulo 2m for all m ≥ 1.

Problem 19.8. [12] Let p > 11 be a prime. Prove that there exists an integer a such that a
and a + 1 are quadratic residues modulo p.

Problem 19.9 (2020 HMMT). [12] Let p > 5 be a prime number. Show that there exists a
prime number q < p and a positive integer n such that p divides n2 − q.

8
20 Olympiad Number Theory Techniques

In this handout we’re going to work towards exploring a technique called ‘Lifting the Expo-
nent’, a powerful result in Olympiad maths that allows us to say more things about the prime
factors of a number than modular arithmetic alone.

20.1 P-adic Order


We’re going to start by looking at p-adic order, the exponent of the prime p in the prime
factorization of integer a, denoted by νp (a).
Let’s redefine the divisibility criteria from before. For positive integers a and b, a|b if and
only if for every prime p, νp (a) ≤ νp (b). Additionally, a = b if and only if for every prime p,
νp (a) = νp (b). Using this definition, try to prove the following properties of p-adic order for
positive integers a and b.

Exercise 20.1. Prove that νp (ab) = νp (a) + νp (b).

Exercise 20.2. Prove that νp (a + b) ≥ min{νp (a), νp (b)}. When does equality hold?

Exercise 20.3. Prove that νp (gcd(a1 , a2 , ..., an )) = min{νp (a1 ), νp (a2 ), ..., νp (an )}.

Exercise 20.4. Prove that νp (lcm(a1 , a2 , ..., an )) = max{νp (a1 ), νp (a2 ), ..., νp (an )}.

Remark. We can also extend the idea of p-adic order to a rational number, q, by letting νp (q) be
the power of p such that q can be written as pνp (q) · ab where a and b are both coprime to p. This
isn’t often used but can help avoid issues when doing questions involving division.

Exercise 20.5. Use the above to prove that νp ( ab ) = νp (a) − νp (b) for all integers a and b.

Example 20.6 (USAMO 1972). For positive integers a, b, c, prove the identity

lcm(a, b) · lcm(b, c) · lcm(c, a) gcd(a, b) · gcd(b, c) · gcd(c, a)


= .
lcm(a, b, c)2 gcd(a, b, c)2

Solution. Before we start, let’s note that it’s easy to control multiplication, lowest common
multiple and greatest common divisors when we’re looking at p-adic orders. Therefore it’s

1
Everaise Academy (2020) Math Competitions II

probably a good idea to prove that the two sides are equal by proving that they have the same
p-adic order for every prime p.
Let’s start by choosing an arbitrary prime p and proving that both sides have the same p-adic
order. Then we know it holds for any arbitrary prime so it must hold for all primes and so we’ll
be done.
Let’s denote the p-adic orders of a, b and c as:
νp (a) = α, νp (b) = β, νp (c) = γ
and without loss of generality, let α ≤ β ≤ γ (this just makes the proof easier to write out and
ensures we have less cases to consider).
Now let’s look at the p-adic order of the left-hand side. Using Exercise 20.4 we get that
νp (lcm(a, b)) = max{νp (a), νp (b)} = α.
We can do the same thing to get that
νp (lcm(b, c)) = β
and
νp (lcm(a, c)) = α.
Note that we can also use it to get
νp (lcm(a, b, c)) = α.

So far, so good! Now we just need to work out what this gives us when all the parts are
combined. Exercise 20.1 allows us to multiply the three pairwise lowest common multiples to
get
νp (lcm(a, b) · lcm(b, c) · lcm(a, c)) = α + β + α = 2 · α + β.
Now we just have to use Exercise 20.5 to deal with the denominator. This gives us that the
p-adic order of the left-hand side is
2 · α + β − (α + α) = β.

So far so good! Now let’s deal with the right-hand side. We can do a similar thing again,
noting that
νp (gcd(a, b)) = min{νp (a), νp (b)} = β
and, in the same way that
νp (gcd(b, c)) = γ
and
νp (gcd(a, c)) = γ.
Note that we can again also get that
νp (gcd(a, b, c)) = γ.

Combining these, using our multiplication and division rules, gives us that the p-adic order
of the right-hand side is
β + γ + γ − (γ + γ) = β.
This gives us that both sides have the same p-adic order for that p. But, as we mentioned
at the start, the prime we picked at the beginning was arbitrary so the result holds true for
every prime. νp (LHS) = νp (RHS) for every prime, which is exactly the equality condition we
needed! 

2
Everaise Academy (2020) Math Competitions II

Exercise 20.7. Prove that lcm(a, b, c)2 | lcm(a, b) · lcm(b, c) · lcm(c, a) for all a, b, c ∈ Z+ .

Example 20.8 (Saint Petersburg Olympiad 2006). Let a1 , a2 , ..., a101 be positive integers
such that gcd(a1 , a2 , ..., a101 ) = 1 and the product of any 51 of these numbers is divisible
by the product of the remaining 50. Prove that a1 a2 · · · a101 is a perfect square.

Solution. Proving that something is a square directly can be quite tricky unless we can find
some sort of suitable factorisation. This doesn’t seem to be the case for this question so how
else could we approach this?
Well, we know that if every exponent in the prime factorisation of a number is even then that
number is a square. We could translate this into the language of p-adic orders — if νp (a) is
even for every prime, then a is a square. This seems like a good thing to try and prove so let’s
begin as we did in the first example and consider νp for some arbitary prime p.
We have been given two criteria on the integers which are going to be easier to work with
if we translate them in to the language of p-adic orders. First let’s use the property proven in
Exercise 20.3 to translate the gcd criterion. This gives us

min{νp (a1 ), νp (a2 ), ..., νp (a101 )} = 0.

This tells us that at least one ai has νp (ai ) = 0. That could be useful, but it’d be more
helpful if we could refer to it more specifically. That motivates us to assume, without loss of
generality, that
νp (a1 ) ≥ νp (a2 ) ≥ ... ≥ νp (a101 )
and note that it follows that νp (a101 ) = 0.
Great, we’re starting to find something out about the variables! We still haven’t used the
given product divisibility property though. Note that this property depends on which 2 sets we
picked so we’re going to want to pick our sets cleverly. What choice of sets would give us the
most information?
Well, we note that if we have a101 as an element in the 51 element set, this doesn’t contribute
anything to νp of the product. So when we translate the problem to p-adic orders, we’re
essentially considering a 50 element set that’s divisible by another 50 element set.
That might give us easier expressions, and possibly an easier way to bound specific variables
so let’s use that. It’s also going to be easier to bound if the set that has the divisible product
has the smallest possible p-adic order so it might be useful to consider our 51 element set as

{a51 , a52 , ..., a100 , a101 }.

Let’s consider the product a51 a52 · · · a101 . We are told that it’s divisible by the product
a1 a2 · · · a50 . Using the multiplication and divisibility properties, we get that this implies that

νp (a1 ) + νp (a2 ) + · · · + νp (a50 ) ≤ νp (a51 ) + νp (a52 ) + · · · + νp (a101 ).

We can set νp (a101 ) = 0 and also note that

νp (a1 ) + νp (a2 ) + ... + νp (a50 ) ≥ νp (a51 ) + νp (a52 ) + ... + νp (a100 )

by our assumption at the start.

3
Everaise Academy (2020) Math Competitions II

But these two inequalities taken together give us an equality condition so we know that

νp (a1 ) + νp (a2 ) + · · · + νp (a50 ) = νp (a51 ) + νp (a52 ) + · · · + νp (a101 ).

Now let’s look again at what we wanted to prove. Since we were asked to show that
a1 a2 · · · a101 is a perfect square, we were aiming to show that

νp (a1 a2 · · · a101 ) = νp (a1 ) + νp (a2 ) + · · · + νp (a101 )

is even. But notice that by the equality condition we derived above,

νp (a1 ) + νp (a2 ) + · · · + νp (a101 ) = 2(νp (a1 ) + νp (a2 ) + · · · + νp (50))

and we are done.


So for an arbitrarily-chosen prime p, the product a1 a2 · · · a101 contains an even power of p in
its prime factorization. Since we could have chosen any prime at the start, this holds true for
all primes and the product therefore must be a perfect square. 

One of the most direct applications of the p-adic order, which you might already be familiar
with, is determining the prime factorization of a factorial.

Theorem 20.9 (Legendre’s Theorem). For a positive integer n and prime p, we define sp (n)
as the sum of the digits of n when it’s written in base p. Then,
     
n n n n − sp (n)
νp (n!) = + 2 + 3 + ··· = .
p p p p−1

Proof. Let’s consider the first portion of the equality. Note that there are b np c numbers in the
range 1, ..., n that are divisible by p so these all contribute at least 1 to the value of νp (n!) (by
considering our first rule) so counting these contributes b np c to the value of νp (n!).
We also note that there are b pn2 c numbers in the same range divisible by p2 , which all con-
tribute at least 2, so we could say that these together all contribute 2 · b pn2 c to the value of
νp (n!). But this won’t quite be the case- all the numbers we count in the second case will also
have been counted in the first case. So each of them is only going to contribute another 1 to
the value of νp (n!) so we only have to add on another b pn2 c.
If we continue like this, considering the numbers divisible by p3 , p4 and so on, we get the first
part of the equality.
Now let’s take a look at the second part of the equality. As sp (n) is the sum of the digits of
n in base-p, we’re going to re-write n as

n = a0 + a1 p + a2 p2 + ... + ak pk

for a0 , a1 , ..., ak ∈ {0, 1, ..., p − 1} and ak 6= 0.


Now let’s use this to evaluate the left-hand side of this equality. Observe that
 
n
= a1 + a2 p + a3 p2 + · · · + ak pk−1
p
 
n
= a2 + a3 p + a4 p2 + · · · + ak pk−2
p2

4
Everaise Academy (2020) Math Competitions II

..
.
We can add these all together (and use the first part of the equality) to get

νp (n!) = a1 + a2 p + · · · + ak pk−1 + a2 + a3 p + · · · + ak pk−2 + · · · + ak .

We can group the terms like

νp (n!) = (a1 ) + (a2 + a2 p) + (a3 + a3 p + a3 p2 ) + (ak + · · · + ak pk−1 )

Note that
(pi + pi−1 + · · · + p + 1)(p − 1) = (pi+1 − 1)
and we can use this to re-write the expression as
1
νp (n!) = [a1 (p − 1) + a2 (p2 − 1) + a3 (p3 − 1) + · · · + ak (pk − 1)].
p−1
Now we’re going to use our trick of adding 0 on to one side. We’re going to add the expression
(a1 + a2 + · · · ap ) − (a1 + a2 + · · · + ap ) on to the right-hand side, which will give us

1
νp (n!) = [a0 + a1 p + a2 p2 + a3 p3 + · · · ak pk − (a0 + a1 + · · · + ak )].
p−1

But a0 + a1 p + · · · ak pk = n and a0 + a1 + · · · ak = sp (n) so this is equivalent to

n − sp (n)
νp (n!) =
p−1
and we’re done. 

Example 20.10 (Turkey TST 1990). Let 2bm be the maximum power of 2 that divides m!.
Find the least m such that m − bm = 1990.

Solution. Notice that the sequence bm = ν2 (m!). So the problem asks us to find the least m
such that m − ν2 (m!) = 1990. But we can use the second part of the equality we just proved to
get that
m − s2 (m)
ν2 (m!) = = m − s2 (m),
2−1
we the problem is just asking us to find the least m such that s2 (m) = 1990.
Now we’ve reduced the problem to something simpler - we’re just considering digit sum in
base 2. We need this to equal 1990, and we can notice that the least such number consists of
1990 consecutive 1s in a binary expansion. Using what we know about binary, we get an answer
of m = 21990 − 1. 

Remark. Using the second part of Legendre’s Theorem was a good choice here as it allowed us to
move from νp , which we didn’t know a lot about, to sp , which we did. This is a good thing to
look out for, especially as sp gives you the minimum value that an integer could be (in a calculable
form).

5
Everaise Academy (2020) Math Competitions II

(4n)!
Example 20.11 (Greece TST 2017). Let A = (2n)!n! where n is a positive integer. Prove
that A is an integer and that it’s divisible by 2n+1 .

Solution. Before we start finding the 2-adic order of A, we should first make sure that the
number in question is an integer. The factorials in the numerator and denominator of A remind
us of binomial coefficients so, to use this to our advantage, let’s re-write A using binomial
coefficients. We can do it like  
4n (3n)!
A= ·
3n (2n)!
or like  
4n (2n)!
A= · .
2n n!
Either way, we can notice that A is the product of 2 integers and must therefore be an integer.
Okay, so now we can move on to the second part of the problem. Here we will look at the
2-adic evaluation with Legendre’s theorem but after we’ll discuss a second solution using a more
advanced theorem. To find ν2 (A), first note that
jnk jnk
ν2 ((4n)!) = 2n + n + + + ···
2 4
jnk jnk
ν2 ((2n)!) = n + + + ···
2 4
Therefore, since we are to show that 2n+1 |A, the problem becomes
 
(4n)! j n k j n k 
ν2 = 2n − + + · · · ≥ n + 1.
(2n)!n! 2 4

We can rearrange the above inequality and note that proving that is equivalent to showing that
jnk jnk
1+ + + · · · ≤ n.
2 4
The ’infinite’ sum on the
 left-hand side seems unwieldy, but we can simplify it. If we let
i i+1 n
2 ≤n≤2 (so 2i+1 = 0 and so on for higher powers), we can use this together with the
fact that bkc ≤ k, to rewrite the left-hand side as

2i − 1
jnk jnk jnk  
1 1 1
1+ + + ... i ≤ 1 + n + + ··· + i = 1 + n.
2 4 2 2 4 2 2i

Therefore, it remains to show


2i − 1
1+ n≤n
2i
but multiplying up by 2i and rearranging gives us that this is equivalent to proving that

2i ≤ n.

This is how we chose i in the first place so we’re done. 

While this is a nice way to solve it, let’s consider a more advanced result that solves this
problem even quicker.

6
Everaise Academy (2020) Math Competitions II

 
n
Theorem 20.12 (Kummer’s Theorem). The p-adic order of is the number of times
k
you have to carry when adding together k and n − k in base p.

This is actually a corollary of Legendre’s theorem. By the definition of a binomial coefficient,


 
n
νp = νp (n!) − νp (k!) − νp ((n − k)!)
k

and we can then use Legendre’s theorem to get

sp (k) + sp (n − k) − sp (n)
νp (n!) − νp (k!) − νp ((n − k)!) = .
p−1
How does this relate to the number of carries performed? Well let’s consider the addition,
starting from the beginning. When we add the two digits in the units place together the
resulting digit will be the same as the digit in the unit place of n, unless the sum if greater than
p and we carried.
What happens if we carry? Well, we add one to the next column and we minus p from this
column, so we’ll minus p − 1 from the overall digit sum.
But we could have done essentially the same argument, no matter which 2 digits we were
adding (so long as we’re careful about considering previously carried digits).
So sp (n) = sp (k) + sp (n − k) − (p − 1)· the number of carries we performed. Rearranging this
gives us that the number of carries we performed was

sp (k) + sp (n − k) − sp (n)
p−1
and our result immediately follows.

Example 20.13. Prove that if n is a positive integer and 1 ≤ k ≤ 2n , then


 n 
2
ν2 = n − ν2 (k).
k

Solution. We apply Kummer’s theorem to the binomial coefficient:


 n 
2
ν2 = s2 (k) + s2 (2n − k) − s2 (2n ).
k

How can we calculate the s2 terms? Well we can note that the right-hand side is just the
number of carries when adding k and 2n − k in base 2 (by Kummer’s theorem). These numbers
also add up to 2n so if we have a 1 in the decimal expansion of k, we’re going to need to carry
on every digit greater than that until we get to the (n + 1)th digit.
So we have to carry from the first non-zero digit of k until we reach the (n + 1)th digit. So
we have ν2 (k) digits at the start where we don’t carry and we must have n − ν2 (k) digits where
we do carry.
So we apply Kummer’s theorem to get that the left and right hand sides are equivalent. 

7
Everaise Academy (2020) Math Competitions II

Exercise 20.14. Apply Kummer’s theorem to Example 20.11.

 
2n
Exercise 20.15. Prove that n ≥ 1 is a power of 2 if and only if 4 does not divide .
n

 n
2
Exercise 20.16. Prove that all numbers with 1 ≤ k < 2n are even and exactly one
k
of them is not a multiple of 4. Which one?

20.2 Lifting the Exponent Lemma


So far, we have been setting the scene for the content we’ll cover in this section.
Let a, b be integers and p be a prime such that p|a − b. Observe that

ap = ((a − b) + b)p = (a − b)p + p(a − b)p−1 b + ... + p(a − b)bp−1 + bp .

Since p|a − b, every term, with the exception of the last one, is divisible by p2 . It follows that
p2 |ap − bp . Said differently,
a ≡ b (mod p)
implies that
ap ≡ bp (mod p2 ).
In more general terms, the same method can be used to prove that if pl |a − b, for some l ≥ 1,
then pl+1 |ap − bp . This leads us to our first major result in this section.

Theorem 20.17. Let a, b be integers and p be a prime such that p|a − b. Then for all
positive integers c,
νp (ac − bc ) ≥ νp (a − b) + νp (c)
or equivalently
ac − bc
 
νp ≥ νp (c).
a−b

Proof. Let k = pνp (c) and let c = km. Note that ac − bc = akm − bkm and we can then use the
factorization we learnt on day 1 to get that

ac − bc = (ak − bk )(ak(m−1) + ak(m−2) · bk + · · · + ak · bk(m−2) + bk(m−1) ).

Now we can clearly see that ak − bk |ac − bc . How could this help us?
Well pνp (a−b) |(a−b) so, by the previous section, pνp (a−b)+1 |ap −bp . But then we can repeat the
2
same thing with ap and bp instead of a and b: as pνp (a−b)+1 |ap −bp we know that pνp (a−b)+2 |ap −
2
bp .
We can keep doing this (making it rigorous with induction) to get that

pνp (a−b)+νp (c) |ak − bk .

8
Everaise Academy (2020) Math Competitions II

So now we know that νp (ak − bk ) ≥ νp (a − b) + νp (c). But we also know that ak − bk |ac − bc
so νp (ac − bc ) ≥ νp (ak − bk ). Combining these two results gives us

νp (ac − bc ) ≥ νp (a − b) + νp (c)

and we’re done.


(The equivalent statement just comes from rearranging using the properties of p-adic order.)


Example 20.18 (Romania TST 2009). Let a, n ≥ 2 be integers such that n|(a − 1)k for
some k ≥ 1. Prove that n|1 + a + a2 + · · · + an−1 .

Solution. Note that we don’t have a lot of tricks to deal with non-prime numbers so we’re
going to split n up into its prime factors and consider each of them separately.
Choose any prime p that divides n. By the given condition that n|(a − 1)k for some k ≥ 1,
so we know that p|a − 1.
How can we relate this to what we’re trying to prove? Well, if we recall the factorization
an − 1
1 + a + a2 + · · · + an−1 =
a−1
we can then see that for a high enough power of p to divide the left-hand side, we’re going to
need to have that  n 
a −1
νp ≥ νp (n).
a−1
But this is exactly the statement of Theorem 20.17!
Since p could be any prime satisfying the condition p|n, this means that we have shown this
condition to be true for every prime dividing n. Therefore, we conclude that n|1 + a + a2 +
· · · + an−1 . 

We can now move on to the general statement of the Lifting the Exponent Lemma (LTE).
It’s really important to note the conditions here — if any of these are false, we’re not going to
be able to use LTE so you’re going to have to check these at the start of each problem. It’s a
decent idea to commit these conditions to memory.

Theorem 20.19 (Lifting the Exponent Lemma (Form 1)). Let p be an odd prime and let
a, b be integers not divisible by p but such that p|(a − b). Then for all integers n ≥ 1,

νp (an − bn ) = νp (n) + νp (a − b).

Proof. Let’s first see what happens if we find two such integers m and n such that the theorem’s
conclusion is true for any a, b such that p|(a − b). Observe that

νp (amn − bmn ) = νp ((am )n − (bm )n ) = νp (am − bm ) + νp (n),

since we assumed that n satisfies the theorem and since (a − b)|(am − bm ). But since m also
satisfies LTE, it follows that

νp (amn − bmn ) = νp (a − b) + νp (m) + νp (n) = νp (a − b) + νp (mn).

9
Everaise Academy (2020) Math Competitions II

So we also have that mn satisfies the conclusion!


Since n = 1 satisfies the theorem, we only need to prove the theorem for any prime q, then
we can just use what we showed above to extend it out to all integers. Let’s first suppose that
q 6= p. In this case, it suffices for us to show that
 q
a − bq

νp = 0.
a−b

We know that
aq − bq
= aq−1 + aq−2 b + · · · + bq−1 ≡ qaq−1 (mod p)
a−b
since the condition p|a − b, gives us that a ≡ b (mod p). Since q is not divisible by p and a is
not divisible by p, this can’t equal 0 (mod p). So
 q
a − bq

νp = 0 = νp (q)
a−b

and we are done with the q 6= p case.


Now we must consider the case q = p. Let a = b + pk c for an integer c that is not divisible
by p and for k ≥ 1. Using the binomial theorem to expand a,
 
p p k+1 p−1 p p−2 2k
a −b =p b c+ b p c + · · · + pkp cp .
2

Because p > 2, all the terms after pk+1 bp−1 c have a p-adic order greater than k+1. Additionally,
because p does not divide b or c, we can conclude that

νp (ap − bp ) = k + 1 = 1 + νp (a − b) = νp (p) + νp (a − b),

which is exactly what we needed.


And our theorem holds for all prime numbers so we can use our discussion at the start to see
that the theorem holds for all integers n ≥ 1. 

Exercise 20.20. What’s the highest power of 95 that divides 3285 − 2285 ?

Example 20.21 (AIME I 2020). Let n be the least positive integer for which 149n − 2n is
divisible by 33 · 55 · 77 . Find the number of positive divisors of n.

Solution. This looks like an ideal problem to apply lifting the exponent to - it’s essentially
going to boil down to determining the p-adic order of 149n − 2n for several primes.
Note that 149 − 2 = 147 = 3 · 7 · 7 (and 149 and 2 are not divisible by 3 or 7) so we can apply
LTE to find the 3-adic order and the 7-adic order.
First, let’s find the 3-adic order:

ν3 (149n − 2n ) = ν3 (n) + 1.

This suggests that 32 |n since the 3-adic height must be at least 3 to satisfy the problem’s
conditions.

10
Everaise Academy (2020) Math Competitions II

Similarly, observe that


ν7 (149n − 2n ) = ν7 (n) + 2.
We need ν7 (149n − 2n ) ≥ 7 so we conclude that 32 · 75 |n.
But we’re not done yet. It remains to find the 5-adic height. Observe that the smallest n
such that the 5-adic height of 149n − 2n is non-zero is n = 4. Also, as 1494 = 1 (mod 5) and
24 = 1 (mod 5), we can also prove that 149n − 2n is only divisible by 5 when n is divisible by 4.
We can compute
ν5 (1494 − 24 ) = 1.
This doesn’t quite satisfy the conditions yet - we need it to be divisible by 55 - but perhaps we
could use lifting the exponent to help with this?
Recall that in order to apply LTE, we must have that p|a − b. Since we have found the
smallest a, b that satisfy the conditions of LTE for p = 5, we can apply the theorem to
n
ν5 ((1494 )n/4 − (24 )n/4 ) = 1 + ν5 .
4
In order for n to satisfy the problem’s condition, we now know that 4 · 54 |n. So, combining the
three results we’ve got above, we know that n must be divisible by 4 · 33 · 55 · 77 .
Therefore, the smallest n that is divisible by 33 · 55 · 77 is exactly n = 22 · 32 · 54 · 75 . This
number has 3 · 3 · 5 · 6 = 270 divisors. 

Exercise 20.22. Let p and q be two odd primes. Find, in terms of p and q, the smallest
positive integer n such that

pp q q |(pq + 1)n − (pq − 1)n .

Remark. The following corollary is an immediate consequence of the first form of LTE. Let p be an
odd prime and let a, b be integers not divisible by p for which p|a + b. Then for all odd positive
integers n,
νp (an + bn ) = νp (a + b) + νp (n).
Since n is an odd integer, the proof for this corollary follows from manipulating the negative sign
before b:

νp (an + bn ) = νp (an − (−b)n ) = νp (n) + νp (a − (−b)) = νp (n) + νp (a + b),

as desired.

Example 20.23. Find all integers n > 1 for which


n+1 n−1
nn |(n − 1)n + (n + 1)n .

Solution. Let’s try see if we can rule out any values for n. Note that if n satisfies the conditions
of the problem, then it follows that
n+1 n−1
n|(n − 1)n + (n + 1)n .

If n is even, then
n+1 n−1 n+1
(n − 1)n + (n + 1)n ≡ (−1)n +1≡2 (mod n).

11
Everaise Academy (2020) Math Competitions II

For it to be divisible by n then, n must equal 2. However, if we test this value, we get that

22 |1 + 32 ,

which is a contradiction. Hence n = 2 is not a solution and there are no even solutions.
Therefore, any solutions to the problem must be odd.
Let p be an arbitrary prime divisor of n. Note that as n is odd, p is also odd, so it seems like
this should be a good candidate for lifting the exponent. What should we use for a and b?
n+1 2 n−1 2
Well (n − 1)n = ((n − 1)n )n so if (n − 1)n + (n + 1) = 0 (mod p) we could apply LTE
to this. But we know that
2 2
(n − 1)n = −1n = −1 (mod n)

so
2
(n − 1)n + (n + 1) = 0 (mod n) = 0 (mod p)
so we have all the necessary conditions for applying LTE.
Then, by LTE,
n+1 n−1 2
νp ((n − 1)n + (n + 1)n ) = νp ((n − 1)n + (n + 1)) + νp (nn−1 )
2
but we know that n|(n − 1)n + (n + 1) by our earlier discussion so
2
νp ((n − 1)n + (n + 1)) + νp (nn−1 ) ≥ νp (n) + νp (nn−1 ) = νp (nn ).
n+1 n−1
But we could do this for any prime dividing n! So this implies nn |(n − 1)n + (n + 1)n for
all odd integers n > 1. Since we know that even integers don’t satisfy the problem’s conditions,
we are done. 

Exercise 20.24. Let p and q be two odd primes. Find, in terms of p and q, the smallest
positive integer n such that

pp q q |(pq + 1)n + (pq − 1)n .

Exercise 20.25. Let p be a prime number and a, n be positive integers such that 2p + 3p =
an . Prove that n = 1.

But wait, there’s more! You might be wondering what happens for the case p = 2. There’s a
similar interesting result that we can prove for this scenario!

Theorem 20.26 (Lifting the Exponent Lemma (Form 2)). If a, b are odd integers and n is
an even positive integer, then
 2
a − b2

n n
ν2 (a − b ) = ν2 + ν2 (n).
2

12
Everaise Academy (2020) Math Competitions II

Proof. Since n is even, we can write n = 2k x for k ≥ 1 and an odd integer x. Next, we can
repeatedly use the difference of squares factorization formula to obtain
kx kx k−1 x k−1 x
a2 − b2 = (ax − bx )(ax + bx )(a2x + y 2x ) . . . (a2 + b2 ).

Let’s consider two odd integers u = 2α + 1, v = 2β + 1. Observe that

u2 + v 2 = (2α + 1)2 + (2β + 1)2 = 4(α2 + β 2 + α + β) + 2 ≡ 2 (mod 4).

So we now know that the sum of the squares of any 2 odd numbers is 2 (mod 4).
We can apply this fact k − 1 times in the factorization of an − bn to obtain

ν2 (an − bn ) = ν2 (a2x − b2x ) + k − 1.

For the final step, it remains to consider ν2 (a2x − b2x ) = ν2 ((ax − bx )(ax + bx )). Since x is an
odd integer, the following factorizations hold:

ax − bx = (a − b)(ax−1 + ax−2 b + · · · + abx−2 + bx−1 )

ax + bx = (a + b)(ax−1 − ax−2 b − · · · − abx−2 + bx−1 ).


Together, these imply that

a2x − b2x = (a2 − b2 )(a2(x−1) + a2(x−2) b2 + · · · + a2 b2(x−2) + b2(x−1) ).

Because a, b are both odd integers, ν2 (a2 − b2 ) ≥ 2. Additionally, observe that

a2(x−1) + a2(x−2) b2 + · · · + a2 b2(x−2) + b2(x−1)

contains x terms, each of which is congruent to 1 (mod 2). Since x is odd, it follows that the
term is odd overall. Consequently, we conclude that

ν2 (a2x − b2x ) = ν2 (a2 − b2 ).

Substituting this into the previous expression, we obtain

ν(an − bn ) = ν(a2 − b2 ) + k − 1,

which is equivalent to
a2 − b2
 
n n
ν2 (a − b ) = ν2 + ν2 (n)
2
and we have our desired result. 

Example 20.27 (Romania TST 2005). Solve the equation 3x = 2x y + 1 for positive integers
x, y.

Solution. To make it easier to apply LTE, let’s break this problem into 2 cases - when x is
odd and when x is even.
If x is odd, then 3x − 1 ≡ 2 (mod 4), so the only solution is x = 1 and we can see that in
that case y = 1. We will write solutions as pairs (x, y), so for the case when x is odd, the only
solution is (1, 1).

13
Everaise Academy (2020) Math Competitions II

If x is even, we can apply Theorem 20.26 to obtain

ν2 (3x − 1x ) = ν2 (x) + 2.

Now ν2 (3x − 1x ) = ν2 (2x y) so we can use this to get

ν2 (x) + 2 = ν2 (2x ) + ν2 (y) ≥ x.

x
Now we can note that 2 ≥ ν2 (x) when x is even (by considering the highest power of 2
dividing x) so
x
+2≥x
2
which gives us that x ≤ 4. But x is even so x = 2 or x = 4.
9−1
For x = 2, we get 32 = 22 y + 1 so y = 4 and y = 2.
81−1
For x = 4, we get 34 = 24 y + 1 so y = 16 and y − 5.
As we have considered all possibilities for x, we conclude that the solution pairs for the
equation are (1, 1), (2, 2), (4, 5). 

20.3 Homework Problems


Problem 20.1. [4] Let a, b be positive integers such that a|b2 , b3 |a4 , a5 |b6 , ... and so on. Prove
that a = b.

Problem 20.2. [4] Prove these two properties of the p-adic order for n > 1 and prime p:
 
1. νp (lcm(1, 2, ..., n)) = logp (n)
2. lcm(1, 2, ..., n) ≤ nπ(n) where π(n) gives the number of primes not exceeding n.

Problem 20.3 (2018 AIME I). [5] Find the least positive integer n such that when 3n is written
in base 143, its two right-most digits in base 143 are 01.

Problem 20.4 (1972 IMO). [6] Let m and n be arbitrary non-negative integers. Prove that

(2m)!(2n)!
m!n!(m + n)!

is an integer.

Problem 20.5 (2009 AIME II). [6] Define n!! to be n(n − 2)(n − 4) · · · 3 · 1 for n odd and
n(n − 2)(n − 4) · · · 4 · 2 for n even. When
2009
X (2i − 1)!!
(2i)!!
i=1

ab
is expressed as a fraction in lowest terms, its denominator is 2a b with b odd. Find .
10
Problem 20.6 (Mathematical Reflections). [6] Find all integers n > 1 having a prime factor p
such that νp (n!)|(n − 1).

Problem 20.7 (Russia 1996). [7] Let x, y, p, n, and k be positive integers such that xn +y n = pk .
Prove that if n > 1 is odd, and p is an odd prime, then n is a power of p.

14
Everaise Academy (2020) Math Competitions II

Problem 20.8 (IMO Longlist 1985). [8] Let a and b be integers and n a positive integer. Prove
that
bn−1 a(a + b)(a + 2b) · · · (a + (n − 1)b)
n!
is an integer.

Problem 20.9 (IMO 2019). [10] Find all pairs (k, n) of positive integers such that

k! = (2n − 1)(2n − 2)(2n − 4) · · · (2n − 2n−1 ).

Problem 20.10 (Romania TST 1994). [12] Let n be an odd positive integer. Prove that
n +1
((n − 1)n + 1)2 |n(n − 1)(n−1) + n.

15
An Brief Introduction to Abstract Algebra
Everaise Academy

July 28, 2020

1 What’s a Binary Operation, and Why Should I Care?

Definition 1.1. Let G be a set.


1. A binary operation on a set G is a function ? : G × G → G. For any a, b ∈ G, we will
write a ? b for ?(a, b).
2. ? is associative if for all a, b, c ∈ G, we have a ? (b ? c) = (a ? b) ? c.
3. We say elements a, b ∈ G commute if a ? b = b ? a. We say ? (or G) is commutative if
for all a, b ∈ G, we have a ? b = b ? a.

This definition is confusing. So let’s quickly go over some things: firstly, the set X × Y is the set
of ordered pairs (x, y) where x ∈ X and y ∈ Y .
Here, ? is a function that maps ordered pairs (a, b) such that a, b ∈ G to elements c ∈ G. That is,
?(a, b) = c for some a, b, c ∈ G.
This is all very confusing, so let’s clarify it with a few examples.

Example 1.2 (Addition). Let R be the set of real numbers. Addition, +, is a binary operation
+ : R × R → R.

Addition is a very handy binary operation that you’ve surely run into before. Let’s show that it
is: indeed, + maps ordered pairs of real numbers, (a, b), to their sum a + b, which is also a real
number.
Note that addition is also associative, as a + (b + c) = (a + b) + c. Moreover, it is commutative, for
much the same reason.
In this case, we usually say that the reals are closed under addition. That is, we can keep adding
and adding and adding reals all we want, and all we’ll ever get is more real numbers. The integers
are similarly closed under addition.

Exercise 1.3. Name another binary operation the reals are closed under.
Everaise Academy (2020) An Brief Introduction to Abstract Algebra

Example 1.4 (Addition Modulo n). Let Z/nZ be the set {0, 1, 2, . . . , n − 1}. Then addition
modulo n is a binary operation.

In this case, our set G is the set Z/nZ, and the binary operation is addition modulo n. Let’s
consider n = 7 for now. Addition modulo 7 takes in an ordered pair of numbers in Z/7Z — let’s
say, 3 and 5 — and outputs a number in Z/7Z — in this case, 3 + 5 ≡ 1 (mod 7). In fact, in this
case we would just say 3 + 5 = 1 in Z/7Z.

Exercise 1.5. Make sure you understand what’s going on! Don’t be afraid to ask for help.

Example 1.6 (Division). Is division a binary operation


• on the set Z, the integers?
• on the set R, the reals?

Solution. For the first part: observe that binary operations on Z send ordered pairs of elements
of Z to other elements of Z. Does division map ordered pairs of integers to other integers?
Not quite — observe that 1 ÷ 2 is not an integer, and therefore division is not a binary operation
on the set of the integers.
Regarding the second: is division a binary operation on the real numbers? It sure seems that way
at first — if we divide two real numbers, it seems like we should always get a real number.
An important objection, though: what happens if we try to divide by 0, and should we worry about
this case? Well, by definition, a function ought to accept all elements in its domain as inputs. That
is, since we’re assuming that ÷ is a binary operation on the set of real numbers, it must accept all
inputs of the form (r1 , r2 ), where r1 and r1 are real numbers, and output real numbers. (Return
to definition 1.1 if you’re finding yourself confused!)
But ÷ cannot accept inputs of the form (r, 0) for any real number r, because r ÷ 0 doesn’t exist!
Therefore division is not a binary operation on the reals. 

Exercise 1.7. Show that division is a binary operation on


1. the set R+ , the positive reals, and
2. the set Q6=0 , the nonzero rationals.

Example 1.8 (Exponentiation). Show that ?(a, b) = ab is a binary operation on the set of
natural numbers (positive integers) N.

Solution. Here we’ve brought the star notation back — don’t be too confused, ? is just a function,
like all the f ’s and g’s you’ve seen before. We need to show that ?(a, b) ∈ N when a, b ∈ N; that is,
that the natural numbers are closed under exponentiation.
Everaise Academy (2020) An Brief Introduction to Abstract Algebra

In fact, this is not hard: we know that ab = a × a × · · · × a. Moreover, it’s not hard to show that
| {z }
b times
the natural numbers are closed under multiplication; that is, the product of two natural numbers is
a natural number. Therefore, ab is also a natural number, and therefore ?(a, b) ∈ N, as desired. 

Hopefully binary operations are making sense by now. Let’s move on.

2 Groups and Isomorphisms

Definition 2.1. A group is an ordered pair (G, ?) where G is a set and ? is a binary operation
on G satisfying the following axioms:
1. ? is associative,
2. there exists some e ∈ G such that for any a ∈ G, e ? a = a ? e = a. We call e the
identity.
3. for each a ∈ G there exists an a−1 ∈ G such that a ? a−1 = a−1 ? a = e. We call a−1 the
inverse of a.
We will say G is an abelian (or commutative) group if a ? b = b ? a for all a, b ∈ G; we will say
G is a finite group if G is a finite set. (Informally, we will refer to the group (G, ?) as just G.)
If G is a finite group, then we say that its order is |G|, the number of elements in the set G.

Again, this definition probably doesn’t make a ton of sense by itself. Let’s go over some examples.

Example 2.2. Prove that the integers are a group under the binary operation addition.

Solution. So what does this actually mean? Well, in our ordered pair (G, ?) in Definition 2.1, we
have G = Z and ? = +.
To check that (Z, +) is actually a group, we need to check the three group laws that Definition 2.1
gives: first, that ? — that is, addition — is associative. Well, that isn’t too bad; we know that
addition is associative from elementary school math.
Next, we need to check that “there exists some e ∈ G such that for any a ∈ G, e ? a = a ? e = a.”
What does this statement actually mean, in the context of addition and the integers? It seems to
mean that there should exist some integer e such that for any a ∈ Z, e + a = a + e = a. That’s not
that bad either — e = 0 must be the identity!
Finally, we need to check that “for each a ∈ G there exists an a−1 ∈ G such that a ? a−1 = a−1 ? a =
e.” Now we know that e = 0, so what this statement is actually asking us to show is that for any
integer a, there exists some a−1 such that a + a−1 = a−1 + a = 0. Then a−1 = −a!
We’ve shown that the integers Z under addition satisfy the three group laws, so therefore (Z, +) is
actually a group, as desired. 

A quick digression: why do we care about groups? Well, it turns out that groups are an example
of an algebraic structure, which shows up all the time in mathematics. For example, as we’ve seen
Everaise Academy (2020) An Brief Introduction to Abstract Algebra

above, the integers under addition are a group: that means that if we prove anything about groups
in general, we’ll get a result concerning the integers!

Example 2.3. Suppose that p is a prime number; denote the set {1, 2, · · · , p − 1} by Zp . Then
Zp is a group under the operation multiplication modulo p.

Solution. Let’s let · denote multiplication modulo p. Again, to prove that (Zp , ·) is a group, we
need to show that · is associative, that an identity exists, and that inverses exist.
Thus we begin by showing that a · (b · c) ≡ (a · b) · c (mod p); this is fairly obvious. Next, we’ll show
that the identity exists: in this case, a · 1 ≡ 1 · a ≡ a (mod p), so the element 1 is the identity.
The question of inverses is a bit more interesting. If you recall from number theory week, we showed
that every integer that is not a multiple of p has an inverse modulo p, in fact, so therefore for any
a ∈ Zp , there does exist an a−1 such that a · a−1 ≡ a−1 · a ≡ 1 (mod p), so therefore (Zp , ·) is a
group, as desired.
Note that we can actually say that a · a−1 = a−1 · a = 1 in Zp ; if we’re working in Zp with this
operation, then we can use equals signs. 

Example 2.4 (Cyclic Groups). The group H = {1, a, a2 , . . . , an−1 } of order n with the binary
operation ap · aq = ap+q (mod n) is called a cyclic group.

For example, the groups in Example 1.4 — Z/nZ — are all cyclic groups. It may be difficult to
wrap your head around this, because Z/nZ involves addition, whereas the example above appears
to involve multiplication.
Think about the element ak ∈ H as an element corresponding to the element k ∈ Z/nZ. Let’s
try another concrete example: suppose that n = 6. Then we have the following correspondence of
elements: The morally correct way to think about this is that applying H’s binary operation to

H Z/nZ
1 0
a 1
a2 2
a3 3
a4 4
a5 5

any two elements in H — say, a2 and a5 — yields an element that corresponds to the result of
applying Z/nZ’s binary operation to the corresponding two elements in Z/nZ — 2 and 5. That is
to say, a2 · a5 = a and 2 + 5 = 1.
This is one example of a much more fundamental principle: that of isomorphism. The guiding
question here is — when can we say that two groups are the same? It certainly seems that H and
Z/nZ are essentially the same group, dressed up differently.
Everaise Academy (2020) An Brief Introduction to Abstract Algebra

Definition 2.5 (Isomorphism). Let (G, ?) and (H, ) be groups. A bijective map ϕ : G → H
such that
ϕ(x ? y) = ϕ(x)  ϕ(y)
is called an isomorphism, and G and H are called isomorphic groups.

Again, the notation is confusing. Let’s go over it in English: we have a map ϕ : G → H — that is,
ϕ maps elements of G to elements of H. Moreover, ϕ is a bijection, so it is a one-to-one mapping.
Next, ϕ(x ? y) = ϕ(x)  ϕ(y). In the context of the example on the previous page, ϕ(a2 · a5 ) =
ϕ(a2 )+ϕ(a5 ): note that ?, the operation corresponding to G, is equal to the · operation in Example
2.4, and , the operation corresponding to H, is equal to the + operation.
In fact, we have ϕ(a2 · a5 ) = ϕ(a) = 1, and ϕ(a2 ) + ϕ(a5 ) = 2 + 5 = 1, as expected.

Remark. The fundamental principle of isomorphism is that two groups are isomorphic if they’re basically
the same. This isn’t super rigorous, and this handout isn’t intended to be a very rigorous introduction
to abstract algebra. But when two groups are isomorphic, they’re the same group — just different ways
of representing it.

Exercise 2.6 (Roots of Unity). Convince yourself that the group of nth roots of unity is
isomorphic to Z/nZ.

3 Parting Thoughts from the Handout Author


This is Andrew Wu speaking — your math II head. If you have any complaints about the way
we structured Everaise this year, please do bring it up with us by filling out our feedback form.
(Actually do so — we’d like the program to continue running, and to continue improving.) I already
have some thoughts of my own about what we did well and badly this year, but I’d like to hear
yours, too.
This handout is a (very) brief introduction to the field of abstract algebra, which includes the study
of structures such as groups, rings, fields, and many more esoteric things.
I recommend that if you’re interested in learning more of this, don’t begin by picking up the
“standard college textbook” (Dummit and Foote) and trying to read through it. That’s what I did,
and it was ... not very successful, to say the least. In my senior year, I decided I wanted to learn
some abstract algebra, so I talked to my high school and got them to let me do an “independent
study” with a teacher at school — basically, I read the textbook and he assigned me homework. This
worked well for approximately three chapters. After that, the material became incomprehensibly
thick.
If you’re interested in learning some higher math — usually, in this context, abstract algebra or
real analysis — a few things: first, this material is really cool. Some of the things I learned taking
Math 305 (real analysis) at Yale still blow my mind. On the other hand, you do need a requisite
level of mathematical maturity and experience to really get the most out of these fields of study —
Everaise Academy (2020) An Brief Introduction to Abstract Algebra

I guess what I’m trying to say is, there’s no real rush. If you don’t feel ready, if you think there’s
still a lot of interesting competition math to explore ..., well, go do that instead!
But if you really do think you’re ready, I advise finding a local college and trying to see if you
can take some higher-math courses there. (Evan Chen took courses at San Jose State and UC
Berkeley as a high-schooler, for example.) You’ll do much better with structure and guidance from
a professor than I did self-studying the material.
I — and the associate head, Jennifer, and the rest of the Math II team — sincerely hope you
enjoyed Everaise this year, and that you learned a lot of cool math! Go off, now, and go do good
things.
Week 5 Competition — Math II
Everaise Academy

Monday, July 27, 12 AM EDT – Wednesday, July 27, 11:59 EDT

1 Problems
1 1
1. (3) Suppose that x, y, and z are complex numbers satisfying x + yz = 2, y + xz = 3, and
1
z + xy = 4. Find the sum of all possible values for x.

2. (3) Suppose that a + b−1 ≡ b + a−1 ≡ 1 (mod 13), where a−1 and b−1 denote the inverses of
a and b modulo 13 and a and b are integers satisfying 1 ≤ a, b ≤ 12. Find the least possible
value of a.

3. (4) Let ABCD be a parallelogram with AB ⊥ BD, and√suppose that the angle bisectors of
∠A and ∠D meet at point E on BC. If AE+ED
BD = a + cb for positive integers a, b, c with b
squarefree, then find a + b + c.

4. (4) Let d(n) denote the number of positive integer divisors of a positive integer n, and let
f (n) denote the number of positive integer divisors of n that are perfect squares. Find the
smallest n such that fd(n)
(n) = 12.

5. (5) Kelvin the Frog and a fly are sitting on two separate lilypads in a pond that has 2020
lilypads. Each second, Kelvin chooses a lilypad at random among the remaining unoccupied,
intact lilypads to jump to, and the lilypad that he was sitting on sinks into the pond; each
second, the fly also chooses a lilypad at random among the remaining unoccupied, intact
lilypads and flies there. If Kelvin and fly ever choose the same lilypad, he eats the fly. If the
expected value of the number of seconds it takes for Kelvin to eat the fly is ab , where a and b
are coprime positive integers, then find a + b.

6. (6) Let ABCD be a trapezoid with AD k BC and AB = 31, and suppose that AEF G is a
square with side length 24 such that vertices E and F lie on sides AB and BC,
√ respectively.
a b
Suppose that triangle CGD is equilateral. If tan ∠GDA can be expressed as c for relatively
prime positive integers a and c and squarefree b, then find a + b + c.

7. (7) Two rooms are connected by five doors, numbered 1 through 5. At the beginning, the
doors numbered 1 and 2 are open. Siva and Dylan play a game where Siva walks back and
forth between the rooms in the following manner:

a) Siva chooses one of the open doors at random and walks through it.
Everaise Academy (2020) Week 5 Competition — Math II

b) Afterwards, Dylan chooses one of the closed doors at random and opens it.

c) Finally, Dylan closes the door that Siva walked through in step (a).

This three-step process repeats indefinitely. If the probability that the 2020th door Siva walks
through is the door numbered 5 can be expressed as 15 − ab1c , where a, b, and c are positive
integers with a, b, c > 1, a as small as possible, and b squarefree, find a + b + c.

8. (8) Let x, y, z be positive real numbers such that x ≥ 8yz 3 , y ≥ 8zx3 and z ≥ 8xy 3 . Determine
the maximum possible value of
(xyz − 8y 2 z 4 )(xyz − 8z 2 x4 )(xyz − 8x2 y 4 ).

2 Solutions
1. These three equations yield
xyz + 1 = 2yz
xyz + 1 = 3xz
xyz + 1 = 4xy
from which it follows that 2yz = 3xz = 4xy. Therefore y = 3x 3x
2 and z = 2x, so x( 2 )(2x) +1 =
3x 3
2( 2 )(2x), yielding the cubic 3x − 6x + 1 = 0. By Vieta’s Formulae, our answer is 2 .

2. The equation a + b−1 ≡ 1 (mod 13) yields ab + 1 ≡ b (mod 13) upon multiplication by b.
Similarly, we find that ab + 1 ≡ a (mod 13), so a ≡ b (mod 13). From here it is not hard to
check that a = 4 satisfies a + a−1 ≡ 1 (mod 13), so our answer is 4 .

3. Suppose that the line through E parallel to AB and CD meets AD at F .

Note that ∠EAB = ∠EAF , and that as EBAF is a parallelogram, that ∠EAB = ∠F EA
and ∠EAF = ∠AEB. Thus AB = BE = EF = F A, and ABEF is a rhombus; similarly, we
find that CEF D is also a rhombus.

The other given condition, that DB ⊥ AB, now comes into play: as AD = 2AB, it follows
that DBA is a 30 − 60 − 90 triangle. The rest of the lengths fall easily: it is not hard to
Everaise Academy (2020) Week 5 Competition — Math II

conclude that
√ DEF and CDE are equilateral
√ √ triangles, so setting DE = s yields EA = s 3
s+s 3 3
and DB = s 3. Our answer is s 3 = 1 + 3 , so a + b + c = 7 .

4. As 12 is a multiple of 3, it follows that d(n) needs to be a multiple of 3. That means that


we need to have a (3n − 1)th power in the prime factorization of n. As we want to find the
smallest n, we’ll suppose that we need at least one exponent of 2 in the prime factorization
of n.

Furthermore, as 12 is a multiple of 4, we need to either have an exponent of 3 in n’s prime


factorization, or we need at least two exponents of 1. Heuristics tell us that the product of
two primes is less than the cube of a prime, so let’s suppose we need two exponents of 1.

Then by construction we obtain n = 22 · 3 · 5 as a first guess, but f (n) = 2 and d(n) = 12


in this case, as 1 is a square number. Multiplying by 7, though, resolves the issue: we have
n = 22 · 3 · 5 · 7, doubling the number of factors while holding the number of square factors
constant. We then get n = 420 — but we do have to check a few other things first.

As for the cases we haven’t addressed yet: if we have a 5th power instead of squared number
in the prime factorization of n, in the case we thought about in the first paragraph, then we
would have at least 3 squares — 1, p2 , p4 , and it’s not hard to check that in this case n would
have to exceed 420. On the other hand, if we have a cube of a prime, we’d start with 23 · 32 ,
which already gives us way too many square divisors. Our number n would exceed 420 again.

Thus our final answer is 420 .

5. Firstly, it is clear that Kelvin will eventually eat the fly, because the number of lilypads goes
down by 1 every second and at the three-lilypad state Kelvin and the fly must go to the same
lilypad. Thus call Ln the expected value of the number of seconds it takes for Kelvin to eat
the fly if there are n lilypads left; L3 = 1.

We find L4 as follows: when there are four lilypads left, there are two unoccupied lilypads;
either Kelvin and the fly go to the same one, with probability 1/2, or they go to different
ones, also with probability 1/2. Thus L4 = 12 (L3 + 1) + 12 · 1 = 32 .

Similarly, we find L5 = 32 (L4 + 1) + 1


3 = 2 and L6 = 34 (L5 + 1) + 1
4 = 52 . At this point, a
pattern appears to emerge.
n−3 1 n−3
In general, we have Ln = n−2 (Ln−1 + 1) + n−2 , because there’s an n−2 chance that Kelvin
1 n−1
does not eat the fly and a n−2 chance that he does. Moreover, it seems as if Ln = 2 .

We already have the base cases figured out, so now we induct to prove this. Suppose that
Lk = k−1 k−2 1 k
2 . Then Lk+1 = k−1 (Lk + 1) + k−1 = 2 after some algebraic manipulation, so our
induction is complete.
2019
All that’s left is to plug in n = 2020, which yields L2020 = 2 . Our answer is 2019 .

6. First, a few notes on properly constructing diagrams: in this case, it should become quite
obvious that starting with a trapezoid ABCD will not lead to a nice diagram.
Everaise Academy (2020) Week 5 Competition — Math II

Rather, in problems like these it’s often best to start with the most restrictive condition: begin
by drawing square AEF G, then construct B on the extension of ray AE such that A, E, and
7
B are collinear and EB = 24 AE. Then draw a line through A parallel to BF — that will be
the line AD. Points G and D themselves, unfortunately, require a little guesswork, but the
end result should look like this:

Here we’ve already taken the liberty of drawing XY through G perpendicular to AD and BC
— this is useful for finding tan ∠GDA. (ABCD really does look like a parallelogram, doesn’t
it? Unfortunately, diagrams can be deceiving!)

We claim firstly that XG 7


GY = 24 . Let ∠AGX = α, such that ∠F GY = 90 − α and ∠EBF = α.
Thus XG/GY = 24 cos α 7
24 sin α = cot α = 24 , as desired.

Next, we let ∠XGD = β, such that ∠CGY = 120 − β, and let GD = GC = s. It follows
s cos(120−β)
that 24 GY
7 = GX = s cos β . Dividing through by s and then using the angle subtraction

24 3
formula for cosine yields 7 = − 12 + 2 tan β, so it follows that tan β = 55
√ .
7 3
Thus we get

7 3
tan ∠GDA = 55 , and we are done. Our answer is 65 .

7. Call Siva walking through a door a ”move.” Suppose that Pn is the probability that after n
moves, two doors not numbered 5 are open, and suppose that Qn is the probability that after
n moves, a door numbered 5 is open along with a door not numbered 5. We clearly want to
find 12 Q2019 .

Suppose after n moves that two doors not numbered 5 are open. Then after the n + 1th move,
a door not numbered 5 closes and there is a 1/3 chance that door 5 opens. On the other
hand, suppose that a door numbered 5 is open; then after the n + 1th move, the chance is 12
the door numbered 5 gets walked through and is subsequently closed, and 21 that it is not.

Putting this information all together, we get Pn+1 = 23 Pn + 21 Qn and Qn+1 = 13 Pn + 12 Qn .


Knowing that P0 = 1, we can now proceed to find Q2019 .
( 52 )(2n−1 3n +2)−1 2
Through induction (or through pattern-finding), we see that Qn = 2n−1 3n
= 5 −
1
2n−1 3n 5
, so 12 Q2019 = 15 − 5·62019
1
. Thus our answer is 2030 .

8. Let x = 8yz 3 · u, y = 8zx3 · v and z = 8xy 3 · w where u, v, w ≥ 1. Then we have

xyz = 64(xyz)4 uvw


Everaise Academy (2020) Week 5 Competition — Math II

and hence
1
(xyz)3 = .
64uvw
Now, we want to find the maximum value of

x2 y 2 z 2 (x − 8yz 3 )(y − 8zx3 )(z − 8xy 3 ) = 512x6 y 6 z 6 (u − 1)(v − 1)(w − 1).


1
Using the fact that (xyz)3 = 64uvw , we obtain

1 (u − 1)(v − 1)(w − 1)
512x6 y 6 z 6 (u − 1)(v − 1)(w − 1) = ·
8 u2 v 2 w2
1 1 1
≤ · =
8 64 512

a−1 1
as a2
≤ 41 . Our answer is .
512

Note: on Gradescope, the problem was initially marked as if the answer was 512. This has
now been changed; apologies for the confusion.

You might also like