Objective
This note aims to analyze the cost of elliptic curve addition in terms of operations in the underlying field.
Summary
We find that adding two points requires the following field operations:
Since one inverse operation requires multiplications, that cost will dominate.
Let be a field, and let be the elliptic curve group defined by
for some . Let and be points in , where .[1]
The objective of this note is to count the number of field operations necessary to compute .
We write and .
We proceed as follows:
We first write the line connecting and . Denoting the slope of the line as , we find . Then, we can write the equation for as
Computing requires 2 subtractions, finding one inverse, and one multiplication. Computing requires one multiplication and one subtraction.
Cost for constructing is 1 inverse, 2 multiplications, and three subtractions.
AFAIK, Fermat's Little Theorem is the most efficient approach to computing multiplicative inverses. Using repeated squaring, computing using takes ~ multiplications.
Substituting equation (2) into equation (1) yields:
Bringing all terms to the right-hand side, we find
Now, we make a clever[1] observation: since and are solutions to equation (3), we can also write equation (3) in the form
By comparing the coefficient of in equations (4) and (5), we can deduce that . It follows that:
Cost for computing is one multiplication and two subtractions.
Now we can the coordinate of the point of intersection by substituting into equation (2). After reflecting across the -axis, we find the coordinate of :
Cost for computing is one multiplication and one subtraction.
The previous approach requires computing an inverse in order to add elliptic curve points. Writing our points in projective coordinates allows us to avoid that cost.
We write and .
Assume is non-zero and .
We aim to compute .
We continue to follow the approach in Section 2.2 here:
It folllows from the previous section that we can write the sum as
Substituting in our expression for :
Now we can clear denominators:
Now, we simultaneously substitute , and multiply through by to clear denominators:
Warning: Likely contains algebra errors, but it gets the idea across.
The reference notes suggest that with careful accounting it's possible to compute in 12 additions if and 14 additions for point doubling.
Details omitted. See Moon Math Manual for details.
Advantage here is constant time scalar multiplication. Note that even though it's "constant time," there's still a slight difference in the computational approach depending on whether , and whether one of the points is a point at infinity.
Details omitted. See Moon Math Manual for details.
Advantage here is all additions use exactly the same computational approach: no branching necessary in your computational logic.
But, it seems this approach requires computing 2 inverses?!
[1]: For the case where we proceed similarly using the tangent line for . We can write find the tangent line using implicit differentiation. We find ; the computation in this case requires one additional multiplication and one less addition. The remaining case is that is the reflection of across the -axis. In this case, the sum is defined to be the point at infinity.
[2]: See Section 2.2 here