# How to transform the quadratic form of an ellipse to a circle

Consider the ellipse $x^TPx\le a$. I would like to transform (the quadratic form of) this ellipse into a circle $y^T\begin{pmatrix}1&0\\0&1\end{pmatrix}y\le b$ via a coordinate transform $x=Ty$. Where can I find more information about this procedure?

(This question was written in 2D but applies in general to nD.)

In the case of an ellipse, $P$ is a symmetric positive definite matrix and hence is orthogonally diagonalizable by the spectral theorem. Thus, there exists an orthogonal matrix $Q$ such that $P = QDQ^T$, where $D$ is the diagonal matrix of eigenvalues. Since all the eigenvalues of $P$ are positive you can further factorize $P$ as $QD^{1/2}D^{1/2}Q^T$. Substituting this expression into the equation for the ellipse you get that
$$x^TPx \leq a \iff y^TIy \leq a,$$
where $y = D^{1/2}Q^T x$.
Therefore, what you need to investigate is the eigendecomposition of a symmetric matrix and the spectral theorem for symmetric matrices. There are many resources online that go into detail on these topics and any introductory linear algebra textbook worth its salt should cover this material. If you need to compute such a decomposition there are many numerical linear algebra libraries with this capability. I suggest you have a look at LAPACK, which is the de facto standard for such computations. The book "Matrix Computations" by Golub and Van Loan is also an excellent resource, in fact, they have a whole chapter dedicated to the symmetric eigenvalue problem. Also, if you have access to Matlab, then you can use the $\texttt{eig}$ command to compute the eigendecomposition of a matrix.