Linear and quadratic system of equations