3p^2 - 7p -40
Factor -7 out of -7p and rewrite -7 as -15 +8:
3p^2 +(-15 +8)p -40
Apply distributive property:
3p^2 -15p +8p -40
Group the first two terms and the last two terms:
(3p^2 -15p) + (8p-40)
Factor out the GCF from each group:
3p(p-5) + 8(p-5)
Factor the polynomial by factoring out the GCF (p-5)
(p-5)(3p+8)