Question: Suppose $L$ be a Vector Space of Polynomials of $x$ of degree $\leq n-1$ with coefficients in the field $\mathbb{K}$.

Define $$g\_i(x) :=\prod \_ {{j=1},{j\neq i}}^n \frac{x-a\_j}{a\_i-a\_j}$$ Show that the polynomials $g\_1(x), g\_2(x),...,g\_n(x)$ form a basis of L. Furthermore, show that coordinates of polynomial $f$ in this basis are $\{f(a\_1),f(a\_2),...,f(a\_n)\}.$

To show that the polynomials are the bases, I need to show that they span $L$ and that they are linearly independent. I thought showing that any element in the set $\{1,x,x^2,...,x^{n-1}\}$ belongs to the span of $\{g\_1(x), g\_2(x),...,g\_n(x)\}$ would be enough to show the $g\_1(x), g\_2(x),...,g\_n(x)$ spans $L.$ But I don't know how to do this! Also, linear independence seems to be tougher!

Answer: 
Here is very easy method to show that they are linearly independent.

Suppose that $$b\_1g\_1(x)+b\_2g\_2(x)+...+b\_ng\_n(x)=0$$
To show linear independence, it suffices to show that $$b\_1=b\_2=...=b\_n=0$$
Evaluate 
$$b\_1g\_1(x)+b\_2g\_2(x)+...+b\_ng\_n(x)=0$$
at $$x=a\_i\;\;\;\;\forall i\le n$$

You can notice that $$g\_i(a\_j)=\begin{cases}0&i\neq j \\ 1 & i=j\end{cases}$$

It follows that $$b\_1=b\_2=b\_3=...=b\_n=0$$

To see that the coordinates are given as such, consider a general polynomial as above
$$f(x)=c\_1g\_1(x)+c\_2g\_2(x)+...+c\_ng\_n(x)=0$$

Follow same thing as above, start substituting $x=a\_i$, you will see that 
$$c\_1=f(a\_1)$$ and so on.

Best of luck.
I hope I could help.
Choose arbitrary $f\in L$. Let be $$\tilde{f}(x) = \sum\_{i = 1}^{n}f(a\_i)g\_i(x)\text{.} $$

For every $x\in \{a\_1,\dots, a\_n\}$ we have $f(x) = \tilde{f}(x)$, so the polynomial
$p= f - \tilde{f}$ has $n$ zeros and $\deg p \leq n-1$, so $p(x) = 0$ for every $x\in \mathbb{R}$. So $g\_i$ span $L$. We know that $\dim L = n$, so they must be linearly independendent.