I was coding an implementation of the Lagrange interpolation algorithm for Shamir Secret Sharing (i.e. I was evaluating the interpolation polynomial at $0$) and in the following had forgotten the minus sign in the numerator:
$\sum_j \prod_i y(x_j)\frac{0 - x_i}{x_j - x_i}$
I did not initially notice this error because the output of all my unit tests were correct and I moved on, but I noticed it when I came back to try and write a new function to pre-compute the constants and speed up the share reconstruction I noticed it my calculation looked like:
$\sum_j \prod_i y(x_j)\frac{0 + x_i}{x_j - x_i}$
Now I did a few smaller examples by hand and noticed that the signs just happened to even out, but it begged the question why? I thought that the minus sign was distinctly necessary when determining this polynomial, and that flipping the sign in a place like this would require that I do a subtraction instead of an addition somewhere. An example of the kind of effect I thought changing the sign would have is in synthetic division where when you use the zero as the divisor you need to do subtraction and when you use the opposite of the zero in the divisor you need to use addition to calculate the remaining terms.
Maybe I'm just over thinking this, or I happened to come across special cases. Like maybe this is only true of odd powers of polynomials, or only for small degree polynomials like I was using. I was just interested to see if anyone else had any thoughts!
I think you mean $$p(x)=\sum_{j=1}^ny(x_j)\prod_{i=1\\i\ne j}^n\frac{x-x_i}{x_j-x_i}$$ So if $n$ is odd and $x=0$ you get $$p(0)=\sum_{j=1}^ny(x_j)\prod_{i=1\\i\ne j}^n\frac{0-x_i}{x_j-x_i}=\sum_{j=1}^ny(x_j)(-1)^{n-1}\prod_{i=1\\i\ne j}^n\frac{x_i}{x_j-x_i}=\sum_{j=1}^ny(x_j)\prod_{i=1\\i\ne j}^n\frac{0+x_i}{x_j-x_i}$$