Questions tagged [euclidean-algorithm]

For questions about the uses of the Euclidean algorithm, Extended Euclidean algorithm, and related algorithms in integers, polynomials, or general Euclidean domains. This is not about Euclidean geometry.

The Euclidean algorithm, sometimes called Euclid's algorithm, is a very efficient algorithm for determining the greatest common divisor of two numbers, $\gcd(a,b)$.

When we divide $b$ by $a$, we have an expression like $b = aq + r$, where we think of $q$ as the "quotient" and $r$ as the "remainder." The major idea of the Euclidean algorithm is that any number dividing $a$ and $b$ must also divide $r$. Similarly, any number dividing $a$ and $r$ must also divide $b$. Thus $\gcd(a,b) = \gcd(a,r)$, and $r$ is smaller than $b$. Iterating this procedure is the Euclidean algorithm.

It is a general fact (Bezout's Theorem) that the greatest common divisor of $a,b$ is the smallest positive integer that can be written as a linear combination $ax + by$ for some $x,y$. One way to get such an $x,y$ is to use the Euclidean algorithm and then back-substitute. This is sometimes called the Extended Euclidean algorithm, and is very useful in studying linear congruences, modular arithmetic, and cryptography.

More generally, the Euclidean algorithm works in any context in which there is a well-defined division algorithm. These are called “Euclidean Domains”. One particularly well-known and important Euclidean domain is the ring $\mathbb{Q}[x]$ of polynomials in one variable over the rationals (or over any other field).

Applications of the general Euclidean algorithm and Extended Euclidean algorithm are wide-ranging and diverse.

780 questions
8
votes
1 answer

Given $a$ in $\gcd(a,b)$ with $a > b > 0$, how can I find $b$ which give the maximum number of steps for the Euclidean algorithm?

Given $a$, where $a$ and $b$ are positive integers with $a > b$, how can I find the values for $b$ which give the maximum number of steps for the Euclidean algorithm $\gcd(a,b)$? For example, where $a = 1000, b = 703$ and $b = 633$ both give the…
impomatic
  • 181
5
votes
2 answers

Extended Euclidean Algorithm: why does it work?

I find myself able to mechanically apply the "extended" Euclidean algorithm to find the gcd of two integers and to write a linear combination by working backwards. However, I do not have a good grasp as to why this works. Artin gives a…
John P.
  • 2,136
4
votes
3 answers

Euclidean Algorithm : Confusion with how many divisions needed?

The question asks how many the divisions required to find $\gcd(34,55)$. I did it using the Euclidean Algorithm with the following result. $$55=1 \cdot 34+21$$ $$34=1 \cdot 21+13$$ $$21=1 \cdot 13+8$$ $$13=1 \cdot 8+5$$ $$8=1 \cdot 5+3$$ $$5=1 \cdot…
J.Yang
  • 43
3
votes
2 answers

Proving the number of iterations in the Euclidean algorithm

Let m and n be natural numbers. Suppose $ min(m, n) \leq 2^k $ for some natural number k. Show that the Euclidean algorithm needs at most $ 2k $ iterations to find the GCD of m and n. Basically I have no clue how to start this proof, I think I…
2
votes
0 answers

Euclidean Algorithm Failure

I have to prove the following statement 2 ways, one by dividers and the other by the Euclidean Algorithm. Show that for all positive integers $a$, $hcf(6a + 8, 4a + 5) = 1$ The first way was easy enough. Let $x = hcf(6a + 8, 4a + 5)$. By definition…
mathjohnn
  • 181
  • 11
2
votes
3 answers

Why does Euclid's HCF algorithm work?

I saw this Khan Academy video on the visualization of Euclid's algorithm. The problem was to find the HCF of $32$ and $12$. At $6:53$, the instructor reduced the original problem to $12$ and $8$ as: $$ \left\{ \begin{array}{c} 32 = 12 + 12 + 8…
2
votes
1 answer

How to find positive coefficients in Bezout's Identity?

I'm trying to find the multiplicative inverse of $10$ modulo $27$ using the extended euclidean algorithm and Bezout's Identity. Using euclids algorithm I find that gcd$(27,10)=1$, and the extended version gives me $$1=\text{gcd}(27,10)=27\cdot…
2
votes
0 answers

How to find the highest common factor of two complex numbers

I have $$7+i,\quad\quad 5+3i\in\mathbb{Z}[i]$$ The answer is given as $$7+i=(5+3i)\cdot 1+(2-2i)$$ $$5+3i = (2-2i)\cdot 2i+(1-i)$$ $$2-2i=(1-i)\cdot 2$$ So $hcf(7+i,5+3i) = 1-i$ What I don't understand is how they're finding what to multiply by,…
mrnovice
  • 5,773
2
votes
4 answers

How is the Euclidean Algorithm used to solve IMO 1959 Problem 1?

Problem 1 : Prove that the fraction $\frac{21n+4}{14n+3}$ is irreducible for every natural number $n$. I understand that it can be solved using the Euclidean Algorithm, but how would the solution look like? I know the Euclidean Algorithm, but don't…
jimpix
  • 211
2
votes
1 answer

Prove that if Euclid’s algorithm applied to the pair (u, v) takes n steps, then $u ≥ f_{n+2}$ and $v ≥ f_{n+1}$.

Let $u, v \in \mathbb{Z^+}$ satisfy $u > v$. Prove that if Euclid’s algorithm applied to the pair (u, v) takes n steps, then $u ≥ f_{n+2}$ and $v ≥ f_{n+1}$. I think that to start this proof I would first have to show that applying Euclid's…
2
votes
1 answer

Euclidean Algorithm

This is the problem that I'm having trouble on: Let $a$ and $b$ be natural numbers with $1000000>a>b$. What bound does Theorem 4.2.3 give for the number of steps the Euclidean Algorithm will take when performed on $a$ and $b$? Theorem 4.2.3 states…
ematth7
  • 719
1
vote
1 answer

Bezout's identity: general solutions???

S O L V E D After using the Euclidean algorithm to find the greatest common divisor between $ a = r_{-1} $ and $ b = r_0 $ (see figure) I'm trying to express in a general way the solution (x and y) of the correlated Bezout's identity. In figure I…
Stefano
  • 43
1
vote
1 answer

Suppose m and n are relatively prime integers. Prove that $m^2$ and $n^2$ are also relatively prime.

I know that $am+bn=1$ for some integers $a$ and $b$. I know that I will have to use this to show that $cm^2 + dn^2 = 1$. I tried squaring both sides but I am left with the term $2ambn$ which doesn't factor with the $n^2$ and $m^2$. So I'm not sure…
1
vote
1 answer

Finding general solution using Euclid's extended algorithm

I have a problem where I'm supposed to find the general equation to $242x+1870y=66$. I used Euclid's extended algorithm to find $x=8$ and $y=-1$, but am not sure how to find all possible solutions using this information. Is there a formula I can…
1
vote
2 answers

Find integers $x,y$ such that $21x + 13y = 1$

Given Bézout's identity, how do I find the $x,y$, I already performed the euclidean algorithm. So. 21 = 1 * 13 + 8 13 = 1 * 8 + 5 8 = 1 * 5 + 3 5 = 1 * 3 + 2 3 = 1 * 2 + 1 2 = 1 * 1 + 1 1 = 1 * 1 + 0 I am not sure how to find the x,y though I…
1
2 3 4