**Section 2.2 **

**The Rank of a Matrix**

`> `
**with(linalg):**

Warning, the protected names norm and trace have been redefined and unprotected

`> `

`> `

**Introduction**

Recall from section 1.6:

*****************************************************************

The
__ROW SPACE__
of an nxm matrix A is the space spanned by the rows of the matrix A.

Since the span of a set of vectors is a subspace, the row space of an
*nxm*
matrix A is a

subspace of .

The
__COLUMN SPACE__
of an nxm matrix A is the space spanned by the columns of the

matrix A.

Since the span of a set of vectors is a subspace, the column space of an
*nxm*
matrix A is a

The
__NULL SPACE__
of an nxm matrix A is the solution set to Ax=0.

*****************************************************************

**Example 1: **
Find the dimension of the column space and row space.

`> `
**A:=matrix([[1,2,3],[6,-3,-8],[8,1,-2]]);**

`> `

`> `
**rref(A);**

`> `

**Rank of a matrix**

********************************************************************

Let A be an m x n matrix. The dimension of the row space of A is equal to the dimension

of the column space of A. The common dimension, the
** rank**
of A, is the number of pivots

in row echelon form of A.

********************************************************************

**Example 2**
: Determine the rank and a basis for the row space and column space of the matrix

`> `
**A:=matrix([[1,8,3,5],[6,-3,7,11],[8,1,-2,10],
[14,-2,5,21]]);**

`> `

Apply Gauss elimination to find the reduced row echelon form of A

`> `
**rref(A);**

`> `

**Example 3:**
Determine the rank and a basis for the column space and row space of the matrix

`> `
**A:=matrix([[1,8,3,5],[6,-3,7,11],[8,1,-2,10],
[14,-2,5,21]]);**

`> `

`> `
**rref(A);**

`> `

**Procedure for finding bases for spaces associated with a matrix**

***************************************************************

Let A be an m x n matrix with row-echelon form H.

1.) For a basis of the row space of A, use the non-zero rows of H.

2.) For a basis of the column space of A, use the columns of A corresponding

to the columns of H containing pivots.

3.) For a basis of the nullspace of A, use H and back substitution to solve Hx=0

in the usual way.

*****************************************************************

**Example 4: **
Determine the rank and a basis for the row space, column space and null space of the matrix

`> `
**A:=matrix([[1,8,3,4,12],[6,-3,7,12,15],
[-8,3,-2,10,18],[-7,11,1,14,31]]);**

`> `

Apply Gauss elimination to find the reduced row echelon form of A

`> `
**rref(A);**

`> `

**Nullity**

********************************************

Let A be an m x n matrix.

The null space, the solution to the equation Ax=0, has a basis

with as many vectors as free variables.

The dimension of the null space of A is called the
** nullity**
of A.

- Dimension of the column space is the number of pivot elements (number of lead variables)

- Dimension of the null space is the number of non-pivot elements (number of free variables)

- Total number of columns is n

**rank(A) + nullity(A) = n**

***************************************************

**Example 5:**
Find the rank and nullity of the following matrix.

`> `

`> `
**A:=matrix([[0,-4,2,8],[4,9,-3,-11],[4,5,-1,-3]]);**

`> `

`> `
**rref(A);**

`> `

An n x n matrix A is invertible if and only if rank(A) = n. Why?

**Exercise**

1, 3, 4, 5, 8, 11, 12.