# How can convert affine to Jacobian coordinates?

I have a point in affine coordinates: $(x,y)$.

What should I do when I want to convert to $(X,Y,Z)$ in Jacobian coordinates? I need it for calculating ECC in a prime field.

When you go from Affine to Jacobian, $X$ and $Y$ stay the same, and $Z$ is equal to $1$

Affine -> Jacobian:

$(X',Y',Z') = (X,Y,1)$

Jacobian -> Affine:

$(X',Y') = (\frac{X}{Z^2}, \frac{Y}{Z^3} )$

• Note that the division in the Jacobian -> Affine transformation is based on the Modular multiplicative inverse. You can't just use the integer division operation offered by common programming languages. Oct 13 '14 at 10:20
• and what if $Z=0$? Jun 1 at 23:48
• Z = 0 means something went wrong in your algorithm. It should never occur if you add or multiply points on the curve. Jul 31 at 2:55

If you have a point $$(x,y)$$ to get its Jacobian coordinates $$(X,Y,Z)$$, take a $$\lambda \in K^*$$ and $$(X,Y,Z) = (x\lambda^2, y\lambda^3, \lambda)$$. The special/identity point is mapped to $$(1,1,0)$$.

Where $$K$$ is the field (of the definition of the Elliptic curve)