Finding minimum point of a function using linear algebra Given a function $$q(x,y)=2x^2-2xy +2y^2$$.
Find the minimum point of the following function by first converting it to a matrix form and using the diagonalisation of the matrix to find its minimum point. (I know its easy just by using the usual method. But the point is that i want to learn how to use linear algebra using this question as an example.)  
What i did was to express the function in matrix form $A$. 
              $$A=\begin{pmatrix}2&-1\\-1&2
\end{pmatrix}.$$
Then using the diagonalisation formula in linear algebra  where $$D=P^TAP$$  I find the eigenvector of A which is  
$$P=\begin{pmatrix}1&-1\\1&1
\end{pmatrix}.$$
and do a matrix multiplication to find D. Im stuck at this
From this point onwards.
I know that after finding D,
$$q(x,y)=x^TAx=x^TPDP^Tx=(P^Tx)^TDP^Tx=x'^TDx'^T$$
And i need to change it to a rotated coordinate system x'y' but how exactly to go about doing it from here. I know that after the rotation the expression becomes $$x^2+3y^2$$. But how to get there? Could anyone explain
 A: First you define as you do a new variable:
$$x'=P^T x$$
In the new coordinate system you have:
$$q(x')=x'^TDx'=\begin{pmatrix}x' & y'\end{pmatrix}\begin{pmatrix}d_1&0\\0&d_2
\end{pmatrix}\begin{pmatrix}x'\\y'
\end{pmatrix}=d_1x'^2+d_2y'^2$$
If $d_1$ and $d_2$ are positive the minimum is when $(x' y')=(0,0)$ therefore you have to solve when $P^Tx=0$
A: For the formulas you apply to work, $P$ must be the matrix of a rotation  $$P^T=P^{-1}; P=\frac{\sqrt2}{2}\begin{bmatrix}1 &-1 \\1 & 1\end{bmatrix} $$
We are then in a new basis of $\mathbb{R}^2$ formed of two eigenvectors corresponding to the eigenvalues ​​$1$ and $3$ obtained by seeking the roots of the polynomial $p(\lambda)$ characteristic of $A$ , $p(\lambda)=\begin{vmatrix}2-\lambda & -1 \\-1 & 2-\lambda\end{vmatrix}=(\lambda-1)(\lambda-3)$. I choose as a basis $\{(\frac{\sqrt2}{2}(1,1);\frac{\sqrt2}{2}(1,-1)\}$. So, writing $X$ for $\begin{bmatrix}x \\y\end{bmatrix}$(coordinates in the old basis)
, and X' for $\begin{bmatrix}x' \\y'\end{bmatrix}$(coordinates in the new basis):
$X=PX'; X^TAX=(PX')^TAPX'=X'^TP^TAPX'=X'^TP^{-1}APX'=X'^T\begin{bmatrix}1 & 0 \\0 & 3\end{bmatrix}X'=x'^2+3y'^2$
All this is technical but is fortunately interpreted on the following graph:
