Saturday, July 25, 2020

Matrix Algebra - Notes

Here are the notes for the Matrix Algebra Section in the Linear Programming Unit.  Let me know if there are any questions.

A matrix is a rectangular array of numbers.  The numbers in the array are called in entries in the matrix.  The entry that occurs in row i and column j of the matrix A will be denoted by a_ij.  A general m x n (m by n) matrix has the form of m rows and n columns.  The first row has entries a_11, a_12, .., a_1n.  The second row has entries a_21, a_22, ..., a_2n.  The mth row has entries a_m1, a_m2, ..., a_mn.  Example: Consider the 2 X 3 matrix A with 1st row 4, 6, 5/7 and 2nd row with entries -2, 8, 9.  Note that a_11 = 4, a_12 = 6, a_13 = 5/7, a_21 = -2, a_22 = 8, and a_23 = 9.  Two matrices A and B are equal, written A = B, if they have the same size and their corresponding entries are equal, i.e. a_ij = b_ij for all i and j.

Example: Note that the matrix with first row 1, 4 and second row 6, 2 is equal to the matrix with first row a, b and second row c, d if and only if a = 1, b = 4, c = 6, and d = 2.  Non-example: Notice that the matrix A with row 1 entries 2, 9, 3 and row 2 entries 6, 5, 7 is not equal to matrix B with row 1 entries 2, 9, 3 and 6, 4, 7 because a_22 = 5 is not equal to 4 = b_22.  Next, we will discuss addition and subtraction of matrices.  Definition: If A and B are matrices of the same size, then the sum A + B is the matrix obtained by adding the entries of B to the corresponding entries of A.  The difference, A - B, is the matrix obtained by subtracting the entries of B from the corresponding entries of A.  Matrices of different sizes cannot be added or subtracted and their sums and differences are said to be undefined.  Examples: The matrix with row 1 given by 6, 4, 7 and row 2 given by 2, 8, 5 plus the matrix with row 1 given by 8, 1, 2 and row 2 given by 1, 4, 3 is equal to the matrix with row 1 given by 14, 5, 9 and row 2 given by 3, 12, 8.  The matrix with row 1 given by 1, 7 and row 2 given by 6, 9 minus the matrix with row 1 given by 8, 2 and row 2 given by 4, 3 is equal to the matrix with row 1 given by -7, 5 and row 2 given by 2, 6.

Note that the matrix with entries in row 1 given by 8, 6, 1 and entries in row 2 given by 4, 5, 2 plus the matrix with row 1 being 1 row 2 being 9 and row 3 being 7 is undefined because their sizes are not the same.  Similarly the matrix with 1 in the first row and 2 in the second row minus the matrix with 3, 6 in the first row and 4, 7 in the second row cannot be defined.  We can also multiply any matrix by a scalar (constant).  Definition:  If A is any matrix and c is any scalar, then the product cA is a the matrix obtained by multiplying each entry in A by c. The matrix cA is said to be a scalar multiple of A.  Example: Let A be the matrix with entries in row 1 given by 4, 2, 6, 8 and entries in row 2 given by 1, 7, 5, and 2.  Let matrix B be given by 1 in the first row, 4 in the second row, and -5 in the third row.  Then, 3A is equal to the matrix with first row entries 12, 6, 18, 24 and second row entries 3, 21,15, 6.  Also, -7B is equal to the matrix with first row entry -7, second row entry -28, and third row entry 35.

Next, we will discuss how to find the product of two matrices.  Definition: If A is an m x r matrix and B is an r x n matrix, then AB is an m x n matrix determined as follows: if A is the matrix with row 1 entries a_11, a_12, ..., a_1r, row 2 entries a_21, a_22, ..., a_2r, and row m entries a_m1, a_m2, ..., a_mr and B is a matrix with row 1 entries b_11, b_12, ..., b_1n, row 2 entries b_21, b_22, ..., b_2n, ..., row r entries b_r1, b_r2,..., b_rn, then AB is the matrix with row 1 entries: a_11 b_11 + a_12 b_21 + ... + a_1r b_r1, a_11 b_12 + a_12 b_22 + ... + a_1r b_r2, ..., a_11 b_1n + a_12 b_2n + ... + a_1r b_rn, row 2 entries: a_21 b_11+ a_22 b_22 + ... + a_2r b_r1, a_21 b_12 + a_22 b_22 + ... + a_2r b_r2, ..., a_21 b_1n + a_22 b_2n + ... + a_2r b_rn, ..., mth row entries: a_m1 b_11 + a_m2 b_21 + ... + a_mr b_r1, a_m1 b_12 + a_m2 b_22 + ... + a_mr b_r2, ..., a_m1 b_1n + a_m2 b_2n + ... + a_mr b_rn.  To find the entry in row i and column j of AB, single out row i from A and column j from B.  Multiply the corresponding entries from the row and column together and add the resulting products.  Example: The matrix with row 1 entries 1, 7 times the matrix with row 1 entries 6, 4, 5 and row 2 entries: 3, 8, 9 is equal to the matrix with row 1 entries (1)(6) + (7)(3), (1)(4) + (7)(8), (1)(5) + (7)(9) which equals the matrix with row 1 entries 27, 60, 68.

