Answer
$x=4.8$
Work Step by Step
Consider the expression: $(x+2)(x+1)=40$
or, $x^2+3x+2=40$
or, $x^2+3x=40-2=38$
Compare it with the standard form of quadratic equation $ax^2+bx+c$, we have $a=1, b=3$
To complete the square, add $\frac{9}{4}$ on both sides.
$x^2+3x+\frac{9}{4}=38+\frac{9}{4}$
$(x+\frac{3}{2})^2=\frac{161}{4}$
$\implies (x+1.5)=6.3$
Neglect negative term, we get
$x=4.8$