# Polynomial Substitution for only higher terms

I'm dealing with elliptic curves in SAGE. Say the elliptic curve I have is $y^2=x^3+x$ working over GF(43) and I have a polynomial expression in x and y: $$y^2 + xy + 1.$$ I want to be able to substitute $y^2=x^3+x$ to get $(x^3+x)+xy+1$. How do I do this?

edit retag close merge delete

n is missing in polyomial

( 2021-09-24 11:09:54 +0100 )edit

Sort by » oldest newest most voted

What you can do is choose a monomial ordering on the polynomial ring such that $y$ is the largest variable, so that in the multivariate division algorithm computing the remainder after division by $y^2 - (x^3 + x)$ will amount to substituting $y^2 = x^3 + x$:

sage: R.<x,y> = PolynomialRing(GF(43), order='invlex')
sage: (y^2 + x*y + 1).reduce([y^2 - (x^3 + x)])
x*y + x^3 + x + 1


Here you could also choose e.g. R.<y,x> = PolynomialRing(GF(43), order='lex').

more

This works in this example, however I am also dealing with expressions of the form $p(x)y^2+ q(x)$ where $p,q$ are polynomials of large degree. Implementing the above does the opposite; it takes the large powers of $x$ and replaces them with $y$

( 2021-10-05 18:08:03 +0100 )edit

If your polynomial is assumed to be zero, then it is also possible to entirely eliminate $y$ by computing resultant of your polynomial and $y^2-(x^3+x)$ with respect to $y$:

sage: R.<x,y> = PolynomialRing(GF(43))
sage: (y^2+x*y+1).resultant(y^2-(x^3+x),y)
x^6 - x^5 + 2*x^4 + x^3 + x^2 + 2*x + 1

more