Determine all positive integer solutions $x, y$ of the equation $x^{2}-2 \cdot y!=2021$.
When looking at modulo $8, 2021 \equiv 5$, and $8 \mid 2 \cdot y!$ as soon as $y \geqslant 4$. Thus, we would have $x^{2} \equiv 5[8]$, a contradiction!

Therefore, $y<4$. By treating the remaining cases, we find the pair $(45,2)$ as the only solution.

## Inverse modulo $n$

## Definition 6.

An integer $b$ is called the inverse of $a$ modulo $n$ if $a b \equiv 1[n]$. If $a$ has an inverse modulo $n$, then we say that $a$ is invertible modulo $n$.

## Example 7.

2 is its own inverse modulo 3 because $2 \cdot 2=4 \equiv 1 \bmod 3$.

## Proposition 8.

An integer $a$ has an inverse modulo $n$ if and only if $a$ and $n$ are coprime. The inverse of $a$ is then unique modulo $n$.

Proof. By Bézout's theorem, there exist integers $u$ and $v$ such that $a u+n v=1$ if and only if $a$ and $n$ are coprime. In this case, $u$ is the inverse of $a$ modulo $n$.

To show uniqueness, suppose that $b$ and $b^{\prime}$ are two inverses of $a$ modulo $n$. We then have

$$
b=b \cdot 1 \equiv b\left(a b^{\prime}\right) \equiv(b a) b^{\prime} \equiv b^{\prime}[n]
$$

Thus, $b \equiv b^{\prime}[n]$, which proves the uniqueness modulo $n$.

## 4 End-of-course training

- Subject -