Euclidean Algorithm: Find Greatest Common Divisor using Euclidean Algorithm.
Let $a$ and $b$ be two integers, not both of them are zero. Then Euclidean Algorithm to find greatest common divisor of $a$ and $b$ is as follows. Since $gcd(|a|,|b|) = gcd(a,b)$, without loss of generality, assume that $0 < b \leq a$.
Step $(1)$ Apply Division Algorithm for integers $a$ and $b$, so there exist integers $q_{1}$ and $r_{1}$ such that $a = b \cdot q_{1} + r_{1}$, where $0 \leq r_{1} < b$. If $r_{1} = 0$, then $b ~|~ a$ and hence $b = gcd(a,b)$. If $r_{1} \not = 0$, then go to step $(2)$.
Step $(2)$ Apply Division Algorithm for integers $b$ and $r_{1}$, so there exist integers $q_2$ and $r_2$ such that $b = r_{1} \cdot q_2 + r_2$, where $0 \leq r_2 < r_{1}$. If $r_2 = 0$, then stop. If $r_2 \not = 0$, then go to step $(3)$.
Step $(3)$ Apply Division Algorithm for integers $r_{1}$ and $r_2$, so there exist integers $q_3$ and $r_3$ such that $r_{1} = r_2 \cdot q_3 + r_3$, where $0 \leq r_3 < r_2$ . If $r_3 = 0$, then stop. If $r_3 \not = 0$, then continue above process until we get the remainder zero say, at the $(n + 1)^{th}$ step where $r_{n-1}$ is divided by $r_n$. Since the decreasing sequence $b > r_{1} > r_2 > \cdots > 0$ cannot contain more than $ b$ integers, this process stop after finite steps.Following system of equations are obtained in this Algorithm:
$a= b \cdot q_{1} + r_{1}$, where $0 < r_{1} < b$
$b = r_{1} \cdot q_2 + r_2$, where $0 < r_2 < r_{1}$
$r_{1} = r_2 \cdot q_3 + r_3$, where $0 < r_3 < r_2$
.
.
.
$r_{n-2} = r_{n-1} \cdot q_n+ r_n$, where $0 < r_n < r_{n-1}$
$r_{n-1} = r_n \cdot q_{n+1} + 0$
We claim that $r_n$, the last nonzero remainder obtained in this Algorithm, is equal to $gcd(a, b)$. We apply Lemma to system of equations that are obtained in this Algorithm, so we get $gcd(a,b) = gcd(b,r_{1})= gcd(r_{1},r_2) = \dots = gcd(r_{n-1},r_n) = gcd(r_n,0) = r_n$. Hence $gcd(a,b) = r_n$.