A Formula for Adding Points

We close this section with an explicit formula for adding two points in $ E(K)$. If $ E$ is an elliptic curve over a field $ K$, given by an equation $ y^2=x^3+ax+b$, then we can compute the group addition using the following algorithm.

Algorithm 10.1.2 (Elliptic Curve Group Law)   Given $ P_1, P_2\in E(K)$, this algorithm computes the sum $ R=P_1+P_2 \in E(K)$.
  1. [One Point $ \O$] If $ P_1=\O$ set $ R=P_2$ or if $ P_2=\O$ set $ R=P_1$ and terminate. Otherwise write $ P_i=(x_i,y_i)$.
  2. [Negatives] If $ x_1 = x_2$ and $ y_1 = -y_2$, set $ R=\O$ and terminate.
  3. [Compute $ \lambda$]Set $ \displaystyle \lambda = \begin{cases}
(3x_1^2+a)/(2y_1) & \text{if }P_1 = P_2,\\
(y_1-y_2)/(x_1-x_2) & \text{otherwise.}
\end{cases}$
    Note: If $ y_1=0$ and $ P_1=P_2$, output $ \O$ and terminate.
  4. [Compute Sum] Then $ R = \displaystyle \left(\lambda^2 -x_1 - x_2, -\lambda x_3 - \nu\right)$, where $ \nu = y_1 - \lambda x_1$ and $ x_3$ is the $ x$ coordinate of $ R$.



William Stein 2012-09-24