You now have two expresions for dy/dx. Compare then and hence get the value of a and b.
Forget this. I have a better idea for you.
The two solutions to dy/dx = 0 are x = 2 and x = -1. Substitute these values of x to get two equation with a and b in them. Solve the resulting equations simultaneously.