So, my task is to find d if $p=5, q=11, e=17$. Here I've tried:
- Find $n=p\cdot q = 5*11 = 55$
- Find $\phi(n) = (p-1)(q-1)=(5-1)(11-1) = 40$
- Euclidean algorithm: $$ 40=2\cdot 17+6 \\ 17 = 2\cdot 6 + 5 \\ 6 = 1*5 + 1 $$
- The last one $$ 6-1*5=1 \\ 6 - 1(17-2\cdot 6)=1 \\ (40-2\cdot 17) - 1(17-2\cdot(40-2\cdot 17)) $$ The next step is to simplify the expression, and get something like $e\cdot d + \phi(n)\cdot x = 1$. But how can I get such simplified expression? I've tried to open brackets etc, but I haven't got such expression.
Thanks.
$$\begin{align*} \left(40-2\cdot 17\right) - 1\cdot\left[17-2\cdot\left(40-2\cdot17\right)\right] &= 1\\ 40-2\cdot 17 - 17 + 2\cdot 40 -4\cdot 17 &= 1\\ 3\cdot 40 -7\cdot17 &= 1 \end{align*}$$
Or break the brackets early, which I usually prefer: $$\begin{align*} 6-1\cdot5 &= 1\\ 6-1\cdot(17-2\cdot 6) &= 1\\ 3\cdot6-1\cdot 17 &= 1\\ 3\cdot(40-2\cdot 17)-1\cdot17 &= 1\\ 3\cdot 40 -7\cdot17 &= 1 \end{align*}$$