Q:

Finding a Cartesian coordinate transformation matrix

I have a vector, $u := [u_1, \ldots, u_n]^\mathrm{T}$. I am trying to find a coordinate transformation matrix, $Q \in \mathbb{R}^{n \times n}$, which is nonsingular, satisfying:
\begin{align*}
\begin{bmatrix} 0 \\ \vdots \\ 0 \\ ||u|| \end{bmatrix} = Q u.
\end{align*}
I would appreciate any idea to find this matrix, $Q$.

A:

Recall that if $W$ is a subespace of $\mathbb{R}^{n}$, then
$$\dim(W)+\dim(W^{\perp})=n$$
Take $W$ as the span of $u$, so
$$\dim(<u>)=n-1.$$
You can construct a matrix $Q$ that will satisfy the same condition taking any set of $n-1$ vectors $v_i$ from any basis of the ortogonal complement of the span of $u$.
$$Q=\left(\begin{array}{cccc}
v_{11}&v_{12}&\cdots&v_{1n}\\
v_{21}&v_{22}&\cdots &v_{2n}\\
v_{31}&v_{32}&\cdots&v_{3n}\\
\vdots&\vdots&\vdots&\vdots\\
v_{n-1,1}&v_{n-1,2}&\cdots&v_{n-1,n}\\
\displaystyle{\frac{u_1}{\vert\vert{u}\vert\vert}}&\displaystyle{\frac{u_2}{\vert\vert{u}\vert\vert}}&\cdots&\displaystyle{\frac{u_n}{\vert\vert{u}\vert\vert}}\\
\end{array}\right)$$
where $v_{i}=(v_{i1},\ldots,v_{in})^{T}$ are vectors in a basis $\{v_{1},\ldots,v_{n-1}\}$ of the ortogonal complement of the linear span of $u$, for all $i$ with $1\leq i\leq n-1$. 

Remark: This matrix $Q$ is non singular because it's rows are linearly independent because the following set is a basis of $\mathbb{R}^{n}$:
  $$\mathcal{B}=\{u,v_1,\ldots,v_{n-1}\}$$
Also: You can use Gram Schmidt process to get an ortogonal basis of $<u>^{\perp}$ starting from $u$. In this way you will find the rights vectors $v_i$ such that $Q$ is inversible.

