Help with Spivak Calculus Ch3 Problem 6a Yet again I find myself stuck on a Spivak question. This time it is simply the question that isn't clear to me. It states:
If $x_1, ..., x_n$ are distinct numbers, find a polynomial function $f_i$, of degree $n-1$ which is 1 at $x_i$ and 0 at $x_j$ for $j\neq i$. Hint: the product of all $(x-x_j)$ for $j\neq i$, is 0 at $x_j$ if $j\neq i$. This product is usually denoted by:
$$\prod_{\begin{smallmatrix}{j=1}\\ {j\neq i} \end{smallmatrix}}^n(x-x_j)$$
To be honest I don't know where to begin. I understand how to create a polynomial equation for a given set of results but this is quite strange. I'm not sure exactly what the author is expecting.
The answer book shows:
$$f_i(x)={\prod_{\begin{smallmatrix}{j=1}\\ {j\neq i} \end{smallmatrix}}^n(x-x_j)}/{\prod_{\begin{smallmatrix}{j=1}\\ {j\neq i} \end{smallmatrix}}^n(x_i-x_j)}$$
Which I have expanded out just fine but don't know what to do with.
 A: One way to think about this question is to consider a fixed $n$ and pick a set of distinct $x_1, x_2, \ldots, x_n$.  For example, suppose we choose $n = 3$ and $x_1 = 1$, $x_2 = 2$, $x_3 = 3$.  Then suppose we want to find a polynomial $f_1(x)$ such that $f_1(x_1) = f_1(1) = 1$, but $f_1(x_2) = f_1(x_3) = f_1(2) = f_1(3) = 0$.  That is to say, $f_1$ is a quadratic which has zeroes at $x = 2$ and $x = 3$, but is equal to $1$ at $x = 1$.  Naturally, this suggests looking at a polynomial of the form $$a(x-2)(x-3)$$, for some constant $a$.  But what is this constant?  Well, if we plug in $x = 1$, we must have $$f_1(1) = 1 = a(1-2)(1-3) = 2a,$$ hence $a = 1/2$ and the desired solution is $$f_1(x) = \frac{1}{2}(x-2)(x-3).$$
Similarly, if we try to find a polynomial $f_2(x)$ for which $f_2(2) = 1$ with roots at $x = 1, 3$, we would have to solve the equation $1 = a(2-1)(2-3)$, which gives $a = -1$, hence $f_2(x) = -(x-1)(x-3)$.
Now, let's look at the general case.  The polynomial $f_i(x)$ satisfies $f_i(x_i) = 1$ and $f_i(x_j) = 0$ for all $j \ne i$, so it must take on the form $$f_i(x) = a \prod_{j \ne i} (x - x_j),$$ for some unknown constant $a$.  To find this constant, we plug in $x = x_i$:  $$f_i(x_i) = 1 = a \prod_{j \ne i} (x_i - x_j),$$ from which it follows that $$a = \left( \prod_{j\ne i} (x_i - x_j) \right)^{\!\!-1}.$$  Then substituting back into the expression for $f_i(x)$ gives us the claimed answer.
