We know that (x+a)2=x2+2ax+a2. Since your equation starts with x2−4x, it means that we must find a value of a such that 2ax=−4x, which means a=−2.
If a=−2, then we have (x−2)2=x2−4x+4. You can see that your equation x2−4x+2 is very close: we only need to add 2.
So, adding 2 to both sides, we get x2−4x+4=2, which means
(x−2)2=2. Extracting square roots at both sides, we get x−2=±√2, which leads us to the solutions
x1,2=2±√2