f is differentiable at 1 if
=> 2 = 2a+b - (1)
f is differentiable at 2 if
=> 4a+b = 1 - (2)
Solving (1) and (2), we get
a = -0.5, b = 3
Now f has to be continous on 1 also, so
=> 1 = a + b + c
=> c = -1.5
Similarly f has to be continous on 2 also, so
=> 4a+2b+c = 2+d
=> d = 0.5
So a = -0.5, b = 3, c = -1.5, d = 0.5