Elliptic Curve Mathematics

Projective Coordinates in Elliptic Curves

# Projective Coordinates in Elliptic Curves

By: Cailyn Yong and Bryan Wee

Previously, we were introduced to elliptic curves and point operations. So far, the elliptic curves we have seen are represented in the affine space, where points can be represented as $(x,y)$ coordinates. Affine group operations, as we will soon see, are costly as they require field divisions. In this article, we will see how projective coordinates can be used to sidestep these costs and achieve greater efficiency.

Since we are concerned with computational efficiency, we will only be studying curves that are restricted to prime fields. Hence, for all equations below, all field arithmetic is modulo arithmetic.

## Cost of Affine Coordinates

Let us consider 2 affine coordinates, $P=({x}_{1},{y}_{1}),Q=({x}_{2},{y}_{2})$, where $P\ne Q$, and recall how point addition is computed.

If either point is $O$, then $P+Q$ is given by the other point.

Else if ${x}_{1}={x}_{2}$, then $P+Q=O$.

Else:

• Let $m=({y}_{1}-{y}_{2})/({x}_{1}-{x}_{2})$

• Then, ${x}_{3}={m}^{2}-{x}_{1}-{x}_{2}$ and ${y}_{3}=m({x}_{1}-{x}_{3})-{y}_{1}$

Notice that in its worst case, point addition requires 2 multiplications, 6 additions/subtractions, and 1 division.

Let us recall how point doubling can be performed as well. To compute $2P=({x}_{2},{y}_{2})$, where $P=({x}_{1},{y}_{1})$:

If $P=O$ or ${y}_{1}=0$, then $2P=O$

Else:

• Let $m=({3{x}_{1}}^{2}+a)/\left(2{y}_{1}\right)$

• Then, ${x}_{2}={m}^{2}-2{x}_{1}$ and ${y}_{2}=m({x}_{1}-{x}_{2})-{y}_{1}$

Point doubling involves 7 multiplications, 4 additions/subtractions, and 1 division.

Both point addition and doubling require 1 field division, which for prime fields, means modular division. This form of division requires the non-trivial act of finding a modular inverse, making it very expensive.

## Projective Coordinates

Costs can be reduced by adopting a new coordinate system that avoids field division entirely. Given an affine coordinate $(x,y)$, we can transform it into a projective coordinate $(X,Y,Z)$ by taking an arbitrary non-zero value $Z$ and assigning $(X,Y,Z)=(xZ,yZ,Z)$.

For instance, $(2,3)$ can be mapped to $(4,6,2)$ or $(8,12,4)$, with $Z=2$ or $Z=4$ respectively. Usually, $z$ is chosen to be $1$ for convenience; affine coordinates $(x,y)$ would be transformed to $(x,y,1)$.

Projecting an entire elliptic curve yields the following curve equation.

${Y}^{2}Z={X}^{3}+aX{Z}^{2}+b{Z}^{3}$

The diagram below visualizes how a projected curve might look like.

To convert projective coordinates $(X,Y,Z)$ back to affine coordinates $(x,y)$, all we have to do is divide the projective coordinate by $Z$.

$(x,y)=(X/Z,Y/Z)$

With projective coordinates, the formulae for point addition and point doubling require no field division. Take $P=({X}_{1},{Y}_{1},{Z}_{1})$, $Q=({X}_{2},{Y}_{2},{Z}_{2})$, and $P\ne Q$. Let us see how we can compute $P+Q=({X}_{3},{Y}_{3},{Z}_{3})$.

If either point is $O$, then $P+Q$ is given by the other point.

Else, let:

• $u={Y}_{2}{Z}_{1}-{Y}_{1}{Z}_{2}$

• $v={X}_{2}{Z}_{1}-{X}_{1}{Z}_{2}$

• $A={u}^{2}{Z}_{1}{Z}_{2}-{v}^{3}-2{v}^{2}{X}_{1}{Z}_{2}$To perform point addition,

• ${X}_{3}=vA$

• ${Y}_{3}=u({v}^{2}{X}_{1}{Z}_{2}-A)-{v}^{3}{Y}_{1}{Z}_{2}$

• ${Z}_{3}={v}^{3}{Z}_{1}{Z}_{2}$

Next, given $P=({X}_{1},{Y}_{1},{Z}_{1})$, how can compute $2P=({X}_{2},{Y}_{2},{Z}_{2})$?

