So you want to find two numbers that add up to -13 and multiply to 40. You can find the factors of 40 and find the pair that adds up to -13. -8 and -5 multiply to 40 and add up to -13.
(x−5)(x−8)=x2−13x+40
You can use foil to test it
x2+(−8x)+(−5x)+40=x2−13x+40
x2−13x+40=x2−13x+