230 likes | 427 Views
GG 313 Lecture 11 Chapter 3 Linear (Matrix) Algebra Sept 27, 2005. Homework due today:
E N D
GG 313 Lecture 11 Chapter 3 Linear (Matrix) Algebra Sept 27, 2005
Homework due today: 1st problem: “…do these data support the claim that on average higher concentrations were obtained before cleaning versus after cleaning?”What is the hypothesis? Null hypothesis? One-sided or 2-sided? What is your conclusion? 2nd problem:”…test whether the number of days with ozone standards exceeded is different for urban versus rural sites.”What is the hypothesis? Null hypothesis? One-sided or 2-sided? What is your conclusion?
Degrees of freedom: The degrees of freedom, , are the number of values in the final calculation of a statistic that are allowed to vary. MEAN: (x1+….+xn)/n n values can vary, so =n VARIANCE (std.dev.): sum((xi-mean)2)/(n) How many free variables? If we know all of the xi values except one, we can calculate the last one. Multiply the mean2 by n and subtract each known xi2. The remainder will be the unknown xi2. Since there are n-1 values free to vary, =n-1 for the variance.
Degrees of freedom: When we get to curve fitting, we will have two statistics - slope and y-intercept for example, which will reduce the degrees of freedom by 2. Example: It takes two points to define a straight line with no degrees of freedom. A circle requires three points to be defined with no degrees of freedom. This means that if you ONLY have two points on a curve, it might have any shape, but you can define a straight line that will fit those points exactly. With three points, you can define a circle exactly.
MATRIX ALGEBRA Some history*: The beginnings of matrices and determinants goes back to the second century BC although traces can be seen back to the fourth century BC. However it was not until near the end of the 17th Century that the ideas reappeared and development really got underway. *http://wwwgroups.dcs.stand.ac.uk/~history/HistTopics/Matrices_and_determinants.html
It is not surprising that the beginnings of matrices and determinants should arise through the study of systems of linear equations. The Babylonians studied problems which lead to simultaneous linear equations and some of these are preserved in clay tablets which survive. For example a tablet dating from around 300 BC contains the following problem: -There are two fields whose total area is 1800 square yards. One produces grain at the rate of 2/3 of a bushel per square yard while the other produces grain at the rate of 1/2 a bushel per square yard. If the total yield is 1100 bushels, what is the size of each field.
The Chinese, between 200 BC and 100 BC, came much closer to matrices than the Babylonians. Indeed it is fair to say that the text Nine Chapters on the Mathematical Art written during the Han Dynasty gives the first known example of matrix methods. First a problem is set up which is similar to the Babylonian example given above: -There are three types of corn, of which three bundles of the first, two of the second, and one of the third make 39measures. Two of the first, three of the second and one of the third make 34 measures. And one of the first, two of the second and three of the third make 26 measures. How many measures of corn are contained of one bundle of each type?
Now the author does something quite remarkable. He sets up the coefficients of the system of three linear equations in three unknowns as a table on a 'counting board'. bundles 1 2 3 type 1 corn 2 3 2 type 2 3 1 1 type 3 26 34 39 measures
the author, writing in 200 BC, instructs the reader to multiply the middle column by 3 and subtract the right column as many times as possible, the same is then done subtracting the right column as many times as possible from 3 times the first column. This gives 0 0 3 4 5 2 8 1 1 39 24 39
Next the left most column is multiplied by 5 and then the middle column is subtracted as many times as possible. This gives 0 0 3 0 5 2 36 1 1 type 3 99 24 39 measures
from which the solution can be found for the third type of corn, then for the second, then the first by back substitution. This method, now known as Gaussian elimination, would not become well known until the early 19th Century.
Let’s get into it. • In a great many cases, the simplest way to describe a set of relationships uses matrix algebra. • Matrices are like plain numbers in many ways - they can be added and subtracted, and, in some cases, multiplied and divided and inverted. • Some operations have unexpected results, such as AB≠BA in general, and it is possible for A2 to equal zero when A ≠0. • As we shall see, matrix algebra is an important tool for solving real-world problems.
A matrix is an array of elements - usually numbers - arranged in a series of m rows and n columns. The ORDER of a matrix specifies m and n. The matrix above has order 3x5.
The elements of a matrix are specified by the ith row and jth column. In the matrix above, the element a(3,1) is in row three column 1. A(3,1)=-60, a(2,5)=-10, for example. Matrix notation usually has matrix names in BOLD capital letters. Matrices provide a compact notation for manipulation of large groups of numbers. Matrix operations are easily visualized without worrying about the large number of elements. A few standard operations are all that are needed.
“Matlab” stands for “matrix laboratory”, and its commands and formats are explicitly designed for matrix operations. DEFINITIONS: A scalar is a 1x1 matrix, or just a single number. VECTOR: A matrix with a single row or column. A column vector has a single column: B(n,1) A row vector has a single row: A(1,n) B above has an order (5,1) and A has order (1,3).
A null matrix has all elements equal to zero. The matlab function zeros(m,n) generates a null matrix of order m,n. Similarly the Matlab function ones(m,n) generates a matrix where all elements equal one. A square matrix has the same number of rows and columns. A diagonal matrix is a square matrix with the only non-zero elements along the diagonal (i=j). We shall see that diagonal matrices are important for scaling the values in other matrices.
The identity matrix is a diagonal matrix (designated: I) where the diagonal elements equal 1. Matlab generates identity matrices with the function eye (m). The following is an order 7,7 identity matrix: The function eye(m,n) generates a non-square diagonal matrix where the elements on the principal diagonal alone equal 1. See above right.
A triangular matrix has zeros on one side of the diagonal. An upper triangular matrix has all elements below the diagonal equal to zero: A fully populated matrix has all values non-zero. A sparse matrix has few non-zero elements.
A symmetric matrix is symmetric around the diagonal: A skew-symmetric matrix in which aij=-aji.
Note that the diagonal elements are zero in the skew-symmetric matrix. This is because aij cannot equal -aji unless the value is zero when i=j. A matrix operation that is particularly important is transpose. The transpose of a nxm matrix is a mxn matrix in which the rows and columns are switched from the original:
Note that the transpose of a symmetric matrix is itself: ST=S The transform of a skew-symmetric matrix, S, is -SS. SST=-SS The trace of a matrix, trA, is the sum of the diagonal elements, useful in calculating various quantities discussed later. In Matlab: function: trace(A)
We can generate sub-matrices from larger matrices just by grabbing appropriate sections. For example: >> A=randint(5,7,10) % generates random integer matrix A = 9 7 6 4 0 2 0 2 4 7 9 3 1 7 6 0 9 9 8 6 4 4 8 7 4 0 2 9 8 4 1 8 1 1 4 >> B=A(1:3,4:7) % generates a sub-matrix of A B = 4 0 2 0 9 3 1 7 9 8 6 4
In -class exercise: Generate a random integer column vector A of order 6. Generate B=Transpose A Generate C= Transpose B Generate an order 4x4 random integer matrix, D Change enough values to make it symmetric Generate E= transpose D Generate F by making E skew-symmetric Generate G= Transpose E Multiply G by -1.