please help me solve this maths factorisation!

This process is often called "completing the square". Recall that
[tex](a+b)^2 = a^2 + 2ab + b^2[/tex]
Let
[tex]x^2 + 4x - 8 = (x + p)^2 + q[/tex]
Expand the right side to get
[tex]x^2 + 4x - 8 = x^2 + 2px + p^2 + q[/tex]
Then
[tex]\begin{cases}2p = 4 \\ p^2 + q = -8\end{cases} \implies \boxed{p = 2 \text{ and } q=-12}[/tex]
More generally, we can use this method rewrite a generic quadratic as
[tex]ax^2 + bx + c = a \left(x + \dfrac b{2a}\right)^2 - \dfrac{b^2}{4a} + c[/tex]