DM559 Linear and Integer Programming. Lecture 3 Matrix Operations. Marco Chiarandini

Similar documents
Phys 201. Matrices and Determinants

Matrix Arithmetic. j=1

Matrices and Linear Algebra

DM559 Linear and Integer Programming. Lecture 2 Systems of Linear Equations. Marco Chiarandini

Linear Algebra V = T = ( 4 3 ).

Matrix Operations. Linear Combination Vector Algebra Angle Between Vectors Projections and Reflections Equality of matrices, Augmented Matrix

A FIRST COURSE IN LINEAR ALGEBRA. An Open Text by Ken Kuttler. Matrix Arithmetic

ICS 6N Computational Linear Algebra Matrix Algebra

Matrices BUSINESS MATHEMATICS

Elementary maths for GMT

Linear Algebra. The analysis of many models in the social sciences reduces to the study of systems of equations.

Linear Algebra. Matrices Operations. Consider, for example, a system of equations such as x + 2y z + 4w = 0, 3x 4y + 2z 6w = 0, x 3y 2z + w = 0.

INSTITIÚID TEICNEOLAÍOCHTA CHEATHARLACH INSTITUTE OF TECHNOLOGY CARLOW MATRICES

1 Matrices and matrix algebra

Lecture 3 Linear Algebra Background

Matrix Algebra 2.1 MATRIX OPERATIONS Pearson Education, Inc.

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations

A primer on matrices

Matrix Algebra Determinant, Inverse matrix. Matrices. A. Fabretti. Mathematics 2 A.Y. 2015/2016. A. Fabretti Matrices

