Here, I will fill in some of the gaps (quite literally) from the earlier post on algebraic and elliptic curves. There, I showed how we can, algebraically, construct points on a curve in terms of already known ones. For curves of degree 2, or conics, this led to a parameterisation of the entire curve. For degree 3, or elliptic curves, this gave a binary operator allowing us to construct one new point out of any two existing points which, as I will cover later, leads to the group structure used in the Bitcoin digital signature algorithms. If you have not already, I would suggest reading that post before coming back to this one. However, there was one small problem that we encountered. For some special cases, the construction is not well-defined and directly applying the algebraic formulas would give divide-by-zero errors. We interpreted this as giving points *at infinity*. However, it was not clear what the points at infinity are, or how they should be handled algebraically. I will state upfront, this post consists of the mathematical background to better understand elliptic curves. If you are happy with the explanation given in the previous post, and to take at face value how to handle the point at infinity of the curve used by Bitcoin, then this post can be skipped. On the other hand, if you want to understand the mathematics better, then read on.

As an example, consider the hyperbola in figure 1 given by the solutions to . Most lines that intersect the curve at all, will intersect it at precisely two points. There are tangents to the curve, that will intersect at one point, but with multiplicity two. However, lines which are perpendicular to one of the asymptotes have gradient 1 or -1 and will intersect at most once. To fill in this missing point, we interpret these lines as also intersecting the curve at a point at infinity. All parallel lines intersect at the same point at infinity and, in the case of the hyperbola, the asymptotes themselves (which have gradient 1 or -1 and pass through the origin) are interpreted as intersecting a point at infinity with multiplicity 2.

Next, consider the elliptic curve given by as in figure 2. Most lines which intersect this at two points, will also intersect at a third point. The exception is vertical lines, which intersect at exactly two points. We interpret these as also intersecting the point at infinity of the curve, which we denoted by . Furthermore, for consistency, we wrote , meaning that the line tangent to actually intersects it with multiplicity 3. This line is actually the *line at infinity*.

What causes these points at infinity to appear? They should not just be ignored, especially for the case of elliptic curves, as that would mess with the nice algebraic properties.

We defined a curve as the set of solutions to a polynomial equation in two unknowns *x* and *y*, which are allowed to take values in a given field *F*. The set of all points as *x* and *y* take values in *F* is known as the *affine plane*, and a curve defined as above is more correctly called an *affine curve* or *affine algebraic curve*. The problem is that the affine plane is not complete, and is effectively missing points at infinity. Adding these points leads us to the *projective plane*. Defining a curve over the projective plane will naturally include the points at infinity, so that they can be handled in exactly the same way as the ‘finite’ points which lie on the affine plane.

Let me start with the projective line over the base field *F*. This is denoted , and points on the projective line are written as for elements *x* and *y* of the base field which are not both zero. We also identify points if they are scaled by a nonzero element of the field, so that for any nonzero *a* in *F*. Expressed slightly differently, and represent the same projective point if and only if . In the case where , then this means that and . So, these points can be thought as ratios, equal to , which are just elements of the base field. This is expressed by the map from the base field to the projective line, which has inverse over . However, we also include the point with , which is the point at infinity.

There is the obvious symmetry on the projective given by exchanging the components, so that goes to . Using the identification of points on the projective line with the base field, this is just the multiplicative inverse for nonzero *x*

Also, 0 and the point at infinity are exchanged. Under this map, a polynomial of the form is taken to , which is not a polynomial. However, rational functions (i.e., the ratio of two polynomials) does remain a rational function under the transformation, suggesting that polynomials are not natural objects defined on the projective line, but rational functions are.

Note that a line in the affine plane through a fixed point *P* can be parameterised by , for elements of the base field which are not both zero. Then, another line is in fact the same line if is proportional to . This shows that the points in the projective line are in one-to-one correspondence with the lines in the plane through *P*. Under this correspondence, the line is associated with the point . Furthermore, as described in the previous post, the points of the projective line over the real numbers are in one-to-one correspondence with the unit circle. This is as in figure 3, showing the mapping between the lines through point *P*, the points of a circle, and the base field *F* together with the point at infinity.

The projective plane over the base field *F*, denoted by , can be constructed in a similar way. Individual points are expressed as for elements *x,y,z* of the base field which are not all zero. Points are identified if they are equal up to a scaling factor, for a nonzero *a* in *F*. Alternatively, fixing a point *P* in the affine plane, we can identify a point in the projective plane with the line through *P*.

Note that, by scaling, points in the projective plane can be assumed to have or . The points with are in one-to-one correspondence with points in the affine plane. The points with are still only defined up to a scaling factor, so are in correspondence with points in the projective line,

This identifies the projective plane as the disjoint union of the affine plane and the projective ‘line at infinity’.

For the field of real numbers, any point in the projective plane can be scaled so that is equal to one. As multiplying through by leaves the point unchanged, this identifies points on the projective plane with pairs of antipodal points on the unit sphere. The north hemisphere is in one-to-one correspondence with the affine plane (as is the south hemisphere, identifying antipodal points), with the equator at corresponding to the projective line at infinity, This is as in figure 4.

Clearly, *n*-dimensional projective space can be defined in the exact same way, as points for elements of the base field, not all zero, where we identify points which are equal up to a scaling factor. Here, though, I am only looking at the projective line and plane.

#### Linear Equations

The equation for a line for points in the projective plane is

(1) |

where *a,b,c* are constants in the base field, not all equal to zero. Note that each of the terms is a multiple of one of the coordinates *x,y,z*. There is no constant term independent of these since, points in projective space are invariant under scaling, so the same must also be true for the equation of a line. Multiplying each of *x,y,z* through by a scaling factor also scales the left hand side of (1) by the same factor, so does not effect whether or not it is equal to zero. This would not be the case if a constant term was included. Note also, that for points corresponding to the affine plane, (1) is just the usual equation for a line , so long as *a* and *b* are not both zero. On the other hand, if *a* and *b* are both zero, then the equation gives the points , which is the line at infinity.

