matrix_primer

matrix_primer - Matrix Primer Add two 3x3 matrices...

This preview shows pages 1–2. Sign up to view the full content.

Matrix Primer Add two 3x3 matrices Pre-conditions: two non-empty 3x3 matrices of integer/ real / complex type Post-conditions: a new 3x3 matrix of the same type with the elements added Pseudo-code: 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.

This note was uploaded on 02/20/2012 for the course AERO 16.02 taught by Professor Charlescoleman during the Winter '12 term at MIT.

Page1 / 4

matrix_primer - Matrix Primer Add two 3x3 matrices...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online