[ Here 21 is the dot product of (3, 1, 2, 5) with (2, 3, 1, 2), and 31 is the dot product of

Matrices. Chapter Definitions and Notations

Lecture Notes in Linear Algebra

CLASS 12 ALGEBRA OF MATRICES

n n matrices The system of m linear equations in n variables x 1, x 2,..., x n can be written as a matrix equation by Ax = b, or in full

Chapter 2. Matrix Arithmetic. Chapter 2

NOTES on LINEAR ALGEBRA 1

MATH2210 Notebook 2 Spring 2018

1 Multiply Eq. E i by λ 0: (λe i ) (E i ) 2 Multiply Eq. E j by λ and add to Eq. E i : (E i + λe j ) (E i )

Section 9.2: Matrices.. a m1 a m2 a mn

Knowledge Discovery and Data Mining 1 (VO) ( )

Two matrices of the same size are added by adding their corresponding entries =.

Vectors and Matrices

Matrix Multiplication

Lecture 3: Matrix and Matrix Operations

We could express the left side as a sum of vectors and obtain the Vector Form of a Linear System: a 12 a x n. a m2

Matrix & Linear Algebra

Review of linear algebra

Linear Equations in Linear Algebra

DM559 Linear and Integer Programming. Lecture 6 Rank and Range. Marco Chiarandini

Basic Concepts in Linear Algebra

Matrices Gaussian elimination Determinants. Graphics 2009/2010, period 1. Lecture 4: matrices

Elementary Row Operations on Matrices

MATRICES. a m,1 a m,n A =

Matrix operations Linear Algebra with Computer Science Application

Quantum Computing Lecture 2. Review of Linear Algebra

Review of Basic Concepts in Linear Algebra

Linear Algebra and Matrix Inversion

. a m1 a mn. a 1 a 2 a = a n

Calculus II - Basic Matrix Operations

Topics. Vectors (column matrices): Vector addition and scalar multiplication The matrix of a linear function y Ax The elements of a matrix A : A ij

Introduction to Quantitative Techniques for MSc Programmes SCHOOL OF ECONOMICS, MATHEMATICS AND STATISTICS MALET STREET LONDON WC1E 7HX

POLI270 - Linear Algebra

MATH.2720 Introduction to Programming with MATLAB Vector and Matrix Algebra

M. Matrices and Linear Algebra

A matrix is a rectangular array of. objects arranged in rows and columns. The objects are called the entries. is called the size of the matrix, and

Chapter 2. Ma 322 Fall Ma 322. Sept 23-27

Elementary Linear Algebra

Section 9.2: Matrices. Definition: A matrix A consists of a rectangular array of numbers, or elements, arranged in m rows and n columns.

Mathematics 13: Lecture 10

A matrix is a rectangular array of. objects arranged in rows and columns. The objects are called the entries. is called the size of the matrix, and

ELEMENTARY LINEAR ALGEBRA

Prepared by: M. S. KumarSwamy, TGT(Maths) Page

Matrices: 2.1 Operations with Matrices

Matrices. Chapter What is a Matrix? We review the basic matrix operations. An array of numbers a a 1n A = a m1...

1 Matrices and Systems of Linear Equations. a 1n a 2n

10. Linear Systems of ODEs, Matrix multiplication, superposition principle (parts of sections )

Matrix Arithmetic. a 11 a. A + B = + a m1 a mn. + b. a 11 + b 11 a 1n + b 1n = a m1. b m1 b mn. and scalar multiplication for matrices via.

Introduction. Vectors and Matrices. Vectors [1] Vectors [2]

CS100: DISCRETE STRUCTURES. Lecture 3 Matrices Ch 3 Pages:

1 The Basics: Vectors, Matrices, Matrix Operations

Linear Algebra March 16, 2019

Digital Workbook for GRA 6035 Mathematics

Unit 3: Matrices. Juan Luis Melero and Eduardo Eyras. September 2018

1 Matrices and Systems of Linear Equations

A Review of Matrix Analysis

Math 123, Week 2: Matrix Operations, Inverses

Math 360 Linear Algebra Fall Class Notes. a a a a a a. a a a

Introduction to Matrix Algebra

A primer on matrices

Math Camp II. Basic Linear Algebra. Yiqing Xu. Aug 26, 2014 MIT

x + 2y + 3z = 8 x + 3y = 7 x + 2z = 3

MTH 35, SPRING 2017 NIKOS APOSTOLAKIS

Linear Algebra (Review) Volker Tresp 2017

Chapter 5. Linear Algebra. A linear (algebraic) equation in. unknowns, x 1, x 2,..., x n, is. an equation of the form

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

TOPIC III LINEAR ALGEBRA

Matrices and Vectors. Definition of Matrix. An MxN matrix A is a two-dimensional array of numbers A =

Chapter 4 - MATRIX ALGEBRA. ... a 2j... a 2n. a i1 a i2... a ij... a in

7.6 The Inverse of a Square Matrix

Linear Systems and Matrices

Fall Inverse of a matrix. Institute: UC San Diego. Authors: Alexander Knop

3 Matrix Algebra. 3.1 Operations on matrices

Vectors and matrices: matrices (Version 2) This is a very brief summary of my lecture notes.

Linear algebra. S. Richard

Linear Algebra (Review) Volker Tresp 2018

A matrix over a field F is a rectangular array of elements from F. The symbol

Matrices. Math 240 Calculus III. Wednesday, July 10, Summer 2013, Session II. Matrices. Math 240. Definitions and Notation.

chapter 5 INTRODUCTION TO MATRIX ALGEBRA GOALS 5.1 Basic Definitions

is a 3 4 matrix. It has 3 rows and 4 columns. The first row is the horizontal row [ ]

Matrix representation of a linear map

Transcription:

DM559 Linear and Integer Programming Lecture 3 Matrix Operations Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark

Outline and 1 2 3 and 4 2

Outline and 1 2 3 and 4 3

and Definition (Matrix) A matrix is a rectangular array of numbers or symbols It can be written as a 11 a 12 a 1n a 21 a 22 a 2n a m1 a m2 a mn We denote this array by a single letter A or by (a ij ) and we say that A has m rows and n columns, or that it is an m n matrix The size of A is m n The number a ij is called the (i, j) entry or scalar 4

A square matrix is an n n matrix and The diagonal of a square matrix is the list of entries a 11, a 22,, a nn The diagonal matrix is a matrix n n with a ij = 0 if i j (ie, a square matrix with all the entries which are not on the diagonal equal to 0): a 11 0 0 0 a 22 0 0 0 a mn Definition (Equality) Two matrices are equal if they have the same size and if corresponding entries are equal That is, if A = (a ij ) and B = (b ij ) are both m n matrices, then: A = B a ij = b ij 1 i m, 1 j n 5

Matrix Addition Definition (Addition) If A = (a ij ) and B = (b ij ) are both m n matrices, then and A + B = (a ij + b ij ) 1 i m, 1 j n matrix A a 11 a 12 a 1n a 21 a 22 a 2n a m1 a m2 a mn + + + matrix B + b 11 b 12 b 1n b 21 b 22 b 2n b m1 b m2 b mn Eg: A + B = [ ] 3 1 2 + 0 5 2 [ ] 1 1 4 =? 2 3 1 c 11 c 12 c 1n c 21 c 22 c 2n c m1 c m2 c mn element-wise operation matrix C = A + B 6

Scalar Matrix Multiplication and Definition (Scalar Multiplication) If A = (a ij ) is an m n matrix and λ R, then λa = (λa ij ) 1 i m, 1 j n Eg: 2A =? element-wise operation 7

Matrix Multiplication and Two matrices can be multiplied together, depending on the size of the matrices Definition (Matrix Multiplication) If A is an m n matrix and B is an n p matrix, then the product is the matrix AB = C = (c ij ) with c ij = a i1 b 1j + a i2 b 2j + + a in b nj a i1 a i2 a in b 1j b 2j b nj What is the size of C? 8

a11 a1k a1p ai1; aik; ai p; an1 ank anp A : n rows p columns b11 b1j ; b1q bk1 bk j ; bkq bp1 bp j ; bpq B : p rows q columns c11 c1j c1q ci1 ci j ; ci q cn1 cnk cnq C = A B : n rows q columns ai1 b1j aik bk j aip bp j + + + + Not an element-wise operation!

and 1 1 1 AB = 2 0 1 3 0 1 2 4 1 1 = 1 3 2 2 1 3 4 5 3 1 14 9 1 (2)(3) + (0)(1) + (1)( 1) = 5 The motivation behind this definition is that it allows to deal conveniently with several tasks in linear algebra Think about the way we rewrote a system of linear equations using this definition 10

and AB BA in general, ie, not commutative try with the example of previous slide A = A = [ ] 2 1 3 1 2 1 [ ] 1 2 3 4 3 1 B = 1 0 AB is 2 2 and BA is 3 3 1 1 B = [ ] 1 1 0 1 ok sizes but AB BA 11

Matrix Algebra and are useful because they provide compact notation and we can perform algebra with them Bear in mind to use only operations that are defined In the following rules, the sizes are dictated by the operations being defined commutative A + B = B + A Proof? associative: (A + B) + C = A + (B + C) λ(ab) = (λa)b = A(λB) (AB)C = A(BC) distributive: A(B + C) = AB + AC (B + C)A = BA + CA λ(a + B) = λa + λb Size? Why both first two rules? 12

Zero Matrix and Definition (Zero Matrix) A zero matrix, denoted 0, is an m n matrix with all entries zero: 0 0 0 0 0 0 0 0 0 additive identity: A A = 0 A + 0 = A A A = 0 0A = 0, A0 = 0 13

Identity Matrix and Definition (Identity Matrix) The n n identity matrix, denoted I n or I is the diagonal matrix with a ii = 1: zero: 1 0 0 0 1 0 I = 0 0 1 multiplicative identity (like 1 does for scalars) AI = A and IA = A A of size m n What size is I? the identity matrix must be a square matrix Exercise: 3A + 2B = 2(B A + C) 14

Matrix Inverse and If AB = AC can we conclude that B = C? A = [ ] 0 0, B = 1 1 AB = AC = [ ] 0 0 4 4 [ ] 1 1, C = 3 5 but hold on, this might be just a lucky case [ ] 8 0 4 4 A + 5B = A + 5C = B = C addition and scalar multiplication have inverses ( A and 1/c) Is there a multiplicative inverse? 15

Inverse Matrix Definition (Inverse Matrix) The n n matrix A is invertible if there is a matrix B such that and AB = BA = I where I is the n n identity matrix The matrix B is called the inverse of A and is denoted by A 1 A = Theorem [ ] [ ] 1 2 2 1, B = 3 4 3/2 1/2 If A is an n n invertible matrix, then the matrix A 1 is unique Proof: Assume A has two inverses B, C so AB = BA = I and AC = CA = I Consider the product CAB: CAB = C(AB) = CI = C CAB = (CA)B = IB = B associativity + AB = I associativity + CA = I 16

and If a matrix has an inverse we say that it is invertible or non-singular If a matrix has no inverse we say that it is non-invertible or singular Eg: [ 0 0 1 1 ] [ ] a b c d [ ] 1 0 0 1 If A = [ ] a b, ad bc 0 c d then A has the inverse [ ] A 1 1 d b = ad bc c a ad bc 0 check that this is true The scalar ad bc is called determinant of A and denoted A 17

Matrix Inverse and Back to the question: If AB = AC can we conclude that B = C? If A is invertible then the answer is yes: A 1 AB = A 1 AC = IB = IC = B = C But AB = CA then we cannot conclude that B = C Note: the operation of matrix division is not defined! 18

Properties of the Inverse and Let A be invertible = A 1 exists (A 1 ) 1 = A (λa) 1 = 1 λ A 1 the inverse of the matrix (λa) is a matrix C that satisfies (λa)c = C(λA) = I Using matrix algebra: (λa) ( ) 1 λ A 1 = λ 1 λ AA 1 = I and ( ) 1 λ A 1 (λa) = 1 λ λa 1 A = I (AB) 1 = B 1 A 1 19

Powers of a matrix and For A an n n matrix and r N A r = AA A }{{} r times For the associativity of matrix multiplication: (A r ) 1 = (A 1 ) r A r A s = A r+s (A r ) s = A rs 20

Transpose Matrix and Definition (Transpose) The transpose of an m n matrix A is the n m matrix B defined by b ij = a ji for i = 1,, n and j = 1,, m It is denoted A T a 11 a 12 a 1n a 11 a 21 a m1 a 21 a 22 a 2n a 12 a 22 a m2 A = (a ij ) = AT = (a ji ) = a m1 a m2 a mn a 1n a 2n a nm [ ] [ ] 1 0 1 3 We reflect the matrix about its main diagonal 3 1 0 1 Note that if D is a diagonal matrix: D T = D 21

Properties of the transpose and (A T ) T = A (λa) T = λa T (A + B) T = A T + B T (AB) T = B T A T (consider first which matrix sizes make sense in the multiplication, then rewrite the terms) if A is invertible, (A T ) 1 = (A 1 ) T A T (A 1 ) T = (A 1 A) T = I T = I using (AB) T = B T A T (A 1 ) T A T = (AA 1 ) T = I T = I using (AB) T = B T A T 22

Symmetric Matrix and Definition (Symmetric Matrix) A matrix A is symmetric if it is equal to its transpose, A = A T (only square matrices can be symmetric) 23

Outline and 1 2 3 and 4 24

and An n 1 matrix is a column vector, or simply a vector: v 1 v 2 v = v n The numbers v 1, v 2, are known as the components (or entries) of v A row vector is a 1 n matrix We write vectors in lower boldcase type (writing by hand we can either underline them or add an arrow over v) Addition and scalar multiplication are defined for vectors as for n 1 matrices: v 1 + w 1 λv v 2 + w 2 λv v + w = λv = element-wise operations v n + w n λv 25

and For a fixed n, the set of vectors together with the operations of addition and multiplication form the set R n, usually called Euclidean space For vectors v 1, v 2,, v k in R n and scalars α 1, α 2,, α k in R, the vector v = α 1 v 1 + α 2 v 2 + + α k v k is known as linear combination of the vectors v 1, v 2,, v k A zero vector is denoted by 0; 0 + v = v + 0 = v; 0v = 0 The matrix product of v and w cannot be calculated The matrix product of v T w gives an 1 1 matrix The matrix product of vw T gives an n n matrix 26

Inner product of two vectors and Definition (Inner product) Given v 1 v 2 v = v n w 1 w 2 w = w n the inner product denoted v, w, is the real number given by v 1 w 1 v 2 v, w =, w 2 = v 1 w 1 + v 2 w 2 + + v n w n = v T w v n w n It is also called scalar product or dot product (and written v w) 27

w 1 v T w = [ ] w 2 v 1 v 2 v n = v 1w 1 + v 2 w 2 + + v n w n w n and Theorem The inner product x, y = x 1 y 1 + x 2 y 2 + + x n y n, x, y R n satisfies the following properties for all x, y, z R n and for all α R: x, y = y, x α x, y = αx, y = x, αy x + y, z = x, z + y, z x, x 0 and x, x = 0 if and only if x = 0 Note: vectors from different Euclidean spaces live in different worlds 28

Outline and 1 2 3 and 4 29

and Let A be an m n matrix a 11 a 12 a 1n a 21 a 22 a 2n a m1 a m2 a mn and denote the columns of A by the column vectors a 1, a 2,, a n, so that a 1i a 2i a i =, i = 1,, n a mi and Then if x = (x 1, x 2,, x n ) T is any vector in R n Ax = x 1 a 1 + x 2 a 2 + + x n a n (ie, vector Ax in R m is a linear combination of the column vectors of A) 30

Resume and We saw Matrix Algebra We can now prove two theorems on linear systems 31

Outline and 1 2 3 and 4 32

Solution Sets of Linear Systems and Theorem A system of linear equations either has no solution, a unique solution or infinitely many solutions Proof Let s assume the system Ax = b has two distinct solutions p and q, that is: Ap = b Aq=b p q 0 Let t be any scalar and v = p + t(q p), t R Then: Av = A(p + t(q p)) = Ap + t(aq Ap) = b + t(b b) = b that is, v is a solution of Ax = b and since p q 0 and there are infinitely many choices for t, then there are infinitely many solutions for Ax = b 33

and Theorem (Principle of Linearity) Suppose that A is an m n matrix, that b R m and that the system Ax = b is consistent Suppose that p is any solution of Ax = b Then the set of all solutions of Ax = b consists precisely of the vectors p + z for z N(A); ie, {x Ax = b} = {p + z z N(A)} Proof: We show that 1 p + z is a solution for any z in the null space of A ({p + z z N(A)} {x Ax = b}) 2 all solutions, x, of Ax = b are of the form p + z for some z N(A) ({x Ax = b} {p + z z N(A)}) 1 A(p + z) = Ap + Az = b + 0 = b so p + z {x Ax = b} 2 Let x be a solution Because p is also we have Ap = b anda(x p) = Ax Ap = b b = 0 so z = x p is a solution of Az = 0 and x = p + z (Check validity of the theorem on the last examples of previous lecture) 34