p^2-6p+5
To factor a quadratic of the form ax^2+bx+c you need to find two values, j and k, which satisfy two conditions:
jk=ac=5 and j+k=b=-6, so j and k must be -1 and -5
now replace bx with jx and kx in the original equation to get:
p^2-p-5p+5 and then factor 1st and 2nd pair of terms...
p(p-1)-5(p-1)
(p-5)(p-1)