The functions and operators described in this section only apply to matrices.


The ROW and COL infix operators can be used as an alternative to the SUB operator (see Vector Manipulation FunctionsVector_Manipulation_Functions) to extract rows and columns of matrices.  If A is a matrix, A ROW n and A COL n return the nth row and column of A as a vector, respectively.  For example,

[a, b, c; d, e, f; g, h, i] ROW 2

simplifies to [d, e, f], and

[a, b, c; d, e, f; g, h, i] COL 2

simplifies to [b, e, h].  If the right operand of ROW or COL is a vector of indices, a matrix of the specified rows or columns is returned.  For example,

[a, b, c; d, e, f; g, h, i] ROW [3, 1]

simplifies to

g  h  i
       
a  b  c

and

[a, b, c; d, e, f; g, h, i] COL [3, 1]

simplifies to

c  a
     
f  d
     
i  g

Note that the ... ellipsis can be used to extract a range of rows or columns.  For example,

A ROW [3, ..., 7]

returns a matrix consisting of the 3rd through 7th rows of the matrix A.


The transpose of a matrix is the matrix resulting from interchanging its rows and columns.  The transpose of a scalar or a vector of scalars is the original scalar or vector of scalars.  Use the `(back-accent) postfix operator to generate the transpose of a matrix.  For example,

[[a, b, c], [1, 2, 3]]`

displays as

a  b  c  
        ` 
1  2  3  

and simplifies to

a  1  
      
b  2  
      
c  3  


A square matrix is a matrix with the same number of rows as columns.  Use DET to compute the determinant of a square matrix.  For example,

DET([2, 3; a, b])

simplifies to 2·b - 3·a.


The trace of a square matrix is the sum of its diagonal elements.  Use TRACE to compute the trace of a square matrix.  For example,

TRACE([a, b, c; d, e, f; g, h, i])

simplifies to a + e + i.


Use the ^ operator to raise a square matrix to an integer power.  For example,

[2, 3; a, b]^2

simplifies to

 3·a + 4    3·b + 6
                   
                  2
a·(b + 2)  3·a + b  


A singular matrix is a square matrix whose determinant is 0.  A singular matrix has no inverse.  For example,

[2, 3; 4·a, 6·a]^(-1)

does not simplify further since the matrix is singular.


Inverting a matrix can produce dramatically more complicated elements than the original matrix.  The complexity of the inverse of an n by n matrix with symbolic elements often grows combinatorially with n.  Even for numeric matrices, the elements of an inverse computed in exact or mixed mode can have dramatically more digits than the given elements.  


A system of linear equations can be represented as a vector of constants that is equal to the product of a coefficient matrix and a vector of unknowns.  Provided the matrix is nonsingular, you can use the matrix inverse and product operations to solve this matrix equation.  For example, to solve the system of equations

5·x + 3·y - 7·z  =  4
2·x - 8·y +  z  =  6
-x + 9·y + 4·z  =  5

enter the expression

[5, 3, -7; 2, -8, 1; -1, 9, 4]^(-1)·[4, 6, 5]

which approximates to the solution vector for x, y, and z

[2.910596026, 0.1754966887, 1.582781456]

Note that the exact rational solution can be found by simplifying, instead of approximating, the equation.


The above method is only able to solve systems of linear equations that are nonsingular.  Also since it requires the explicit computation of the inverse of a matrix, it is both space and time inefficient.  In contrast, the Solve commandsSolve_commands and the function ROW_REDUCE (see Row Echelon FormRow_Echelon_Form) can solve larger as well as singular systems of linear equations, so long as they are consistent.


Other Vectors and MatricesVectors_and_Matrices topics

Created with the Personal Edition of HelpNDoc: Free CHM Help documentation generator