Finding a matrix using diagonalization I am working on a problem and I am little bit stuck. Useful hints will be appreciated greatly. 

I want to find a matrix $A$ such that $$A^TA =X,$$ where $$ X=
  \left[ {\begin{array}{cc}
   0 & 1\ \\1 &0
     \end{array} } \right].$$ 

The professor gave us a hint that I should diagonalise the matrix X to obtain a diagonal matrix D where $X= P^{-1}XD$ and find a matrix B such that $$B^TB =D.$$He said that once I find matrix B, I can use the matrix $B$ and $P$ to obtain the matrix A.
Here is my approach. I diagonalized $X$ and obtained my matrix D to be $$D=\left[ {\begin{array}{cc}
   1 & 0\ \\0 &-1
     \end{array} } \right].
$$ I also got the matrix $P$ to be $$P=\left[ {\begin{array}{cc}
   1 & -1\ \\1 &1
     \end{array} } \right].
$$ Now I need to figure out matrix B such that $B^TB=D$. Suppose that $$B= \left[ {\begin{array}{cc}
   a & b\ \\c &d
     \end{array} } \right],$$ where $a,b,c,d \in \mathbb{C}$.
I obtained the following equations from $B^TB=D$ that $$a^2 + c^2 =1$$
$$b^2 + d^2 =1$$
$$ab+cd=0.$$ I am having troubles solving this system of equations. I am stuck here at the moment.
 A: If the solution is supposed to be in $\mathbb{R}^{2\times 2}$, you are in trouble, because $A^TA$ is positive-semidefinite, while $X$ is not. If the solution is supposed to be in $\mathbb{C}^{2\times 2}$, choose $$B=\begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix}$$
A: The equations can be solved as follows. For $c=0$ we have $a=\pm 1$ and $ab=0$, hence $b=0$. This gives $a^2=d^2=1$. Hence $B=\pm I$. Otherwise we can write $d=-ab/c$ and substitute this into the first two equations. We obtain
$$
a^2(1+a^2+c^2)=0.
$$
Now $1+a^2+c^2>0$ for real $a,c$ hence $a^2=0$, so that $a=d=0$. For complex $a,c$ this does not hold.
A: We have $X=\left[\array{0&1\\1&0}\right] $ is symmetric matrix then we can write $X$ by the form $X=PDP^{-1}$; $P^{-1}$  orthogonal matrix (i.e. $P^{-1}=P^T$) then $X=PDP^T$. We have $P=\left[\array{\frac{1}{\sqrt2}&\frac{-1}{\sqrt2}\\\frac{1}{\sqrt2}&\frac{1}{\sqrt2}}\right] , D=\left[\array{1&0\\0&-1}\right] $
we have $D$ is diagonal Matrix, $BB^T$ is always symmetric matrix and equal  $D$ then $B=\left[\array{a&0\\0&d}\right]$ then $D=B B^T\Rightarrow \left[\array{1&0\\0&-1}\right]=\left[\array{a&0\\0&d}\right]\left[\array{a&0\\0&d}\right]=\left[\array{a^2&0\\0&d^2}\right] $ then $a^2=1,d^2=-1\Rightarrow a=±1,d=±i$ then $B=\left[\array{-1&0\\0&i}\right]$ or $B=\left[\array{+1&0\\0&i}\right]$ or $B=\left[\array{-1&0\\0&-i}\right]$ or $B=\left[\array{+1&0\\0&-i}\right]$
finally: $X=PDP^T=PBB^TP^T=PB(PB)^T=A^TA$ where $A=(PB)^T=\left[\array{\frac{1}{\sqrt2}&\frac{1}{\sqrt2}\\\frac{-i}{\sqrt2}&\frac{i}{\sqrt2}}\right]$ in case $B=\left[\array{-1&0\\0&i}\right]$. Other cases in same way.
A: More generally, suppose $X$ is a symmetric real $n\times n$ matrix. If $X=A^TA$, for some square real matrix $A$, then, for any real $n\times 1$ vector $v$,
$$
v^TXv=v^TA^TAv=(Av)^T(Av)\ge0
$$
Since, in your case
$$
\begin{bmatrix}-1 & 1\end{bmatrix}
\begin{bmatrix}0&1 \\ 1&0\end{bmatrix}
\begin{bmatrix}-1 \\ 1\end{bmatrix}=
\begin{bmatrix}-1 & 1\end{bmatrix}
\begin{bmatrix}1 \\ -1\end{bmatrix}=-2
$$
the matrix $A$ you're looking for cannot be real.
Suppose $A$ is the required matrix:
$$
A^TA=
\begin{bmatrix}a & c \\b & d\end{bmatrix}
\begin{bmatrix}a & b \\c & d\end{bmatrix}=
\begin{bmatrix}a^2+c^2 & ab+cd \\ab+cd & b^2+d^2\end{bmatrix}
$$
gives
\begin{cases}
a^2+c^2=0\\
b^2+d^2=0\\
ab+cd=1
\end{cases}
Thus $c=hai$ and $d=kib$ (where $h$ and $k$ are either $1$ or $-1$), so
$$
ab-hkab=1
$$
Thus we see that we must take $1-hk\ne0$, so $h=1$ and $k=-1$ (or the converse). Take $a=1$, $b=1/2$, $c=i$, $d=-i/2$.
