# Displaying Z-coordinate of the Elliptic curve points

when i generate an elliptic curve and work with it's points. it is always displaying with Z-coordinate =1 as following:

sage: EC=EllipticCurve(GF(101),[2,3])
sage: EC
Elliptic Curve defined by y^2 = x^3 + 2*x + 3 over Finite Field of size 101
sage: EC.random_point()
(60 : 65 : 1)
sage: point1=EC.random_point()
sage: point1
(3 : 6 : 1)
sage: point2=2*point1
sage: point2
(30 : 55 : 1)


as shown Z-coordinate always = 1. can i work with points with it's normal (original) Z- component ??

edit retag close merge delete

Sort by » oldest newest most voted

The thing is that the points of the curve are defined up to a multiplicative constant, since the equation that defines the curve is homogenous:

sage: EC.defining_polynomial()
-x^3 + y^2*z - 2*x*z^2 - 3*z^3


So if i take a random point :

sage: p = EC.random_point()
sage: p
(50 : 60 : 1)


there is no canonical choice of which multiple (a*50, a*60, a*1) that represents that point.

That said, you can decide to fix the x coordinate to be equal to 1:

sage: p.dehomogenize(0)
(82, 99)


or the y coordinate:

sage: p.dehomogenize(1)
(85, 32)


or the z coordinate:

sage: p.dehomogenize(2)
(50, 60)

more

Here is an alternative answer, to show points...

sage: EC = EllipticCurve(GF(101), [2, 3])
sage: EC
Elliptic Curve defined by y^2 = x^3 + 2*x + 3 over Finite Field of size 101
sage: P = EC.random_point()
sage: P
(98 : 24 : 1)
sage: P.xy()
(98, 24)
sage: ORIGIN = EC.point(0)
sage: ORIGIN.xy()
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)


As seen, there is a problem to represent P using the P.xy() method (only) in the case the point needed is the $O$ point on the elliptic curve (declared in the shape $y^2=x^3+ax+b$).

Note that one can easily access the components and do stuff with them as best suited for the own taste...

sage: P
(98 : 24 : 1)

sage: x, y, z = P
sage: x, y, z
(98, 24, 1)
sage:

sage: x, y, z = ORIGIN
sage: x, y, z
(0, 1, 0)

more

## Stats

Seen: 73 times

Last updated: May 14 '20