You don't want to set the gradient of one equal to the other, you want to set the gradient of one equal to the gradient of the other.

For a) the gradient of the other is -3 everywhere, whereas for b) you'll solve a quadratic to see where the two gradient functions (i.e. dy/dx and d g(x) / dx ) have the same value.