Friday, August 15, 2014

Subtraction of Matrices

The subtraction of matrices is basically like matrix addition. You just subtract them instead of adding. For example:

        [3  7  5]               [5  2  9]
A =   [2  0  6]        B = [4  7  1]
        [8  9  1]               [3  2  6]

Where we have to solve A - B.

The solution is simply

      [ 3 - 5   7 - 2   5 - 9 ]  
      [ 2 - 4   0 - 7   6 - 1 ]
      [ 8 - 3   9 - 2   1 - 6 ]

         [ -2   5   -4 ]
     =  [ -2  -7    5 ]
         [  5   7   -5 ]

Like addition, we also cannot subtract matrices that have different sizes such as
       [ 7 ]
A = [ 2 ]    and     B = [  3  4  6  ]
       [ 4 ]

Friday, August 8, 2014

Multiplication of Matrices

If A = [aij] is an m x n matrix and B = [bij] is an n x p matrix, then the product AB is an m x p matrix.


Sample Problem #1

       [   1   5   2   ]          [ 3 ]
A=   [   2   9   5   ]    B= [ 5 ]
       [   5   2   6   ]          [ 1 ]
Matrix A is measured to be 3 x 3, while Matrix B is 3 x 1.
This means that we can multiply the the matrices with each other.

This Results to

[ (1)(3) + (5)(5) + (2)(1) ]
[ (2)(3) + (9)(5) + (5)(1) ]
[ (5)(3) + (2)(5) + (6)(1) ]

   [ 3 + 25 + 2 ]
= [ 6 + 45 + 5 ]
   [ 15 + 10 +6]

    [ 30 ]
=  [ 56 ]
    [ 31 ]

Sample Problem #2

       [ 2  7  5 ]
A = [ 1  3  6 ]       B = [ 3  1  8 ]
       [ 3  2  1 ]

Since Matrix A is measured to be 3 x 3, and Matrix B is  1 x 3, we cannot multiply the matrices with each other. Therefore, it is undefined.



Friday, August 1, 2014

Addition of Matrices

If A = [ aij ] and B = [bij ] are matrices of size m x n, then their sum is the m x n matrix given by

A + B = [aij + bij ].


The sum of two matrices of different sizes is undefined.

Examples
a. [  -2   3   ]  +   [   4   2   ]    =   [  -2 + 4,  3 + 2  ]   =  [   2   5   ]
    [   5   8   ]       [  -1   3   ]         [ 5 + (-1), 8 + 3  ]       [  4  11   ]

b. [  -1   6   4  ]   +   [   3   1   6   ]    =   [   2   7   10   ]
    [   4   1   5   ]        [  -8   5   3   ]        [  -4   6   8     ] 

c. [ 1 ]      [ 2 ]       [ 3 ]
    [ 7 ]  +  [ 3 ]  =  [10]
    [ 5 ]      [ 4 ]      [ 9 ]

d. The sum of
       [ 5  1 ]                   [  1  2  6  ]
A = [ 2  3 ]  and  B =    [  4  3  8  ]
       [ 1  4 ]                   [ -1  2  0  ]


is undefined. Because the matrices of both A and B have different sizes.