Go to the first, previous, next, last section, table of contents.

### Matrix Tutorial Exercise 3

To solve @c{$A^T A \, X = A^T B$} trn(A) * A * X = trn(A) * B, first we compute A2 = trn(A) * A and @c{$B' = A^T B$} B2 = trn(A) * B; now, we have a system @c{$A' X = B'$} A2 * X = B2 which we can solve using Calc's /' command.

The first step is to enter the coefficient matrix. We'll store it in quick variable number 7 for later reference. Next, we compute the B2 vector.

1:  [ [ 1, 2, 3 ]             2:  [ [ 1, 4, 7, 2 ]     1:  [57, 84, 96]
[ 4, 5, 6 ]                   [ 2, 5, 6, 4 ]         .
[ 7, 6, 0 ]                   [ 3, 6, 0, 6 ] ]
[ 2, 4, 6 ] ]           1:  [6, 2, 3, 11]
.                             .

' [1 2 3; 4 5 6; 7 6 0; 2 4 6] RET  s 7  v t  [6 2 3 11]   *


Now we compute the matrix @c{$A'$} A2 and divide.

2:  [57, 84, 96]          1:  [-11.64, 14.08, -3.64]
1:  [ [ 70, 72, 39 ]          .
[ 72, 81, 60 ]
[ 39, 60, 81 ] ]
.

r 7 v t r 7 *             /


(The actual computed answer will be slightly inexact due to round-off error.)

Notice that the answers are similar to those for the @c{$3\times3$} 3x3 system solved in the text. That's because the fourth equation that was added to the system is almost identical to the first one multiplied by two. (If it were identical, we would have gotten the exact same answer since the @c{$4\times3$} 4x3 system would be equivalent to the original @c{$3\times3$} 3x3 system.)

Since the first and fourth equations aren't quite equivalent, they can't both be satisfied at once. Let's plug our answers back into the original system of equations to see how well they match.

2:  [-11.64, 14.08, -3.64]     1:  [5.6, 2., 3., 11.2]
1:  [ [ 1, 2, 3 ]                  .
[ 4, 5, 6 ]
[ 7, 6, 0 ]
[ 2, 4, 6 ] ]
.

r 7                            TAB *
`

This is reasonably close to our original B vector, [6, 2, 3, 11].

Go to the first, previous, next, last section, table of contents.