Quiz 1) Simplify 9999 999 9999 998 9999 998 2) Locate your 1 st order neighbors Name Hometown Me Name Hometown Name Hometown Name Hometown
Solving Linear Algebraic Equa3ons
Basic Concepts Here only real vector and matrices are considered. Column vector Row vector Scalar product Norm (length)
Basic Concepts Matrix of order Matrix A is square if m = n Matrix A consists of columns of vectors a j
Basic Concepts Transpose of A: (becomes matrix of order n m) Diagonal matrix:
Basic Concepts Identity matrix Inverse of matrix A is A -1 satisfying A is symmetric if A is orthogonal if A is square and
Basic Concepts Lower triangular matrix Upper triangular matrix goes analogously Exponential (A is square matrix, I is identity matrix)
(1) Addition Matrix Algebra (2) Subtraction For (1) and (2), A, B, and C of the same order (3) Multiplication by a number (4) Product of two matrices (in general)
Exponential relations Matrix Algebra
Trace If A is square matrix of order n n, then Trace is the sum of the diagonal elements. for order The trace of a matrix A is the sum of its eigenvalues
Determinants A determinant is a real number associated with every square matrix. The determinant of a square matrix A is denoted by "det A" or A. The Leibniz formula for the determinant of an n n matrix A is
Determinants If A is a square matrix, then the minor of the entry in the i-th row and j-th column is the determinant of the sub-matrix formed by deleting the i-th row and j-th column. The (i,j) cofactor is obtained by multiplying the minor by (-1) i+j.
Determinants For n = 2: For n = 3 (example, operation along the 1 st row):
Determinants For n = 4 (example, operation along the 2 nd column):
Triangular determinant Determinants
Determinants (7) If all elements of a row (or a column) are multiplied by a constant c, the determinant is multiplied by c. (8) Exchange of two rows (or columns) changes the sign of the determinant.
Determinants (9) A determinant does not change if one row (column) multiplied by a constant is added to another row (column). (10) A determinant equals zero if (i) all elements of a row (column) are zero, or (ii) two rows (columns) coincide. (11) Sub-determinant D ij of order (n-1) (n-1) is formed by deleting the i th row and the j th column of D. Cofactor
Matrix Inversion The inverse of a square matrix A (also called reciprocal matrix), is a matrix A 1, such that where I is the identity matrix. If matrix A has an inverse, then it is called nonsingular or, also invertible. If linearly independent. columns (rows) are
Matrix Inversion There are many methods to calculate A 1 : (1) Cofactor method where C is the matrix cofactors. So
Matrix Inversion (2) Elementary row operations from which (3) Newton s method (4) Eigendecomposition (5) Cholesky decomposition (6) etc
Inversion of 2 2 matrices Inversion of 3 3 matrices
MATLAB Implementa3ons MATLAB has built-in functions/commands for matrix operations: >> det(a) - computes matrix determinant >> inv(a) - computes matrix inverse >> trace(a) - computes matrix trace >> eig(a) - computes eigenvalues >> rank(a) - computes matrix rank >> eye(a) - generates identity matrix >> diag(a) - returns matrix diagonal elements >> sum(diag(a)) - computes matrix trace etc.
MATLAB Implementa3ons Creating a simple solver/function that calculates the determinant of 3 3 matrices function [d] = Det3by3(a) % Function to calculate determinant matrices size 3x3 % Operation based on the 1st row row1 = a(1,:); dd1 = a(2,2)*a(3,3) - a(2,3)*a(3,2); dd2 = a(2,1)*a(3,3) - a(2,3)*a(3,1); dd3 = a(2,1)*a(3,2) - a(2,2)*a(3,1); d = (-1)^2*row1(1,1)*dd1 + (-1)^3*row1(1,2)*dd2 +... (-1)^4*row1(1,3)*dd3;
MATLAB Implementa3ons To use the solver, on the Command Window: >> u=[1,1,0;4,5,9;0,2,8] u = 1 1 0 4 5 9 0 2 8 >> Det3by3(u) ans -10
Systems of Linear Equa3ons The general form of systems of linear equations (3.1) where a s are constant coefficients, b s are constants, m is the number of equations, and n is the number of variables or unknowns. The system (3.1) is homogeneous if all otherwise inhomogeneous.
Systems of Linear Equa3ons Arranging in matrix and vector notation or (3.2) The matrix A is called the coefficient matrix and has size (m rows and n columns).
Systems of Linear Equa3ons Solutions of general linear systems with m equations in n unknowns may be classified into exactly three possibilities: (1) No solution (2) Infinitely many solutions (3) A unique solution
Solving Equa3ons with Geometry If n = 2 (plane) or n = 3 (space), the system of equations (3.1) has a geometric interpretation that can give us valuable intuition about possible solutions. Plane Geometry - represented by line equations (3.3) Solving the system above is the geometrical equivalent of finding all possible (x,y)-intersections of the lines.
Solving Equa3ons with Geometry Parallel lines, no solution Identical lines, infinitely many solutions Non-parallel distinct lines, one solution at the unique intersection
Solving Equa3ons with Geometry Space Geometry - A plane in xyz-space is given by plane equation The vector is normal to the plane. (3.4) Solving the system above is the geometrical equivalent of finding all possible (x,y,z)-intersections of the planes.
Solving Equa3ons with Geometry A B C A=B Triple-decker. Planes A, B, and C are parallel. No intersection point. Double-decker. Planes A and B are equal and parallel to plane C. No intersection. C C A B Book shelf. Planes A and B are distinct and parallel. No intersection point.
Solving Equa3ons with Matrix Op. A system of m linear equations and n unknowns can be written in matrix notation as: or solving it: (3.5) (3.6)
Solving Equa3ons with Matrix Op. If m=n in Eq. (3.1) and if det A 0, the unique solution can be expressed explicitly by either: where det A is the determinant of matrix A, det A j is the determinant that arises when the j-th column of det A is replaced by the column elements b 1,, b n (Cramer s rule).
MATLAB Implementa3ons Solve the following system of equations using MATLAB: >> A = [0.3,0.52,1;0.5,1,1.9;0.1,0.3,0.5]; >> b = [-0.01, 0.67, -0.44] ; >> x = A\b x = -14.9000-29.5000 19.8000
Solving of Equa3ons by Gaussian Elimina3on If m n in Eq. (3.1), Gaussian elimination can be employed to solve the system of equations (3.1). By elementary row operations (i.e., (i) exchange of equations, (ii) multiplication of an equation by a constant, (iii) adding one equation to another), the system (3.1) can be transformed into echelon form. From the echelon form, the unknowns n are determined by backward substitution. Of these there are 2 groups: 1) Basic variables: corresponding to pivots 2) Free variables: the others
Solving of Equa3ons by Example: Gaussian Elimina3on x,y,z are basic variables, u is free variable.
Eigenvalues The number λ is called an eigenvalue of a square matrix A and g 0 is a corresponding eigenvector if (3.7) Characteristic equation is the equation which is solved to find a matrix s eigenvalues. The characteristic equation in variable λ is defined by
Eigenvalues (product of all eigenvalues) (sum of eigenvalues) (Real square) matrix A is symmetric if If matrix A is symmetric: (1) all eigenvalues are real (2) eigenvectors corresponding to different eigenvalues are orthogonal (3)
Eigenvalues The characteristic equation of a 2x2 matrix: or can be written in the particular form: Similarly, the characteristic equation of a 3x3 matrix:
Eigenvalues or, can be written as well as where tr(a) is the matrix trace of A and det(a) is its determinant.
Spectral Theorem Assume that: (1) Matrix A is symmetric (2) are its eigenvalues Then there exist corresponding eigenvectors g 1,, g n such that: (1) (pairwise orthogonal and normed) Set, then (2) P is an orthogonal matrix (3) (4) (5)
Eigenvalues & Eigenvectors Example: Find eigenvalues and eigenvectors of matrix Solution The characteristic equation of matrix A is with roots
Eigenvalues & Eigenvectors Using Eq. (3.3), which states and we get If we choose the general solutions
Eigenvalues & Eigenvectors then the unknown vector is given by Since eigenvectors are normalized, then From
Eigenvalues & Eigenvectors we get If we choose the general solutions then the second unknown vector is given by
Eigenvalues & Eigenvectors From Choosing the general solutions the third eigenvector is given by
MATLAB Implementa3ons Matlab commands for matrix operations: >> A=[8,1,6;3,5,7;4,9,2] >> B = A >> trace(a) >> rank(a) >> det(a) >> inv(a)
MATLAB Implementa3ons Creating a diagonal matrix from a vector: >> A=[1,2,4,5,7,9]; >> B=diag(A) B = 1 0 0 0 0 0 0 2 0 0 0 0 0 0 4 0 0 0 0 0 0 5 0 0 0 0 0 0 7 0 0 0 0 0 0 9
MATLAB Implementa3ons Generating a vector: >> A=zeros(1,2) A = 0 0 Transpose of a vector: >> B=A B = 0 0 Creating a 2 3 matrix: >> D=[1,2,4;5,7,9] D = 1 2 4 5 7 9 Multiplication of matrices/vectors: >> C=A.*B; Suppress output
MATLAB Implementa3ons Generating a 5 5 matrix whose elements are all zeros: Generating a 5 3 matrix whose elements are all ones >> A=zeros(5) A = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >> B=ones(5,3) B = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
MATLAB Implementa3ons Concatenating matrices A and B horizontally : >> C=[A,B] C = 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 (Same length of rows) Concatenating matrices vertically: >> C=[A;B] (Same length of columns)