I am given a homework problem that states: prove that for any polynomial $q$ of degree $n-1$ or lower that:
$$\sum^n_{i=0}q(x_i)\prod_{j=0, j \ne i} (x_i - x_j)^{-1} = 0$$
Intuitively, I don't know why this is necessarily the case.
I have tried approaching this by considering the Lagrange interpolating polynomial at $n$ distinct nodes. If $q$ is of degree $n-1$, then $q$ is the unique polynomial that interpolates $q$ at $n$ distinct nodes:
$$\sum^n_{i=0}q(x_i) \frac{\prod_{j=0, j \ne i}^n(x - x_j)}{\prod_{j=0, j \ne i}^n(x_i - x_j)} = q(x)$$
This is the same as the given expression with an additional factor of $\prod_{j=0, j \ne i}^n(x - x_j)$.
Any tips appreciated!
Thank you so much for help in the comments on this. Used those tips to come up with this proof:
Let $q$ be a polynomial of degree $\le n-1$. Then, given $n$ distinct nodes $x_0, ..., x_{n-1}$, $q$ is the unique polynomial that interpolates these points:
$\displaystyle q(x) = \sum_{i=0}^{n-1} q(x_i) \prod_{j=0, j \ne i}^{n-1} (x - x_j)(x_i - x_j)^{-1}$
Then, at $x_n$,
$\displaystyle q(x_n) = \sum_{i=0}^{n-1} q(x_i) \prod_{j=0, j \ne i}^{n-1} (x_n - x_j)(x_i - x_j)^{-1}$
Multiplying both sides by $\prod_{j=0}^{n-1} (x_n - x_j)^{-1}$ ,
$\displaystyle q(x_n) \prod_{j=0}^{n-1} (x_n - x_j)^{-1} = \sum_{i=0}^{n-1} q(x_i) (x_n - x_i)^{-1}\prod_{j=0, j \ne i}^{n-1} (x_i - x_j)^{-1}$
Since $(x_n - x_i)^{-1} = - (x_i - x_n)^{-1}$,
$\displaystyle q(x_n) \prod_{j=0}^{n-1} (x_n - x_j)^{-1} = - \sum_{i=0}^{n-1} q(x_i) (x_i - x_n)^{-1}\prod_{j=0, j \ne i}^{n-1} (x_i - x_j)^{-1}$
Adjusting indices on the left, and combining terms on the right,
$\displaystyle q(x_n) \prod_{j=0, j \ne n}^{n} (x_n - x_j)^{-1} = - \sum_{i=0}^{n-1} q(x_i) \prod_{j=0, j \ne i}^{n} (x_i - x_j)^{-1}$
Adding the right hand side to both sides,
$\displaystyle q(x_n) \prod_{j=0, j \ne n}^{n} (x_n - x_j)^{-1} + \sum_{i=0}^{n-1} q(x_i) \prod_{j=0, j \ne i}^{n} (x_i - x_j)^{-1} = 0$
Combining terms again,
$\displaystyle \sum_{i=0}^{n} q(x_i) \prod_{j=0, j \ne i}^{n} (x_i - x_j)^{-1} = 0$