Elliptic Curve Addition

You might have heard of this fancy math stuff before, but if not, don’t worry. We’re going to break it down in a way that even your grandma could understand (well, maybe).

So what is an elliptic curve? It’s basically just a fancy line with some extra points on it. But instead of using regular lines like you learned in grade school, we use these curves for cryptography purposes because they have some pretty cool properties that make them perfect for keeping your secrets safe.

Now how to add two points on an elliptic curve together. It might sound complicated at first, but trust us it’s not as bad as you think!

First, we need to choose our starting point (let’s call this P) and the second point we want to add (let’s call this Q). Here’s what that looks like:

P = (x1, y1)
Q = (x2, y2)

Next, we draw a line through these two points. This is called the “line of addition.” The equation for this line is:

y y1 = m(x x1)

where m is the slope of our line. To find m, just take the difference between the y-coordinates and divide by the difference between the x-coordinates (if they’re not equal). If you get a division by zero error, that means your points are on top of each other or collinear in which case, we have to do some extra steps.

But let’s assume our line isn’t vertical for now and continue with the calculation:

m = (y2 y1) / (x2 x1)

Now that we have m, we can find a third point on this line by plugging in any value of x into the equation. Let’s call this new point R. Here’s what it looks like:

R = (x3, y3)

where:

y3 = m(x3 x1) + y1

Now that we have our third point on the line of addition, we need to check if it falls back onto the elliptic curve. If not, then we’re done! We simply add R as our final result (let’s call this S). Here’s what it looks like:

S = R

But if R does fall off the curve, we have to do some extra steps to get back on track. This is called “point doubling” and involves finding a new point that’s twice as far away from P (our starting point) in terms of distance along the elliptic curve. Here’s what it looks like:

First, let’s find the slope m again using our line of addition equation:

m = (y2 y1) / (x2 x1)

Next, we need to calculate a new value for x3 that’s twice as far away from P in terms of distance along the elliptic curve. To do this, let’s find the “tangent” at point P by taking the derivative of our equation:

y = (x^3 + ax + b) / (2 * x^2 + r * x + s)

where a, b, r, and s are constants that define our elliptic curve. The tangent is just the slope at point P:

m_tangent = y’ = (-(3*x1^2+a)*y1 / (2*x1^3 + r*x1^2 + s*x1))

Now that we have our new value for m, let’s find a new x-coordinate for point R by plugging it into the line of addition equation:

R = (x3, y3)

where:

y3 = m(x3 x1) + y1

But we don’t want to add this point directly. Instead, let’s find a new value for x3 that’s twice as far away from P in terms of distance along the elliptic curve by using our tangent:

x3 = (x1 m_tangent) / (2 * y1′)

where y1′ is the slope at point P. Now we can find a new value for y3 that corresponds to this x-coordinate:

y3 = (x3^3 + ax + b) / (2*x3^2 + r*x3 + s)

And there you have it our final result! We’ve added two points on an elliptic curve using point doubling. It might sound complicated, but trust us it’s not as bad as you think!

SICORPS