1 / 58

Matrix Arithmetic for Use in the Biological Sciences

Matrix Arithmetic for Use in the Biological Sciences . Animal Science 500 Lecture No. 18 & 19 November 9, 2010. Matrix Arithmetic and Algebra. References

galya
Download Presentation

Matrix Arithmetic for Use in the Biological Sciences

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Matrix Arithmetic for Use in the Biological Sciences Animal Science 500 Lecture No. 18 & 19 November 9, 2010

  2. Matrix Arithmetic and Algebra • References • Matrix Algebra for the Biological Sciences – S. R. Searle. 1966. John Wiley & Sons, New York, N.Y. (This book is older and out of print. For those interested in a copy, there are used copies available from resellers from various internet sites.) • Linear Algebra for Dummies – M. J. Sterling. 2009. John Wiley & Sons, New York, N.Y. (This book is relatively new and can be purchased new or used from numerous resellers found on the internet.) ISBN number: 978-0-470-43090-3

  3. Matrix Arithmetic and Algebra – Why? • “The simulation of physiological systems requires a mathematical base and in most cases a large computer.” (W. J. Dixon, 1966) • Attempting to turn what we observe or what is occurring physiologically or what is commonly referred to as a “phenotype” into a mathematical model. • Explain experimental results • Explain various environmental factor • Today biological sciences are very much quantitative whereas years ago it was more descriptive

  4. What is Matrix Algebra • Is in a way a shorthand notation for the language of mathematics • Provides the ability to deal with many numbers and / or equations simultaneously • A matrix is simply a rectangular array of numbers set out in rows and columns. • Is frequently used in organizing the presentation of numerical data that will be handled in some way mathematically. • Common examples • Animal breeding – solving equations to estimate variance components and breeding values • Solving simultaneous equations – nutritional nutrient balancing • Data analysis – any procedure that involves linear equations involves the use of matricies.

  5. Matrix and Regression Analysis • An example that illustrates the wide spread use of matrix and matrix algebra y = b0 + b1 x1 + b2 x2 + … + bkxk Where there are numerous observations on the variable y and on each of the k variables x1,x2, ….xk. b’s values can be obtained when X’Xb = X’y as b = (X’X)-1 X’y is solved. Where X and y are both matrices representing all of the observations in the x and y variables respectively and b represent the series of b’s

  6. Matrix Algebra • Is a mathematical procedure for many problems of any size (small and large) can be described. • Hence, size does not affect the understanding of the procedures just the amount of calculating or computer time required to solve the equations.

  7. General description of a Matrix • A matrix is an aid in organizing data. Example: From Searle, 1966 Table 1. Percentage of sterile cultures among different populations in successive generations.

  8. General description of a Matrix • Extract the numbers within the results and written into a matrix • This array of number is called a matrix. • Position of the entry within the array determines or defines its meaning. • For example the third entry in the second row represents the percentage of sterile cultures observed in the second generation in population 3

  9. Matrix Algebra Notation • Algebra is arithmetic with letters of the alphabet representing numbers. The first two rows of the previous matrix would be: Could be written as A =

  10. Matrix Algebra Notation • Since using letters would limit us to 26 entries A = The individual entries a1, a2, a3, … b3are called elements of the array or matrix The integers 1, 2, & 3 are called subscripts and in this they represent the column where each element is located.

  11. Matrix Algebra Notation • This notation can be carried further: A = Again the individual entries a11, a12, a13, … b23 are called elements of the array or matrix This time two integers 11, 12, 13, … 23 are called subscripts and in this they represent the row and column where each element is located. The first number represents the row and the second represents the column

  12. Summation Notation • Suppose we want to add five numbers representing a1, a2, a3, a4, a5. Easily this can be written a1 + a2 + a3 + a4 + a5. It can also be expressed in words as ‘the sum of all values of aifor i = 1, 2, …., 5. The phrase “the sum of all values of” is typically written by the capital form of the Greek letter sigma ∑

  13. Summation Notation • Accordingly the sum of the a’s is written • ∑aifor I = 1, 2, …..,5. • A further abbreviation is Many variations to this = a1+ a2 + a3 + a4 + a5. = a1+ a2 + a3.

  14. Summation Notation • and still more variations = x1+ x2+ x3 and = x1 + x2 + x3………xn-2 + xn-1 + xn

  15. Summation Notation • and still more variations = y1 + y2 + y3 + y4 = y3+ y4 + y5 + y6 + y7 and = y3 + y5 + y6 + y7

  16. Summation Notation • and still more variations = a11+ a12 + a13 and = a1j + a2j

  17. Definition of a Matrix • A matrix is a rectangular (or square) array of numbers arranged in rows and columns. • The rows are equal length • The columns are equal length • Let aijrepresent denote the element in the ith row and the jth column of matrix A. • A has r rows and c columns and can be written as follows:

  18. Definition of a Matrix A =

  19. Definition of a Matrix • A = • The curly brackets indicating that aij is a typical element the limits i and j being r and c respectively • The element aij is sometimes called the ijth element. { Aij} for I = 1, 2, …, r, and j = 1, 2, …, c,

  20. Definition of a Matrix • Thus a23 is the element in the second row and the third column. • The size of the matrix is called its order (or sometimes its dimensions) • The matrix called A with r rows and c columns has an order r x c (read “r” by “c”) • When the number of rows equals the number of columns, A is square and is called a “square matrix” and is described have the order r

  21. Definition of a Matrix • In the square matrix, elements a11, a22, a33…arr are referred to as the diagonal elements. • The sum of the diagonal elements is called the trace of the matrix. • In every case the first term in the first row of a matrix, a11 is called the leading term.

  22. Definition of a Matrix • Again a simple example of a matrix, one of order 2 x 3 is as follows: • When all of the non-diagonal elements are zero the matrix is called a diagonal matrix. A 2 x 3 = A =

  23. Definition of a Matrix • If all elements above or below the diagonal are zero, the matrix is called a triangular matrix. B = Upper triangular matrix C = Lower triangular matrix

  24. Matrix Vectors and Scalars • A matrix consisting of a single column is called a column vector. x = • A vector is an ordered collection of numbers. • Vectors containing two or three numbers are represented by rays, or a line segment • with an arrow on the end. A ray loses its effect or meaning when you deal with larger vectors and numbers. • Technically a vector is a column matrix so also called a column vector

  25. Matrix Vectors and Scalars • A matrix consisting of a single row is called a row vector. y =

  26. Matrix Vectors and Scalers • A single number such as 2, 6, 4, -4, or 0.2 is called a scalar. • A scalar will generally be multiplied by all elements of a larger matrix. • Matrices are usually denoted by upper case letters and their elements by lower case letters with appropriate subscripts. • Vectors are denoted by lower case letters, usually from the end of the alphabet using the prime superscript to distingush a row vector from a column vector. • X = a column vector • X’ = a row vector

  27. Matrix Vectors and Scalers • λ is frequently used for denoting a scalar • You might see an array surrounded by

  28. Basic Matrix Operations • Addition A = B =

  29. Basic Matrix Operations • Addition A + B = A + B =

  30. Basic Matrix Operations • Addition • Two matrices can be added together only if the two matrices have the same order • Both matrices must have the same number of rows and columns • If the two matrices can be added together they are said to be conformable for addition

  31. Basic Matrix Operations • Subtraction • The difference between two matrices is the difference element by element

  32. Basic Matrix Operations • Addition A = If matrix b is ending wt. and matrix b is beginning wt. you would Subract b from a or B- A B =

  33. Basic Matrix Operations • Addition A = As was the case with adding matrices, only matrices with the same order can be Subtracted. So it can be said that the two matrices are conformable for subtraction. Hence, a matrix that is conformable for addition is also conformable for subtraction and vise versa.

  34. Basic Matrix Operations • Multiplying by a scalar λ . • λA = {λaij} λ = 3 and A = B - A = or A- (-B) =

  35. Basic Matrix Operations • Equality and the Null Matrix . • Two matrices are equal when they are identical element by element • A = B when {aij} = {bij} meaning that aij= bij • A matrix that is made up entirely of zeros is called a null matrix or a zero matrix • Not unique because for a matrix of any order there is a corresponding null matrix of the same order.

  36. Basic Matrix Operations • Multiplying matrices. • Multiplying two vectors • Example • Suppose there number of lambs having 0, 1, and 2 lambs respectively are written as a row vector call a’ a‘ = [58 26 8] • The number of lambs per ewe are written as a column vector call x 0 x = 1 2

  37. Basic Matrix Operations • Multiplying matrices. • Multiplying two vectors • Example • Suppose there number of lambs having 0, 1, and 2 lambs respectively are written as a row vector call a’ • The number of lambs per ewe are written as a column vector call x The product of a’ x = [ 58 26 8 ] 0 1 2 a’x = 58(0) + 26(1) + 8(2) = 42

  38. Basic Matrix Operations • Multiplying matrices. • Multiplying two vectors • Example • Suppose there number of lambs having 0, 1, and 2 lambs respectively are written as a row vector call a’ • The number of lambs per ewe are written as a column vector call x • This example shows you the general procedure for obtaining a’ x; • Multiply each element of the row vector a’ by the corresponding element of the column vector x and add the products

  39. Basic Matrix Operations • Multiplying matrices. • Multiplying two vectors • Thus the general for exists • a’ = [a1 + a2 + … + an] • X = x1 x2 . . . xn • The product of a’x = a1x1 + a2x2 + … anxn =

  40. Basic Matrix Operations • Multiplying matrices. • Multiplying matrix and a vector A = x is a column vector of

  41. Basic Matrix Operations • Multiplying matrices. • Multiplying matrix and a vector • You multiply each column by the corresponding single row element from x. A = = = 42 82 21

  42. Basic Matrix Operations • Multiplying matrices. • Multiplying matrix and a vector • Notation form A= and x = x1 x2 x3

  43. Basic Matrix Operations • Multiplying matrices. • Multiplying matrix and a vector • Notation form Ax= = The product of Ax of a matrix A and a column vector x is a column vector whose ith term Is the sum of products of the elements of the ith row of A each multiplied by the corresponding element of x. From this definition and from the example it is easily seen that Ax is defined only when the number of rows in A are equal to the number of elements in the rows of A (i.e. number of columns) is the same as the number of elements in the column vector x.

  44. Basic Matrix Operations • Multiplying matrices. • Multiplying matrix and a vector • The product of Ax of a matrix A and a column vector x is a column vector whose ith term • Is the sum of products of the elements of the ith row of A each multiplied by the corresponding element of x. From this definition and from the example it is easily seen that Ax is defined only when the number of rows in A are equal to the number of elements in the rows of A (i.e. number of columns) is the same as the number of elements in the column vector x. • Therefore when A has r rows and c columns and x is of the order c, Ax is a column vector of order r

  45. Basic Matrix Operations • Multiplying matrices. • Multiplying 2 matrices • A = • B =

  46. Basic Matrix Operations • Multiplying matrices. • Multiplying 2 matrices • A = B = A*B = =

  47. Basic Matrix Operations • Multiplying matrices. • Multiplying 2 matrices • In order to multiply matrix A by matrix B, the number of rows in matrix A must equal the number of columns in B.

  48. Transposing a Matrix • Transposing can best be described by showing an example • A = • A transpose

  49. Determinants • The determinant is a real number, it is not a matrix. • The determinant can be a negative number. • It is not associated with absolute value at all except that they both use vertical lines. • The determinant only exists for square matrices (2×2, 3×3, ... n×n). The determinant of a 1×1 matrix is that single value in the determinant. • The inverse of a matrix will exist only if the determinant is not zero.

  50. Determinants • The determinant of a 2×2 matrix is found much like a pivot operation. It is the product of the elements on the main diagonal minus the product of the elements off the main diagonal. • A= • Determinant = ad – bc= ad = 6 bc = 5 • Determinant = 6 – 5 = 1

More Related