Accelerating the pace of engineering and science

# Documentation Center

• Trial Software
• Product Updates

# linalg::delCol

Delete matrix columns

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```linalg::delCol(A, c)
linalg::delCol(A, c1 .. c2)
linalg::delCol(A, list)
```

## Description

linalg::delCol(A, c) returns a copy of the matrix A in which the column with index c is deleted.

linalg::delCol(A, c1.. c2) deletes those columns whose indices are in the range c1.. c2. If c2< c1 then the input matrix A is returned.

linalg::delCol(A, list) deletes those columns whose indices are contained in list.

If all columns are deleted then NIL is returned.

## Examples

### Example 1

We define the following matrix:

`A := matrix([[1, 2, 3, 4], [5, 6, 7, 8]])`

and demonstrate the three different input formats for linalg::delCol:

`linalg::delCol(A, 2)`

`linalg::delCol(A, [1, 3])`

`linalg::delCol(A, 2..4)`

### Example 2

We compute the inverse of the 2×2 matrix:

```MatQ := Dom::Matrix(Dom::Rational):
A := MatQ([[3, 2], [5, -4]])```

by appending the 2×2 identity matrix to the right side of A and applying the Gauss-Jordan algorithm provided by the function linalg::gaussJordan:

`B := linalg::gaussJordan(A . MatQ::identity(2))`

We get the inverse of A by deleting the first two columns of the matrix B:

`AI := linalg::delCol(B, 1..2)`

Finally, we check the result:

`A * AI, AI * A`

Note: The inverse of A can be computed directly by entering 1/A.

## Parameters

 A An m×n matrix of a domain of category Cat::Matrix c The column index: a positive integer less or equal to n c1 .. c2 A range of column indices (positive integers less or equal to n) list A list of column indices (positive integers less or equal to n)

## Return Values

Matrix of a domain of category Cat::Matrix(R), where R is the component ring of A, or NIL.

## More About

Was this topic helpful?