TITLE: Finding a matrix $Q \in \mathbb{R}^{d\times r}$ such that $Q^\top Q=I_r$ and $(QQ^\top)_{ii}=h_{ii}$
QUESTION [6 upvotes]: Given $\{h_{ii}\}_{i=1}^d$, where $h_{ii}\in[0,1],$ and $\displaystyle\sum_{i=1}^d h_{ii}=r<d,$ does there exist a matrix $Q\in\mathbb{R}^{d\times r},$ s.t. 
$$Q^\top Q=I_r, \qquad (QQ^\top)_{ii}=h_{ii}?$$

REPLY [4 votes]: (For convenience, I write $h_i$ instead of $h_{ii}$.)
You may start with $Q=\pmatrix{I_r\\ 0}$. The idea is to fix the diagonal entries of $QQ^T$ one by one, by applying Givens rotations to $Q$ recursively. More specifically, suppose at some stage, we have $Q^TQ=I_r$ and
$$
QQ^T=\left[\begin{array}{c|c}P&\ast
\\ \hline\ast&\begin{matrix}q_{k+1}\\ &\ddots\\ &&q_d\end{matrix}
\end{array}\right],\tag{$\dagger$}
$$
where the diagonal entries of $P$ are members of $\{h_1,\ldots,h_d\}$. By relabelling the $h_i$s if necessary, we may assume that it is $(h_1,\ldots,h_k)$. We also suppose that the bottom right subblock of $QQ^T$ in $(1)$ is a diagonal matrix $\operatorname{diag}(q_{k+1},\ldots,q_d)$ such that

$\sum_{i=k+1}^dh_i=\sum_{i=k+1}^dq_i$,
$q_{k+1}\ge\cdots\ge q_s>h_{k+1}\ge\cdots\ge h_d>q_{s+1}\ge\cdots\ge q_d$ for some $s$.

Now, note that
\begin{align}
&\pmatrix{\cos t&-\sin t\\ \sin t&\cos t}
\pmatrix{q_s\\ &q_{s+1}}
\pmatrix{\cos t&\sin t\\ -\sin t&\cos t}\\
=&\pmatrix{q_s\cos^2 t+q_{s+1}\sin^2 t&\ast\\ \ast&q_s\sin^2 t+q_{s+1}\cos^2 t},
\end{align}
Therefore, by applying an appropriate Givens rotation $R$ to the $s$-th and $(s+1)$-th rows of $Q$, we may turn one of the $s$-th or $(s+1)$-th diagonal entries of $(RQ)(RQ)^T$ into any desired convex combination of $q_s$ and $q_{s+1}$. In particular,

if $q_s-h_{k+1}<h_d-q_{s+1}$, let us make the $s$-th diagonal entry of $(RQ)(RQ)^T$ becomes $h_{k+1}$;
if $q_s-h_{k+1}\ge h_d-q_{s+1}$ instead, let us make the $(s+1)$-th diagonal entry of $(RQ)(RQ)^T$ equal to $h_d$.

Note that the entries in $P$ are unaffected and we still have $(RQ)^T(RQ)=Q^TQ=I_r$. Perform a further permutation to move the newly set diagonal entry to position $(k+1,k+1)$. If the other diagonal entry involved in the rotational transform also equals to some $h_i$, perform one more permutation to move that diagonal entry to the $(k+2,k+2)$-th position. The resulting matrix is still of the form $(\dagger)$ (but $k$ is now incremented by $1$ or $2$), with the bottom right subblock remains diagonal. More importantly, since the trace is preserved and due to the way we set the new $(k+1)$-th diagonal entry, conditions 1 and 2 in the above are also satisfied in the resulting matrix.
So, we have reduced the dimension of the problem by $1$ or $2$. Proceed recursively, we can construct a matrix $Q$ with orthonormal columns so that the diagonal of $QQ^T$ is a permutation of $(h_1,\ldots,h_d)$. Now, apply a final permutation to the rows of $Q$ so that the diagonal of $QQ^T$ is exactly $(h_1,\ldots,h_d)$.