What is it we are looking for in these algorithms? We want algorithms that are

Similar documents
Linear Algebra Massoud Malek

1. General Vector Spaces

Jim Lambers MAT 610 Summer Session Lecture 2 Notes

b 1 b 2.. b = b m A = [a 1,a 2,...,a n ] where a 1,j a 2,j a j = a m,j Let A R m n and x 1 x 2 x = x n

Class notes: Approximation

Linear Algebra Review

MAT 610: Numerical Linear Algebra. James V. Lambers

AMS526: Numerical Analysis I (Numerical Linear Algebra for Computational and Data Sciences)

Lecture Notes to be used in conjunction with. 233 Computational Techniques

Numerical Linear Algebra

AMS526: Numerical Analysis I (Numerical Linear Algebra)

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Review of Basic Concepts in Linear Algebra

Lecture Notes to be used in conjunction with. 233 Computational Techniques

Foundations of Matrix Analysis

Knowledge Discovery and Data Mining 1 (VO) ( )

Math 350 Fall 2011 Notes about inner product spaces. In this notes we state and prove some important properties of inner product spaces.

Numerical Linear Algebra

Math 6610 : Analysis of Numerical Methods I. Chee Han Tan

APPENDIX A. Background Mathematics. A.1 Linear Algebra. Vector algebra. Let x denote the n-dimensional column vector with components x 1 x 2.

2. Linear algebra. matrices and vectors. linear equations. range and nullspace of matrices. function of vectors, gradient and Hessian

Linear Algebra Review. Vectors

MATH 532: Linear Algebra

LINEAR ALGEBRA BOOT CAMP WEEK 4: THE SPECTRAL THEOREM

DS-GA 1002 Lecture notes 0 Fall Linear Algebra. These notes provide a review of basic concepts in linear algebra.

5. Orthogonal matrices

Basic Concepts in Linear Algebra

Mathematical Foundations

G1110 & 852G1 Numerical Linear Algebra

ESSENTIALS OF COMPUTATIONAL LINEAR ALGEBRA Supplement for MSc Optimization 1

Math Camp Lecture 4: Linear Algebra. Xiao Yu Wang. Aug 2010 MIT. Xiao Yu Wang (MIT) Math Camp /10 1 / 88

Review of Some Concepts from Linear Algebra: Part 2

A Review of Linear Algebra

Lecture 2: Linear Algebra Review

Algebra C Numerical Linear Algebra Sample Exam Problems

Part 1a: Inner product, Orthogonality, Vector/Matrix norm

Inner products and Norms. Inner product of 2 vectors. Inner product of 2 vectors x and y in R n : x 1 y 1 + x 2 y x n y n in R n

STA141C: Big Data & High Performance Statistical Computing

Lecture # 3 Orthogonal Matrices and Matrix Norms. We repeat the definition an orthogonal set and orthornormal set.

Mathematical foundations - linear algebra

Lecture Notes 1: Vector spaces

Linear Algebra. Session 12

Elementary linear algebra

2 Two-Point Boundary Value Problems

Cheat Sheet for MATH461

Applied Mathematics 205. Unit II: Numerical Linear Algebra. Lecturer: Dr. David Knezevic

Scientific Computing: Dense Linear Systems

Linear Algebra V = T = ( 4 3 ).

Linear Algebra and Eigenproblems

CS 246 Review of Linear Algebra 01/17/19

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

Chapter 3 Transformations

STA141C: Big Data & High Performance Statistical Computing

Numerical Linear Algebra

Quantum Computing Lecture 2. Review of Linear Algebra

The following definition is fundamental.

Review of Linear Algebra

Mathematical foundations - linear algebra

Typical Problem: Compute.

Math 4A Notes. Written by Victoria Kala Last updated June 11, 2017

Functional Analysis Review

Review of linear algebra

EE/ACM Applications of Convex Optimization in Signal Processing and Communications Lecture 2

SUMMARY OF MATH 1600

Ir O D = D = ( ) Section 2.6 Example 1. (Bottom of page 119) dim(v ) = dim(l(v, W )) = dim(v ) dim(f ) = dim(v )

Chapter 7 Iterative Techniques in Matrix Algebra

Introduction to Matrix Algebra

Linear Algebra March 16, 2019

HOMEWORK PROBLEMS FROM STRANG S LINEAR ALGEBRA AND ITS APPLICATIONS (4TH EDITION)

LinGloss. A glossary of linear algebra

Computational math: Assignment 1

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

Matrix Algebra: Vectors

Introduction to Numerical Linear Algebra II

Computational Methods CMSC/AMSC/MAPL 460. Linear Systems, Matrices, LU Decomposition, Ramani Duraiswami, Dept. of Computer Science

