Right Left System Solving

Description

Given a matrix $A$ and a vector $\mathbf{b}$, we can use the method .solve_right() to find a solution to the equation $A\mathbf{x} = \mathbf{b}$. Note that this methods will only provide one solution even if the equation has multiple solutions—if you need to find a solution set, it is better to use the rref method. For example, if

(1)
\begin{align} A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & -1 \end{pmatrix} \end{align}

and $\mathbf{b} = (24, 63, 52)$, we can use Sage to solve $A\mathbf{x} = \mathbf{b}$.

Sage Cell

Code

A = matrix([[1, 2, 3], [4, 5, 6], [7, 8, -1]])
b = vector([24, 63, 52])
right = A.solve_right(b)
print("right solution =", right)


Options

Solving $\mathbf{x}A = \mathbf{b}$

Given a matrix $A$ and a vector $\mathbf{b}$, we can use the method .solve_left() to find a solution to the equation and $\mathbf{x}A = \mathbf{b}$.

Code

A = matrix([[1, 2, 3], [4, 5, 6], [7, 8, -1]])
b = vector([24, 63, 52])
left = A.solve_left(b)
print("left solution =", left)


Tags

CC:

Primary Tags: Linear Algebra: Systems of linear equations

Secondary Tags: Systems of linear equations: Systems with 2 variables, Systems with 3 variables, Systems with 4 or more variables, Matrix-vector forms