Solving $Ax = b$ when $A$ is singular I have a system of equations, expressed as
$\mathbf{A} \begin{pmatrix}x_1 \\ x_2 \\ x_3 \\ x_4 \end{pmatrix} = \begin{pmatrix} 0 \\ i (\frac{1}{2} + C - a) \\ i(\frac{1}{2} - C - a) \frac{m \cos(\alpha)}{k} \\ -i(\frac{1}{2} - C - a) \frac{\sqrt{m^2 + k^2} + m \sin(\alpha)}{k} \end{pmatrix}$
$\mathbf{A} = \begin{pmatrix} m \sin(\alpha) - \sqrt{m^2 + k^2} & m \cos(\alpha) & k & 0 \\ m \cos(\alpha) & -m\sin(\alpha) - \sqrt{m^2 + k^2} & 0 & k \\ k & 0 &  -m\sin(\alpha) - \sqrt{m^2 + k^2} & -m \cos(\alpha) \\ 0 & k & -m \cos(\alpha) & m \sin(\alpha) - \sqrt{m^2 + k^2} \end{pmatrix}$
where $\mathbf{A}$ is a $4\times 4$ singular matrix and $C, a$ are non-zero constants.
I am trying to find $x_n$. If $\mathbf{A}$ is singular, as far as I know, this is only possible if the right-hand side is $0$.
I can set the constraint $ \frac{1}{2} -C = a$ so that the RHS becomes $\begin{pmatrix} 0 \\ 2iC \\ 0 \\ 0 \end{pmatrix}$, but that doesn't really get me anywhere. Are there other methods of doing this?
 A: If you're comfortable letting a tool like MATLAB do the work, you can always try computing the pseudoinverse and multiplying by the vector:
y = pinv(A) * x;
Then you can see if $A * y = x$. If so, then $x$ is in the range space of $A$; if not, it's not.
If you need to do something symbolic, then what I would suggest is expressing $(x_3,x_4)$ in terms of $(x_1,x_2)$ using the first two rows; then substituting the result into the second two rows. I'll give it a go and see if I can come up with something decent; if so, I'll edit this post.
EDIT: Here's the thought. First, break the coefficient matrix into $2\times 2$ blocks and the LHS and RHS vectors accordingly:
$$
\begin{bmatrix} A_1 & k I \\ k I & A_2 \end{bmatrix} \begin{bmatrix} \bar{x}_{12} \\ \bar{x}_{34} \end{bmatrix} = \begin{bmatrix} b_1 \\ b_2 \end{bmatrix}
$$
where $\bar{x}_{12}=\left[\begin{smallmatrix}{x_1\\x_2}\end{smallmatrix}\right]$ and
$\bar{x}_{34}=\left[\begin{smallmatrix}{x_3\\x_4}\end{smallmatrix}\right]$.
Now you have from the first block row,
$$ k \bar{x}_{34} = b_1 - A_1 \bar{x}_{12} $$
Substituting back into the second block row,
$$
k \bar{x}_{12} + A_2 \left( k^{-1} b_1 - k^{-1} A_1 \bar{x}_{12} \right) = b_2$$
Consolidating and multiplying through by $k$,
$$
( k^2I - A_2 A_1 ) \bar{x}_{12} = k b_2 - A_2 b_1$$
You shouldn't have difficulty computing these quantities symbolically. It should be significantly easier to determine when this $2\times 2$ system has a solution.
EDIT 2: Ha ha! I have a sneaking feeling that $k^2I-A_2A_1\equiv 0$. It certainly does for a couple of numerical instances I tried. If so, there's your answer: the linear system has a solution only when $k b_2 - A_2 b_1 = 0$.
