-8 x^2 + x^4 + 8 y^2 + 2 x^2 y^2 + y^4 == (x^2 + y^2)^2 - 8 (x^2 - y^2)
How to complete the square simultaneously in x and y for the left-hand expression to get the right-hand form?
This replacement rule works:
pol = -8 x^2 + x^4 + 8 y^2 + 2 x^2 y^2 + y^4; repl = a_.*x^4 + b_.*x^2 y^2 :> a (x^2 + b/(2 a)*y^2)^2 - a (b/(2 a)*y^2)^2; pol /. repl
You give one possible result, and it only has pure powers inside the squares. Is there some reason for to disallow cross-terms such as x*y inside the squares?
I thought that this would work, but, sadly, it doesn't:
pol = -8 x^2 + x^4 + 8 y^2 + 2 x^2 y^2 + y^4; FullSimplify[pol, ComplexityFunction -> Count[_^4]]