Consider $n$ numbers $a_1,..., a_n$ and $x_1,..., x_n$. Can one find a polynomial, $f(x)\in R[x]$ st $f$ path through $(x_i,a_i) $ Consider $n$ arbitrary integer numbers $a_1,\ldots, a_n$ and real numbers $x_1,\ldots, x_n$. Can one find a polynomial, $f(x)\in \mathbb{R}[x]$ such that the graph of $f$ path through $(x_1,a_1), \cdots , (x_n,a_n) $, and   


*

*$\deg(f)=n$  

*$\deg(f)=n-1$


Any help would be appreciated. 
 A: Assuming that the $x_i$'s are distinct.
Step 1: For any $i$, can you find a polynomial which vanishes at $x_1,\cdots,x_{i-1},x_{i+1},\cdots,x_n$?  (And does not vanish at $x_i$).
Step 2: For any $i$, can you take the polynomial discovered in Step 1 and make its value $a_i$ at $x_i$ (and the value $0$ at $x_j$ for $j\not=i$).
Step 3: Can you combine such polynomials (for all $i$) into a solution?
A: For degree $n$, it can be done, using a construction along the lines described in the answer by Michael Burr. One needs a little trick to ensure the degree is exactly $n$.
For degree $n-1$, in general it cannot be done. The Lagrange interpolation process produces a polynomial of degree $\le n-1$, but finding a polynomial of degree exactly $n-1$ is not always possible.
For example, let $a_i=0$ for all $i$. Suppose there is a polynomial $P(x)$ of degree $n-1$ such that $P(x_i)=a_i$ for all $i$. This polynomial vanishes at $n$ places, so must be the zero polynomial. Alternately, we can use $a_i=x_i$. 
