Suppose $A \in \mathbb{R}^{n \times n}$ is a positive semi-definite matrix. Can we solve the following for $x \in \mathbb{R}^n$?
\begin{equation} \begin{split} A(x-a) + \lambda_1 e_i+\lambda_2e_j&=0\\ e_ix&=0,\,\,\,\text{or }(x_i=0)\\ e_jx&=0,\,\,\,\text{or }(x_j=0) \end{split} \end{equation} where $\lambda_1, \lambda_2 \in \mathbb{R}$, $a \in \mathbb{R}^n$, $e_i$ is the i-th column of the identity matrix, and $i,j$ are fixed and given indices as well as $a$. I have solved for the case where $e_i, e_j \in R(A)$ but cannot solve it when either one of $e_i$ or $e_j $ is not in $R(A)$ or both are not in range of $A$.
Proof for the case when $e_i, e_j \in R(A)$:
Since $e_i, e_j \in R(A)$, there exist $y_i, y_j$ such that $Ay_i=e_i$ and $Ay_j=e_j$. Let $b$ be in null space of A. Then, one can check the following is a solution:
$$ x=a -\lambda_1(y_i+b)-\lambda_2(y_j+b) $$
where $\lambda_1, \lambda_2$ are obtained form the following:
$$ \begin{bmatrix} e_{i_1}^T\\ e_{i_2}^T \end{bmatrix} \begin{bmatrix} y_1+b & y_2+b \end{bmatrix} \begin{bmatrix} \lambda_1\\ \lambda_2 \end{bmatrix} = \begin{bmatrix} a_{i}\\ a_j \end{bmatrix} $$
How can one solve for the following cases:
$e_i\in R(A)$ and $e_j\notin R(A)$ (or $e_i\notin R(A)$ and $e_j\in R(A)$)
$e_i, e_j\notin R(A)$
There are three cases depending on how large is the intersection $M:=R(A)\cap\mathrm{Span}(e_i,e_j)$.
Case 1. $\dim M=2$, i.e., $e_i,e_j\in R(A)$. This is covered by the asker.
Case 2. $\dim M=1$, i.e., there are $\alpha_i,\alpha_j\in\mathbb{R}$ and $y\in\mathbb{R}^n$, such that $$Ay=\alpha_ie_i+\alpha_je_j$$ Any other vector in $M$ is a multiple of this since $M$ is one-dimensional. Then the first condition is equivalent to $$\exists\lambda\in\mathbb{R},\quad A(x-a)=-\lambda Ay$$ $$\therefore\quad\exists b\in N(A),\quad x=a-\lambda y+b$$ Thus the required solution lies in $a+N(A)+\mathrm{Span}(y)$. The other two orthogonality conditions then imply $x=a-\lambda y+b\in e_i^\perp\cap e_j^\perp$. This is the intersection of a displaced subspace $a+N(A)+\mathrm{Span}(y)$ and an $(n-2)$-dimensional subspace $\mathrm{Span}(e_i,e_j)^\perp$. This intersection is empty if they are 'parallel', i.e. $$N(A)+\mathrm{Span}(y)\subseteq\mathrm{Span}(e_i,e_j)^\perp$$ $$\iff e_i,e_j\in(N(A)+\mathrm{Span}(y))^\perp$$ $$\iff e_i^TAz=0, e_i^Ty=0, e_j^TAz=0, e_j^Ty=0, \forall z$$ If this is not the case then there exist $b\in N(A)$, $\lambda\in\mathbb{R}$ such that $$0=e_i^Tx=e_i^T(a+b-\lambda y)$$ $$0=e_j^Tx=e_j^T(a+b-\lambda y)$$ These imply $\phi(a+b)=0$, where $\phi:=(e_j\cdot y)e_i^T-(e_i\cdot y)e_j^T$. So take any $$b\in -a+N(\phi),\qquad \lambda=e_i\cdot(a+b)/e_i\cdot y$$
Case 3. $\dim M=0$, i.e., no linear combination of $e_i,e_j$ is in $R(A)$ except $0$. So $\lambda_1=0=\lambda_2$ and $$A(x-a)=0\implies x=a+b,\quad \exists b\in N(A)$$ Again, similarly to case 2., the orthogonality conditions require an intersection of $a+N(A)$ with $\mathrm{Span}(e_i,e_j)^\perp$. This is possible iff $N(A)$ is not 'parallel' to $e_i^\perp,e_j^\perp$, that is, $$e_i,e_j\notin N(A)^\perp$$ To get $b$ take any solution of $$\begin{bmatrix}e_i^T\\e_j^T\end{bmatrix}b=-\begin{bmatrix}e_i\cdot a\\e_j\cdot a\end{bmatrix}$$