Let’s take a look at how to manipulate matrixes. 

Multiply two 3X3 matrixes would look like the following:

image

image

Nothing fancy, this is one of the reasons that pre-computer engineers and scientists looked for calculators and computational systems to solve matrixes.  One of the principal motivation for the ENIAC computer was for it to solve large numbers of differential equations in a matrix format.  These equations would speed the production and delivery of cannons to the battlefield, since every cannon required a unique table to compensate for variations in production.  The work pre-ENIAC was done mostly by women, whose job title was “computers” because they computed using hand methods or some form of mechanical calculator. 

In the multiplication (or addition), there are rows, in the video represented by the lowercase letter i, and columns, represented by the lowercase j.  The reason that I used the letters i and j comes from my first language: FORTRAN.  In the case of FORTRAN, integers used variables that started with certain letters, and that practice has become common, but isn’t required.   

The outside “for” loop increments the row or ‘i’ and the inside “for” loop column or ‘j’.  As long as you multiple or add  the same elements (in this case) then you can expect the correct answer.  Using “1” (one’s) for one of the initial matrixes allows you to make sure your code is correct.  There are other reasons for using a matrix of “1” (ones).

If I am going to multiple or add two identical matrixes and putting the result into a third matrix, I will need three matrix (which is different than the video where I simply output the results),.  In this case I would need to define three matrixes:

int [,] w; int [,] x; int[,] z;
for (int i = 0; i < 3; i++) 

    for (int j = 0; j < 3; j++) 
     { 
           tmphold = w[i, j]; 
           z[i, j] = w[i,j] * x[i, j];                 
     } 
}

Take a look at the video:

Get Microsoft Silverlight