We have,
p2 + 6p + 8
Coefficient of p2 is unity. So, we add and subtract square of half of coefficient of p.
p2 + 6p + 8 = p2 + 6p + 32 – 32 + 8 (Adding and subtracting 32)
= (p + 3)2 – 12 (By completing the square)
By using the formula (a2 – b2) = (a+b) (a-b)
= (p + 3 – 1) (p + 3 + 1)
= (p + 2) (p + 4)