Functions > Matrix Operations

Besides the functions available under this category, some other functions are also useful to work with matrices. These include the functions described in the category Numerical Manipulations and Number Theory and some of the functions described in the category Array and Data Manipulation.

The following functions are described in this section:

 01. addcol 02. addrow 03. adjugate 04. cofact 05. columns 06. comatrix 07. delcols 08. delrows 09. det 10. getcol 11. getcolmatrix 12. getiden 13. getrow 14. inverse 15. inversedet 16. isdiag 17. isiden 18. matrix 19. minor 20. minormatrix 21. order 22. rank 23. ref 24. rows 25. rref 26. trans

Returns a new matrix by adding a new column. It has the following three forms:

Returns a new matrix adding one extra column filled with 0's at the right-most column of the given matrix.

Returns a new matrix adding one extra column filled with 0's at the specified index in the given matrix.

Returns a new matrix with one extra column at the specified index filled with data (data should be an array with appropriate number of values).

Returns a new matrix by adding a new row. It has the following three forms:

Returns a new matrix adding one extra row filled with 0's at the end of the given matrix.

Returns a new matrix adding one extra row filled with 0's at the specified index in the given matrix.

Returns a new matrix with one extra row at the specified index filled with data (data should be an array with appropriate number of values).

Expects a matrix as argument. Create a new matrix that is the adjugate (classical adjoint) of the input matrix.

### cofact

Gets the Cofactor of a matrix for the specified row and column. Its syntax is:

cofact (matrix, row_number, col_number)

### columns

Returns the number of columns in a matrix.

### comatrix

Expects a matrix as argument. Creates a new matrix that is the Matrix of Co-factors for the specified matrix.

### delcols

Returns a new matrix by deleting the given number of columns starting at the specified index. Its syntax is:

delcols (matrix, index, count)

### delrows

Returns a new matrix by deleting the given number of rows starting at the specified index. Its syntax is:

delrows (matrix, index, count)

### det

Expects a matrix as argument. Returns the determinant of the given matrix.

### getcol

Retrieves the column at the specified index of a matrix as an array. It has the following form:

getcol(a_matrix, index)

### getcolmatrix

Retrieves the column at the specified index as a column matrix. It has the following form:

getcolmatrix(matrix, index)

### getiden

Gets an identity matrix with specified order. Its syntax is:

getiden (order)

### getrow

Retrieves the row at the specified index as an array. It has the following form:

getrow(matrix, index)

### inverse

Creates a new matrix, if defined, that is the inverse of the input matrix.

### inversedet

Creates a new matrix, if defined, that is the inverse of the input matrix. This functions uses the determinant and adjoint instead of the Reduced Row Echelon From used by the inverse function. The inverse function is more efficient and precise than this function. But it is given in case you need to calculate inverse based on the method of determinant and adjoint.

### isdiag

Expects a matrix as argument. Returns Boolean value 1 (i.e. true) if the argument matrix is diagonal. Returns 0 (false) otherwise.

### isiden

Expects a matrix as argument. Returns Boolean value 1 (i.e. true) if the argument matrix is an identity matrix. Returns 0 (false) otherwise.

### matrix

Creates a matrix. It can be called using either of the following two forms:

matrix (array_1, array_2, ..., array_n)
matrix (value_1, value_2, ..., value_n)

The arguments to the function matrix() are either single values or arrays of equal size. If single values are used, a column matrix is obtained. If arrays are used, they become rows of the resulting matrix. Arguments are processed from left to right while being added to the matrix from top to bottom.

The following commands show the use of matrix() function:

```{
row1 = array (1,2,3):
row2 = array (4,5,6):
mat1 = matrix (row1, row2):
mat2 = matrix( array(2,3,4), array(4,3,2)):
}```

### minor

Gets the Minor of a minor matrix for the specified row and column. Its format is:

minor (matrix, row_number, col_number)

### minormatrix

Expects a matrix as argument. Creates a new matrix that is the Matrix of Minors for the specified matrix.

### order

Expects a matrix as argument. Returns the order of the given matrix.

### rank

Expects a matrix as argument. Returns the rank of the given matrix.

### ref

Expects a matrix as argument. Gets the Row Echelon Form of the given matrix.

### rows

Expects a matrix as argument. Returns the number of rows in the given matrix.

### rref

Expects a matrix as argument. Gets the Reduced Row Echelon form of the given matrix

### trans

Expects a matrix as argument. Returns a new matrix which is transpose of the given matrix.