x^2-18x-40=0

You need to look for factors of -40 that will add to -18. Can you do that?