$$S(x)=\begin{cases} x^3 +4x^2 -2x +7 & \text{ if } -1\leq x\leq 0, \\ x^3 - 2x^2 +4x +5& \text{ if } 1\leq x\leq 2, \end{cases}$$
is a cubic spline with knots $\{-1, 0, 1, 2\}$
Find $s2(x)$ on the interval $0\leq x\leq 1$
So $S'(x) = 3x^2 +8x -2$ if $-1\leq x\leq 0$
$S'(x)=3x^2 - 4x +4$ if $1\leq x\leq 2$
I know We need $s2(0) = 7$, $s2(1) = 8$ and $s2'(0) = -2$ , $s2'(1) = 3$
But I don't know what to actually put into the matrix to solve this.. The answer given in class was
$$s2(x) = -x^3 + 4x^2 -2x +7$$
but I'm not sure how he got that.
$s2(x)=ax^3+bx²+cx+d$
$s2'(x)=3ax²+2bx+c$
You just have to replace $x$ with $\{0,1\}$ and you will get 4 equations with 4 unknowns...