Matrix Arithmetic

Part 1.  Basic Properties of Matrix Arithmetic

We begin by defining  three matrices with which we will carry out some experiments:

\(A\  = 
      \ {\ {1, 0, \(-1\), 3}, {2, 1, 4, \(-2\)}, {0, \(-5\), 0, 1}, {\(-1\), 
          2, \(-1\), 3}\ }; \ 
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
    A\  // \ MatrixForm\)\(B\  = 
      \ {\ {2, 1, 0, 7}, {\(-2\), 5, 1, 2}, {4, 1, 3, \(-6\)}, {\(-1\), 1, 
          \(-8\), 2}\ }; 
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
    B\  // \ MatrixForm\)\(H = 
      \ {{2, 1, \(-5\), \(-2\)}, {\(-3\), 4, \(-1\), 3}, {0, 2, 0, 1}, {7, 
          13, \(-52\), 3}}; 
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
    Z // \ MatrixForm\)

Compute the product AB -- note that matrix multiplication is indicated by . (not *).

A.B  //  MatrixForm

Create a matrix with random integer entries:

Table[Random[Integer,  {-99, 99}],  {2}, {3} ]  //  MatrixForm

Part 2. The Product Ax as a Linear Combination

We define the 4-dimensional standard unit vectors (Subscript[e, 1]), (Subscript[e, 2]), (Subscript[e, 3]), (Subscript[e, 4]):

e1  = {1, 0, 0, 0}e2  = {0, 1, 0, 0}e3  = {0, 0, 1, 0}\(e4\  = {0, 0, 0, 1}
\)

For reference we reproduce here the matrix A defined in Section 1.

A //  MatrixForm

A.e1

Map[ #[[1]]&,  A]

x  =  {2,  -3,  4,  -5}

Part 3:  Transpose of a Matrix

The transpose of a matrix A is denoted (A^T).  In Mathematica, this is evaluated as Transpose[A].

A  //  MatrixFormTranspose[A]  //  MatrixForm

Here is a 3 by 5 matrix with random entries:

\(M\  = Table[Random[Integer, \ {\(-99\), 99}], \ {3}, {5}\ ]; \ \ 

    M // MatrixForm\)

M . (Transpose[M])  //  MatrixForm

Part 4.  Advanced Properties of Matrix Arithmetic

A matrix surprise:  Compute powers of X

\(X\  = 
      \ {\ {\(-22\), \ \(-3\), \ \(-25\)}, \ {40, \ 6, \ 44}, 
        \ {16, \ 3, \ 16}\ }; 
X\  // \ MatrixForm\)

MatrixPower[X, 2]  //  MatrixForm

Another surprise:  Computer PQ and PR

P  =  { {1, 2},  {3, 6} };     P  //  MatrixFormQ  =  { {1, 2},  {-1, 3} };   Q  //  MatrixFormR  =  { {-9, 6},  {4, 1} };   R  //  MatrixForm

Create a 4 by 4 identity matrix:

I4  =  IdentityMatrix[4];   I4  //  MatrixForm

Create zero matrices of various shapes:

Z1  =  Table[0, {4}, {4}];   Z1  //  MatrixFormZ2  =  Table[0, {4}, {7}];   Z2  //  MatrixFormZ3  =  Table[0, {5}, {4}];   Z3  //  MatrixForm

Part 5.  Diagonal Matrices

A matrix with zeros everywhere except on the main diagonal in called a diagonal matrix.  Enter the following diagonal matrices:

F  =  DiagonalMatrix[ {1, 2, -1, 3} ];   
    F  //  MatrixFormG  =  DiagonalMatrix[ {4, -1, 5, 2} ];   
    G  //  MatrixForm

Part 6.  Summary