Show which matrices are upper triangular orthogonal in $\mathbb R$. 
Show which matrices are upper triangular orthogonal in $\mathbb R$.

I've tried written the matrix product $Q^T Q$ and I get the following equations:
$x_{1,1}^2 = 1$
$x_{2,1}^2 + x_{2,2}^2 = 1$
...
$x_{n,1}^2 + \ldots + x_{n,n}^2 = 1$
I also get equations that must be equal to zero for $Q^TQ = I_n$ to be a reality. There must be a smarter way of deciding these matrices ?
 A: Suppose that $Q$ is a triangular matix, but then $Q^{-1}$ is also triangular of the same kind, combining this with the fact that $Q^{-1}=Q^T$ we conclude that $Q$ must be upper and lower triangular at the same time, that is $Q$ must be diagonal. 
$$Q=\hbox{diag}(\lambda_1,\ldots,\lambda_n)$$
and the condition $Q^TQ=I$ becomes $\lambda_k\in\{-1,1\}$ for $k=1,\ldots,n$.
So, there are $2^n$ such matrices in total.
A: Suppose 
$$
M = [v_1\,\,v_2\,\,\ldots\,\,v_n]
$$
is an $n\times n$ upper triangular matrix, so $v_1,\ldots,v_n\in\mathbb{R}^n$. Then $v_i \cdot v_j = 0$ for $i\neq j$. Note that $v_1$ is of the form $(a,0,\ldots,0)^T$ for $a\in\mathbb{R}$, so $v_i\cdot v_1 = 0$ implies that $v_{i,1} = 0$ for $i\neq 1$. It follows that $v_2$ is of the form $(0,a,0,\ldots,0)^T$ for a certain $a\in\mathbb{R}$, from which we see that all $v_i$ have a zero at their second spot for $i\neq 2$, that is $v_{i,2}=0$. By proceding inductively we see that $M$ must be diagonal. Now $v_i\cdot v_i = 1$, so all the diagonal elements are in $\{-1,1\}$. It follows that there are $2^n$ different upper triangular orthogonal matrices. All possible combinations of ones and minus ones on the diagonal.
