Matlab

Submitted by: Submitted by

Views: 53

Words: 1009

Pages: 5

Category: Science and Technology

Date Submitted: 10/15/2014 07:00 AM

Report This Essay

Lecture 2 Matrix Operations

• transpose, sum & difference, scalar multiplication • matrix multiplication, matrix-vector product • matrix inverse

2–1

Matrix transpose

transpose of m × n matrix A, denoted AT or A′, is n × m matrix with AT

ij

= Aji

rows and columns of A are transposed in AT T  0 4 0 7 3 . example:  7 0  = 4 0 1 3 1 • transpose converts row vectors to column vectors, vice versa • AT

T

=A

2–2

Matrix Operations

Matrix addition & subtraction

if A and B are both m × n,    1 0 4 example:  7 0  +  2 0 3 1 we form A + B by adding corresponding entries    1 6 2 3 = 9 3  3 5 4 1 6 9 3 0 6 9 2

can add row or column vectors same way (but never to each other!) matrix subtraction is similar: −I =

(here we had to figure out that I must be 2 × 2)

Matrix Operations

2–3

Properties of matrix addition

• commutative: A + B = B + A • associative: (A + B) + C = A + (B + C), so we can write as A + B + C • A + 0 = 0 + A = A; A − A = 0 • (A + B)T = AT + B T

Matrix Operations

2–4

Scalar multiplication

we can multiply a number (a.k.a. scalar ) by a matrix by multiplying every entry of the matrix by the scalar this is denoted by juxtaposition or ·, with the scalar on the left:     −2 −12 1 6 (−2)  9 3  =  −18 −6  −12 0 6 0 (sometimes you see scalar multiplication with the scalar on the right) • (α + β)A = αA + βA; (αβ)A = (α)(βA) • α(A + B) = αA + αB • 0 · A = 0; 1 · A = A

Matrix Operations 2–5

Matrix multiplication

if A is m × p and B is p × n we can form C = AB, which is m × n

p

Cij =

k=1

aik bkj = ai1b1j + · · · + aipbpj ,

i = 1, . . . , m,

j = 1, . . . , n

to form AB, #cols of A must equal #rows of B; called compatible • to find i, j entry of the product C = AB, you need the ith row of A and the jth column of B • form product of corresponding entries, e.g., third component of ith row of A and third component of jth column of B • add up all the products

Matrix Operations 2–6...