I've been stuck on a problem in spivak calculus and can't find the anwser anywhere.. I'm wondering if I'm missing something so here it goes:
Question
Find a polynomial function $f$ of degree $n-1$ such that $f(x_i) = a_i$ where $a_i,...., a_n$ are given numbers. It should give us the lagrange interpolation formula.
Solution
In part a), we showed that
$f_i(x) =\frac{\prod_{ j\neq i} (x-x_j)}{\prod_{ j\neq i} (x_i-x_j) } = 1$ for $f_i(x_i)$ and $0$ for $f_i(x_j)$
Therefore I assumed that if I want $a_i$ for $f(x_i)$ I would simply need
$f(x) = a_i \cdot f_i(x)$
But the book awnser is
$f(x) = \sum_{i=1}^n a_i \cdot f_i(x)$
But it seems to me that $f(x_i)$ would be $ \sum_{i=1}^n a_i \neq a_i $
Am I missing somethign or maybe misunderstanding the question?
THank you in advance and I can't write the sum and prod very well I'm sorry.