How to deal with translations, with change of coordinates for Quadratic Forms: $x^TAx=k$ ?

When working with a change of coordinates using

$x^TAx=k$

how and when do we deal with translations? I'm comfortable with setting up the formula $x^TAx$ where A is the matrix whose diagonal entries are the coefficients of (say in $R^2$) x and y and whose other entries correspond to half of the $xy$ term in said equation. Then finding eigenvectors that translate our coordinate system and sketching our graph from there. What I'm struggling with is say we have:

$x^2 - 2xy + y^2 + 6x - 4 = 0$

I know that if I were to say, complete the square I would have something that looks like:

$(x+3)^2 - 2xy + y^2 = 13$

Do I then just move forward and still build my matrix A as \begin{align} A = \begin{pmatrix} 1 & -1 \\ -1 & 1 \\ \end{pmatrix} \end{align}

Or do I need to account for the shift when building this matrix? Again, I'm comfortable with the math up until dealing with the translation. Do I complete the process of sketching the graph and then account for my translation or does the translation play a role throughout the process?

-
When in doubt, give things names. For example, let $w = x+3$. Then your equation becomes $w^2 - 2(w-3)y + y^2 = 13$, or $w^2 - 2wy + y^2 + 6y = 13$. Now you can see that you haven't got very far from the original equation; you've just traded a $6x$ for a $6y$. – Rahul Dec 12 '12 at 1:24

You should complete the square the "matrix" way: $$x^2 - 2xy + y^2 + 6x - 4 = [x,y]\begin{bmatrix}1&-1\\-1&1\end{bmatrix}\begin{bmatrix}x\\ y\end{bmatrix} + [6,0]\begin{bmatrix}x\\ y\end{bmatrix} + 4.$$ In general, for a quadratic form $\mathbf{x}^TA\mathbf{x}+2\mathbf{b}^T\mathbf{x}+c$ where $A$ is symmetric, if $\mathbf{b}=A\mathbf{u}$ for some vector $\mathbf{u}$, then we can kill the linear term by a translation because $$\mathbf{x}^TA\mathbf{x}+2\mathbf{b}^T\mathbf{x}+c \ =\ \mathbf{x}^TA\mathbf{x}+2\mathbf{u}^TA\mathbf{x}+c \ =\ (\mathbf{x}+\mathbf{u})^TA(\mathbf{x}+\mathbf{u})+\left(c-u^TAu\right).$$ Now, since $(6,0)^T$ does not reside in the column space of $A=\begin{bmatrix}1&-1\\-1&1\end{bmatrix}$, there is no way to kill all the linear terms, no matter what translation you apply.

-
Great answer! While implementing this in code i noticed that the constant term should be $(c-\mathbf{u}^T A \mathbf{u})$ though. – Thies Heidecke May 22 '13 at 9:39
@ThiesHeidecke Yes, thanks for catching that mistake. – user1551 May 22 '13 at 11:07

If you center your $(p,q)$ coordinates at $\left(\frac{7}{24}, \frac{43}{24} \right)$ and rotate $135^\circ,$ so

$$x = \frac{7}{24} - \frac{p}{\sqrt 2} - \frac{q}{\sqrt 2},$$

$$y = \frac{43}{24} + \frac{p}{\sqrt 2} - \frac{q}{\sqrt 2},$$

you see the evident parabola in

$$q = \left(\frac{\sqrt 2}{3} \right) \, p^2.$$

It is not that difficult to check this, as your original equation is $$(y-x)^2 + 6 x - 4 = 0$$ and $y-x$ is not so bad in terms of $p,q.$

-