Example: The matrix with row 1 entries 6, -2 and row 2 entries -8, 4 times the matrix with row 1 entries 1/7, 1/8 and row 2 entries 5, 3 is the matrix with row 1 entries -9 1/7, -5 1/4 and row 2 entries: 18 6/7, 11.  Example: The matrix with row 1 entries 3, 8, 5 and row 2 entries: 2, 4, 7 times the matrix with row 1 entries 4, 1, 9 and row 2 entries 8, 9, 7 is undefined because the number of columns of the first matrix is not equal to the number of rows of the second matrix.  Why do we study matrices?  They can be used to determine solutions to systems of linear equations.  The system of equations  ax + by = e and cx + dy = f can be transformed to the matrix with row 1 entries a, b and row 2 entries c, d times the matrix with row 1 entry x row 2 entry y equals the matrix with row 1 entry e and row 2 entry f.  For example, the system of equations 5x - 7y = 4, 6x + 2y = 9 can be transformed to the matrix with first row entries 5, -7 and second row entries 6, 2 times the matrix with x in the first row and y in the second row equals the matrix with 4 in the first row and -9 in the second row.

For the system ax + by = e, cx + dy = f, we write the matrix with first row entries a, b second row entries c, d times the matrix with first row entry x second row entry y equals the matrix with first row e, second row f.  We can write what we expressed previously as Av = w where A is the 2 X 2 matrix with first row a, b second row c, d and v being the matrix with x and y and w being the matrix with e and f.  If the inverse of A exists, then Av = w implies that v = A inverse times w.  Thus, A inverse times w will give the solutions to our system.  Next, we will discuss when the inverse of a matrix exists.  Let A be the matrix with first row entries a, b and second row entries c, d.  If ad - bc is not equal to 0, then A inverse exists.  Also, we define (for a 2 x 2 matrix A), A inverse is equal to 1/(ad - bc) times the matrix with first row entries d, -b and second row entries -c, a.

Example: If matrix A has first row entries 2, 6 and second row entries 4, 7, then (2)(7) - (6)(4) = -10 which is not equal to 0, and so A inverse exists.  Also, A inverse equals 1/(-10) times matrix with first row entries 7, -6 and second row entries -4, 2 which equals the matrix with first row entries -7/10, 3/5 and second row entries 2/5, 1/5.  Example: If the matrix B has first row entries 1, 3 and second row entries 2, 6, then (1)(6) - (3)(2) = 0 and so B does not have an inverse.  Theorem: Let ax + by = e, cx + dy = f be a system of equations.  Let A be the matrix with first row entries a, b and second row entries c, d, v be the matrix with x in the first row and y in the second row, and w be the matrix with e in the first row and f in the second row.  Then, the system of equations can be written as Av = w and: 1. there is a solution to the system given by v = A inverse times w if A inverse exists, 2.  the system has no solutions or infinitely many solutions if A inverse does not exist.  No solutions: if cx + dy = f is not a multiple of ax + by = e.  Infinitely many solutions: if cx + dy = f is a multiple of ax + by = e.

Example: The system of equations 2x + 3y = 4, 5x + 6y = 7.  Convert to the matrix with first row entries 2, 3 and second row entries 5, 6 times the matrix with first row entry x and second row entry y equals the matrix with first row entry 4 and second row entry 7.  Note that the matrix has an inverse since (2)(6) - (3)(5) is not 0.  The inverse of the matrix is the matrix with first row entries -2, 1 and second row entries 5/3, -2/3.  Hence, we get that the matrix with first row entry x and second row entry y is equal to the matrix with first row entries -2, 1 and second row entries 5/3, -2/3 times the matrix with first row entry 4 and second row entry 7.  The multiplication yields the matrix with first row -1 and second row 2, and so x = -1 and y = 2.  We can check by substituting into the original system: 2(-1) + 3(2) = 4 and 5(-1) + 6(2) = 7.  Hence, the answer is indeed correct.

Example: 3x + 4y = 5, 6x + 8y = 10.  Convert to a matrix with first row entries 3, 4 and second row entries 6, 8 times a matrix with first row entry x and second row entry y equals a matrix with first row entry 5 and second row entry 10.  Since (3)(8) - (4)(6) = 0, the inverse does not exist.  Since 6x + 8y = 10 is obtained by multiplying 2 to 3x + 4y = 5, there are infinitely many solutions given by the matrix with first row x and second row y equal to the matrix with first row x and second row (1/4)(5 - 3x) from 3x + 4y = 5 implying that y = (1/4)(5 - 3x) and 6x + 8y = 10 implying that y = (1/4)(5 - 3x).  An example of a solution could be obtained by taking x = 0 and y = (1/4)(5 - 3(0)) = 5/4.  We could also have the solution matrix with first row x and second row y equals the matrix with first row (5 - 4y)/3 and second row y.

Example: The system 4x + 8y = 7, 4x + 8y = 9.  Convert to the matrix with first row entries 4, 8 and second row entries 4, 8 times the matrix with first row entry x and second row entry y equals the matrix with first row entry 7 and second row entry 9.  Since (4)(8) - (4)(8) = 0, the matrix does not have an inverse.  Since 4x + 8y = 9 is not a multiple of 4x + 8y = 7, it follows that the system does not have any solutions.



No comments:

Post a Comment