6 Inner Product Spaces

Computational Methods CMSC/AMSC/MAPL 460. Vectors, Matrices, Linear Systems, LU Decomposition, Ramani Duraiswami, Dept. of Computer Science

MATH 583A REVIEW SESSION #1

Linear Algebra Formulas. Ben Lee

Algebra II. Paulius Drungilas and Jonas Jankauskas

Lecture notes: Applied linear algebra Part 1. Version 2

Lecture Note 7: Iterative methods for solving linear systems. Xiaoqun Zhang Shanghai Jiao Tong University

Section 3.9. Matrix Norm

Glossary of Linear Algebra Terms. Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Lecture 6: Geometry of OLS Estimation of Linear Regession

Numerical Methods - Numerical 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

NONCOMMUTATIVE POLYNOMIAL EQUATIONS. Edward S. Letzter. Introduction

MATRICES ARE SIMILAR TO TRIANGULAR MATRICES

Preliminary/Qualifying Exam in Numerical Analysis (Math 502a) Spring 2012

October 25, 2013 INNER PRODUCT SPACES

MATH 240 Spring, Chapter 1: Linear Equations and Matrices

Properties of Matrices and Operations on Matrices

Linear Algebra Highlights

Review problems for MA 54, Fall 2004.

Linear Algebra for Machine Learning. Sargur N. Srihari

Math 102, Winter Final Exam Review. Chapter 1. Matrices and Gaussian Elimination

Math Bootcamp An p-dimensional vector is p numbers put together. Written as. x 1 x =. x p

MATH 423 Linear Algebra II Lecture 33: Diagonalization of normal operators.

Math 3108: Linear Algebra

Transcription:

Fundamentals. Preliminaries The first question we want to answer is: What is computational mathematics? One possible definition is: The study of algorithms for the solution of computational problems in science and engineering. Other names for roughly the same subject are numerical analysis or scientific computing. What is it we are looking for in these algorithms? We want algorithms that are fast, stable and reliable, accurate. Note: One could also study hardware issues such as computer architecture and its effects, or software issues such as efficiency of implementation on a particular hardware or in a particular programming language. We will not do this. What sort of problems are typical? Example The Poisson problem provides the basis for many different algorithms for the numerical solution of differential equations, which in turn lead to the need for many algorithms in numerical linear algebra. Consider 2 u(x, y) = [u xx (x, y) + u yy (x, y)] = f(x, y), in Ω = [, ] 2 u(x, y) =, on Ω. One possible algorithm for the numerical solution of this problem is based on the following discretization of the Laplacian: 2 u(x j, y k ) u j,k + u j,k + u j+,k + u j,k+ 4u j,k h 2, () where the unit square is discretized by a set of (n + ) 2 equally spaced points (x j, y k ), j, k =,..., n, and h = n. Also, we use the abbreviation u j,k = u(x j, y k ). Formula () is a straightforward generalization to two dimensions of the linear approximation u u(x + h) u(x) (x). h If we visit all of the (n ) 2 interior grid points and write down the equation resulting from the discretization of the PDE, then we obtain the following system of linear equations 4u j,k u j,k u j,k u j+,k u j,k+ = f j,k, j, k =,..., n n2 along with the discrete boundary conditions u j, = u j,n = u,k = u n,k =, j, k =,,..., n.

Jacobi 3 operations 845 Gauss-Seidel 5 2 operations 832 SOR operations 95 FFT.5 8 operations 965 multigrid 8 operations 979 Table : Improvements of algorithms for Poisson problem. Z3 flops 94 Intel Paragon Gflops 99 NEC Earth Simulator (52 processors) 4 Tflops 22 IBM Blue Gene/L (372 processors) 367 Tflops 26 Table 2: Improvements of hardware for Poisson problem. This method is known as the finite difference method. In order to obtain a relative error of 4 using finite differences one needs about n =, i.e., 6 points. Therefore, one needs to solve a 6 6 sparse system of linear equations. Note that the system is indeed sparse since each row of the system matrix contains at most 5 nonzero entries. Using the state-of-the-art algorithms and hardware of 94 it would have taken one of the first computers about 3, years to solve this problem with the desired accuracy. In 99, on the other hand, it took about / second. In fact, the Earth Simulator (the fastest computer available in 22) was able to solve a dense system of 6 linear equations in 6 unknowns in less than 6 hours using Fortran and MPI code. This example is typical and shows in addition to the huge improvements possible by advances in both software and hardware that using numerical methods we can usually expect only an approximate solution. As just noted, errors are introduced in a variety of ways: through discretization, i.e., by converting a continuous problem to a discrete one, through floating-point representations and roundoff errors, through the nature of certain algorithms (e.g., iterative vs. direct). While other sources of errors also exist (such as measurement errors in experiments), we will focus on the above three sources.. Fundamentals from Linear Algebra.. Basic Definitions Definition. A vector space (or linear space) V over the field C of complex numbers consists of a set of elements (or vectors) together with two operations + : V V V (vector addition) and : C V V (scalar multiplication) such that. For any u, v V we have u + v V, i.e., V is closed under vector addition. 2

