Unlimited Power ⛈️
Now that we have the machinery of the and general divisibility, we can touch on a theorem that will unlock us the ability to prove a ton of problems that otherwise would have been super freaking annoying to solve without it. Note that much of the information on this page was referenced from brilliant.org which is a great resource for such information.
Bezout’s Lemma: For all values of , the equation where are integer variables has a solution iff
This solution is actually quite insane, as we can see whether or not there will be solutions to equations by observing the Euclidean Algorithm.
so we know a solution exists.
which means no solution exists. This will have many applications, but let us first provide the proof.
First, the forward direction that solution exists
implies is quite easy by contrapositive, as if then if you divided both sides by the then would not be an integer and the equation would not be solvable with integers. Now for the more challenging direction
In order to prove that implies solution exists
we will actually provide an algorithm to find the solution. This algorithm is called the Extended Euclidean Algorithm and actually is just the Euclidean Algorithm, but holding onto some extra variables.
The idea of the algorithm is that we are going to find values such that at every step we get
where each is a remainder in the Euclidean Algorithm. If we can eventually get to the final step, we will be able to solve the equation for the . We start with
This should make sense as then and which is correct. From here we proceed with the Euclidean algorithm as well as two additional steps. Let
and in general we would have
with . Taking this value of we will say that
We can show that this algorithm will always produce valid steps as
Therefore, as long as we eventually reach the we will find a value of that solves the equation; since the Euclidean algorithm guarantees the , this is done.
If then we are done, however if , then find the final solutions of that solve for the , and then multiply both sides of the equation by . This proves our claim
QED.
Holy shit that was a lot. When I taught this for the first time to my students, literally people understood what was going on, so it might be worthwhile to go through an example. Notice that this algorithm is also as its just the Euclidean algorithm but with some additional steps each iteration.
Walking through the Extended Euclidean Algorithm
Example: Find values that satisfy
We will, by hand, compute the extended Euclidean Algorithm to solve this problem. We start with
We now proceed with the next step. which means that and . Also
which gives us that which is correct. We now go to the next step to see so and .
and again we get which is true. We still have not hit a remainder of yet so we continue. meaning and .
and to confirm we find that . Continuing we get that with and .
shockingly we find that . When we do we find a remainder of which means our algorithm is done. While we could leave it like this, we generally want to present our positive, so we would multiply both sides by to get
Now since we want to solve for when the equation equals , we can multiply both sides by to get that
which plugging into a calculator we find is correct! So a valid solution is and . If we wanted smaller positive numbers, we could add and to our solutions which would cancel out but make things easier, so
so we get and
so and is another valid solution.
Silly Results with Bezout’s Lemma
The solving of integer equations opens us up to some funny results as we can create word problems for them. One that I used personally was
Example: One trip on the PATH train with a metrocard costs M. For what values of will the card eventually reach $$0$ with no leftover money?
Solution
First, represent all values in terms of cents, so we don't need to worry about decimals. So is in cents, it costs per trip, and we refill with . If we refill times, and take trips, we want to find values such that
By Bezout's Lemma we know that a solution exists if and only if and since the is , the value on the card will reach if contains any dollar amount with cents.
Q.E.D.
Fun little side thing is that if the of the amount you refill and is , then any value of will eventually reach ! In order to do this just be unhinged as fuck and refill with every time since .
The Fundemental Theorem of Arithmetic
Now that we have access to Bezout’s Lemma, we now have the tools that we need to easily prove the Fundemental Theorem of Arithmetic, which forms the basis of number theory and why we really care so much about prime numbers.
But first before we actually explain what that is, we need to prove something called Euclid’s Lemma first. Funny enough this little Lemma is why we need Bezout’s Lemma, if we just took it by assumption then we could have skipped all this effort LOL. Crazier, Euclid proved this shit using fucking Geometry what a psychopath 🔪🩸
Euclid’s Lemma: Let be a prime number. If then or .
Proof
In order to prove this, we will show that if then its required that which is sufficient to prove, as if then we're done. We know that which means that
Since and is prime, then since the only factor of is and . As such by Bezout's Lemma we know that has a solution. Multiply both sides by to get that Notice before that we said so we can substitute to get that which means that as we know a solution exists and otherwise would not be an integer. This proves our claim.
Q.E.D.
With this result we are now ready to tackle the Fundemental Theorem.
Fundemental Theorem of Arithmetic: For every integer , either is prime, or there exists a unique product of primes
In other words, every number has a prime factorization.
This is how we know that every number can be broken up into prime factors! Now like many theorems, this one has two pieces. The first is showing that a factorization always exists, and the second is showing that every number has only one factorization. We will do these two proofs seperately; existence is easy, uniqueness is hard (kinda).
The existence proof comes from the way that we often ourselves do factoring. Suppose I wanted to factor , well I could see that , so dividing I’d find that and now our problem is reduced to finding the factors of ! This is effectively strong induction which is why we will use strong induction to prove.
Existence Proof
Our base case is which is prime. We will now perform the induction step. Consider some value of and assume that all integers less than satisfy our hypothesis. If is prime then we are done. If is not prime, then there is some number such that which means for some value of . Since both by our strong induction hypothesis we know that they both have prime factorizations. As such we can multiply these prime factorizations to get a prime factorization for .
Q.E.D.
Now to prove uniqueness we will do exactly the same thing we do for all uniqueness proofs; assume there are two different versions and then prove that they must be the same.
Uniqueness Proof
Suppose that for some value of we have two distinct prime products
and
Where values of are prime. Let us begin by first observing that by definition, so
and since is prime, by Euclid's Lemma we know that must divide some . For the sake of convenience say that since is also prime, we can see that which means that . We can continually apply this process to see that in fact every prime and which makes the two factorizations the same, proving our claim.
Q.E.D.
This result actually is quite massive, as it shows us that we can always factorize any integer. Perhaps this result is boring to the people who were already aware that you could factorize integers and didn’t really care why it was why it was. In the future I will put a section here on algorithms for prime factorizing
Practice Problems
Example: Find a value such that
Theorem: Let and . Then
Theorem: Let be prime and . Then