[Math] Addition of points on elliptic curves over a finite field

abstract-algebraalgebraic-geometryelementary-number-theoryelliptic-curves

I have found the following formulas for the coordinates of $P+Q$ given that $P = (x_{1}, y_{1})$ and $Q = (x_{2}, y_{2})$ are points on a general curve $y^2 = x^3 + ax + b$ over $\mathbb{R}$:

$$P + Q = (x_3, y_3) = \left(\left[\frac{y_2-y_1}{x_2-x_1}\right]^2-x_1-x_2, -\left[\frac{y_2-y_1}{x_2-x_1}\right] \cdot \left[x_3-x_1\right]-y_1\right)$$

For point doubling, the case where $P = Q$, I have found:

$$2P = \left(\left[\frac{3x^2_1+a}{2y_1}\right]^2-2x_1, -\left[\frac{3x^2_1+a}{2y_1}\right] \cdot [x_3-x_1]-y_1\right)$$

(See this page for a cleaner representation)

These formulas work for elliptic curves over $\mathbb{R}$, but not for finite fields $\mathbb{F}_{p}$ of prime order $p$. I know I will have do some calculations modulo $p$, but I do not know where. How do I modify the above formulas so they will work for $\mathbb{F}_{p}$ instead of $\mathbb{R}$?

Best Answer

Comments under the question suggest that possibly the difficulty was in doing arithmetic modulo a prime. How does one find $-23/4$ in $\mathbb F_5$? $-23$ reduces to $2$, and to divide by $4$ you multiply by the mod $5$ multiplicative inverse of $4$, which you need to find.

Trial and error will find the multiplicative inverse when the modulus is $5$, but what if it's a large prime? I answer that question here.

Related Question