2. Vector addition is associative and commutative, i.e., (u + v) + w = u + (v + w) and u + v = v + u. 3. There is a zero vector such that u + = u for every u V. 4. For every u V there is a negative u such that u + ( u) =. 5. For every u V and every scalar α C we have αu V, i.e., V is closed under scalar multiplication. 6. For every α, β C and every u, v V we have (α + β)u = αu + βu, and α(u + v) = αu + αv (i.e., distributive laws hold). Remark Often we consider V as a vector space over R. Example Standard examples we will be working with are V = R m or V = C m with the usual vector addition and scalar multiplication, or V = R m n or V = C m n with the usual addition of matrices and scalar multiplication. If A C m n is an m n matrix then A is a linear map (or linear transformation) since it satisfies. A(x + y) = Ax + Ay for every x, y C n, 2. A(αx) = αax for every x C n and α C. Conversely, any linear map from C n to C m can be associated with matrix multiplication by a matrix in C m n. Example The matrix A = cos θ sin θ sin θ cos θ maps R 3 into R 3 since it represents counterclockwise rotation about the x-axis by an angle θ. The matrix [ ] A = maps R 3 into R 2 by projecting into the x-y plane...2 Matrix-Vector Multiplication For the following we assume A C m n and x C n. In fact, our vectors are always to be interpreted as column vectors unless noted otherwise. A first interpretation of a matrix-vector product b = Ax is obtained (using Matlab notation) via the representation b(i) = A(i, j)x(j), j= = A(i, :)x, i =,..., m 3

