Polar decomposition of a general matrix How can I calculate the polar decomposition for a general matrix? For example for this simple one:
$$
    \begin{pmatrix}
    a & -b  \\
    b & a  \\
    \end{pmatrix}
$$
I know how to calculate it for a matrix with numbers, via eigenvalues, eigenvectors. I have been searching for the answer on the internet for a while but I don't fully understand it.
 A: So first let $A = \begin{pmatrix}a&-b\\b&a\end{pmatrix}=QS$.
Then, we have $A^{T}A=\begin{pmatrix}a&b\\-b&a\end{pmatrix}\begin{pmatrix}a&-b\\b&a\end{pmatrix}=\begin{pmatrix}a^2+b^2&0\\0&a^2+b^2\end{pmatrix}$.
The Eigenvalue(s) of this matrix is $a^2+b^2$, sometimes they're different but not too hard to handle.
The Eigenvectors are $\begin{pmatrix}1\\0 \end{pmatrix}$ and $\begin{pmatrix}0\\1 \end{pmatrix}$.
So then we can write $A^TA=\begin{pmatrix}1&0\\0&1\end{pmatrix}\begin{pmatrix}a^2+b^2&0\\0&a^2+b^2\end{pmatrix}\begin{pmatrix}1&0\\0&1\end{pmatrix}^{-1}$.
The first factor is just the Eigenvectors, the second is a diagonal matrix consisting of each of the corresponding eigenvalues, and the third is the inverse of the first.
We now define a second matrix $S=\begin{pmatrix}1&0\\0&1\end{pmatrix}\begin{pmatrix}\sqrt{a^2+b^2}&0\\0&\sqrt{a^2+b^2}\end{pmatrix}\begin{pmatrix}1&0\\0&1\end{pmatrix}^{-1}$.
The only difference here is that $S$ is constructed using the singular values, which are basically the square roots of the eigenvalues.
We have that $S=\begin{pmatrix}\sqrt{a^2+b^2}&0\\0&\sqrt{a^2+b^2}\end{pmatrix}$.
We also have that $Q=AS^{-1}= \begin{pmatrix}a&-b\\b&a\end{pmatrix}\begin{pmatrix}\sqrt{a^2+b^2}&0\\0&\sqrt{a^2+b^2}\end{pmatrix}^{-1}=\begin{pmatrix}\frac{a}{\sqrt{a^2+b^2}}&-\frac{b}{\sqrt{a^2+b^2}}\\\frac{b}{\sqrt{a^2+b^2}}&\frac{a}{\sqrt{a^2+b^2}}\end{pmatrix}$.
So finally, we have the polar decomposition: $\begin{pmatrix}a&-b\\b&a\end{pmatrix}=\begin{pmatrix}\frac{a}{\sqrt{a^2+b^2}}&-\frac{b}{\sqrt{a^2+b^2}}\\\frac{b}{\sqrt{a^2+b^2}}&\frac{a}{\sqrt{a^2+b^2}}\end{pmatrix}\begin{pmatrix}\sqrt{a^2+b^2}&0\\0&\sqrt{a^2+b^2}\end{pmatrix}$
A: Presumably, $A$ is invertible (otherwise, it would be the zero matrix). I'll also assume that $A$ has real entries (if not, change all occurrences of $A^T$ to $A^*$). I'm not going to discuss the proof of the polar decomposition, but consulting the proof will tell you that the matrices I give are the correct ones, and that they have the desired properties (you can check this without too much work).
We want to find the factorization $A=UP,$ where $U$ is orthogonal (unitary) and $P$ is positive semi-definite and symmetric (Hermitian). Compute $(A^TA)^{1/2},$ and set this to be $P$. Then, simply define $U$ by $U=AP^{-1}.$ Let's talk about finding the square root. Since $A$ is invertible, $A^TA$ is positive definite, so we can define the square root (all of the eigenvalues are positive; note that only positive semi-definiteness is needed). So, we can diagonalize $A^TA,$ getting the eigendecomposition $A^TA=S\Lambda S^{-1}.$ Now, the square root is defined as $(A^TA)^{1/2}=S\Lambda^{1/2}S^{-1}$, where $\Lambda^{1/2}=\text{diag}\left(\sqrt{\lambda_j}\right).$ 
So, here are the steps:


*

*Get an eigendecomposition of $A^TA$.

*Find the square root of $A^TA$, and define this to be $P$.

*Set $U=AP^{-1}.$
This gives us our decomposition $A=UP.$ We can do this for a matrix of your form, and I encourage you to follow these steps and see what you get. We don't need "numbers," as it's simple enough for a $2\times 2$.
A: Other answers describe a fairly standard method of finding the polar decomposition of an invertible matrix $M$ by diagonalizing $M^*M$. More generally, both polar decompositions of a matrix can be computed directly from its SVD: For a square matrix $M$, we have $A=U\Sigma V^*$, with $\Sigma$ diagonal and positive-semidefinite, while $U$ and $V$ are unitary (orthogonal if $M$ is real). To obtain polar decompositions from this, simply insert another pair of $U$’s or $V$’s: $$M = (U\Sigma U^*)(UV^*) = (UV^*)(V\Sigma V^*).$$ 
Note that for matrices of the specific form in your question, the polar decomposition can easily be determined from geometric considerations. Assuming that we’re talking about real matrices, these matrices are isomorphic to the complex numbers: the matrix $M=\small{\begin{bmatrix}a&-b\\b&a\end{bmatrix}}$ corresponds to $z=a+bi=re^{i\theta}$. The polar decomposition of a $2\times2$ real matrix factors it into a scaling along a pair of orthogonal directions followed by a rotation. Multiplication by $z$ is a combination of uniform scaling by $r=\sqrt{a^2+b^2}$ and a rotation through $\theta$, so we can immediately factor $M$ into $$\left(\frac1{\sqrt{a^2+b^2}}M\right)  \begin{bmatrix}\sqrt{a^2+b^2}&0\\0&\sqrt{a^2+b^2}\end{bmatrix}.$$ Indeed, the polar decomposition of $M$ here is a direct analog of the decomposition of $a+bi$ into the product of the nonnegative real number $r$ and the unit complex number $e^{i\theta}$.
