Skip to main content

Linear Algebra with SageMath Learn math with open-source software

Section 3.2 Solving Systems of Equations

Sage allows us to generalize the previous methods to solve systems of equations. In order to do this we must first define multiple symbolic variables, then we use the solve function as we did before.
There are various ways to create multiple symbolic variables at once. The following are all valid.
Notice how these symbolic variables are all equivalent regardless of how they are created.
To solve a system of equations algebraically, we first define the variables and the equations in the system.
In this case, the first argument we pass to solve is a list of equations and the following arguments are the variables being solved for.
Observe that Sage returns a nested list structure. The outer list contains all possible solutions to the system (in this case, there is only one solution). Each solution is represented as an inner list of equations showing the value of each variable.
We also can solve a system of three equations with three variables. This system of equations has exactly one solution and will hereby be referred to as \(\textbf{Case I}\text{.}\)
The following is an example of a system with infinitely many solutions. The general solution is expressed as a parameterized function. This system will hereby be referred to as \(\textbf{Case II}\text{.}\)
The following is an example of an inconsistent system. Since the system has no solutions, Sage returns an empty list. This system will hereby be referred to as \(\textbf{Case III}\text{.}\)