In javascript, I am implementing Lagrange interpolation over a finite field $GF_p$ for some prime $p$. I only need to compute the value of the $y$-intercept of the Lagrange interpolation polynomial $L(x)$ (this is for Shamir's threshold secret sharing scheme, which stores the secret in the constant term). Given points on a polynomial $(x_0,y_0),...,(x_k,y_k)$, I am using the following formula for the Lagrange interpolation polynomial $L(x)$ evaluated at $x=0$:
$L(0) = \sum\limits_{i=0}^{k} y_i \prod\limits_{j=0, j\neq i}^{k} \frac{x_j}{(x_j-x_i)}$ mod $p$
I notice that the negative of some $(x_j-x_i)$ terms will appear in some of the product terms. Because computing the multiplicative inverse of $(x_j-x_i)$ is computationally expensive, I don't want to repeat calculations that can be simplified. Therefore, how can I compute the multiplicative inverse of $(x_i-x_j)$ from an already-computed multiplicative inverse of$(x_j-x_i)$? Are they equal, or is the former the negation of the latter?