i.e., the i-th entry of b is given by the dot product of row i of A with x. A second (vectorized) interpretation is obtained via b(:) = = A(:, j)x(j) j= x(j)a(:, j), j= i.e., the (entire) vector b is given as a linear combination of the columns of A. Remark Using the first interpretation we need to perform m dot products to calculate b. With the second interpretation we compute n scalar products and n additions. Geometrically (based on the second approach above) we can interpret A as a linear transformation, i.e., on the one hand b represents a point in C m with coordinates b(), b(2),..., b(m) with respect to the standard basis {e, e 2,..., e m } whereas Ax represents the same point in C m with coordinates x(), x(2),..., x(m) with respect to the basis {A(:, ), A(:, 2),..., A(:, m)} of columns of A...3 Matrix-Matrix Multiplication If we assume that A C l m and C C m n then B = AC C l n and m B(i, j) = A(i, k)c(k, j), k= = A(i, :)C(:, j), i =,..., l, j =,..., n i.e., the ij entry of B is obtained as the dot product of row i of A with column j of C. An alternative (vectorized) interpretation of the same matrix-matrix product is given by B(:, j) = = m A(:, k)c(k, j) k= m C(k, j)a(:, k), k= i.e., the j-th column of B is given as a linear combination of the columns of A. Example Let s take C = R C n n with R(i, j) = { i j i > j, 4

i.e., an upper triangular matrix of all ones. Then B = AR leads to B(:, j) = = R(j, k)a(:, k) k= j A(:, k) = k= j A(:, k) since R(k, j) = if k > j by definition and otherwise. Thus, column j of B is given by the sum of the first j columns of A (which is similar to computation of the integral..4 Range and Nullspace x f(t)dt = F (x). The range of A (range(a) or column space of A) is given by the set of all Ax. The following theorem is a direct consequence of the vectorized interpretation of matrix-vector multiplication: Theorem.2 The range(a) is a vector space spanned by the columns of A. Remark The columns of A are a basis for range(a) if they are linearly independent. The nullspace of A (null(a) or kernel of A) is given by the set of all x such that Ax =. Remark From the vectorized interpretation of the matrix-vector product Ax = we know that = x()a(:, ) +... + x(n)a(:, n), so null(a) characterizes the linear dependence of the columns of A. In particular, if null(a) contains only the zero vector then the column of A are linearly independent and form a basis for range(a). The column rank of A is given by the dimension of range(a) (i.e., number of linearly independent columns of A). The row rank is defined analogously. Remark We always have row rank = column rank = rank. Moreover, for any m n matrix we have dim(null(a)) + rank(a) = n. k= Example Consider the matrix A = 2. 5

The range(a) is given by all vectors in C 3 with third component zero since Ax = 2 x() x(2) x(3) = x(2) 2x(3) Since A has two linearly independent columns (and rows) we have Moreover, rank(a) = dim(range(a)) = 2., 2 is a basis for range(a). The nullspace of A is given by all vectors with last two components zero since x A = for any x. Alternatively, we can see that x()a(:, ) + x(2)a(:, 2) + x(3)a(:, 3) = x() as soon as x(2) = x(3) =. Therefore, dim(null(a)) =...5 Inverse + x(2). + x(3) 2 = Any square matrix A C m m with rank(a) = m (i.e., of full rank or nonsingular) has an inverse A such that AA = A A = I, where I = [e, e 2,..., e m ] is the m m identity matrix. Theorem.3 For A C m m the following are equivalent:. A has an inverse A, 2. rank(a) = m, 3. range(a) = C m, 4. null(a) = {}, 5. is not an eigenvalue of A, 6. is not a singular value of A, 6

7. det(a). Following our earlier geometric interpretations we can interpret multiplication by A as a change of basis transformation: On the one hand Ax = b gives us the coordinates x of a point in C m with respect to the basis {A(:, ),..., A(:, m)} and on the other hand b can be viewed as the coordinates of the same point with respect to the standard basis {e,..., e m }. Therefore Ax = b x = A b represents a change of basis. In other words, if we multiply b (the coordinates of our point with respect to the standard basis) by A then we obtain the coordinates x with respect to the column space of A. Conversely, if we multiply x by A, then we transform back to the standard basis. Remark The solution x of the linear system Ax = b gives us the vector of coefficients of b expanded in terms of the columns of A, i.e., we rotate b back into the column space of A via A..2 Orthogonal Vectors and Matrices.2. Adjoint If A C m n is an m n matrix then A C n m is called the adjoint of A provided A (i, j) = A(j, i), i =,..., m, j =,..., n. If A is real then A is called the transpose of A and usually denoted by A T (or A in Matlab). If A = A then A is called Hermitian (or symmetric if real). Remark Note that only square matrices can be Hermitian (or real symmetric). Applied to vectors this means that x denotes a column vector and x a row vector..2.2 Inner Product If x, y C m then x y = m x(i)y(i) i= is called the inner product (or dot product) of x and y. The length of a vector x is given by x = ( m ) /2 x x = x(i) 2. This is the same as the (Euclidean) or 2-norm of the vector. We will say more about norms later. i= 7

Once an inner product is available we can define an angle α between two vectors x and y by cos α = x y x y. We summarize the following properties of inner products. Lemma.4 Let x, y, z C m and α, β C. Then. (x + y) z = x z + y z, 2. x (y + z) = x y + x z, 3. (αx) (βy) = αβx y. Together, we say that an inner product is bilinear. Moreover, the definition of the inner product implies that y x = x y. In the real case, however, the inner product is symmetric. We can use the inner product and its properties to obtain some other properties of matrix multiplication. Lemma.5 Assume A and B are m m matrices. Then. (AB) = B A, 2. (AB) = B A. Proof We will prove item. Let C = AB so that C(i, j) = A(i, :)B(:, j), the inner product of row i of A with column j of B. Now (AB) (i, j) = C (i, j) = C(j, i) = A(j, :) B(:, i) m = A(j, k) B(k, i) = k= m B (i, k)a (k, j) k= = B (i, :)A (:, j) = (B A )(i, j). Remark We will use the notational convention A = (A ) = (A ). 8

.2.3 Orthogonal Vectors Since we defined angles earlier as cos α = x y x y, the vectors x and y are orthogonal if and only if x y =. If X, Y are two sets of vectors then X is orthogonal to Y if x y = for every x X and every y Y. X is an orthogonal set (or simply orthogonal) if x y = for every x, y X with x y. X is orthonormal if X is orthogonal and x = for all x X. Theorem.6 Orthogonality implies linear independence, i.e., if X is orthogonal then X is linearly independent. Corollary.7 If X C m is orthogonal and consists of m vectors then X is a basis for C m..2.4 Orthogonal Decomposition of a Vector In analogy to the Cartesian decomposition of a vector into its coordinates, i.e., v = v()e +... + v(m)e m we can find the components of an arbitrary vector v with respect to any given orthogonal set. Assume Q = {q,..., q n } is an orthonormal set and v C m is an arbitrary vector with m n. Claim: We can decompose v as v = r + with {r, q,..., q n } an orthogonal set. (q i v)q i Remark The vectors (q i v)q i are the projections of v onto the (basis) vectors q i. i= Proof We need to show that r = v n i= (q i v)q i is orthogonal to Q. This can be done by considering the inner product with an arbitrary member q j of Q: ( ) q jr = q jv q j (q i v)q i = q jv i= (q i v)q jq i. i= 9

Now, since Q is orthonormal we have q jq i = δ ij = {, i j, i = j, where δ ij is referred to as the Kronecker delta. Therefore only one term in the summation survives (namely if i = j) and we have q jr = q jv (q jv) =. Since q j was arbitrary we have established that r is orthogonal to the entire set Q. Remark If Q is a basis for C m then n = m and (since v C m ) r =. Therefore we get the coordinates of v with respect to Q: v = m (q i v)q i. i= We now take a closer look at the projection idea. This will be very important later on. First (q i v)q i = q i (q i v) since (q i v) is a scalar. Next, by the associativity of vector multiplication, this is also equal to (q i q i )v. This latter expression is the product of a (rank-) matrix and a column vector. The matrix (q i q i ) is known as a projection matrix. Now we can represent the projections occurring in the decomposition of v either via a sum of vector projections (q i v)q i or by a sum of matrix projections i (q i q i )v. i Example Compute the orthogonal decomposition of v = [,, ] with respect to q = [/ 2,, / 2], q 2 = [/ 2,, / 2], and q 3 = [,, ]. Since v R 3 and q, q 2, q 3 are orthonormal they form a basis for R 3 and we know that r =.. In terms of vector projections we have v = 3 (q i v)q i i= = 2 q + q 2 + q 3 2 = + + Thus, the coordinates of v with respect to q, q 2, q 3 are ( 2,, )..

2. In terms of matrix projections we get v = = = 3 (q i q i )v i= /2 /2 /2 /2 + v + + /2 /2 /2 /2. v + v.2.5 Unitary and Orthogonal Matrices A square matrix Q C m m is called unitary (or orthogonal in the real case) if its columns are orthonormal, i.e., if Q Q = I. Equivalently, Q = Q. In particular, this implies { q, i j i q j = δ ij =, i = j. Recall that earlier we observed that if we multiply a given vector b (the coordinates of some point with respect to the standard basis) by A then we obtain the coordinates x with respect to the column space of A. Conversely, if we multiply x by A, then we transform back to the standard basis. Now, if we assume that A is a unitary matrix, i.e., A = Q and A = Q, then multiplication of b by Q yields the coordinates x with respect to the basis {Q(:, ),..., Q(:, m)} = {q,..., q m }. Conversely, multiplication of x by Q transforms back to the standard basis {e,..., e m }. Example Take b = and Q = / 2 / 2 / 2 / 2 and note that b = v and the columns of Q are given by q, q 2, q 3 from the previous example. Clearly, / 2 / 2 Q = / 2 / 2, and therefore Q b = 2 are the coordinates with respect to the columns of Q.

Some properties of unitary matrices are collected in Lemma.8 Assume Q C m m is unitary and x, y C m. Then. (Qx) (Qy) = x y, that is angles are preserved under unitary (orthogonal) transformations. 2. Qx = x, that is lengths are preserved under unitary (orthogonal) transformations. 3. All eigenvalues λ of Q satisfy λ =, and therefore detq = ±. Remark The + in item 3 corresponds to rotations, and the to reflections. Proof We prove item : (Qx) (Qy) = x Q Q y = x y. }{{} =I.3 Norms.3. Vector Norms Definition.9 Let V be a vector space over C. A norm is a function : V R + which satisfies. x for every x V, and x = only if x =. 2. αx = α x for every x V, α C. 3. x + y x + y for all x, y V (triangle inequality). Example. x = m x(i), l -norm. i= ( m ) /2 2. x 2 = x(i) 2, l 2 -norm or Euclidean norm. i= 3. x = max i m x(i), l -norm, maximum norm or Chebyshev norm. ( m ) /p 4. x p = x(i) p, l p -norm. i= It is interesting to consider the corresponding unit spheres for these three norms, i.e., the location of points in R m whose distance to the origin (in the respective norm) is equal to. Figure illustrates this for the case m = 2. 2

.5.5.5.5.5.5.5.5.5.5.5.5 Figure : Unit circles in R 2 for the l, l 2 and l norms. Sometimes one also wants to work with weighted norms. To this end one takes a diagonal weight matrix w(). W = w(2).......... w(m) and then defines x W = W x. Example A weighted p-norm is of the form.3.2 Matrix Norms ( m ) /p x W,p = w(i)x(i) p. i= Definition. If (m) and (n) are vector norms on C m and C n, respectively, and A C m n, then the induced matrix norm (or associated or subordinate matrix norm) is defined by A = sup x C n x (n) = Ax (m) = sup x C n x Ax (m) x (n). Remark. The notation sup in Definition. denotes the supremum or least upper bound. 2. Often we can use the maximum instead of the supremum so that A = max x C n x Ax (m) x (n). 3

3. One can show that satisfies items () (3) in Definition.9, i.e., it is indeed a norm. 4. A can be interpreted as the maximum factor by which A can stretch x. Example The stretch concept can be understood graphically in R 2. Consider the matrix [ ] A = which maps R 2 to R 2.. By mapping the -norm unit circle under A we can see that the point that is maximally stretched is (, ) which gets mapped into (, ). Thus, a vector of -norm length is mapped to a vector with -norm length 2, and A = 2. 2. By mapping the 2-norm unit circle under A we can see (although this is much harder and requires use of the singular value decomposition) that the point that is maximally stretched is (.5257,.857) which gets mapped into (.3764,.857). Thus, a vector of 2-norm length is mapped to a vector with 2-norm length.68, and A 2 =.68. 3. By mapping the -norm unit circle under A we can see that the point that is maximally stretched is (, ) which gets mapped into (2, ). Thus, a vector of -norm length is mapped to a vector with -norm length 2, and A = 2. How to Compute the Induced Matrix Norm We now discuss how to compute the matrix norms induced by the popular p-norm vector norms. Strictly speaking we now would have to use two different subscripts on the vector norms (in addition to the index p also the (m) and (n) indicating the length of the vectors). In order to simplify notation we omit the second subscript which can be inferred from the context. Consider an m n matrix A. The most popular matrix norms can be computed as follows:. A = max j n m = max j n A(i, j). i= This gives rise to the name maximum column sum norm. 2. A 2 = max j n σ j, where σ j is the j-th singular value of A (more later, fairly difficult to compute). 3. A = max i m = max A(i, j). i m j= 4

This gives rise to the name maximum row sum norm. Example Let A = Then A = 5, A 2 = 3.4385, A = 4. 2 2 We now verify that the matrix norm induced by the l -norm is indeed given by the formula stated in item 3: A = sup Ax = x = sup. x = By interchanging the supremum and maximum we obtain A = max sup i m x = Next, we rewrite the matrix-vector product to get A = max sup i m x = max (Ax)(i). i m (Ax)(i). A(i, j)x(j). Finally, using formula (2) below we obtain the desired result, i.e., A = max We now derive formula (2). Consider i m j= j= A(i, j). A(i, j)x(j) = A(i, )x() + A(i, 2)x(2) +... + A(i, n)x(n). j= The supremum over all unit vectors (in the maximum norm) is attained if all terms in the above sum are positive. This can be ensured by picking x(j) = sign(a(i, j)). But then we have sup x = A(i, j)x(j) = A(i, ) + A(i, 2) +... + A(i, n) = j=.3.3 Cauchy-Schwarz and Hölder Inequalities A(i, j). (2) Theorem. Any two vectors x, y V equipped with an inner product such that x 2 = x x satisfy the Cauchy-Schwarz inequality x y x y. j= 5

Proof The Cauchy-Schwarz inequality in a real vector space can be proved geometrically by starting out with the projection p = x y y of x onto the y. Since y is in y 2 general not a unit vector we need to normalize by y here. Now x p 2 for any x, y and we can use the definition of the norm properties of the inner product (in particular x y = y x if x, y real) to compute x p 2 = x x y y 2 y 2 ( ) = x x y ( ) y 2 y x x y y 2 y ( = x x 2 x y x ) y 2 y 2 x y + y 2 y y ( = x 2 2 x y x ) y 2 y 2 x y + y 2 y 2 = x 2 y 2 2 (x y) 2 + (x y) 2 y 2 = x 2 y 2 (x y) 2 y 2. Remembering that this quantity is non-negative we get (x y) 2 x 2 y 2 and taking square roots x y x y. As a generalization of the Cauchy-Schwarz we have the Hölder inequality: x y x p y q, where we allow any p, q such that p + q =. Example We can apply the Cauchy-Schwarz inequality to compute the 2-norm of a rank- matrix A = uv (cf. the projection matrices that came up earlier). First, we note that by the Cauchy-Schwarz inequality. Now Ax 2 = (uv )x 2 = u (v x) }{{} 2 scalar = v x u 2 u 2 v 2 x 2 (3) A 2 = sup x C n x 6 Ax 2 x 2

so that (3) gives us However, in the special case x = v we get and therefore actually A 2 u 2 v 2. Ax 2 = Av 2 = (u v )v }{{} 2 = v v u 2 = v 2 2 u 2, scalar.3.4 Other Matrix Norms A 2 = sup x C n x Ax 2 x 2 = u 2 v 2. There are also matrix norms that are not induced by vector norms. Example The Frobenius norm of an m n matrix A is given by /2 m A F = A(i, j) 2, i= j= i.e., we interpret the matrix in C m n as a vector in C mn and compute its 2-norm. Other formulas for the Frobenius norm are A F = tr(a A) = tr(aa ), where the trace tr(a) is given by the sum of the diagonal entries of A. Finally, Theorem.2 Let A C m n and Q C m m be unitary. Then. QA 2 = A 2, 2. QA F = A F, i.e., both the 2-norm and the Frobenius norm are invariant under unitary transformation. Proof The invariance of the matrix 2-norm is a direct consequence of the invariance of lengths of vectors under unitary transformations discussed earlier, i.e., Qx 2 = x 2. In particular, QAx 2 = Ax 2, and so QA 2 = sup x C n x For the Frobenius norm we have since Q Q = I. QAx 2 x 2 = sup x C n x QA F = tr ((QA) (QA)) = tr (A Q QA) = tr (A A) = A F Ax 2 x 2 = A 2. 7

.4 Computer Arithmetic.4. Floating-Point Arithmetic We will use normalized scientific notation to represent real numbers x, i.e., in decimal representation we write x = ±r n, r <, and in binary representation (which of course will matter on the computer) we write x = ±q 2 m, 2 q <. Both of these representations consist of the sign ±, the mantissa (either r or q), the base (either or 2), and the exponent (either n or m). Example Some examples of various floating-point numbers in normalized scientific notation with base :.747 =.747 4 3.459265 =.3459265 2 9, 7,, =.97 K =.24 4 for computer stuff. In order to study the kinds of errors that we can make when we represent real numbers as machine numbers we will use a hypothetical binary computer. We will assume that this computer can represent only positive numbers of the form (.d d 2 d 3 d 4 ) 2 2 n with n { 3, 2,,,, 2, 3, 4}. Our representation will actually have a 3-bit mantissa (i.e., the digit is always assumed to be, and therefore never stored). The set of choices for the exponent n comes from using a 3-bit exponent which allows us to generate,,..., 7, so that the n is actually determined as the values of 4 exponent. With this configuration we are able to generate 2 3 = 8 different mantissas: (.) 2 = (.5) (.) 2 = (.5625) (.) 2 = (.625) (.) 2 = (.6875) (.) 2 = (.75) (.) 2 = (.825) (.) 2 = (.875) (.) 2 = (.9375) for a total of 64 machine numbers (obtained by combining the 8 mantissa with the 8 possible exponents). 8

n = 3 n = 2 n = n = n = n = 2 n = 3 n = 4 (.) 2.625.25.25.5 2 4 8 (.) 2.7325.4625.2825.5625.25 2.25 4.5 9 (.) 2.7825.5625.325.625.25 2.5 5 (.) 2.859375.7875.34375.6875.375 2.75 5.5 (.) 2.9375.875.375.75.5 3 6 2 (.) 2.5625.2325.4625.825.625 3.25 6.5 3 (.) 2.9375.2875.4375.875.75 3.5 7 4 (.) 2.7875.234375.46875.9375.875 3.75 7.5 5 Table 3: List of all 64 machine numbers for hypothetical computer. Remark Any computer has finite word length (usually longer than that of our hypothetical computer) and can therefore represent only a discrete set on finite numbers exactly. Moreover, these numbers are distributed unevenly. ) + 6 = 7 5 Example How does the computation of ( + 5 =.46 work out in our hypothetical computer? First, we notice that we will be committing a number of representation errors. The closest machine number to is.5625 = (.) 2 2 3. Similarly, the closest machine number to 5 is.2325 = (.) 2 2 2. We can add these two numbers (by shifting the mantissa of the first number) and obtain (.) 2 2 2. This, however, is not in normalized scientific notation. The correct representation of the intermediate calculation of + 5 is therefore (.) 2 2. Now, however, our computer has only a 4-bit mantissa, and therefore we need to commit a rounding error, i.e., we represent the intermediate result by (.) 2 2. Note that this is indeed (fortunately so) the closest machine number to 3 For the final step of the calculation we need to represent 6 as a machine number. We again commit a representation error by using.7875 = (.) 2 2 2. Adding this to the intermediate result from above (again by shifting the mantissa) we get (.) 2 2. Once more we need to round this result to the nearest machine number, so that the final answer of our calculation is (.) 2 2 =.5 which is a rather poor representation of the true answer 7 5 =.46. In fact, the absolute error of our calculation is and the relative error is.5.46 =.3,.5.46.46.74 or 7.4%. Example Another important observation is the fact that the order of operations matters, i.e., even though addition (or multiplication) is commutative and associative for real numbers, this may not be true for machine numbers. Consider the problem of adding + 6 + 6 = 9 8 =.25 on our hypothetical computer. Note that all of these numbers are machine numbers (so we will be committing no representation errors). 9.

a) We first represent by (.) 2 2 and 6 by (.) 2 2 3. Addition of these 2 numbers leads to (.) 2 2 which now has to be rounded to a machine number, i.e., (.) 2 2. Clearly, adding another 6 will not change the answer. Thus, + 6 + 6 =. b) If we start by adding the smaller numbers first, then 6 + 6 is represented by (.) 2 2 3 + (.) 2 2 3 = (.) 2 2 2 (exactly), and adding = (.) 2 2 to this yields the correct answer of (.) 2 2 =.25 More common word lengths for the representation of floating-point numbers are 32-bit (single precision) and 64-bit (double precision). In the 32-bit representation the first bit is used to represent the sign, the next 8 bits represent the exponent, and the remaining 23 bits are used for the mantissa. This implies that the largest possible exponent is () 2 = 2 8 = 255 (or 26,..., 27 where the two extreme cases and 255 are reserved for special purposes). This means that we can roughly represent numbers between 2 26 38 and 2 27 38. Since the mantissa has 23 bits we can represent numbers with an accuracy (machine ε) of 2 23.2 6, i.e., we can expect 6 accurate digits (which is known as single precision). In the 64-bit system we use bits for the exponent and 52 for the mantissa. This leads to machine numbers between 2 22 38 and 2 23 38. The resolution possible with the 52-bit mantissa is 2 52.22 5. Thus double precision has 5 accurate digits..4.2 Rounding and Chopping Machine numbers can be obtained by either rounding (up or down to the nearest machine number), or by simply chopping off any extra digits. Depending on the representation method used (rounding or chopping) any number will be represented internally with relative accuracy δ, where δ = fl(x) x x or fl(x) = x( + δ). Here δ 2 β n for rounding and δ β n for chopping with representing the base (usually 2 for digital computers) and n the length of the mantissa. Example A nice (actually quite disastrous) illustration of the difference of chopping versus rounding is given by the first few months of operations of the Vancouver Stock Exchange. In 982 its index was initialized to a value of. After that, the index was updated after every transaction. After 22 months the index had fallen to 52, and everyone was stumped, since common sense indicated mild growth. The explanation was found when it was discovered that the updated values were truncated instead of rounded. A corrected update using rounding yielded an index values of 98.892. Some other examples of disasters due to careless use of computers can be found on the web at http://www.ima.umn.edu/ arnold/disasters/. In order to have a good computer we would like fl(x y) = [x y]( + δ) 2

for any basic arithmetic operation {+,,, /}. This is usually accomplished by using higher precision internally..4.3 Loss of Significance Consider the function f(x) = x ( x + x ). We want to accurately compute f(5). The true solution is.74755374798.... This problem is studied in the Maple worksheet 477 577 loss of significance.mws. Using 6 digits (single precision) the detailed computations are ( ) f(5) = 5 5 5 = 5 (22.383 22.367) = 5 (.223) =.5 with a relative error of.5.748.748.22%. On the other hand, if we choose a better method to solve the problem (without disastrous subtractions), i.e., rewrite the function as g(x) = x ( x + x ) x + + x x + + x = = x(x + x) x + + x x x + + x then g(5) = 5 5 + 5 = 5 22.383 + 22.367 = 5 44.7437 =.748, which is exact up to the precision used. We end with a theorem quantifying the loss of significant digits in subtractions. Theorem.3 If x > y are positive normalized floating-point numbers in binary representation and 2 q y x 2 p then the number l of significant binary bits lost when computing x y satisfies p l q. Proof We show the lower bound, i.e., l p (the upper bound can be shown similarly). Let x = r 2 n and y = s 2 m with 2 r, s <. In order to perform the subtraction we rewrite (shift) y such that y = (s 2 m n ) 2 n. Then x y = [ r s 2 m n] 2 n, where r s 2 m n = r ( s ) 2m r 2 n ( = r y ). x 2

Now r < and y x 2 p by assumption, so that the mantissa satisfies r s 2 m n < 2 p. Finally, we need to shift at least p bits to the left in order to normalize the representation (we need 2 mantissa < ). This introduces at least p (binary) zeros at the right end of the number, and so at least p bits are lost. Remark If the theorem is formulated in base, i.e., if the relative error is between q and p, then between p and q digits are lost. 22