Answer
(q + p + 3)(q - p + 3)
Work Step by Step
$q^2$ + 6q + 9 - $p^2$
= $q^2$ + 2 * 3 * q + $3^2$ - $p^2$
Now, $a^2$ + 2 * a * b + $b^2$ = $(a + b)^2$
and a = q , b = 3
Which implies,
= $(q+3)^2$ - $p^2$
Now, $a^2$ - $b^2$ = (a+b)(a-b)
and a = q+3, b = p
Which implies,
= ((q+3) + p)((q+3) - p)
= (q + p + 3)(q - p + 3)
which is the answer