Given
[tex]7 - px - x^2 = 16 - (q + x)^2[/tex]
expanding the right side gives
[tex]7 - px - x^2 = 16 - (q^2 + 2qx + x^2)[/tex]
[tex]7 - px - x^2 = 16 - q^2 - 2qx - x^2[/tex]
Two polynomials of equal degree are the same if their coefficients are identical. This means
[tex]\begin{cases}16 - q^2 = 7 \\ -2q = -p\end{cases}[/tex]
[tex]16 - q^2 = 7 \implies q^2 = 9 \implies q=\pm3[/tex]
[tex]-2q = -p \implies p = 2q = \pm6[/tex]
Both [tex]p[/tex] and [tex]q[/tex] are positive, so [tex]\boxed{p=6}[/tex] and [tex]\boxed{q=3}[/tex].