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.

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}$$
