# Elliptic curve Jacobian coordinates example

I am working on Matlab Jacobian coordinates, I want a jacobian coordinates example with numbers include doubling and additions based on k value to test the code if works properly? I tried to search in google to find any example, but I didn't find.

Can anyone refer to me a clear example includes numbers with answers to test my code

Thanks for all

I have some test vectors included in the source code for my secp256k1 implementation called ekliptic. This sounds like it might be similar to what you're after. However... you should probably convert Jacobian coordinates back to affine coordinates before comparing the results of Jacobian point addition/doubling operations. Here's why.

For any affine point $$(x_a,y_a)$$, there is an absurdly large number of possible Jacobian coordinate triplets $$(x_j,y_j,z)$$ which satisfy the requirements of Jacobian coordinates:

$$x_a = \frac{x_j}{z^2}$$

$$y_a = \frac{y_j}{z^3}$$

$$z$$ is basically a scaling factor we use to defer and accumulate division operations.

As a more concrete example, one could represent the affine point $$(7,10)$$ as the Jacobian $$(x,y,z)$$ points:

• $$(7,10,1)$$
• $$(28,80,2)$$
• $$(63,270,3)$$
• $$(112,640,4)$$
• etc etc.

As a result, I've found that different addition/doubling formulas will give me different Jacobian coordinates. For example, in my ekliptic library, I used the add-1998-cmo-2 formula for addition. But if I used a different addition formula to add the same two Jacobian points, I might get a different $$(x_j,y_j,z)$$ output. Indeed when i tried to scrape and reuse some test vectors from the btcec project, i ran into exactly this issue, because they chose different formulas than I chose.

As long as two sets of Jacobian coordinates simplify to the same affine point $$(x_a,y_a)$$, they are still fundamentally equivalent, but this means that test vectors from one project may not be reusable for yours, without doing some conversions first.

Usually converting back to affine is simpler.

• what is the a, b and p values you are using in your example? Commented Feb 2, 2023 at 6:46
• I'm using the secp256k1 curve which is $y^2 = x^3 + 7$. You can look up those parameters online. Here's where they're defined in my library: github.com/kklash/ekliptic/blob/main/constants.go Commented Feb 6, 2023 at 22:42