coefficient for interpolation of data $(\frac{\pi}{2},1), (0,-1)$ with $P(x)=c_1p_1(x)+c_2p_2(x)$? Equation: $P_1(x)=cos^2x$, $p_2(x)=sin^2y$
Goal is: interpolation of data $(\frac{\pi}{2},1), (0,-1)$ with 
$P(x)=c_1p_1(x)+c_2p_2(x)$
Question: find $c_1, c_2$. 
Answer: $c_1=-1, c_2=1$

My question is via the answer of  this problem, how we can numerically
  find $c_1$ and $c_2$?


Since $P(x)=c_1p_1(x)+c_2p_2(x)$ so
$\begin{pmatrix}p_1(x) & p_2(x)\\ p_1(y) & p_2(y) \end{pmatrix} \begin{pmatrix}c_1 \\ c_2 \end{pmatrix} = \begin{pmatrix}P(x) \\ P(y) \end{pmatrix}$
then 
$\begin{pmatrix}p_1(\frac{\pi}{2}) & p_2(\frac{\pi}{2})\\ p_1(0) & p_2(0) \end{pmatrix} \begin{pmatrix}c_1 \\ c_2 \end{pmatrix} = \begin{pmatrix}P(\frac{\pi}{2}) \\ P(0) \end{pmatrix}$
then 
$\begin{pmatrix}0 & 1\\ 1 & 0 \end{pmatrix} \begin{pmatrix}c_1 \\ c_2 \end{pmatrix} = \begin{pmatrix}1 \\ -1 \end{pmatrix}$
By matrix multiplication:

$\begin{pmatrix}c_2 \\ c_1 \end{pmatrix} = \begin{pmatrix}1 \\ -1 \end{pmatrix}$
So $c_2 = 1$ and $c_1 = -1$
