Linear Algebra

on TI-8x Graphing Calculators


Contents

  1. Matrix Operations
  2. Matrix Commands

[Prev] [TI Calc Intro] [Next]

The TI-82/83/85/86 graphing calculators have a fairly well thought out set of matrix and vector capabilities. These vary among the different models, but any of these calculators has most of the functions noted, although getting to them can require different keystrokes on each calculator. A general introduction to using these calculators can be found in a separate document.

Matrix Operations

Basic Matrix Operations

Most of the linear algebra functions can be found in Matrix mode. To enter Matrix mode on the TI-85/86 press the sequence [2nd][7] and on the TI-82/83 press [2nd][x-1]. This mode gives you a menu which leads you to the linear algebra functions, a matrix editor and a menu of existing matrices. To get out of the Matrix mode and return to the Home screen press the [EXIT] key on the TI-85/86 or the QUIT key ([2nd][MODE]) on the TI-82/83.

The simplest way to define a matrix is to use the matrix editor. Enter matrix mode, enter the editor and create a 2x2 matrix. The sequence of keys to do this (from Home Screen) is:

The matrix is now in the calculator. Display the matrix by returning to matrix mode, going to the Names menu, and selecting B. (Alternatively, on the TI-85/86 you may simply type the command B at the Home Screen.) You now see the matrix:

A
         [[1 2]
          [3 4]]

We may now compute with this matrix using the usual addition, subtraction, multiplication and inversion (x-1) operators:

A+A
         [[2 4]
          [6 8]]
A*A
         [[7 10]
          [15 22]]
A-1
         [[-2   1 ]
          [1.5 -.5]]

Elements of the matrix can be directly manipulated. For that matter, a new matrix can be created on the Home Screen:

A(2,2)
         4

[[1,1][1,2]] -> B
         [[1 1]
          [1 2]]

Solving Linear Systems

A common use of matrices is to express and solve a system of linear equations. Consider the matrix equation A*x=b, where A is the 2x2 matrix [[1,2][3,4]] and b is the vector [1,1]. If the matrix is invertible (this one is) we may solve this equation as x=A-1b:

A-1*[[1][1]]

          [[-1]
           [1]]

A more general case is when the matrix is not invertible. To solve such a system we can row reduce an augmented matrix. This row reduction is done with a sequence of the elementary row operations. These operations are named rowSwap, *row and *row+ on the TI-82/83 and rSwap, multR and mRAdd on the TI-85/86. All but the TI-82 also have the ref (row echelon form) and rref (reduced row echelon form) functions to reduce an matrix in a single step. We first solve the matrix equation Ax=b where A is the 2x3 matrix [[1,2,3][2,1,1]] and b is the vector [6,4]. The matrix commands we use here can all be found in the menus of Matrix mode.

[[1,2,3][2,1,1]] -> A

         [[1 2 3]
          [2 1 1]]

aug(A,[[6][4]]) -> B

         [[1 2 3 6]
          [2 1 1 4]]

*row+(-2,B,1,2) -> B

         [[1  2  3  6]
          [0 -3 -5 -8]]

*row+(2/3,B,2,1) -> B

         [[1  0 -0.33 0.66]
          [0 -3 -5   -8]]

*row(-1/3,B,2)

         [[1 0 -.33  .66]
          [0 1 1.66 2.66]]

On the TI-83/85/86 we could accomplish the same thing (bringing the augmented matrix to reduced row echelon form) with a single command:

rref(B)

         [[1 0 -.33  .66]
          [0 1 1.66 2.66]]

We interpret this answer as follows - The vector [0.66, 2.66, 0] is a solution, as is any vector of the form [0.66, 2.66, 0] + z*[0.33, -1.66, 1] for any value of z.

Bug: Note that the ref and rref functions, as implemented on the TI-8x calculators, have a bug which causes them to fail when the matrix is taller than it is wide - i.e. for an overdetermined system of equations.

We now look for solutions of Cx=d, where C is the 3x2 matrix [[1,2][2,1][1,1]] and d is the vector [1,2,2].

[[1,2][2,1][1,1]] -> C

         [[1 2]
          [2 1]
          [1 1]]

aug(C,[[1][2][2]])

         [[1 2 1]
          [2 1 2]
          [1 1 2]]

rref(Ans)

         [[1 0 0]
          [0 1 0]
          [0 0 1]]

We interpret this answer as follows - When this augmented matrix is reduced, the third equation ends up being 0*x + 0*y = 1, an inconsistent equation - one which cannot be satisfied for any values of x and y. Thus the original matrix equation, Cx=d, was inconsistent and had no solution.

LU Decompositions (TI-85/86 only)

The TI-85/86 calculators implement an LU decomposition command. This command places the L (lower triangular), U (upper triangular) and P (permutation) matrices into specified variables. This command will perform an LU decomposition with partial pivoting, producing three matrices, L, U and P such that if A is the original matrix then L*U=P*A.

