### Maths Greatest Common Divisor

##### Greatest Common Divisor (GCD)

The greatest common divisor (GCD) of two or more integers is the largest positive integer that divides each of the integers without leaving a remainder. It is also known as the highest common factor (HCF).

##### Finding the GCD

There are several methods for finding the GCD of two or more integers. One common method is the Euclidean algorithm, which works as follows:

- Divide the larger integer by the smaller integer.
- Take the remainder and divide the previous divisor by it.
- Repeat steps 1 and 2 until the remainder is 0.
- The last non-zero remainder is the GCD of the two integers.

For example, to find the GCD of 12 and 18, we would follow these steps:

- 18 ÷ 12 = 1 remainder 6
- 12 ÷ 6 = 2 remainder 0

The last non-zero remainder is 6, so the GCD of 12 and 18 is 6.

##### Properties of the GCD

The GCD has several important properties, including:

- The GCD of two integers is always a positive integer.
- The GCD of two integers is the same as the GCD of their absolute values.
- The GCD of two integers is equal to the product of their common prime factors.
- The GCD of two integers is a divisor of their least common multiple (LCM).

##### Steps to Find Greatest Common Divisor

The greatest common divisor (GCD) of two or more integers is the largest positive integer that divides each of the integers without leaving a remainder. It is also known as the highest common factor (HCF).

There are several methods to find the GCD of two or more integers. One of the most common methods is the Euclidean algorithm.

##### Euclidean Algorithm

The Euclidean algorithm is a simple and efficient method to find the GCD of two integers. It is based on the following principle:

If $a$ and $b$ are two positive integers, then the GCD of $a$ and $b$ is the same as the GCD of $b$ and the remainder when $a$ is divided by $b$.

In other words, we can find the GCD of two integers by repeatedly dividing the larger integer by the smaller integer and taking the remainder. The last non-zero remainder is the GCD.

Here are the steps to find the GCD of two integers using the Euclidean algorithm:

- Let $a$ and $b$ be the two integers.
- If $b = 0$, then the GCD of $a$ and $b$ is $a$.
- Otherwise, let $r$ be the remainder when $a$ is divided by $b$.
- Replace $a$ with $b$, and $b$ with $r$.
- Repeat steps 2 to 4 until $b = 0$.
- The last non-zero value of $b$ is the GCD of $a$ and $b$.

##### Example

Let’s find the GCD of 12 and 18 using the Euclidean algorithm.

- Let $a = 12$ and $b = 18$.
- Since $b \neq 0$, we proceed to step 3.
- The remainder when 12 is divided by 18 is 6.
- Replace $a$ with $b$, and $b$ with $r$. So, $a = 18$ and $b = 6$.
- Repeat steps 2 to 4.
- The last non-zero value of $b$ is 6. Therefore, the GCD of 12 and 18 is 6.

The Euclidean algorithm is a simple and efficient method to find the GCD of two or more integers. It is based on the principle that the GCD of two integers is the same as the GCD of the larger integer and the remainder when the larger integer is divided by the smaller integer.

##### Methods to Find GCD (Greatest Common Divisor)

The greatest common divisor (GCD) of two or more integers is the largest positive integer that divides each of the integers without leaving a remainder. Finding the GCD is a fundamental operation in number theory and has various applications in mathematics and computer science. Here are some commonly used methods to find the GCD:

##### 1. Euclidean Algorithm:

The Euclidean algorithm is an efficient method for finding the GCD of two integers. It is based on the principle that the GCD of two integers is the same as the GCD of their remainder when the larger integer is divided by the smaller one. The algorithm works as follows:

- Let $a$ and $b$ be the two integers for which we want to find the GCD.
- If $b = 0$, then the GCD is $a$.
- Otherwise, compute the remainder $r$ when $a$ is divided by $b$.
- Replace $a$ with $b$, and $b$ with $r$.
- Repeat steps 2 and 3 until $b = 0$.
- The last non-zero value of $b$ is the GCD of $a$ and $b$.

For example, to find the GCD of 12 and 18 using the Euclidean algorithm:

- $18 = 12 \times 1 + 6$
- $12 = 6 \times 2 + 0$
- The last non-zero remainder is 6, so the GCD of 12 and 18 is 6.

##### 2. Prime Factorization Method:

