I'm trying to understand a solution to a PDE problem, and it involves reducing an expression by completing the square. I'm not sure how to go about the steps.
The expression is: $$-x^2+2xy-y^2+4kty$$ which becomes: $$-x^2+2(x+2kt)y-y^2$$ and finally $$-(y-2kt-x)^2+4ktx+4k^2t^2$$
Can someone show me how to arrive to this simplification?
$$-x^2+2(x+2kt)y-y^2$$ $$=-x^2-4k^2t^2-4ktx+2(x+2kt)y-y^2+4k^2t^2+4ktx$$ $$=-(x+2kt)^2+2(x+2kt)y-y^2+4k^2t^2+4ktx$$ $$=-[(x+2kt)^2-2(x+2kt)y+y^2]+4k^2t^2+4ktx$$ $$=-[y^2-2(x+2kt)y+(x+2kt)^2]+4k^2t^2+4ktx$$ $$=-[y-(x+2kt)]^2+4k^2t^2+4ktx$$ $$=-[y-x-2kt]^2+4k^2t^2+4ktx$$ $$=-(y-2kt-x)^2+4ktx+4k^2t^2$$
Hope this is clear enough to clear your doubts.