# Number Theory: Euclid's lemma

## Understanding Euclid’s Lemma

• Euclid’s Lemma is a key proposition in number theory, providing a vital tool for understanding properties of prime numbers and factoring.
• It states that if a prime number divides the product of two integers, then it must divide at least one of those integers.
•  Formally, if p is a prime number and p ab (read as “p divides ab” or “p is a divisor of ab”), then **p a** or **p b**.

## Applications of Euclid’s Lemma

• Euclid’s Lemma is often used in proofs of other propositions or theorems in number theory, including the Unique Factorisation Theorem (also known as Fundamental Theorem of Arithmetic).
• It can be used to prove that √n is the largest possible prime factor of n. Because if n has a prime factor greater than √n, it should also have a complementary factor that is less than √n.

## Extended Version of Euclid’s Lemma

•  A more generalized version of Euclid’s Lemma, known as the Extended Euclid’s Lemma, can be used to find the greatest common divisor (GCD) of two numbers a and b: If p is a prime number and p ab, then p must divide a or p must divide b, or both.
• This extension provides the method behind the Euclidean Algorithm for finding the GCD of two numbers.

## Understanding the Euclidean Algorithm

• The Euclidean Algorithm is a method for finding the greatest common divisor (GCD) of two numbers based on the Extended Euclid’s Lemma.
• It’s an iterative process that repeatedly applies the lemma, replacing the larger number by the difference of the two numbers, until the two numbers become equal. This final equal number is the GCD of the original two numbers.
• For example, to find the GCD of 48 and 18, one starts by finding the remainder of 48 divided by 18, and then replaces the larger number (48 in this case) with that remainder.

## Importance in the RSA Algorithm

• Knowing Euclid’s Lemma and understanding the Euclidean algorithm is extremely valuable in the domain of cryptography.
• Particularly in the RSA algorithm, a widely used algorithm in public key cryptography, where it is used in the key generation phase. The correctness of the RSA algorithm hinges on number theory concepts including Euclid’s Lemma and the Euclidean algorithm.

Remember to understand the proofs of these concepts which is often important in exams. They are fundamental building blocks to a deeper understanding of number theory and more advanced mathematical concepts.