Extract the obvious constant factor of #2#

#color(white)("XXX")color(green)(2)color(orange)((x^2+4x+2))#

Factor the second term using the quadratic formula for roots

#color(white)("XXX")r=(-b+-sqrt(b^2-4ac))/(2a)#

In this case:

#color(white)("XXX")r=(-4+-sqrt(4^2-4(1)(2)))/(2(1))#

#color(white)("XXX")= (-4+-sqrt(8))/2#

#color(white)("XXX")=-2+-sqrt(2)#

If #r# is a root then #(x-r)# is a factor

So

#color(white)("XXX")color(orange)((x^2+4x+2))#

factors as

#color(white)("XXX")=color(red)((x+2+sqrt(2)))color(blue)((x+2-sqrt(2)))#

Giving the final factoring:

#color(white)("XXX")2x^2+8x+4#

#color(white)("XXX")=color(green)(2)color(red)((x+2+sqrt(2)))color(blue)((x+2-sqrt(2)))#