Examples of Matrix Operations Versus Array Operations


The table at the bottom of this page is meant to illustrate the differences between matrix and array operations. The following matrices are used:

A=                                 B=                                C=
    1  2                               5  6                              1i  2i
    3  4                               7  8                              3i  4i

As a note, C (with imaginary values) is used to demonstrate unconjugated versus conjugated transpose. With values that are not imaginary, such as A, the results of both types of transpose are identical.

Matrix division uses the inverse of A or B, which are:

A-1 =                                B-1 =
      -2      1                            -4      3
      3/2   -1/2                           7/2   -5/2
Matrix Operation Array Operation
A*B
1*5+2*7  1*6+2*8
3*5+4*7  3*6+4*8
ans =
      19    22
      43    50
A.*B
  1*5 2*6
  3*7 4*8
ans =
       5    12
      21    32
A/B
1*(-4)+2*7/2  1*3+2*(-5/2)
3*(-4)+4*7/2  3*3+4*(-5/2)
ans =
    3.0000   -2.0000
    2.0000   -1.0000
A./B
  1/5 2/6
  3/7 4/8
ans =
    0.2000    0.3333
    0.4286    0.5000
A\B
(-2)*5+1*7      (-2)*6+1*8
3/2*5+(-1/2)*7  3/2*6+(-1/2)*8
ans =
      -3    -4
       4     5
A.\B
  5/1 6/2
  7/3 8/4
ans =
    5.0000    3.0000
    2.3333    2.0000
A^2
1*1+2*3  1*2+2*4
3*1+4*3  3*2+4*4
ans =
       7    10
      15    22
A.^2
  1*1 2*2
  3*3 4*4
ans =
       1     4
       9    16
A'
ans =
       1     3
       2     4
A.'
ans =
       1     3
       2     4
C'
ans =
        0 - 1.0000i        0 - 3.0000i
        0 - 2.0000i        0 - 4.0000i
C.'
ans =
        0 + 1.0000i        0 + 3.0000i
        0 + 2.0000i        0 + 4.0000i