I'm practising for a cryptography test and came across this question:
Let us assume that for a specific elliptic curve the formulas for the computation of $(x_3, y_3)=R+S$ are given by:
$X_3=\sigma^2-x_1-x_2\ (\textrm{mod}\ p)$
$Y_3=\sigma(x_1-x_3)-y_1 \ (\textrm{mod}\ p)$
$\sigma = \frac{y_2-y_1}{x_2-x_1}\qquad \textrm{if R}\neq\textrm{S}$
$\sigma = \frac{3x_1^2+5}{2y_1}\qquad \textrm{if R = S}$
The following holds: $p=17$, $P=(3, 5)$, $a=3$, $k=2$, $M=(2, 7)$. Compute Q.
I understand the provided solution up until step 5.
1.$\ Q=a\cdot P = 3\cdot P$
2.$\ P= (3, 5) \Rightarrow 3\cdot P=2\cdot P+P$
3.$\ 2\cdot P\Rightarrow(3,5)+(3,5)$
4.$\ \sigma=\frac{3x_1^2+5}{2y_1}\qquad\ \ \ (R=S)$
5.$\ \sigma =\frac{3\cdot 3^2+5}{2\cdot 5}=\frac{32}{10}=\frac{16}{5}=\frac{16\cdot7}{5\cdot 7}\textrm{ mod } 17=112\textrm{ mod }17=10\qquad\ \ \ (5^{-1}=7\textrm{ mod } 17)$
I understand that $16\cdot 7\textrm{ mod }17=10$, but where does the $7$ come from? Also, why is $5^{-1}=7\textrm{ mod } 17$ shouldn't that equal zero..?