x^2 + 5x + 4
list the factors of 4 1*4 and 2*2
which of the factors add up to 5 1 + 4 = 5
(x + 1)(x + 4)
x^2 - 7x + 10
list the factors of 10 1*10 and 2*5
which of these factors add up to 7 2 + 5 = 7
since it is -7 it will be -2 + -5 = -7
(x - 2)(x - 5)