Least squares with variants Find $\mathbf X$ and $\mathbf Y$ such that the two equations hold
$$
(\mathbf X^t\mathbf X)^{-1}\mathbf X^t \mathbf Y=A
$$
$$
(\mathbf X^t\mathbf X)^{-1}=B
$$
$\mathbf{X}$ is an $n\times p$ matrix and $\mathbf{Y}$ is vector of length $n$

I assume the first equation is $(X^tX)^{-1}X^tY = A$, otherwise the matrix multiplication is not defined if $p < n$.
I assume I have been given a $p \times p$ matrix B and a $p \times 1$ vector $A$ and a $n > p$ and I have to construct a $n \times p$ matrix $X$ and a $n \times 1$ vector $Y$ satisfying the two given equations. 
Clearly if $B$ is not positive definite the second equation does not have any solution. So assume $B$ is positive definite.
$B^{-1}$ also must be positive definite. Let $B^{-1/2}$ be the $p \times p$ symmetric square root of $B^{-1}$. Let $X = \begin{pmatrix} B^{-1/2} \\ \mathbf{0} \end{pmatrix}$ where $\mathbf{0}$ is a $(n-p) \times p$ matrix of all zeroes.
By construction $X^tX=B^{-1}$ and $(X^tX)^{-1} = B$. So this $X$ satisfies the second equation. 
Having determined $X$ choose $Y=XA$, it is easy to see for this choice of $Y$ we have $(X^tX)^{-1}X^tY=(X^tX)^{-1}X^tXA=A$.
