I am reading RSA algorithm. So, I was writing a question but I saw this question and still couldn't understand it.

If $$e\cdot d \equiv 1 \pmod{\varphi(n)},$$ then $$ed=k\cdot \varphi(n)+1, \qquad k\in \mathbb{Z},$$

How did that first step turned to second step. Is that some kind of formula? Do, I need to cram it or there is some logic? I think of $1 (\bmod ~\varphi(n)) $ as 1 % $\varphi(n)$ which I quess must be very small as $\varphi(n)$ is very large

Here, $\varphi(n)$ is (p-1)(n-1) where p and q are both large prime numbers.

Also, where does this k come from in picture where k belongs to integer Z.


Solution 1:

The notation $a \equiv b \pmod{r}$ is defined to mean that $r$ divides the difference $a-b$. Therefore, the equation $d\cdot e \equiv 1 \pmod{\phi(n)}$ is interpreted to mean that $\phi(n)$ divides the difference $d\cdot e - 1$. This means that the difference, being a multiple of $\phi(n)$, is of the form $k \cdot \phi(n)$ for some integer $k$. (This is where the $k$ comes in.) Rearranging $d\cdot e - 1 = k\cdot \phi(n)$ yields $d\cdot e = 1 + k\phi(n)$, as desired.

You should think of $1 \pmod{\phi(n)}$ as an equivalence class of all numbers of the form $\{ 1 + k\phi(n)\}$. You don't really want to use your intuition about 'size' when thinking about modular arithmetic, which I view conceptually as due to the fact that you're using a number wheel (such as a clock, for mod $12$), as opposed to a number line.