[[1,2,1][1,3,1][2,1,1]]->A

         [[1 2 1]
          [1 3 1]
          [2 1 1]]

LU(A,L,U,P)

         Done

L

         [[2  0  0 ]
          [1 2.5 0 ]
          [1 1.5 .2]]

U

         [[1 .5 .5]
          [0 1  .2]
          [0 0  1 ]]

P

         [[0 0 1]
          [0 1 0]
          [1 0 0]]

P-1*L*U

         [[1 2 1]
          [1 3 1]
          [2 1 1]]

Eigenvalues & Eigenvectors

We may compute the eigenvalues and eigenvectors of a given square matrix. The TI-85/86 has commands which will directly compute the eigenvalues and eigenvectors of a matrix. The eigVl command will numerically compute the eigenvalues of a matrix and the eigVc command will numerically compute the eigenvectors.

On any of these calculators we may compute eigenvalues using the numerical power method:

[[1,2,1][1,3,1][2,1,1]] -> A

         [[1 2 1]
          [1 3 1]
          [2 1 1]]
A^20*[[1][1][1]] -> B

A*B -> C

C(1,1)/B(1,1)

         4.507

If we have a TI-85/86 we may use the builtin commands to confirm that the largest eigenvalue of matrix A is 4.507:

eigVl A

         {-.285 4.507 .778}

det A

         -1

eigVc A

         [[-.497 .532  .130]
          [-.110 .684 -.455]
          [.860  .498  .881]]

The eigVc command returns the eigenvectors as the columns of a matrix, in the same order as the corresponding eigenvalues. Here we can confirm the eigenvalue/eigenvector pair l=-.285, v=(-0.497, -0.110, 0.860) by computing Av/l and confirming that it equals v. We extract the first eigenvector by transposing the matrix of eigenvectors, making it the first row, then extracting the first row:

[[1,2,1][1,3,1][2,1,1]]->A

         [[1 2 1]
          [1 3 1]
          [2 1 1]]

eigVl A

         {-.285 4.507 .778}

Ans(1) -> L

         -.285

(eigVc A)T

         [[-.497 -.110  .860]
          [.532  .684  .498]
          [ .130  -.455  .881]]

Ans(1) -> V

         [-.497 -.110 .860]

A*V/L

         [-.497 -.110 .860]

Matrices with complex eigenvalues are also dealt with, returning complex numbers as a list of the real and imaginary components. In this example the eigenvalues are i and -i.

[[0,-1][1,0]]->B

         [[0 -1]
          [1 0 ]]

eigVl B

         {(0,1) (0,-1)}

Iterative Methods & the Hilbert Matrix

We examine the classic ill-conditioned matrix, the Hilbert matrix, whose (i,j) entry is 1/(i+j). (Note that the curly brackets used in setting the dimension of H are found in the List Mode menu on the TI-85/86 and on the keyboard of the TI-82/83 as [2nd][(] and [2nd][)].)

{10,10} -> dim H

         {8 8}
For(I,1,10):For(J,1,10):(I+J)-1 -> H(I,J):End:End

         Done

H

         [[0.5  0.33 0.25 ...
          [0.33 0.25 0.2 ...
          [0.25 0.2  0.16 ...
          [0.2  0.16 0.14 ...

A matrix equation involving the Hilbert matrix can be difficult to solve - the ill-conditioned nature of the matrix can lead to large errors during reduction. A measure of the bad nature of this matrix, available on the TI-85/86, is the condition number:

cond A
         big stuff

Polishing an answer - Here we will set up a problem with the Hilbert matrix which has a known answer. Multiply H by the known vector [1,1,...,1] to get a right hand side of our equation, B. When we solve the equation H*I=B for I we should get back the vector [1,1,...,1]. We see that we are not very close. In fact, if we look very closely at the reduced matrix, we see an unexpected non-pivot column:

[[1,1,1,1,1,1,1,1,1,1]]T -> J

         [1 1 1 1 1 1 1 1 1 1]

H*J -> B

         [2.02 1.60 1.34 1.17 ...

rref(augment(H,B))

         [whatever]

Ans*[[0,0,0,0,0,0,0,0,0,0,1]]T -> I

         [1.00 0.99 1.09 0.29 3.91 -6.15 ...

We now polish the inaccurate answer by repeatedly taking the answer I, computing the residue C = B - H*I, solving the system H*X = C, and computing the new answer I + X.

B - H*I -> C

         [whatever]

rref(augment(H,C))

         [whatever]

I + Ans*[[0,0,0,0,0,0,0,0,0,0,1]]T -> I

         [better whatever]

Matrix Commands

Matrix Menu Commands

non-Matrix Commands which work on Matrices


[Prev] [TI Calc Intro] [Next]
Robert Campbell
7 October, 2002