As for the affine line, so long as *a* is nonzero, given any values of *y,z* we can solve (1) simply as

This provides a one-to-one map from points of the projective line to points in the projective plane solving (1). Similarly, if *b* or *c* is non-zero, the same idea holds with the roles of *x* and *y* or *z* exchanged.

More generally, for any two distinct points and then the unique line passing through these can be parameterised as

(2) |

for points in the projective line. There is a slight abuse of notation here, since the left hand side of (2) is only defined in terms of the choice of representation of the points *P* and *Q*. Scaling them by nonzero constants changes the parameterization, but does not affect the line through *P* and *Q*.

It is a straightforward result that any two lines in the projective plane intersect. Using (1) for the equation of a line, we obtain two linear equations in three unknowns for the point of intersection, which always has a nontrivial solution. Furthermore, two distinct lines will intersect at a unique point.

Just as for the affine plane, the lines through a fixed point *P* are in one-to-one correspondence with points on the projective line. For example, consider a point not at infinity. The affine lines though this point are just for points in . In the projective plane, this corresponds to the line (2) passing through *P* and the point at infinity. More generally, for any line *L* in the projective plane not containing *P*, (2) gives a one-to-one map between the points *Q* on *L* and the lines through *P*.

#### Quadratic Equations

I now look at higher order algebraic curves. Recall that a curve for points in the affine plane is determined by the zeros of a polynomial of some degree *d*. As the points of the projective plane, with *z* nonzero, correspond to in the affine plane, the equation defining the curve becomes . Since this involves dividing by *z*, it is not defined at the line at infinity, where . This is easily remedied by multiplying through by , giving a polynomial of degree *d* in *x,y,z*. For example, consider a general degree 2 (quadratic) polynomial,

We convert to a polynomial in *x,y,z*,

The result is a *homogeneous* polynomial in *x,y,z*. By this, we mean each of the monomial terms in the polynomial expansion has the same degree . A consequence is that scaling by a constant has the effect of scaling by , meaning that it does not affect whether or not it evaluates to zero. So, the equation is a well-defined statement for points in the projective plane.

For example, the hyperbola in the affine plane extends to the projective curve for points in the projective plane. This is shown in figure 5. The apparently two distinct components of the hyperbola over the real numbers are really just a single closed curve in the projective plane passing through the line at infinity at two points. This shows as two circles in the sphere representation but, as we identify antipodal points, it is really just a single circle.

This is the general idea, a *projective curve* of degree *d* consists of the ponts in the projective plane satisfying for a homogeneous degree *d* polynomial *p*. We assume that *p* is irreducible, so that it does not factor as a product of polynomials of lower degree (if it did, the curve would be a union of curves of lower degree). A point on the curve will be said to be singular if the partial derivatives also all vanish there.

Consider a quadratic curve (or conic) of the form for *p* homogeneous of degree 2, as in (1). Suppose that we know one nonsingular point *P* on the curve. Then, for any line though this, parameterized as as in (2), is a homogeneous degree 2 polynomial in *s,t* vanishing when *t* is zero,

The terms cannot both be zero, otherwise *p* would vanish on the entire line, which can only be the case if it has a linear factor. Since we assume that it is irreducible, this is not the case. So, the line through *P* intersects at the second point corresponding to . This provides a one-to-one parameterisation of the points on the conic in terms of the lines through *P*.

Looking at the circle example as in the previous post, in projective space this becomes . Then, fix the point . The line though *P* and the point at infinity is parameterised as . This passes through the circle at,

So, we have the solution , parameterising the points of the circle as,

Using the real numbers as the base field, will be nonzero, so we can divide through by this to get the same parameterization as found in the previous post. For the complex numbers, or any base field containing a square root of -1, there will be one point with and which maps to the point at infinity on the conic.

#### Cubic Equations

Now consider a polynomial which is homogeneous of degree 3, and the algebraic curve . We suppose that *p* is irreducible and does not contain singular points. This is an elliptic curve. For example, the Weierstrass normal form mentioned in the previous post for affine elliptic curves is,

In projective space, this becomes the homogeneous third order polynomial equation

for points in projective space, corresponding to the polynomial

Evaluated on the line at infinity , we obtain , giving a single point of intersection at with multiplicity 3. This is as in figure 6 below. The elliptic curve in the real projective plane, represented as points on the sphere, becomes a closed curve intersecting the equator tangentially at a single pair of antipodal points.

Now, consider two points *P* and *Q* on the degree 3 curve. They are joined by the line as in (2) and, evaluating *p* along this line gives a homogeneous degree polynomial, which must vanish at the points *P* and *Q* corresponding to and ,

This cannot vanish identically, otherwise the elliptic curve would contain the line, and have a linear factor. So, and are nonzero, giving a third point of intersection corresponding to . Hence, the point is uniquely defined. In a similar way, if (and is nonsingular), then we take to be tangent to the curve at *P*, in which case vanishes with multiplicity 2 at giving,

Again, we have a uniquely determined third point of intersection at . So, is defined everywhere, and may or may not correspond to a point at infinity.

We already noted that an elliptic curve in Weierstrass form has a unique point at infinity. As the line at infinity intersects this point with multiplicity 3, we have already determined the identity . Given points and on the elliptic curve, then all lie on the horizontal line , so that , and . There is no need recompute the explicit formulas not involving the point at infinity, as the calculation from the previous post applies in the same way.

This all works out as was stated in the previous post, but using projective space explains why the point at infinity behaves as it does, and allows for different parameterizations which may have different points at infinity.