Section 1.2 Solving systems of linear equations — mechanics
We run through the mechanics of using Sage to solve a system of linear equations.
Insight 1.2.1.
When we consider a linear system of the form \(Ax=b\text{,}\) we know (via Gaussian elimination) that the system is solvable if and only if the rightmost column of the augmented matrix \([A|b]\) is not a pivot column, which is to say that the reduced row-echelon form of the augmented matrix does not have a row of the form \([0\ 0\ \cdots \ 0\ *]\) where \(*\) is a nonzero scalar.
Let’s define a fixed coefficient matrix and augment it with different column vectors, checking for consistency (solvability).
Now we define two column vectors \(b_1\) and \(b_2,\) and consider the solvabilty of the system \(Ax=b\) for each \(b =b_i.\) Sage treats these as column vectors even though they will be displayed as row vectors.
We produce the reduced row-echelon form of each augmented matrix.
Thus we see the first system has no solution.
We see the second system is solvable. How shall we characterize the solutions?
We note that the coefficient matrix is \(5\times 7,\) and the rref form of \(A\) (or of the augmented matrix) has four pivots, hence four constrained variables leaving 3 free variables.
Rewriting this reduced matrix once again as a linear system of equations, we see:
\begin{align*}
x_1\amp= x_5-x_6+x_7+2\\
x_2\amp=x_5-x_6+3 \\
x_3\amp=-2x_6+2x_7\\
x_4\amp=-2x_5+x_6+2x_7
\end{align*}
When we untangle all that we see that the general solution has the form:
\begin{equation*}
\ba{r}x_1\\x_2\\x_3\\x_4\\x_5\\x_6\\x_7\ea =
x_5\ba{r}1\\1\\0\\-2\\1\\0\\0\ea+
x_6\ba{r}-1\\-1\\-2\\1\\0\\1\\0\ea+
x_7\ba{r}1\\0\\2\\2\\0\\0\\1\ea+
\ba{r}2\\3\\0\\0\\0\\0\\0\ea
\end{equation*}
If we ask Sage to solve the system, it hands us a single solution, the one with \(x_5=x_6=x_7=0.\)
On the other hand we know all solutions to the system have the form of the sum of a particular solution and an element of the nullspace. We ask for generators of the nullspace (really a
basis). The vectors returned as rows should look very familiar from the work above.