I'm new to Mathematica, so I'm sorry if this is really simple.
I am trying to find the condition that vector b must satisfy so that Ax=b has solution. I would like to learn a general method, but I'll show my particular case.
Given
$A=\left(
\begin{array}{cccccc}
-1 & 1 & -1 & 0 & 0 & 0 \\
1 & 0 & 0 & -1 & -1 & 0 \\
0 & -1 & 0 & 0 & 1 & -1 \\
0 & 0 & 1 & 1 & 0 & 1 \\
\end{array}
\right)$ and $b=\left(
\begin{array}{c}
b_1 \\
b_2 \\
b_3 \\
b_4 \\
\end{array}
\right)$
When performing RowReduction
by hand, I end up with matrix $U$ such that the last line is of 0:
$$\left(
\begin{array}{cccccc}
-1 & 1 & -1 & 0 & 0 & 0 \\
0 & 1 & -1 & -1 & -1 & 0 \\
0 & 0 & -1 & -1 & 0 & -1 \\
0 & 0 & 0 & 0 & 0 & 0 \\
\end{array}
\right)$$
and vector $b$: $$\left( \begin{array}{c} b_1 \\ b_1+b_2 \\ b_1+b_2+b_3 \\ b_1+b_2+b_3+b_4 \\ \end{array} \right)$$
This means that if $b_1+b_2+b_3+b_4=0, Ax=b$ has solution. Otherwise, it does not.
What I've tried (without success)
- Decompose $A$ into $LU$ so that I can do $L.b$ so as to perform same elemental operations to $b$.
LUDecomposition
command gives error because $A$ is singular. - Tried to find which elemental matrices were used to
RowReduce[]
$A$. However, I could not find a command that would give said output (my aim was to construct a matrix $Q$ with those numbers such that $Q.A=U$ and then do $Q.b$ to obtain the correct $b$). - Tried to augment matrix $A$ such that $$(A|b)= \left(
\begin{array}{ccccccc}
-1 & 1 & -1 & 0 & 0 & 0 & b_1 \\
1 & 0 & 0 & -1 & -1 & 0 & b_2 \\
0 & -1 & 0 & 0 & 1 & -1 & b_3 \\
0 & 0 & 1 & 1 & 0 & 1 & b_4 \\
\end{array}
\right)$$ in order to perform
RowReduction
and extract $b$. However, the output was not what I expected:RowReduce[(A|b)]
outputs $$\left( \begin{array}{ccccccc} 1 & 0 & 0 & -1 & -1 & 0 & 0 \\ 0 & 1 & 0 & 0 & -1 & 1 & 0 \\ 0 & 0 & 1 & 1 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ \end{array} \right)$$
Again, sorry if this seems too basic, but I spent a lot of time trying to find something here (and on other sites) to no avail. It is very likely that I'm just not looking in the right places, so if you could point me in the right direction, I would be grateful.
Thanks!
LinearSolve[Transpose[mat].mat, Transpose[mat].{b1, b2, b3, b4}]
yields something you might want to inspect thoroughly. $\endgroup$