Sage SS1 Solving Systems, Part 1

Sage has a built-in command that will solve a linear system of equations, given a coefficient matrix and a vector of constants. We need to learn some more theory before we can entirely understand this command, but we can begin to explore its use. For now, consider these methods experimental and do not let it replace row-reducing augmented matrices.

The matrix method A.solve_right(b) will provide information about solutions to the linear system of equations with coefficient matrix A and vector of constants b. The reason for the “right” (and the corresponding command named with “left”) will have to wait for Sage MVP. For now, it is generally correct in this course to use the “right” variant of any Sage linear algebra command that has both “left” and “right” variants.

Let us apply the .solve_right() command to a system with no solutions, in particular Archetype E. We have already seen in Sage RCLS that this system is inconsistent.



This is our first discussion of Sage error messages, though undoubtedly you have seen several already! First, here we only show the first and last lines of the message since typically it contains a lot of information specific to whichever computer you may be using. but we always begin with the last line as the most important indication of what has happened. Here the “problem” is quite evident: we get an “error” message telling us that the matrix equation has no solutions. We can debate whether or not this is really an error, but that is the design decision taken in Sage — we just need to be aware of it, the .solve_right() is really only valuable when there is a solution.

Generally, when deciphering Sage error messages, you want to start at the bottom of the “traceback” and read up through the various routines that have been called. Execute the block above and you may see references to matrix methods such as ._solve_right_general() and then .solve_right(). With time and practice, these mysterious messages will become more and more helpful, so spend some time reading them in tandem with locating the real source of any problems you encounter.

What does .solve_right() do with a system that does have solutions? Let us take a look at Example ISSI again, as we did in Sage FDV.



This vector with 7 entries is indeed a solution to the system of equations (check this!). But from Example ISSI we know this system has infinitely many solutions. Why does Sage give us just one solution? Of the infinitely many solutions, why this one? How can a finite computer ever present us with infinitely many solutions? Do we have the time to read through an infinite list of solutions? Is there a “best” solution? This behavior should prompt these questions, and maybe more.

In order to totally understand the behavior of the .solve_right() command, we need to understand more of the theory of linear algebra. In good time. So for now, .solve_right() is a curiosity we will fully understand soon — specifically in Sage SS2 and Sage SS3.