The prime factorization method involves expressing the two integers as products of their prime factors and then identifying the common prime factors. The GCD is the product of the common prime factors.

For example, to find the GCD of 12 and 18 using the prime factorization method:

- $12 = 2^2 \times 3$
- $18 = 2 \times 3^2$
- The common prime factor is 3, so the GCD of 12 and 18 is 3.

##### 3. Binary GCD Algorithm:

The binary GCD algorithm is a fast and efficient method for finding the GCD of two integers. It is based on the principle that the GCD of two integers can be expressed as a linear combination of the integers. The algorithm works by repeatedly halving the integers and updating the linear combination until one of the integers becomes 0.

For example, to find the GCD of 12 and 18 using the binary GCD algorithm:

- $12 = 2^2 \times 3$
- $18 = 2 \times 3^2$
- The common prime factor is 3, so the GCD of 12 and 18 is 3.

The Euclidean algorithm, prime factorization method, and binary GCD algorithm are three commonly used methods for finding the greatest common divisor (GCD) of two or more integers. Each method has its own advantages and applications depending on the specific situation and the size of the integers involved.

##### Solved Examples of Greatest Common Divisor

The greatest common divisor (GCD) of two or more integers is the largest positive integer that divides each of the integers without leaving a remainder.

##### Example 1: Find the GCD of 12 and 18.

**Solution:**

- List the factors of 12: 1, 2, 3, 4, 6, 12
- List the factors of 18: 1, 2, 3, 6, 9, 18
- The common factors of 12 and 18 are 1, 2, 3, and 6.
- The greatest common factor of 12 and 18 is 6.

##### Example 2: Find the GCD of 24, 36, and 48.

**Solution:**

- List the factors of 24: 1, 2, 3, 4, 6, 8, 12, 24
- List the factors of 36: 1, 2, 3, 4, 6, 9, 12, 18, 36
- List the factors of 48: 1, 2, 3, 4, 6, 8, 12, 16, 24, 48
- The common factors of 24, 36, and 48 are 1, 2, 3, 4, 6, and 12.
- The greatest common factor of 24, 36, and 48 is 12.

##### Example 3: Find the GCD of 1071 and 462.

**Solution:**

- Use the Euclidean algorithm:

- Divide 1071 by 462: 1071 ÷ 462 = 2 remainder 147
- Divide 462 by 147: 462 ÷ 147 = 3 remainder 27
- Divide 147 by 27: 147 ÷ 27 = 5 remainder 12
- Divide 27 by 12: 27 ÷ 12 = 2 remainder 3
- Divide 12 by 3: 12 ÷ 3 = 4 remainder 0

- The last non-zero remainder is 3.
- Therefore, the GCD of 1071 and 462 is 3.

##### Applications of GCD

The GCD has many applications in mathematics and computer science. Some of the applications include:

- Finding the lowest common multiple (LCM) of two or more integers
- Simplifying fractions
- Solving Diophantine equations
- Finding the greatest common divisor of a set of polynomials
- Cryptography

##### Greatest Common Divisor FAQs

##### What is the greatest common divisor (GCD) of two numbers?

The greatest common divisor (GCD) of two numbers is the largest positive integer that divides both numbers without leaving a remainder.

##### How do you find the GCD of two numbers?

There are several methods for finding the GCD of two numbers. One common method is the Euclidean algorithm, which involves repeatedly dividing the larger number by the smaller number and taking the remainder. The GCD is the last non-zero remainder.

##### What is the GCD of two prime numbers?

The GCD of two prime numbers is 1.

##### What is the GCD of two numbers that have a common factor?

If two numbers have a common factor, then their GCD is equal to the product of that common factor and the GCDs of the numbers divided by that common factor.

##### What is the GCD of two numbers that are relatively prime?

Two numbers are relatively prime if they have no common factors other than 1. The GCD of two relatively prime numbers is 1.

##### What is the GCD of a number and 0?

The GCD of a number and 0 is the number itself.

##### What is the GCD of a number and 1?

The GCD of a number and 1 is 1.

##### What is the GCD of a number and itself?

The GCD of a number and itself is the number itself.

##### What is the GCD of a number and its negative?

The GCD of a number and its negative is the absolute value of the number.

##### What is the GCD of a number and its reciprocal?

The GCD of a number and its reciprocal is 1.