Given #2x^2+8x#

Extract the coefficient of #x^2# as a factor

#color(white)("XXXX")##=(2)(x^2+4x)#

Half of the coefficient of #x# is #1/2xx4 = 2#

So the square of half the coefficient of #x# is #2^2 = 4#

Add (and subtract) the square of half the coefficient of #x#

#color(white)("XXXX")##= (2)(x^2+4x+2^2 -4)#

Which could be written as

#color(white)("XXXX")##=(2)((x+2)^2 -4)#

In case you were wondering "why the square of half the coefficient of #x#?)

#color(white)("XXXX")#We are trying for a squared binomial of the form #(x+a)^2#

#color(white)("XXXX")#Since

#color(white)("XXXX")##color(white)("XXXX")##(x+a)^2 = x^2+2ax+a^2#

#color(white)("XXXX")#Given the first 2 terms in the form:

#color(white)("XXXX")##color(white)("XXXX")##x^2+d#

#color(white)("XXXX")##color(white)("XXXX")##color(white)("XXXX")#(#d=2a#)

#color(white)("XXXX")#We need to add #(d/2)^2# to get a "squared form"