upload diverse filer
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,20 @@
|
||||
#import "@local/dtu-template:0.5.1":*
|
||||
|
||||
|
||||
#show: dtu-note.with(
|
||||
course: "01017",
|
||||
course-name: "Discrete Mathematics",
|
||||
title: "Primes and the Eucledian algorithm",
|
||||
date: datetime(day: 27, month: 11, year: 2025),
|
||||
author: "Rasmus Rosendahl-Kaa (S255955)",
|
||||
semester: "2025 Fall",
|
||||
)
|
||||
|
||||
= Primes
|
||||
#definition()[
|
||||
$
|
||||
a,b,c in ZZ, a in ZZ_+
|
||||
$
|
||||
If $a = b dot c$ then $a$ is _composite_ (sammensat), if not, then $a$ is a prime,
|
||||
|
||||
]
|
||||
95
Diskret Mat/Primes and the Euclidean algorithm/test.latex
Normal file
95
Diskret Mat/Primes and the Euclidean algorithm/test.latex
Normal file
@@ -0,0 +1,95 @@
|
||||
\documentclass{article}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{amssymb}
|
||||
\usepackage{amsthm}
|
||||
|
||||
\newtheorem{theorem}{Theorem}
|
||||
\newtheorem{lemma}[theorem]{Lemma}
|
||||
\newtheorem{corollary}[theorem]{Corollary}
|
||||
\theoremstyle{definition}
|
||||
\newtheorem{definition}[theorem]{Definition}
|
||||
|
||||
\title{Primes and the Euclidean Algorithm}
|
||||
\date{02-10-2025}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
|
||||
\section{Introduction}
|
||||
|
||||
Let $a, b \in \mathbb{Z}$. We say that $a$ \textbf{divides} $b$, written $a \mid b$, if there exists $c \in \mathbb{Z}$ such that $b = ac$.
|
||||
|
||||
\begin{definition}
|
||||
A positive integer $p > 1$ is called \textbf{prime} if its only positive divisors are $1$ and $p$ itself.
|
||||
\end{definition}
|
||||
|
||||
\begin{definition}
|
||||
For integers $a$ and $b$, not both zero, the \textbf{greatest common divisor} $\gcd(a,b)$ is the largest positive integer that divides both $a$ and $b$.
|
||||
\end{definition}
|
||||
|
||||
\section{The Euclidean Algorithm}
|
||||
|
||||
The Euclidean algorithm is an efficient method for computing the greatest common divisor of two integers.
|
||||
|
||||
\begin{theorem}[Division Algorithm]
|
||||
Let $a, b \in \mathbb{Z}$ with $b > 0$. Then there exist unique integers $q$ and $r$ such that
|
||||
\[
|
||||
a = bq + r \quad \text{with} \quad 0 \leq r < b.
|
||||
\]
|
||||
Here $q$ is called the \textbf{quotient} and $r$ is called the \textbf{remainder}.
|
||||
\end{theorem}
|
||||
|
||||
\begin{theorem}
|
||||
If $a = bq + r$, then $\gcd(a,b) = \gcd(b,r)$.
|
||||
\end{theorem}
|
||||
|
||||
\begin{proof}
|
||||
Let $d = \gcd(a,b)$. Then $d \mid a$ and $d \mid b$. Since $r = a - bq$, we have $d \mid r$. Thus $d$ is a common divisor of $b$ and $r$, so $d \leq \gcd(b,r)$.
|
||||
|
||||
Conversely, let $d' = \gcd(b,r)$. Then $d' \mid b$ and $d' \mid r$. Since $a = bq + r$, we have $d' \mid a$. Thus $d'$ is a common divisor of $a$ and $b$, so $d' \leq \gcd(a,b) = d$.
|
||||
|
||||
Therefore $d = \gcd(b,r)$.
|
||||
\end{proof}
|
||||
|
||||
\subsection{The Algorithm}
|
||||
|
||||
To compute $\gcd(a,b)$ where $a \geq b > 0$:
|
||||
\begin{enumerate}
|
||||
\item Apply the division algorithm repeatedly:
|
||||
\begin{align*}
|
||||
a &= bq_1 + r_1, \quad 0 \leq r_1 < b \\
|
||||
b &= r_1 q_2 + r_2, \quad 0 \leq r_2 < r_1 \\
|
||||
r_1 &= r_2 q_3 + r_3, \quad 0 \leq r_3 < r_2 \\
|
||||
&\vdots \\
|
||||
r_{n-2} &= r_{n-1} q_n + r_n, \quad 0 \leq r_n < r_{n-1} \\
|
||||
r_{n-1} &= r_n q_{n+1} + 0
|
||||
\end{align*}
|
||||
|
||||
\item The last non-zero remainder $r_n$ is $\gcd(a,b)$.
|
||||
\end{enumerate}
|
||||
|
||||
\begin{theorem}[Bézout's Identity]
|
||||
Let $a, b \in \mathbb{Z}$, not both zero, and let $d = \gcd(a,b)$. Then there exist integers $x$ and $y$ such that
|
||||
\[
|
||||
ax + by = d.
|
||||
\]
|
||||
\end{theorem}
|
||||
|
||||
\begin{proof}
|
||||
Consider the set $S = \{ax + by : x, y \in \mathbb{Z} \text{ and } ax + by > 0\}$. This set is non-empty (contains $|a|$ or $|b|$) and bounded below by $1$, so by the well-ordering principle it has a smallest element, say $d' = ax_0 + by_0$.
|
||||
|
||||
We claim that $d' = \gcd(a,b)$. First we show that $d' \mid a$. By the division algorithm, write $a = d'q + r$ with $0 \leq r < d'$. Then
|
||||
\[
|
||||
r = a - d'q = a - (ax_0 + by_0)q = a(1 - x_0q) + b(-y_0q).
|
||||
\]
|
||||
If $r > 0$, then $r \in S$ and $r < d'$, contradicting the minimality of $d'$. Thus $r = 0$ and $d' \mid a$. Similarly, $d' \mid b$.
|
||||
|
||||
So $d'$ is a common divisor of $a$ and $b$, hence $d' \leq d = \gcd(a,b)$.
|
||||
|
||||
Conversely, since $d \mid a$ and $d \mid b$, we have $d \mid (ax_0 + by_0) = d'$. Thus $d \leq d'$.
|
||||
|
||||
Therefore $d = d'$, completing the proof.
|
||||
\end{proof}
|
||||
|
||||
\end{document}
|
||||
2974
Diskret Mat/Primes and the Euclidean algorithm/test.pdf
Normal file
2974
Diskret Mat/Primes and the Euclidean algorithm/test.pdf
Normal file
File diff suppressed because it is too large
Load Diff
88
Diskret Mat/Primes and the Euclidean algorithm/test.typ
Normal file
88
Diskret Mat/Primes and the Euclidean algorithm/test.typ
Normal file
@@ -0,0 +1,88 @@
|
||||
= Introduction
|
||||
<introduction>
|
||||
Let $a , b in bb(Z)$. We say that $a$ #strong[divides] $b$, written
|
||||
$a divides b$, if there exists $c in bb(Z)$ such that $b = a c$.
|
||||
|
||||
#block[
|
||||
#strong[Definition 1];. A positive integer $p > 1$ is called
|
||||
#strong[prime] if its only positive divisors are $1$ and $p$ itself.
|
||||
|
||||
Hello
|
||||
]
|
||||
#block[
|
||||
#strong[Definition 2];. For integers $a$ and $b$, not both zero, the
|
||||
#strong[greatest common divisor] $gcd (a , b)$ is the largest positive
|
||||
integer that divides both $a$ and $b$.
|
||||
|
||||
]
|
||||
= The Euclidean Algorithm
|
||||
<the-euclidean-algorithm>
|
||||
The Euclidean algorithm is an efficient method for computing the
|
||||
greatest common divisor of two integers.
|
||||
|
||||
#block[
|
||||
#strong[Theorem 3] (Division Algorithm). #emph[Let $a , b in bb(Z)$ with
|
||||
$b > 0$. Then there exist unique integers $q$ and $r$ such that
|
||||
$ a = b q + r quad upright("with") quad 0 lt.eq r < b . $ Here $q$ is
|
||||
called the #strong[quotient] and $r$ is called the #strong[remainder];.]
|
||||
|
||||
]
|
||||
#block[
|
||||
#strong[Theorem 4];. #emph[If $a = b q + r$, then
|
||||
$gcd (a , b) = gcd (b , r)$.]
|
||||
|
||||
]
|
||||
#block[
|
||||
#emph[Proof.] Let $d = gcd (a , b)$. Then $d divides a$ and
|
||||
$d divides b$. Since $r = a - b q$, we have $d divides r$. Thus $d$ is a
|
||||
common divisor of $b$ and $r$, so $d lt.eq gcd (b , r)$.
|
||||
|
||||
Conversely, let $d' = gcd (b , r)$. Then $d' divides b$ and
|
||||
$d' divides r$. Since $a = b q + r$, we have $d' divides a$. Thus $d'$
|
||||
is a common divisor of $a$ and $b$, so $d' lt.eq gcd (a , b) = d$.
|
||||
|
||||
Therefore $d = gcd (b , r)$.~◻
|
||||
|
||||
]
|
||||
== The Algorithm
|
||||
<the-algorithm>
|
||||
To compute $gcd (a , b)$ where $a gt.eq b > 0$:
|
||||
|
||||
+ Apply the division algorithm repeatedly:
|
||||
$ a & = b q_1 + r_1 , quad 0 lt.eq r_1 < b\
|
||||
b & = r_1 q_2 + r_2 , quad 0 lt.eq r_2 < r_1\
|
||||
r_1 & = r_2 q_3 + r_3 , quad 0 lt.eq r_3 < r_2\
|
||||
& dots.v\
|
||||
r_(n - 2) & = r_(n - 1) q_n + r_n , quad 0 lt.eq r_n < r_(n - 1)\
|
||||
r_(n - 1) & = r_n q_(n + 1) + 0 $
|
||||
|
||||
+ The last non-zero remainder $r_n$ is $gcd (a , b)$.
|
||||
|
||||
#block[
|
||||
#strong[Theorem 5] (Bézout’s Identity). #emph[Let $a , b in bb(Z)$, not
|
||||
both zero, and let $d = gcd (a , b)$. Then there exist integers $x$ and
|
||||
$y$ such that $ a x + b y = d . $]
|
||||
|
||||
]
|
||||
#block[
|
||||
#emph[Proof.] Consider the set
|
||||
$S = { a x + b y : x , y in bb(Z) upright(" and ") a x + b y > 0 }$.
|
||||
This set is non-empty (contains $lr(|a|)$ or $lr(|b|)$) and bounded
|
||||
below by $1$, so by the well-ordering principle it has a smallest
|
||||
element, say $d' = a x_0 + b y_0$.
|
||||
|
||||
We claim that $d' = gcd (a , b)$. First we show that $d' divides a$. By
|
||||
the division algorithm, write $a = d' q + r$ with $0 lt.eq r < d'$. Then
|
||||
$ r = a - d' q = a - (a x_0 + b y_0) q = a (1 - x_0 q) + b (- y_0 q) . $
|
||||
If $r > 0$, then $r in S$ and $r < d'$, contradicting the minimality of
|
||||
$d'$. Thus $r = 0$ and $d' divides a$. Similarly, $d' divides b$.
|
||||
|
||||
So $d'$ is a common divisor of $a$ and $b$, hence
|
||||
$d' lt.eq d = gcd (a , b)$.
|
||||
|
||||
Conversely, since $d divides a$ and $d divides b$, we have
|
||||
$d divides (a x_0 + b y_0) = d'$. Thus $d lt.eq d'$.
|
||||
|
||||
Therefore $d = d'$, completing the proof.~◻
|
||||
|
||||
]
|
||||
Reference in New Issue
Block a user