Given the equation:
x^2+13*x+42 = (x+6)*(x-a)
Expand expressions:
x^2+13*x+42 = x^2 - 6*a + 6*x - a*x
Reducing, you get:
42 + 6*a + 7*x + a*x = 0
Move free summands (without x)
from left part to right part, we given:
$$a x + 6 a + 7 x = -42$$
Move the summands with the other variables
from left part to right part, we given:
$$a x + 7 x = \left(-6\right) a - 42$$
Divide both parts of the equation by (7*x + a*x)/x
x = -42 - 6*a / ((7*x + a*x)/x)
We get the answer: x = -6