# Thread: Help with this matrix for natural spline

1. ## Help with this matrix for natural spline

Can someone please tell me what the matrix would be and they got it for a free(natural) cubic spline that interpolates the data f(0)=0, f(1)=1, f(2)=2

so far my matrix was turning out like this:

\begin{array}{cc}1&0&0&0&0&0&0&0\\1&4&1&0&0&0&0&0\ \0&1&4&1&0&0&0&0\\0&0&0&0&1&4&1&?\end{array}

However, the answer found online is \begin{array}{cc}1&0&0&0&0&0&0&0\\1&1&1&1&0&0&0&0\ \0&0&0&0&1&0&0&0\\0&0&0&0&1&1&1&1\\0&1&2&3&0&-1&0&0\\0&0&2&6&0&0&-2&0\\0&0&2&0&0&0&0&0\\0&0&0&0&0&0&2&6\end{array}

I know the formula for the actual matrix, I just don't know why i'm not getting the same answer. Could someone please check to see if the online answer is correct and then show how it was found. i.e $h_0$=? $2(h_0+h_1)$=? like the actual math and numbers used in the matrix as opposed to just the matrix itself. I'm getting so frustrated with this matrix thank you

2. Sorry, I guess I don't know how to use the math thing to make a matrix..however like the second one should be 8x8 with each row separated by \\