# Sage code to check independence of rational points on elliptic curve

Suppose I have three rational points $$(x_1,y_1),(x_2,y_2),(x_3,y_3)$$ on certain elliptic curve. Then they are linearly independent if and only if the determinant of matrix $$()_{i,j}$$ is non zero where $$<\_,\_ >$$ is Neron-Tate height pairing.

How to write a code in Sage or Pari to compute this determinant. Note that I don't want to write an equation of my elliptic curve in the code to compute rational points first. Rather I know my rational points and want to directly put rational points and compute the determinant.

• If you do not provide the equation of the curve, how do you compare its Neron-Tate height? Given three points on the plane, you can always write down an elliptic curve which passes through all three which make the points dependent. – Hw Chu Jan 20 at 20:39
• @Hw Chu Yes. Mistake! So in general, how do we write a code in Sage to find that determinant. Can you please illustrate me though some example. – ersh Jan 20 at 21:28
• Try asking this question in the coding branch of Stack Exchange. – BadAtGeometry Jan 21 at 19:18

In SageMath this can be accomplished using the command height_pairing_matrix. For example:

sage: E = EllipticCurve([1, 0, 0, 0, 1])
sage: E
Elliptic Curve defined by y^2 + x*y = x^3 + 1 over Rational Field
sage: pts = E.gens()
sage: pts
[(-1 : 1 : 1), (0 : -1 : 1)]
sage: M = E.height_pairing_matrix(points = pts)
sage: M
[0.541484699372469 0.161800998136433]
[0.161800998136433 0.463307138146013]
sage: M.det()
0.224694163418167


• 3000, So using above code, sage will first generate these rational points, right? What If I already know my rational points, I don't want Sage to generate the points because it would take my time. How should I write a code in that case? – ersh Jan 21 at 18:09
• If you already have a list of the points, you can input it as points =  in the height_pairing_matrix function. I tried to show this in my example; I could've just put E.height_pairing_matrix() and it would've computed the generators automatically. – André 3000 Jan 21 at 18:12

Something similar was already asked at Independence of points on Elliptic curve the answers there are the same as above but maybe a little more extensive.

Edit: I just noticed the question asker is the same as the previous question. So maybe this question really is trying to ask something different. The height of a point will depend on the elliptic curve itself so you will need to put the equation of the curve somewhere.

• Yes, I was actually expecting you to comment as I had worked with your answer you provided me last time. You are right my question is different from the last one. I wanted to feed Sage only may rational points even including the equation of elliptic curve. But I don't want sage to compute the rational points. I already have a rational points in my hand and I want to compute determinant for my specific rational points. – ersh Jan 21 at 19:46
• If you give sage the equation of and elliptical curve it will not compute any rational points by default. You can write P = E((1,0)) to define a point with coordinates (1,0) on E if you know it. Then a list of such can be given to height_pairing_matrix . you will have go define the elliptic curve though as the matrix depends on the equation of the curve. – Alex J Best Jan 21 at 20:11
• Thanks for more clarification. – ersh Jan 21 at 20:25

I am not a sage expert. But I know you can call pari within sage and here you can compute the Gram/height matrix from the points and determine its determinant. Suppose you e is your elliptic curve (in pari this created by ellinit) and suppose P1,P2,P3 are your points then you just use the following commands:

v=[P1,P2,P3];
m = ellheightmatrix(e,v);
print(matdet(m));


If the last line is $$0$$ then your points are dependent. Either something similar is done in sage or just call pari commands from sage.