Blog

# Adding points on hyperelliptic curves

Suppose that we have two points P and Q in the Jacobian of a hyperelliptic curve of genus 2 where

P = (P1) + (P2) - 2(O)

and

Q = (Q1) + (Q2) – 2(O)

where the curve is defined by

y2 = f(x)

where f is a polynomial of degree 5.

Now suppose that we want to find P + Q = R where

R = (R1) + (R2) - 2(O)

Here's how we can use the structure of the hyperelliptic curve to do this.

In this picture

the red points represent P, the green points represent Q and the black points represent R. Let's write –R1 and –R2 for the blue points that we get by reflecting the black points across the x-axis even though that notation is a bit misleading, and let's look at three functions on the hyperelliptic curve: the curve u through P1, P2, Q1, Q2, –R1 and –R2, the vertical line v1 through R1 and –R1 and the vertical line v2 through R2 and –R2.

Note that if we write the cubic through P1, P2, Q1, Q2 as

y = g(x)

then we have

y2 = g2(x)

The hyperelliptic curve is defined by

y2 = f(x)

so we have that

g2(x) = f(x)

or that

g2(x) – f(x) = 0

which is a polynomial of degree 6 with zeroes at P1, P2, Q1, Q2, –R1 and –R2 and a pole of order 6 at O.

We can then write

div(u) = (P1) + (P2) + (Q1) + (Q2) + (-R1) + (-R2) - 6(O)

div(v1) = (R1) + (-R1) - 2(O)

and

div(v2) = (R2) + (-R2) - 2(O)

Combining these gives us that

div(u) – div(v1) – div(v2) = (P1) + (P2) + (Q1) + (Q2) – (R1) – (R2) – 2(O)

= (P1) + (P2) - 2(O) + (Q1) + (Q2) – 2(O) - (R1) - (R2) + 2(O)

P + QR

or that

P + Q = R + div(u/v1v2)

which is very similar to what we get for an elliptic curve.

In practice, there's an easier way to do this, and that's with Cantor's algorithm. With Cantor's algorithm, we work with polynomials whose zeroes we get from the coordinates of points on a hyperelliptic curve instead of with the points themselves. Cantor's algorithm is more efficient, but it's hard to see the geometric meaning of what's going on with it. If we just work with divisors, adding points on hyperelliptic curves is probably easier to understand.