Additive inverse for elliptic curve addition in finite field in jacobian coordinates I wrote a solidity smart contract for elliptic curve point addition in Jacobian coordinates.

Jacobian coordinates: [X,Y,Z]
Affine representation: [x,y]=[X/Z^2, Y/Z^3]

I used the following formulas: Link. My code seems to work fine however my questions are:


What is the additive inverse in Jacobian coordinates? Is it the point at infinity and the result therefore: P-P=[0,1,0]?
My elliptic curve multiplication function seems to have an error, any idea? I think I need to set the start value of R to "additive zero for points".



// function for elliptic curve multiplication in jacobian coordinates using Double-and-add method
function ecmul(uint256[3] P, uint256 d) constant returns (uint256[3] R) {

  R[0]=0;
  R[1]=0;
  R[2]=0;

  //return (0,0) if d=0 or (x1,y1)=(0,0)
  if (d == 0 || ((P[0]==0) &amp;&amp; (P[1]==0)) ) {
    return (R);
  }
  uint256[3] memory T;
  T[0]=P[0]; //x-coordinate temp
  T[1]=P[1]; //y-coordinate temp
  T[2]=P[2]; //z-coordiante temp

  while (d != 0) {
    if ((d &amp; 1) == 1) {  //if last bit is 1 add T to result
      R = ecadd(R,T);
    }
    T = ecdouble(T);    //double temporary coordinates
    d=d/2;              //"cut off" last bit
  }

  return R;
}
The projective form of Weierstrass equation of an elliptic curve is obtained by replacing $x$ by $X/Z^c$ and $y$ by $Y/Z^d$. If $c=d=1$ then we have standard projective coordinates. In this state, point at infinity is $(0:1:0)$. But in Jacobian coordinates($c=2$ and $d=3$), point at infinity is $(1:1:0)$.

As poncho said in comments, The additive inverse of the point $(X:Y:Z)$ is  $(X:-Y:Z)$ .