Quadratic splines, minimizing S

Hi i have a problem with quadratic splnes, i am supposed to find $\displaystyle S_1$ and $\displaystyle S_2$ 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 $\displaystyle \int_{-1}^1 \! (S(x))^2 \, \mathrm{d}x. $ is minimal. The answer is on the form

$\displaystyle

S_1(x)=a_1 x^2 +b_1x +c_1 $ on [-1,0] and

$\displaystyle

S_2(x)=a_2x^2 +b_2x +c_2 $ 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 $\displaystyle

\int_{-1}^1 \! (S(x))^2 \, \mathrm{d}x.

$, can i divide it up?

$\displaystyle

min\int_{-1}^1 \! (S(x))^2 \, \mathrm{d}x.=min (\int_{-1}^0 \! (S_1(x))^2 \, \mathrm{d}x. +\int_{0}^1 \! (S_2(x))^2 \, \mathrm{d}x. ) ?

$

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.