How to solve this rank-deficient linear system?

1.4k Views Asked by At

Basically, I have a very simple system of linear equations of the form $Ax = b$, namely,

$$ \begin{bmatrix} -1 & 0 & 1 \\ 1 & -1 & 0 \\ 0 & 1 & -1 \\ \end{bmatrix} \cdot \begin{bmatrix}p_1 \\ p_2 \\ p_3\end{bmatrix} = \begin{bmatrix}e_1 \\ e_2 \\ e_3\end{bmatrix} $$

so obviously matrix $A$ is rank-deficient; but we can apply an additional condition by letting:

$$ p_1 = 0 $$

and we also guarantee that:

$$ e_1 + e_2 + e_3 = 0 $$

then the linear system is solvable now. We are going to solve it with scientific computing packages like NumPy or Eigen, but all these packages solve this problem with the syntax:

Solve(A, b) ==> return x

Is there any scientific computing package allowing me to apply the additional condition ($p_1=0$, in my case), so the problem can be solved like:

Solve(A, b, conditions on x) ==> return x

Or is there any way to re-arrange the equation by eliminating $p_1$ from $x$, as $p_1$ is constant to be zero?

1

There are 1 best solutions below

0
On

Thanks guys.

Our real problem is of course much more complicated, and we've adopted the Normal Equation to solve it.

First we re-arrange our problem by eliminating p1 (a little different from Theo Bendit's way, bc in real problem we cannot assume e3=-(e1+e2) ):

$$ \begin{bmatrix} 0 & 1 \\ -1 & 0 \\ 1 & -1 \\ \end{bmatrix} \cdot \begin{bmatrix}p_2 \\ p_3\end{bmatrix} = \begin{bmatrix}e_1-(-1 \cdot p_1) \\ e_2-(1\cdot p_1) \\ e_3-(0\cdot p_1)\end{bmatrix} = \begin{bmatrix}e_1 \\ e_2 \\ e_3 \end{bmatrix} $$

let's simply annotate the new equation like:

$$ Mp = e $$

Then we do:

$$ M^T Mp = Lp = M^T e = e' $$

then the problem can be easily handled in Numpy:

Solve(L, e') ==> return p values