Let:

• $w=a{{Z}_{1}}^{2}+3{{X}_{1}}^{2}$

• $s={Y}_{1}{Z}_{1}$

• $B={X}_{1}{Y}_{1}s$

• $h={w}^{2}-8B$To perform point doubling:

• ${X}_{2}=2hs$

• ${Y}_{2}=w(4B-h)-8{s}^{2}{{Y}_{1}}^{2}$

• ${Z}_{2}=8{s}^{3}f$

Both operations require more addition and multiplication than before, but demand zero divisions! Knowing this, we can much more efficiently manipulate elliptic curve points by:

Converting affine coordinates to projective coordinates.

Perform the required computation.

Converting the results back to affine coordinates. (Only this step requires division)

Now, only two field divisions are required for any amount of consecutive point addition and doubling. This, in turn, saves a drastic amount of computation for elliptic curves over finite fields.

## Jacobian Coordinates

A modified form of projective coordinates is Jacobian coordinates. For Jacobian coordinates, instead of multiplying $x$ and $y$ with $Z$ like we did in the standard form of projective coordinates, we map affine coordinates $(x,y)$ to $(X,Y,Z)=(x\ast {Z}^{2},y\ast {Z}^{3},Z)$.

Using Jacobian coordinates, elliptic curves adopt the following equation.

${Y}^{2}={X}^{3}+aX{Z}^{4}+b{Z}^{6}$

Here is the formula for point addition, assuming $P\ne Q$:

If either point is $O$, then $P+Q$ is given by the other point.

Else, let:

• ${U}_{1}={X}_{1}{{Z}_{2}}^{2}$ and ${U}_{2}={X}_{2}{{Z}_{1}}^{2}$

• $s={S}_{1}={Y}_{1}{{Z}_{2}}^{3}$ and ${S}_{2}={Y}_{2}{{Z}_{1}}^{3}$

• $H={U}_{2}-{U}_{1}$

• $r={S}_{2}-{S}_{1}$To perform point addition

• ${X}_{3}={r}^{2}-{H}^{3}-2{U}_{1}{H}^{2}$

• ${Y}_{3}=r({U}_{1}{H}^{2}-{X}_{3})-{S}_{1}{H}^{3}$

• ${Z}^{3}=H{Z}_{1}{Z}_{2}$

...and the formula for point doubling.

If ${Y}_{1}=0,$ then $2P=O$.

Else, let:

• $S=4{X}_{1}{{Y}_{1}}^{2}$

• $M=3{{X}_{1}}^{2}+a{{Z}_{1}}^{4}$

• $T={M}^{2}-2S$To perform point doubling:

• $S={X}_{2}=T$

• ${Y}_{2}=M(S-T)-8{{Y}_{1}}^{4}$

• ${Z}_{2}=2{Y}_{1}{Z}_{1}$

Like before, these operations do not require field division. Jacobian coordinates offer a slight edge compared to standard projective coordinates because they trade multiplication for more addition/subtraction which tends to be cheaper.

### Jacobian Coordinates ⇌ Affine Coordinates

Each instance of affine point addition/doubling requires one field division. This becomes extremely expensive once we consider consecutive curve operations (e.g., scalar multiplication). On the other hand, Jacobian coordinates demand no field divisions. We can exploit this fact to support affine point manipulation by:

1. Converting affine points to Jacobian points, with $z=1$.

$(x,y)\to (x,y,1)$

2. Performing all necessary operations in Jacobian space.

3. Converting Jacobian points back to affine space. Let ${z}^{-1}$ be the modular inverse of $z$.

$(x,y,z)\to (x\ast ({z}^{-1}{)}^{2},y\ast \left({z}^{-1}{)}^{3}\right)$

This way, we only require one modular inversion for an arbitrary number of elliptic curve operations, saving a significant amount of computation!

## Conclusion

In the previous article, we learned about the elliptic curve and the discrete logarithm problem. We then restricted the curve such that it can be computed by a computer with finite memory.

In this article, we transformed the curve onto a projective space and saw how it optimizes point arithmetic. After much math, we have arrived at a version of elliptic curves that is optimal for computers, and now have the necessary impetus to learn about elliptic curve cryptography.

If only I could read these glyphs a little faster...