MathDash Book
MathDash Book
as
hD
Your Guide to Math Contests
”Mathematics is not about numbers, equations, or algorithms: it is about
understanding.”
Contents
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Number Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
h
Practice Contests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
MATHCOUNTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
as
AMC 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
hD
Power of a Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Practice Contests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
MATHCOUNTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
AMC 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
at
Combinatorics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Linearity of Expectation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
M
Generating Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Ptolemy’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Incenter-Excenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Practice Contests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
AIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
USA(J)MO 34
MathDash CONTENTS 3
Number Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Quadratic Residues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
h
as
hD
at
M
MathDash CONTENTS 4
This is the official MathDash Guide to help you prepare for US-based math competitions, including
the MAA’s AMC-AIME-USA(J)MO progression and MathCounts.
We will provide a handout on each topic you may need to know, including walking through some
illustrative example problems to show how you can use that technique to solve problems. In order to
succeed, we suggest that you:
1. Preview the handout materials at your level (check the rating range) before attempting the
problems, ensuring that the relevant materials are fresh on your mind.
h
2. Clarify anything that is confusing with peers or with a coach using the pre-contest chat
3. Practice solving problems using timed contests on MathDash ← − this is where you will spend the
as
bulk of your time. This is ”exercise” for your mental muscles
5. Chat and discuss your ideas about problems with peers and coaches to refine your intuition.
Every single practice problem should be “solvable” using techniques previously covered at some point
hD
in this guide. That doesn’t mean you should expect to get a perfect score! Just knowing the
techniques is the first step. What we really need to work on together is the actual problem-solving
process. We have selected the highest quality problems for you to train the most efficiently, and have
also created a fun way to train since you can gain rating and track your progress over time :)
Whether you are aiming for a perfect score or solving a few problems as a first-time taker, remember
that every bit of progress is valuable and is putting you ahead of the field.
This is a LIVING document that will be updated as you request more modules. Submit any
M
requests for training topics to [email protected]. With your help and feedback, we hope this
guide will become one of the best ways to prepare for competition math!
MathDash Prime Factors and Divisors 5
h
We know that the prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, · · · .
as
60 = 2 × 2 × 3 × 5 = 22 × 3 × 5
It turns out that this is the only way to write 60 as the product of prime numbers! We call this
the prime factorization of 60.
hD
In general, each number N can be written in the form
Example 1
at
Solution: Multiplying this number out and then trying to find primes that divide it would take a
long time! Let’s instead do this by finding the prime factorization of each product in the multiplication.
M
10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1
= (2 × 5) × (32 ) × (23 ) × 7 × (2 × 3) × 5 × 22 × 3 × 2 × 1
= 28 × 34 × 52 × 7
Definition 1
The divisors of N are the positive integers d for which N is divisible by d. We use the notation
d|N to mean that d is a divisor of N , or N is divisible by d, or d divides N .
MathDash Prime Factors and Divisors 6
Example 2
Find all of the divisors of 60.
Solution: How can we find all of the divisors of a number? Well, we could try each of the 60
numbers from 1 through 60 and see if they evenly divide into 60. This would take a long time though
- so let’s search for a quicker solution.
In the case of N = 60, one trick we can use is the fact that if d|N , then (N/d)|N as well! (For
example, 2 is a divisor of 60 - so 60 ÷ 2 = 30 is also a divisor of 60). This is because the divisors
come in pairs that multiply to N = 60.
h
√
All we need to do is find all of the divisors of 60 that are less than 60 - and then calculate 60 ÷ d
for each divisor to get the rest of them!
√
as
Since 60 ≤ 8, we can check d = 1, 2, · · · , 8 and see that 1, 2, 3, 4, 5, 6 are all divisors of 60 - and
then their pairs are 60 , 60 , 60 , 60 , 60 , 60 - giving us the 10 divisors 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60 .
1 2 3 4 5 6
√
How do we know that there are no more? Well, if d > 60 and d is a divisor of 60, then (60/d)
√
is also a divisor of 60, and 60 d
≤ √6060 = 60. So, we would have found 60 d
in our search already
√
- since we checked all divisors less than 60 - and thus have found d because we counted each of
hD
those divisors as well as the divisors they are paired with.
Example 3
How many divisors does 90000 have?
at
√
If we were to use the method in the previous example, we would have to check 90000 = 300
numbers to see if they were divisors of 90000. While better than checking 90000 values, this is still
a lot of numbers to check.
Let’s instead try to figure out what the prime factorization of a divisor of 90000 would look like -
M
Theorem 2
If a is a divisor of b, then the exponent of a prime p in the prime factorization of a is less than
or equal to the exponent of the same prime p in the prime factorization of b
Why is this true? Let’s think about the exponent of the prime p in the prime factorization of
b
a
,which is an integer. We know that there are more factors of p in a than b - so the exponent of
p in the prime factorization of ab would be negative! (As an example, you can see that if p = 3,
a = 2 × 33 , and b = 22 × 32 , then ab would have a negative exponent for 3). This is not possible,
because the prime factorization of any positive integer has only non-negative exponents.
MathDash Prime Factors and Divisors 7
Now - to solve the original problem, lets write 90000 = 9 × 104 = 32 × (2 × 5)4 = 24 × 32 × 54
Now that we’ve prime factorized 90000, what must the prime factorization of a divisor of 90000
look like? Well - from Theorem 2, we know that the exponent of 2 must be less than or equal to 4,
the exponent of 3 must be less than or equal to 2, and the exponent of 5 must be less than or equal
to 4.
Also - since 90000 has an exponent of 0 for every prime that isn’t 2, 3, 5 - we know that the
exponent in a divisor of 90000 of any prime that isn’t 2, 3, 5 must also be less than or equal to 0!
So, for d a divisor of 90000, we can write it’s prime factorization as d = 2□ 3□ 5□ 7□ 11□ · · ·
and we know:
h
• the exponent of 2 is either 0, 1, 2, 3, 4,
• the exponent of 3 is either 0, 1, 2, and
as
• the exponent of 5 is either 0, 1, 2, 3, 4, and
• the exponents of 7, 11, · · · are all 0.
For each number d of this form, is it necessarily a divisor of 90000? Well, an integer d is a divisor of
90000 if there is another integer k such that d · k = 90000. For each number of the form 2e0 3e1 5e2
hD
with the given conditions on e0 , e1 , e2 , we can let k = 24−e0 32−e1 54−e2 , and d · k will be equal to
24 32 54 = 90000. So, we’ve figured out a way to write the prime factorization of every divisor of
90000.
Now all that remains is to count the divisors. There are 5 choices for the value of e0 , 3 choices for
the value of e1 , and 5 choices for the value of e2 . Each possible choice gives us a value for 2e0 3e1 5e2
that is one of the divisors of 90000. Since there are 5 × 3 × 5 = 75 ways for us to choose these
at
This is because there are e0 + 1 ways to choose the exponent of 2 in the divisor (any integer
from 0 through e0 inclusive), e1 + 1 ways to choose the exponent of 3, and so on.
Example 4
Three consecutive integers multiply to 29760. What is the middle integer?
Solution: Well, a first idea would be to let the integers be n, n+1, and n+2. We get n(n+1)(n+2) =
29760. This is pretty difficult to solve though - it is a cubic equation and we don’t really have a good
way to solve these.
MathDash Prime Factors and Divisors 8
Let’s use the fact that n is an integer to help us - perhaps we can try prime factorizing 29760.
We can immediately write 29760 = 10 · 2976. To prime factorize 2976, we can start by repeatedly
dividing it by 2 - 2976 = 2 × 1488 = 4 × 744 = 8 × 372 = 16 × 186 = 32 × 93.
Then, we see that 93 satisfies the divisibility test for 3 (it’s digits sum to a multiple of 3) - so we
can divide by 3 to get 93 = 3 × 31.
Now, how do we figure out what n is? Well - we know that 31 is a divisor of n(n + 1)(n + 2).
Theorem 4
h
If a prime number p divides a × b, then either p divides a or p divides b (or both). This is
because if p didn’t divide either a or b, then p would not be in the prime factorizations of a or
b, meaning that their product’s prime factorization wouldn’t have p in it.
as
From the above theorem, we know that 31 is either a divisor of n, n + 1, or n + 2. Furthermore,
since n(n + 1)(n + 2) = 29760, we know that if either of n, n + 1, n + 2 was a multiple of 31 larger
than 31, then n > 60, which means n(n + 1)(n + 2) > n3 > 216000 - which is way too big. So, this
hD
tells us that one of n, n + 1, n + 2 must be equal to 31.
If n = 31, then n + 2 = 33, but 11 is not in the prime factorization that we obtained - so 33
cannot be one of the terms. If n + 2 = 31, then n = 29, but 29 is not in the prime factorization
we obtained. So, we must have n = 30 - and we can confirm 30 × 31 × 32 has the same prime
factorization that we obtained! Thus, our answer, the middle integer, is 31 .
at
h
Example 5
as
How many even perfect square divisors does 1000000 have?
Solution: We will use the ideas from an earlier example - we can prime factorize 1000000 = 106 =
26 × 56 . Thus, the divisors are 2□ 5□ where each box is an integer from 0 through 6 inclusive. We
hD
know that there are 7 × 7 = 49 total divisors - the question though is how many of these are even
and perfect squares?
For a number 2□ 5□ to be even, the exponent of two needs to be greater than 0. For it to be a
perfect square, we need both of the exponents to be even, so that they can be evenly divided into two
equal numbers. For example, 24 52 is a perfect square because it can be written as (22 × 5) × (22 × 5)
- which is because the exponents 4, 2 are both even.
at
So, we need the exponent of 2 to specifically be an integer from 0 to 6 inclusive that is greater
than 0 and even - it can only be 2, 4, 6. And we need the exponent of 5 to be an integer from 0 to
6 inclusive that is even - it can only be 0, 2, 4, 6.
MATHCOUNTS
by MathDash Community
https://mathdash.com/contests?tag=MATHCOUNTS
h
as
hD
at
M
MathDash AMC 8 11
AMC 8
by MathDash Community
https://mathdash.com/contests?tag=AMC+8
h
AMC 8 Full-length Mock Contests
as
https://mathdash.com/contests?tag=AMC+8
hD
at
M
MathDash Power of a Point 12
Power of a Point
by MathDash Team
https://mathdash.com/maps/map/power-of-a-point
h
A O
as D
hD
Theorem 10 (Power of a Point)
Given any circle with center O and radius R, and any point X inside that circle, we call
OX 2 − R2 the power of the point X with respect to the circle.
The theorem states that for any chord AB that goes through X, AX · XB is equal to the
negative of the power of the point X. Since this is constant, this means AX · XB = CX · XD.
at
Proof: Let’s define E to be the midpoint of chord AB, and draw some extra lines
B
M
E
X
A O
D
MathDash Power of a Point 13
We want to find the expression AX × XB. This is equal to (AE − EX)(BE + EX) = (AE −
EX)(AE + EX) = AE 2 − EX 2 . Now, since we have right triangles, let’s use the Pythagorean
Theorem!
There is another way to prove that AX · XB = CX · XD using similar triangles! We know that
h
⌢
∠AXC = ∠BXD, and ∠ACX = ∠DBX (because they both are half the measure of arc AD) -
so by Angle Angle Similarity, we know that △ACX ∼ △DBX.
as
CX BX
This tells us = which rearranges to AX · XB = CX · XD.
AX DX
Interestingly, Power of a Point doesn’t only hold for points inside the circle - let’s look at a case
where point X is outside of the circle!
hD
Figure 2: Power of a Point - XA · XB = XC · XD = OX 2 − R2
E
C
X O
B
at
A
M
The theorem states that for any chord AB that goes through X, XA · XB is equal to the
power of the point X. Since this is constant, this means OX 2 − R2 = XA · XB = XC · XD.
Where did the XE 2 come from, you may ask? Well - consider what happens if we move C and
D closer together (maintaining that CD intersects X). We still have that XC · XD = OX 2 −
R2 = XA · XB holds as we move C and D closer and closer together. When they meet each
MathDash Power of a Point 14
other, we still need CD to intersect X - this means that they will meet at point E! And so,
XE · XE = OX 2 − R2 = XA · XB giving us our result.
As an aside, maybe you will notice that we defined the ’power of a point’ to be the negative of
our earlier definition. We can keep this consistent using something called directed lengths - where
we consider XA = −1 · AX. If this is the case, then the above theorem holds whether or not X is
inside or outside of the circle!
h
This is a really powerful theorem that can help us solve a variety of questions.
Example 6
as
Two circles intersect at F and E. A line is drawn tangent to both circles at C and D, and EF
intersects CD at X. If XC = 4, and the radii of the circles are 10 and 8, find XD.
hD
D
C X
F
at
E
M
Solution: Power of a Point on the left circle tells us XC 2 = XF · XE. Power of a Point on the
right circle also tells us XD2 = XF · XE. So, XC 2 = XD2 - and since XC = 4, we must have
XD = 4 . The radii of the circles turns out to be a bit of a red herring!
MATHCOUNTS
by MathDash Community
https://mathdash.com/contests?tag=MATHCOUNTS
h
as
hD
at
M
MathDash AMC 10 16
AMC 10
by MathDash Community
https://mathdash.com/contests?tag=AMC+10
h
AMC 10 Full-Length Mocks
as
https://mathdash.com/contests?tag=AMC+10
hD
at
M
MathDash Linearity of Expectation 17
Linearity of Expectation
by MathDash Team
https://mathdash.com/maps/map/linearity-of-expectation
h
as
Example 7
A six-sided die is rolled, having sides 1, 2, 3, 4, 5, 6. What is the expected value of the result of
the roll?
hD
Solution: We can use the definition of expected value - let A be the random variable for the
result of the dice roll. We know that the expected value of A is
E[A] = P (A = 1) · 1 + P (A = 2) · 2 + P (A = 3) · 3 + P (A = 4) · 4 + P (A = 5) · 5 + P (A = 6) · 6
1
P (A = i) = 6
for each i = 1, 2, 3, 4, 5, 6, so this simplifies to simply A = 61 (1 + 2 + 3 + 4 + 5 + 6) =
21
6
= 3.5
at
That was easy enough. Now let’s look at a very basic example of Linearity of Expectation
Example 8
If a random number a has an expected value of 3, and a random number b has an expected
M
Turns out that you can easily guess than the answer would be 3 + 4 = 7 . This is precisely
what Linearity of Expectation says - for any two random variables A, B, we have that E[A + B] =
E[A] + E[B]. More generally,
In other words, the expected value of the sum is the sum of the expected values.
Easy enough - why is this even a theorem you may ask - it seems very obvious! Of course the
expected value of a sum should be the sum of the expected values. Well, let’s take a look at the
next problem
Example 9
(Classic) n students take a test. Afterwards, the teacher decides to randomly scramble the tests
and give each student one of the tests back. What is the expected number of students who get
their own test back?
h
What an impossible looking question - trying to do this naively would mean we would need to
as
count the number of ways to give the tests back such that one student got their own test back, two
students, three students, etc. Each of those cases are really tricky problems in their own right.
Solution : Let’s use the power of indicator variables to help us solve this. Let Ai be a random
variable defined as follows:
hD
1, if the i-th student receives their own test
Ai =
0, otherwise
First, I claim that the number of students who get their own test back is A1 + A2 + · · · + An . Why?
This is because Ai will be 1 for each student that gets their own test back, and 0 otherwise - so the
sum will count the number of students who get their own test back.
E[A1 + A2 + · · · + An ]
What is E[Ai ] (for an arbitrary i)? Well, the definition of expected value tells us this is 0 · P (Ai =
0) + 1 · P (Ai = 1) - so this is just P (Ai = 1), or the probability that the i-th student receives their
own test. Well - we know what that is - the probability that the i-th student receives their own test
1
is .
n
So, E[Ai ] = n1 , and
1 1 1
E[A1 ] + E[A2 ] + · · · + E[An ] =
+ + ··· + = 1
n n n
In other words, the expected number of students who get their own test back is 1.
Linearity of Expectation is one of the most beautiful and satisfying tricks to use in contest math!
Hopefully you were impressed by the ease at which Linearity of Expectation helped solve that otherwise
quite impossible question.
MathDash Linearity of Expectation 19
The perhaps surprising part of Linearity of Expectation is that it holds even when the random
variables depend on each other ! In this case, A1 depends on A2 - for example, whether or not person
1 receives their own test back definitely impacts the probability that person 2 receives their own test
back. However, we can still use Linearity of Expectation here because it holds in general, not only
for independent events.
(As a sidenote, for independent random variables A1 , A2 , E[A1 A2 ] = E[A1 ]E[A2 ] - but this is
not true if the random variables depend on each other).
Example 10
h
Ten people of different heights stand in a line in a random order. A person ’looks tall’ if they
are taller than both the person to the left and to the right of them (or, if they are on the edge,
taller than the one person next to them). What is the expected number of people who look
as
tall?
Solution: We will use the trick of indicator variables yet again! Let Ai be the random variable
defined as such:
1, if the i-th person in line looks tall
Ai =
hD
0, otherwise
Note that the number of people who look tall is A1 + A2 + · · · + A10 . So we just need to find the
expected value of this sum, or
E[A1 + A2 + · · · + A10 ]
Which by Linearity of Expectation is equal to
at
Now, how do we find this sum? As in the previous problem, E[Ai ] is equal to 0·P (Ai = 0)+1·P (Ai =
1) - so this is just P (Ai = 1), or the probability that the i-th person in line looks tall.
Let’s try to figure out what P (A1 = 1) is - this is the probability that the first person in line ’looks
M
tall’. Well - each possible random ordering of people can be paired up with another random ordering
with the position of the first two people swapped. In exactly one of the two of these, the first person
in line ’looks tall’ and in the other one, they don’t! So, in exactly 12 of the random orderings, the
first person in line looks tall. Thus, P (A1 = 1) = 21 . Similarly, P (A10 = 1) = 21 .
P (A2 = 1) is a little different - this is the probability that the second person in line ’looks tall’.
We can use a similar idea though - we group all of the orderings into groups of 6 - the group is
determined by the ordering of the participants who are not in the 1, 2, or 3 slot. Each group of six is
the same ordering except with the order of 1, 2, 3 changed to be one of the 6 possible orderings. In
1
exactly two of these orderings, the second person in line ’looks tall’ - so across all permutations, of
3
them have the second person in line ’look tall’. Thus, P (A2 = 1) = 13 , and similarly, P (Ai = 1) = 13
for i = 2, 3, · · · , 9
MathDash Linearity of Expectation 20
So, the expected value of the number of people who look tall is E[A1 + A2 + · · · + A10 ] which is
1 1 1 1 1
E[A1 ] + E[A2 ] + · · · + E[A10 ] = + + + ··· + +
2 3 3 3 2
8
= 1+
3
11
= .
3
You can imagine trying to do this question without linearity of expectation - you’d have to count
the number of permutations of 10 people for which there are 0 people who look tall, 1 person who
looks tall, 2 people who look tall, 3 people who look tall, etc. After performing an incredibly large
number of calculations, you would arrive at a final answer of 11
h
3
as well. Linearity of Expectation
saves us a lot of time!
as
Try some Linearity of Expectation Problems
https://mathdash.com/maps/map/linearity-of-expectation
hD
at
M
MathDash Generating Functions 21
Generating Functions
by MathDash Team
https://mathdash.com/maps/map/generating-functions
Generating functions are a powerful tool in combinatorics that allow us to encode sequences of
numbers as coefficients in a power series. By manipulating these power series, we can solve some of
the most difficult combinatorics and algebra problems in competition math!
h
Example 11
There are three baskets on the ground: one has 2 purple eggs, one has 2 green eggs, and one
has 3 white eggs. Eggs of the same color are indistinguishable. In how many ways can I choose
as
4 eggs from the baskets?
Solution
hD
Let’s express the conditions as polynomials. This may seem crazy at first, but bear with me! Since
we can choose either 0, 1, or 2 eggs from the first basket (purple eggs), we can represent this as:
x0 + x1 + x2
x0 + x1 + x2
at
For the white eggs, since we can choose 0, 1, 2, or 3 eggs, we represent this as:
x0 + x1 + x2 + x3
Now let term in the resulting polynomial correspond to choosing one term from each of the original
polynomials! For instance, if we choose x0 from the first factor, x1 from the second, and x2 from
the third, this would correspond to choosing 0 purple eggs, 1 green egg, and 2 white eggs.
So, this 7th -degree monstrosity of a polynomial in fact is the sum of many individual terms each
representing a way to pick eggs from our three baskets!
The problem is asking for the number of ways to choose 4 eggs from the basket. Conveniently,
each term representing one of these ways evaluates to x4 ! So, we only need to find the coefficient of
x4 in the resulting polynomial.
MathDash Generating Functions 22
So, it turns out that the coefficient of x4 is 8, meaning there are 8 ways to choose 4 eggs.
Furthermore, this wild method of solving this question also tells us that there is 1 way to choose 7
eggs, 3 ways to choose 6 eggs, 6 ways to choose 5 eggs, 8 ways to choose 3 eggs, 6 ways to choose
2 eggs, 3 ways to choose 1 egg, and 1 way to choose 0 eggs! (We can see this by simply looking at
the coefficients of the polynomial).
Example 12
h
Find a general formula for the Fibonacci sequence, satisfying the recurrence a0 = 1, a1 = 1,
and an = an−1 + an−2 for n ≥ 2.
as
Solution
Let’s tackle the Fibonacci sequence using generating functions! Generating functions are not just for
hD
combinatorics; they shine in solving recurrence relations too.
First, let’s define the generating function A(x) for the Fibonacci sequence {an } as:
A(x) = a0 + a1 x + a2 x2 + a3 x3 + · · ·
In general, this is how we will define the generating function of any sequence!
Now, given the recurrence relation an = an−1 + an−2 , we can express this in terms of A(x) as
at
follows:
an − an−1 − an−2 = 0
M
A(x)(1 − x − x2 ) = 1
Solving for A(x):
1
A(x) =
1 − x − x2
Now, to find the general formula for an , we will write A(x) in a form where the coefficients are clearly
defined! To do this, we need to express A(x) in a form that allows us to figure out it’s coefficients.
Let’s use partial fraction decomposition.
h
√ √
−(−1) ± 1 + 4 1± 5
x= =
2 2
as
√ √
1+ 5 1− 5
Let ϕ = 2
(the golden ratio) and ψ = 2
.
ψ n − ϕn
an = √
5
Now, remember that an was originally defined to be the n-th Fibonacci number! So, now we have a
general formula for the n-th Fibonacci number:
M
√ √
(1 − 5)n − (1 + 5)n ϕn − ψ n
an = √ = √
2n 5 5
√ n √ n
1+ 5
2
− 1−2 5
an = √
5
This elegant formula allows us to compute the n-th Fibonacci number directly without computing all
the previous terms! And the power of generating functions let us come up with this.
Here are some common generating functions - maybe it could be exciting to try proving them
yourself!
MathDash Generating Functions 24
h
∞
−α
X α+k−1
(1 − x) = xk .
k=0
k
as
Theorem 15 (Generating Function for Combinations)
For fixed k,
∞
X n
xn =
xk
hD
.
n=0
k (1 − x)k+1
X x
F n xn = .
n=0
1 − x − x2
M
h
n=0
as
Example 13
Let n be a positive integer. Show that
n−1 n−2 n−3
Fn = + + + ···
0 1 2
hD
where Fn denotes the nth Fibonacci number
Solution
n−1 n−2 n−3
Well, let an = Fn and let bn = + + + · · · . If we can show that
0 1 2
at
a0 + a1 x + a2 x 2 + · · · = b 0 + b 1 x + b 2 x 2 + · · ·
, then we are done since the polynomials being equal (as polynomials) means that each coefficient is
equal!
M
x
We found the generating function of the Fibonacci sequence - it is 1−x−x 2 (yes, this is multiplied
by x - that is just because we’re defining F0 = 0 here instead, so the series is shifted by one term).
Let’s find the generating function of bi !
Note that ∞
X n−1−i
bn =
i=0
i
MathDash Generating Functions 26
So,
∞ ∞ X ∞
X
n
X n−1−i n
bn x = x
n=0 n=0 i=0
i
∞ X ∞
X n−1−i n
= x
i=0 n=0
i
∞ ∞
X
1+i
X n − 1 − i n−1−i
= x x
i=0 n=0
i
h
X
i+1
x · i+1
= ·
i=0
(1 − x) 1−x 1−x
x 1
= · x2
1 − x 1 − 1−x
as
x
=
1 − x − x2
So, we have shown that these two sequences are equal, and thus, the result is proven! ■
hD
Try some Generating Functions Problems
https://mathdash.com/maps/map/generating-functions
at
M
MathDash Ptolemy’s Theorem 27
Ptolemy’s Theorem
by MathDash Team
https://mathdash.com/maps/map/ptolemy
Figure 3: Ptolemy - AB · CD + AD · BC = AC · BD
D
h
O
as
C
B
hD
Theorem 20 (Ptolemy’s Theorem)
Given four points on a circle in the order A, B, C, D,
AB · CD + AD · BC = AC · BD
Proof:
at
M
Source: Wikipedia
Let’s construct a point K on AC such that ∠ABK = ∠DBC. Note that this makes △AKB is
similar to △BDC because of angle-angle similarity (since ∠BAK = ∠BDC).
AB BD
So, = . Cross-multiplying gives us AB · CD = AK · BD. Nice - we’ve been able to
AK DC
re-write one term in the Ptolemy’s Theorem equation. Let’s do it again!
MathDash Ptolemy’s Theorem 28
Since ∠ABK = ∠DBC, adding ∠KBD to both tells us ∠ABD = ∠KBC. Coupling this with
AD KC
the fact that ∠BDA = ∠BCK, we see that △ABD is similar to △KBC. This tells us =
BD BC
or AD · BC = BD · KC.
h
if and only if A, B, C, D lie on a circle
as
Example 14
A regular hexagon ABCDEF is inscribed in a circle. If P is on the minor arc BC, and
P E = 10, P F = 11, find P A + P B + P C + P D.
hD
P
B C
at
A D
M
F
E
Solution: Let’s use Ptolemy on some of the cyclic quadrilaterals in this diagram! If we use
Ptolemy’s on the red quadrilateral P CEA, we get P A · EC + P C · AE = P E · AC. Note though
that △ACE is an equilateral triangle (being the alternate vertices on a regular hexagon)! So,
AC = CE = AE. Dividing by this side length gives us P A + P C = P E.
h
as
hD
at
M
MathDash Incenter-Excenter 30
Incenter-Excenter
by MathDash Team
https://mathdash.com/maps/map/incenter-excenter
h
as
hD
at
M
Figure 4: Ptolemy - AB · CD + AD · BC = AC · BD
Proof: Well, if M is the midpoint of the arc BC, then BM and CM have equal angle measures.
So, ∠BAM = ∠CAM (both are half of the measures of the arc). Thus, M lies on the angle bisector
of ∠BAC. We know, by definition that I and IA lie on this angle bisector as well - (remember IA
MathDash Incenter-Excenter 31
is defined as the intersection of the A-angle bisector and the B, C external angle bisectors) - so we
know now A, I, M, IA are collinear.
We also know from M being the midpoint of the arc BC that BM = CM . Furthermore, note
that ∠IBM = ∠IBC + ∠CBM = 12 ∠ABC + ∠CAM = 12 ∠ABC + 12 ∠BAC = 90 − 12 ∠ACB.
Also, angle ∠BIM = 180 − ∠AIB = ∠BAI + ∠ABI = 21 ∠ABC + 12 ∠BAC = 90 − 21 ∠ACB.
So, ∠BIM = ∠IBM and thus BM = IM .
Furthermore, similar angle chasing gives us ∠M BIA = ∠CBIA − ∠CBM = 21 (180 − ∠ABC) −
∠CAM = 90 − 21 ∠ABC − 12 ∠BAC = 12 ∠ACB, and ∠M IA B = ∠ICB = 12 ∠ACB. So, M BIA
is isosceles and M B = M IA .
h
Thus, the length equalities are proven as well - M B = M IA = M I = M C.
This theorem by itself is a very common configuration in advanced computational geometry and
olympiad geometry! Let’s use it to solve a problem
as
Example 15
(2013 HMMT Team 6) Let triangle ABC satisfy 2 · BC = AB + AC, and have incenter I and
circumcircle ω. Let D be the intersection of AI and ω. If AI = 10, find DI.
hD
A
10
at
O
I
M
B
C
Solution: First, we can immediately tell that from the Incenter-Excenter Theorem, D, being
the intersection of AI with the circumcircle of ABC, is the midpoint of arc BC! This tells us
BD = CD = ID - so we simply need to find what this common length is. Let it be x.
h
as
hD
at
M
MathDash AIME 33
AIME
by MathDash Community
https://mathdash.com/contests?tag=AIME
h
as
hD
at
M
MathDash Quadratic Residues 34
Quadratic Residues
by MathDash Team
https://mathdash.com/maps/map/quadratic-residues
Definition 3
We define a to be a quadratic residue in mod m if there exists an integer x such that x2 ≡ a
(mod m)
h
Theorem 23
as
For every odd prime p, exactly half of {1, 2, · · · , p − 1} are quadratic residues and exactly half
are quadratic non-residues.
Solution: Consider all the nonzero residues modulo p, namely 1, 2, · · · , p − 1, and square them.
If two of the squares are equal, we have x21 ≡ x22 (mod p), or x21 − x22 = (x1 + x2 )(x1 − x2 ) ≡ 0
hD
(mod p). This means (x1 + x2 )(x1 − x2 ) is divisible by p, so one of the terms has to be divisible by
p! So, x1 is either x2 or −x2 modulo p.
What does this mean? Well, in our set of squares 12 , 22 , · · · , (p − 1)2 , this result means that two
of them are congruent modulo p if and only if they are the same square or they are in a x2 , (p − x)2
pair. Thus our set of squares must consist of p−1
2
distinct values, each occuring twice.
So, these p−1 distinct values are quadratic residues, and the other p−1
nonzero values are quadratic
at
2 2
nonresidues!
Now let’s describe some notation that will come in handy as we work a lot with quadratic residues
and nonresidues
M
Definition 4 (Legrende)
a
If p is an odd prime, a > 0, and gcd(a, p) = 1, the Legrende symbol is defined as
p
a 1,
if a is a quadratic residue mod p,
= −1, if a is a quadratic nonresidue mod p,
p
0, if a is divisible by p.
What an arbitrary definition right? Why would we define this.. Well, this symbol has some cool
properties.
MathDash Quadratic Residues 35
p−1
Proof: Well, we know that Fermat’s Little Theorem says that (a 2 )2 ≡ ap−1 ≡ 1 (mod p). So,
p−1
a 2 is either 1 or −1 modulo p (because if x2 ≡ 1, then (x + 1)(x − 1) ≡ 0 meaning x is 1 or −1
modulo p).
p−1
Which one is it? Well, suppose a is a quadratic residue. Then, a ≡ k 2 (mod p), so a 2 ≡
p−1
k p−1 ≡ 1. So, a being a quadratic residue means that a 2 ≡ 1 as desired!
h
Now, what if a is not a quadratic residue? This is a lot trickier to prove - I’m going to present
two proofs to this - one with some heavy machinery!
as
Theorem 25 (Lagrange’s Theorem)
If p is a prime, and f (x) is a polynomial of degree d with not all coefficients divisible by p, then
f (x) ≡ 0 (mod p) has at most d integer solutions in {0, 1, 2, · · · , p − 1}
hD
A quick sketch of the proof of Lagrange’s Theorem is to repeatedly use the division algorithm in
modulo p to divide out (x − r) for each solution r to this.
p−1
In any case, we can use Lagrange’s Theorem here because a 2 − 1 ≡ 0 already has p−1 2
roots,
p−1
namely all of the quadratic residues, so it must not have any other solution! So, a 2 must not be 1
for a any quadratic nonresidue, meaning it is −1. This proves the result!
Here’s another proof: Consider the set of residues {1, 2, · · · , p − 1}. Let us pair each residue r
at
with a · r−1 . Notice since a is not a quadratic residue, each residue is paired with a different nonzero
residue. Additionally, the product of each pair of residues is a, so the total product is a(p−1)/2 .
However, the product is also (p − 1)! (mod p). So, we just need to show now that (p − 1)! ≡ −1
(mod p), and this is exactly the statement of Wilson’s Theorem.
M
p−1
Now that we’ve shown a 2 ≡ 1 (mod p) for quadratic residues a, and −1 (mod p) for quadratic
nonresidues a, we have proved Euler’s Criterion.
One nice property of the Legrende symbol follows immediately from Euler’s Criterion
Theorem 26
For p an odd prime, and gcd(a, p) = gcd(b, p) = 1,
ab a b
=
p p p
Theorem 28
If p is an odd prime, then
h
2 p2 −1
= (−1) 8
p
as
The proof of these statements is not simple - perhaps we will add a proof into here in the future -
but for now, let’s begin using these to solve a lot of number theory questions!
hD
Example 16
Show that for every prime number p there exists integers a, b such that a2 + b2 + 1 is divisible
by p
All we needed was an understanding of the number of possible values a2 and b2 could be to do
this one! Let’s do another.
M
Example 17
Find all integers x such that x2 − 31x + 34 is divisible by 37.
Example 18
Does there exist a positive integer x such that x2 leaves a remainder of 74 when divided by
131?
Solution The Law of Quadratic Reciprocity is going to come in handy here. We compute as
follows:
74 2 37
=
131 131 131
18·65 131
= (−1) · (−1)
37
h
20
= (−1)
37
5
as
= (−1)
37
18·2 37
= (−1)(−1)
5
2
= (−1)
5
hD
= (−1)(−1)
=1
So, indeed there does exist a positive integer x that satisfies this.
at
Example 19
Find the sum of all primes 5 ≤ p ≤ 30 for which there exist an x such that x2 + 3 is divisible
by p.
M
Example 20
If p = 2n + 1, n ≥ 2, p is prime, then find the remainder when 3(p−1)/2 is divided by p.
Solution Notice since p is not divisible by 3, n must be even. Let n = 2k. Also notice p ≡ 1
MathDash Quadratic Residues 38
p
k 3 p
(mod 4) and p ≡ 4 + 1 ≡ 2 (mod 3) so = −1. Also, = (−1)(p−1)/2 = 1.
3 p 3
3
Therefore = −1 so 3(p−1)/2 + 1 ≡ 0 (mod p), and our answer is p − 1 .
p
h
as
hD
at
M