Quadratic splines, minimizing S

Hi i have a problem with quadratic splnes, i am supposed to find and that interpolates the following points S(-1)=0 S(0)=1 S(1)=2, and at the same time we want to find S such that is minimal. The answer is on the form

on [-1,0] and

on [-1,0]

my answer:

I use the data points and find that a1=-a2, b1=b2 and c1=c2=1, but I have no idea how to use minimize , can i divide it up?

I know i should get an expression and probably set the derivative to zero but i just dont know how to attack the minimizing itegral since the functions has two parts. Help greatly appreciated.