Condition for the solvability of a linear system

I have a linear system such that:

$$\mathbf{y}=\mathbf{A}\mathbf{X}\mathbf{y}$$

It is easy to understand that if $$\mathbf{X}$$ is arbitrary, i.e. it has the structure: $$\mathbf{X}=\begin{bmatrix}x_1&x_2\\x_3&x_4\\x_5&x_6\\x_7&x_8\end{bmatrix}$$

The system is solvable if $$\mathbf{y}$$ belongs to the column-space of $$\mathbf{A}$$. So I verify that according to Rouchè-Capelli theorem:

$$rank(\mathbf{A})=rank([\mathbf{A} | \mathbf{y}])$$

Now, I am confused, in the case $$\mathbf{X}$$ has the prescribed structure: $$\mathbf{X}=\begin{bmatrix}x_1&0\\0&x_2\\x_3&0\\0&x_4\end{bmatrix}$$

which is the condition for the system being solvable? I am looking for something similar to the first case of matrix $$\mathbf{X}$$.

Note: $$\mathbf{A}$$ has 2 rows and 4 columns while $$\mathbf{y}$$ has 2 rows and 1 column and $$\mathbf{X}$$ is my unknown so I can't use its entries in the computation of such condition.

First note that $$(I-AX)y = 0$$. So, either $$AX=I$$ or $$AX = yy^T / (y^T y)$$. In the prescribed structure case $$AX = [a_1 x_1 + a_3 x_3 ~~~~ a_2 x_2 + a_4 x_4]$$ where $$a_i$$ are the columns of $$A$$. So a solution exists if and only if
$$\left( [1 ~~ 0]^T \in \operatorname{Im} A_{13} ~~\text{and}~~ [0 ~~ 1]^T \in \operatorname{Im} A_{24} \right) ~~\text{or}~~ \left( y \in \operatorname{Im} A_{13} ~~\text{and}~~ y \in \operatorname{Im} A_{24} \right)$$
where $$A_{13} := [a_1 ~~ a_3]$$ and $$A_{24} := [a_2 ~~ a_4]$$.
• This is because we need to find $X$ such that $AX=I$ or $AX=yy^T/(y^Ty)$. Looking at the structure of $AX$ we can see that this is only possible with the given condition. Because the first column of $AX$ can be selected any point on the span of vectors $a_1$, $a_3$. Similarly, the second column. Commented Nov 1, 2021 at 10:49