TITLE: Normalizing a matrix
QUESTION [5 upvotes]: I came across a step in an numerical algebra algorithm that says "Normalize the rows of matrix A such that they are unit-norm. Call U the normalized matrix."
I do something like this:
for i=1:no_of_rows
 U(i,:)= A(i,:)./ norm(A(i,:))
end

My question is what norm should I use? Will $2$ norm as below :
$$\|X\|_2=\sqrt{\sum_{k=1}^n|x_k|^2}$$
work here? Do I need to satisfy UU*=I ?

REPLY [3 votes]: Let's $X_j$ the $j$-row of matrix $X$. Then
$$
XX^\ast=(X_{ij})_{n\times n}(X_{ij})_{n\times n}^\ast=(\langle X_j X_j\rangle)_{n\times n}
$$
Note that 
\begin{align}
\| (X_{ij})_{n\times n} \|_F
=
&
\sqrt[2\,]{\mbox{trace}\left[  (X_{ij})_{n\times n}  (X_{ij})_{n\times n}^\ast\right]}
\\
=
&
\sqrt[2\,]{\mbox{trace}\left[  (X_{ij})_{n\times n}  (\overline{X_{ij}})_{n\times n}\right]}
\\
=
&
\sqrt[2\,]{\mbox{trace}\left[  \left(\sum_{k=1}^nX_{ik}\cdot \overline{X_{ik}}\right)_{n\times n}\,\right]}
\\
=
&
\sqrt[2\,]{\sum_{i=1}^n\sum_{k=1}^nX_{ik}\cdot \overline{X_{ik}}}
\\
=
&
\sqrt[2\,]{\sum_{i=1}^n\sum_{k=1}^n |X_{ik}|^2}
\\
=
&
\sqrt[2\,]{\sum_{i=1}^n\langle X_i,X_i\rangle}
\\
=
&
\sqrt[2\,]{\sum_{i=1}^n\| X_i\|^2}
\end{align}
Then $XX^\ast=I$ implies $\| X_i\|=1$ for all $i=1,\ldots, n$. But, the reciprocal not true. This is true if, only if, the rows of $X$ is a orthonormal basis of $\mathbb{R}^n$.