# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# `linalg`::`basis`

Basis for a vector space

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```linalg::basis(`S`)
```

## Description

`linalg::basis(S)` returns a basis for the vector space spanned by the vectors in the set or list S.

`linalg::basis(S)` removes those vectors in `S` that are linearly dependent on other vectors in `S`. The result is a basis for the vector space spanned by the vectors in `S`.

For an ordered basis of vectors, `S` should be a list of vectors.

The vectors in `S` must be defined over the same component ring.

The component ring of the vectors in `S` must be a field, i.e., it must be of category `Cat::Field`.

## Examples

### Example 1

We define the domain of matrices over :

`MatQ := Dom::Matrix(Dom::Rational):`

and compute a basis for the vector space spanned by the vectors , and :

```v1 := MatQ([3, -2]): v2 := MatQ([1, 0]): v3 := MatQ([5, -3]): linalg::basis([v1, v2, v3])```

If not a list but a set of vectors is given, then the basis returned may not consist of the same vectors as above. The order of the vectors in the set depends on the internal order (see `sysorder` and `DOM_SET`), i.e., the order of the vectors appears to be random:

```b := linalg::basis({v1, v2, v3}): op(b, 1)```

## Parameters

 `S` A set or list of n-dimensional vectors; a vector is a n×1 or 1 ×n matrix of a domain of category `Cat::Matrix`

## Return Values

Set or a list of vectors, respectively.