# Subspace generated by the columns of a matrix: colspace

### 5.47.14 Subspace generated by the columns of a matrix: colspace

The colspace command finds a basis for the column space of a matrix.

- colspace takes one mandatory argument and one optional argument:
  - A, a matrix.
  - Optionally, var, a variable name.
- colspace(A ⟨var⟩) returns a matrix whose columns are a basis of the subspace generated by the columns of A. With the optional argument var, Xcas will store the dimension of the subspace generated by the columns of A.

#### Examples.

- Input:
  colspace([[1,1,2],[2,1,3],[3,1,4]])
  Output:

  ⎡
  ⎢
  ⎢
  ⎣

  −1 | 0
  0 | −1
  1 | −2

  ⎤
  ⎥
  ⎥
  ⎦

- Input:
  colspace([[1,1,2],[2,1,3],[3,1,4]],dimension)
  Output:

  ⎡
  ⎢
  ⎢
  ⎣

  −1 | 0
  0 | −1
  1 | −2

  ⎤
  ⎥
  ⎥
  ⎦

  then input:
  dimension
  Output:

  2