This preview shows pages 1–2. Sign up to view the full content.
Matrix Primer
Add two 3x3 matrices
Preconditions:
two nonempty 3x3 matrices of integer/ real / complex type
Postconditions:
a new 3x3 matrix of the same type with the elements added
Pseudocode:
1. Let the matrices A, B be the input matrices
2. Let the matrix holding the sum be called Sum.
3. For I in 1.
. 3 loop
i. For J in 1.
. 3 loop
1. Sum(I,J) := A(I,J) + B(I,J)
4. Return matrix Sum
Multiply two 3x3 matrices
Suppose that A and B are two matrices and that A is an m x n matrix (m rows and n
columns) and that B is a p x q matrix. To be able to multiply A and B together, A must
have the same number of columns as B has rows (i.e., n=p). The product will be a matrix
with m rows and q columns. To find the entry in row r and column c of the new matrix
we take the "dot product" of row r of matrix A and column c of matrix B (pair up the
elements of row r with column c, multiply these pairs together individually, and then add
their products).
Mathematically,
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Winter '12
 CharlesColeman
 Aeronautics, Astronautics

Click to edit the document details