# Determine the values of a,b,c, and d, so that the following function is a cubic spline

Determine the values of a,b,c, and d, so that the following function s(x) is a cubic spline satisfying $$s''(3)=0$$.

$$s(x)= \Big\{^{x^3-4x^2+7 x \in [-1,1]}_{ax^3+bx^2+cx+d x \in [1,3]}$$

To use the Natural/simple boundary conditions I know that it must satisfy:

$$S''(x_o)=0$$ and $$S''(x_n)=0$$ This is what I have:

$$s_1(x)=x^3-4x^2+7 \rightarrow s_1'(x)=3x^2-8x \rightarrow s_1''(x)=6x-8$$

and

$$s_2(x)=ax^3+bx^2+cx+d \rightarrow s_2'(x)=3ax^2+2bx+c \rightarrow s_2''(x)=6ax+2b$$

Now this step is where i'm stuck, any help would be appreciated. What would the next step be?

edit: With the help of mathcounterexamples.net, I was able to use Gauss-Jordan elimination to get the following values:

$$a=\frac{1}{6}, b=\frac{-3}{2}, c= \frac{-5}{2}, d=\frac{47}{6}$$

You have

$$\begin{cases} s_1(1) &= 4\\ s_1^\prime(1) &= -5\\ s_1^{\prime \prime}(1) &= -2 \end{cases}$$

In order to have a spline, you need to have the same values for $$s_2$$ at $$1$$. Hence $$\begin{cases} s_2(1) &= a+b+c+d &=4\\ s_2^\prime(1) &= 3a+2b+c&= -5\\ s_2^{\prime \prime}(1) &= 6a +2b&= -2 \end{cases}$$

Now, let's use the last condition $$s^{\prime \prime}(3)=0$$ which imposes $$18a+2b=0$$.

You have 4 equations with 4 unknowns that you have to solve.

• Why at 1, and not at -1? – Killercamin Feb 1 '19 at 16:17
• Because $1$ is the point at which $s_1$ and $s_2$ join. – mathcounterexamples.net Feb 1 '19 at 16:19
• Oh I see, let me work it out and can I update the question just so that you can verify? If you have the time of course. – Killercamin Feb 1 '19 at 16:20
• @Killercamin I'll let you solve the system with $4$ unknowns... I'm not good at computing! – mathcounterexamples.net Feb 1 '19 at 16:22