a * b = -40 (a)
a + b = -6 (b)
Solve (b) for (a)
a = -6-b
Replace on (a) and solve for b
-6-b * b = -40
-6b -b^2 = -40
-b^2-6b+40 = 0
apply quadratic equation:
positive : 6+26/-2 = 32/-2 = -16
negative = 6-26/-2 = 10
Use the negative:
10 * b = -40
b = -40 /-10
b= 4