Here are some examples using pari to solve linear systems:
The examples here are from class lectures and the text.
Notes: The systems have been written in the form Ax=b where
A is the coefficient matrix and b is the right side column
vector. The function "matinverseimage(A,b)" works in each
case but has a different interpretation depending on the
type of system. For the third example, read the solution in
the text and see how the output of the command "matker(A)"
relates to the general solution.
example 1. (inconsistent system - no solution)
gp > A=[2,1,0;1,-1,3;0,-1,2]
%1 =
[2 1 0]
[1 -1 3]
[0 -1 2]
gp > b=[1;0;2]
%3 =
[1]
[0]
[2]
gp > matinverseimage(A,b)
%4 = [;]
example 2. (consistent system - exactly one solution)
gp > A=[2,1,0;1,-1,3;0,1,-1]
%5 =
[2 1 0]
[1 -1 3]
[0 1 -1]
gp > matinverseimage(A,b)
%6 =
[-4/3]
[11/3]
[5/3]
example 3. (consistent system - infinitely many solutions)
gp > A=[1,3,-2,0,2,0;2,6,-5,-2,4,-3;0,0,5,10,0,15;2,6,0,8,4,18]
%7 =
[1 3 -2 0 2 0]
[2 6 -5 -2 4 -3]
[0 0 5 10 0 15]
[2 6 0 8 4 18]
gp > b=[0;-1;5;6]
%8 =
[0]
[-1]
[5]
[6]
gp > matinverseimage(A,b)
%9 =
[0]
[0]
[0]
[0]
[0]
[1/3]
gp > matker(A)
%10 =
[-3 -4 -2]
[ 1 0 0]
[ 0 -2 0]
[ 0 1 0]
[ 0 0 1]
[ 0 0 0]