You can equate the coefficients or substitute specific values of x (or do both) since the equality is meant to hold for all values of x (and hence it should equal no matter what value of x you substitute in).
When you expand the RHS you get x3 + 3x = ax3 + (2a+b)x2 + .....
The coefficient of...