Algorithms: Divide and Conquer

Size: px
Start display at page:

Download "Algorithms: Divide and Conquer"

Transcription

1 Algorithms: Divide and Conquer Amotz Bar-Noy CUNY Spring 2012 Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

2 Integer Multiplication Input: integers I and J each represented by n bits. I + J and I J can be computed with O(n) bit operations. I J can be computed with O(n 2 ) bit operations using the traditional direct algorithm. Using divide-and-conquer, I J can be computed with O(n log 2 3 ) O(n ) bit operations. Using the Fast-Transform-Fourier, I J can be computed with O(n log n) bit operations. I + J, I J, and I J need at least Ω(n) bit operations. Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

3 Ideas for Divide and Conquer Assumption: The length n of I and J is a power of 2. Input representation: I = I h 2 n/2 + I l J = J h 2 n/2 + J l Claim: Multiplying m-bit number by 2 k can be done with Θ(k + m) bit operations (shifting). Objective: Compute the product I J using multiplications on I h, I l, J h, J l whose lengths are n/2 bits. Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

4 Divide and Conquer I I = I h 2 n/2 + I l J = J h 2 n/2 + J l I J = I h J h 2 n + (I h J l + I l J h )2 n/2 + I l J l Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

5 Divide and Conquer I I = I h 2 n/2 + I l J = J h 2 n/2 + J l I J = I h J h 2 n + (I h J l + I l J h )2 n/2 + I l J l T (n) = 4T (n/2) + Θ(n) bit operations. T (n) = Θ(n 2 ) bit operations. Result: Not an improvement! Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

6 Solving the Recursion T (n) = 4T (n/2) + Θ(n) Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

7 Solving the Recursion T (n) = 4T (n/2) + Θ(n) a = 4. b = 2. log b (a) = 2. d = 1. d < log b (a). Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

8 Solving the Recursion T (n) = 4T (n/2) + Θ(n) a = 4. b = 2. log b (a) = 2. d = 1. d < log b (a). Master Theorem Case 1: T (n) = Θ ( n 2). Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

9 Divide and Conquer II (I h I l )(J l J h ) = I h J l I h J h I l J l + I l J h I h J l + I l J h = (I h I l )(J l J h ) + I h J h + I l J l A = I h J h B = I l J l C = (I h I l )(J l J h ) I J = I h J h 2 n + (I h J l + I l J h )2 n/2 + I l J l I J = A2 n + (C + A + B)2 n/2 + B Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

10 Divide and Conquer II (I h I l )(J l J h ) = I h J l I h J h I l J l + I l J h I h J l + I l J h = (I h I l )(J l J h ) + I h J h + I l J l A = I h J h B = I l J l C = (I h I l )(J l J h ) I J = I h J h 2 n + (I h J l + I l J h )2 n/2 + I l J l I J = A2 n + (C + A + B)2 n/2 + B T (n) = 3T (n/2) + Θ(n) bit operations. T (n) = Θ ( n log 2 3) bit operations. Result: Better than Θ(n 2 )! Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

11 Solving the Recursion T (n) = 3T (n/2) + Θ(n) Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

12 Solving the Recursion T (n) = 3T (n/2) + Θ(n) a = 3. b = 2. log b (a) d = 1. d < log b (a). Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

13 Solving the Recursion T (n) = 3T (n/2) + Θ(n) a = 3. b = 2. log b (a) d = 1. d < log b (a). Master Theorem Case 1: T (n) = Θ ( n log 2 3). Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

14 Divide and Conquer I and II Divide and Conquer I: I J = I h J h 2 n + (I h J l + I l J h )2 n/2 + I l J l. T (n) = 4T (n/2) + Θ(n) = Θ ( n 2) bit operations. Divide and Conquer II: I J = A2 n + (C + A + B)2 n/2 + B. T (n) = 3T (n/2) + Θ(n) = Θ ( n log 2 3) bit operations. Result: Θ ( n log 2 3) = Θ ( n 1.585) is better than Θ(n 2 )! Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

15 Arbitrary n 1 Algorithm: 2 k 1 < n 2 k 2 k < 2n. Add 2 k n zeros in front of both integers. Run the algorithm with the new integers. Omit zeros at the beginning of the product. Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

16 Arbitrary n 1 Algorithm: 2 k 1 < n 2 k 2 k < 2n. Add 2 k n zeros in front of both integers. Run the algorithm with the new integers. Omit zeros at the beginning of the product. Complexity: (2 k ) log 2 3 < (2n) log 2 3 = 3n log 2 3 The algorithm complexity Θ((2 k ) log 2 3 ) is Θ(n log 2 3 ). Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

17 Matrix Multiplication Input: 2 matrices A and B of scalars of size n n. Output: An n n matrix C = A B. Definition: c i,j = n k=1 a i,k b k,j, for 1 i, j n. Operation: An addition (subtraction) or a multiplication between two scalars. Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

18 Matrix Multiplication Algorithms Direct algorithm: n 3 multiplications and n 2 (n 1) additions. Strassen algorithm: O(n log 2 7 ) O(n 2.81 ) operations. Best known solution: O(n ) operations. Lower bound: Ω(n 2 ) operations. Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

19 Multiplying 2 2 Matrices ( r s t u ) ( a b = c d ) ( e g f h ) Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

20 Multiplying 2 2 Matrices ( r s t u ) ( a b = c d ) ( e g f h ) The values of r, s, t, u: r = ae + bf s = ag + bh t = ce + df u = cg + dh Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

21 Multiplying 2 2 Matrices ( r s t u ) ( a b = c d ) ( e g f h ) The values of r, s, t, u: r = ae + bf s = ag + bh t = ce + df u = cg + dh Complexity: Total of 8 multiplications and 4 additions. Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

22 Divide-and-Conquer I Lemma: The multiplication procedure works for sub-matrices as well. Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

23 Divide-and-Conquer I Lemma: The multiplication procedure works for sub-matrices as well. Algorithm: (for n = 2 k ) Partition A and B into 4 sub-matrices of size n 2 n 2. Recursively compute the 8 sub-matrices multiplications. Do the 4 matrices additions each with (n/2) 2 addition operations. Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

24 Divide-and-Conquer I Lemma: The multiplication procedure works for sub-matrices as well. Algorithm: (for n = 2 k ) Partition A and B into 4 sub-matrices of size n 2 n 2. Recursively compute the 8 sub-matrices multiplications. Do the 4 matrices additions each with (n/2) 2 addition operations. Complexity: T (n) = 8T (n/2) + Θ(n 2 ) = Θ(n 3 ). Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

25 Solving the Recursion T (n) = 8T (n/2) + Θ(n 2 ) Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

26 Solving the Recursion T (n) = 8T (n/2) + Θ(n 2 ) a = 8. b = 2. log b (a) = 3. d = 2. d < log b (a). Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

27 Solving the Recursion T (n) = 8T (n/2) + Θ(n 2 ) a = 8. b = 2. log b (a) = 3. d = 2. d < log b (a). Master Theorem Case 1: T (n) = Θ ( n 3). Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

28 The Magic Idea With 7 multiplications and 10 additions, compute 7 help variables: p 1 = a(g h) p 2 = (a + b)h p 3 = (c + d)e p 4 = d(f e) p 5 = (a + d)(e + h) p 6 = (b d)(f + h) p 7 = (a c)(e + g) Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

29 The Magic Idea With 7 multiplications and 10 additions, compute 7 help variables: p 1 = a(g h) p 2 = (a + b)h p 3 = (c + d)e p 4 = d(f e) p 5 = (a + d)(e + h) p 6 = (b d)(f + h) p 7 = (a c)(e + g) With 8 more additions, compute r, s, t, u: r = p 5 + p 4 p 2 + p 6 s = p 1 + p 2 t = p 3 + p 4 u = p 5 + p 1 p 3 p 7 Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

30 The Magic Idea With 7 multiplications and 10 additions, compute 7 help variables: p 1 = a(g h) p 2 = (a + b)h p 3 = (c + d)e p 4 = d(f e) p 5 = (a + d)(e + h) p 6 = (b d)(f + h) p 7 = (a c)(e + g) With 8 more additions, compute r, s, t, u: r = p 5 + p 4 p 2 + p 6 s = p 1 + p 2 t = p 3 + p 4 u = p 5 + p 1 p 3 p 7 Complexity: Total of 7 multiplications and 18 additions. Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

31 Verifying the Value of r r = p 5 + p 4 p 2 + p 6 = (a + d)(e + h) + d(f e) (a + b)h + (b d)(f + h) = ae + ah + de + dh + df de ah bh + bf + bh df dh = ae + ah / + de / + dh / + df / de / ah / bh / + bf + bh / df / dh / = ae + bf Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

32 Verifying the Value of s s = p 1 + p 2 = a(g h) + (a + b)h = ag ah + ah + bh = ag ah / + ah / + bh = ag + bh Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

33 Verifying the Value of t t = p 3 + p 4 = (c + d)e + d(f e) = ce + de + df de = ce + de / + df de / = ce + df Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

34 Verifying the Value of u u = p 5 + p 1 p 3 p 7 = (a + d)(e + h) + a(g h) (c + d)e (a c)(e + g) = ae + ah + de + dh + ag ah ce de ae ag + ce + cg = ae / + ah / + de / + dh + ag/ ah / ce / de / ae / ag/ + ce / + cg = cg + dh Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

35 Divide-and-Conquer II Lemma: The magic idea works for sub-matrices as well. Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

36 Divide-and-Conquer II Lemma: The magic idea works for sub-matrices as well. Algorithm: (for n = 2 k ) Partition A and B into 4 sub-matrices of size n 2 n 2. Recursively compute the 7 sub-matrices multiplications. Do the 18 matrices additions each with (n/2) 2 addition operations. Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

37 Divide-and-Conquer II Lemma: The magic idea works for sub-matrices as well. Algorithm: (for n = 2 k ) Partition A and B into 4 sub-matrices of size n 2 n 2. Recursively compute the 7 sub-matrices multiplications. Do the 18 matrices additions each with (n/2) 2 addition operations. Complexity: T (n) = 7T (n/2) + Θ(n 2 ) = Θ(n log 2 7 ) Θ(n 2.81 ). Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

38 Solving the Recursion T (n) = 7T (n/2) + Θ(n 2 ) Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

39 Solving the Recursion T (n) = 7T (n/2) + Θ(n 2 ) a = 7. b = 2. log b (a) d = 2. d < log b (a). Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

40 Solving the Recursion T (n) = 7T (n/2) + Θ(n 2 ) a = 7. b = 2. log b (a) d = 2. d < log b (a). Master Theorem Case 1: T (n) = Θ ( n log 2 7). Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

41 Arbitrary n 1 Algorithm: 2 k 1 < n 2 k 2 k < 2n. Add 2 k n zero columns and rows to both A and B. Run the algorithm for the new matrices. Omit the zero columns and rows from C. Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

42 Arbitrary n 1 Algorithm: 2 k 1 < n 2 k 2 k < 2n. Add 2 k n zero columns and rows to both A and B. Run the algorithm for the new matrices. Omit the zero columns and rows from C. Complexity: (2 k ) log 2 7 < (2n) log 2 7 = 7n log 2 7. The algorithm complexity Θ((2 k ) log 2 7 ) is Θ(n log 2 7 ). Amotz Bar-Noy (CUNY) Divide and Conquer Spring / 22

CS473 - Algorithms I

CS473 - Algorithms I CS473 - Algorithms I Lecture 4 The Divide-and-Conquer Design Paradigm View in slide-show mode 1 Reminder: Merge Sort Input array A sort this half sort this half Divide Conquer merge two sorted halves Combine

More information

Here are some examples of combining elements and the operations used:

Here are some examples of combining elements and the operations used: MATRIX OPERATIONS Summary of article: What is an operation? Addition of two matrices. Multiplication of a Matrix by a scalar. Subtraction of two matrices: two ways to do it. Combinations of Addition, Subtraction,

More information

Unit 18 Determinants

Unit 18 Determinants Unit 18 Determinants Every square matrix has a number associated with it, called its determinant. In this section, we determine how to calculate this number, and also look at some of the properties of

More information

Direct Methods for Solving Linear Systems. Matrix Factorization

Direct Methods for Solving Linear Systems. Matrix Factorization Direct Methods for Solving Linear Systems Matrix Factorization Numerical Analysis (9th Edition) R L Burden & J D Faires Beamer Presentation Slides prepared by John Carroll Dublin City University c 2011

More information

Warshall s Algorithm: Transitive Closure

Warshall s Algorithm: Transitive Closure CS 0 Theory of Algorithms / CS 68 Algorithms in Bioinformaticsi Dynamic Programming Part II. Warshall s Algorithm: Transitive Closure Computes the transitive closure of a relation (Alternatively: all paths

More information

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 2. x n. a 11 a 12 a 1n b 1 a 21 a 22 a 2n b 2 a 31 a 32 a 3n b 3. a m1 a m2 a mn b m

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 2. x n. a 11 a 12 a 1n b 1 a 21 a 22 a 2n b 2 a 31 a 32 a 3n b 3. a m1 a m2 a mn b m MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS 1. SYSTEMS OF EQUATIONS AND MATRICES 1.1. Representation of a linear system. The general system of m equations in n unknowns can be written a 11 x 1 + a 12 x 2 +

More information

Elementary Matrices and The LU Factorization

Elementary Matrices and The LU Factorization lementary Matrices and The LU Factorization Definition: ny matrix obtained by performing a single elementary row operation (RO) on the identity (unit) matrix is called an elementary matrix. There are three

More information

Mathematics Course 111: Algebra I Part IV: Vector Spaces

Mathematics Course 111: Algebra I Part IV: Vector Spaces Mathematics Course 111: Algebra I Part IV: Vector Spaces D. R. Wilkins Academic Year 1996-7 9 Vector Spaces A vector space over some field K is an algebraic structure consisting of a set V on which are

More information

Continued Fractions and the Euclidean Algorithm

Continued Fractions and the Euclidean Algorithm Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

More information

Abstract: We describe the beautiful LU factorization of a square matrix (or how to write Gaussian elimination in terms of matrix multiplication).

Abstract: We describe the beautiful LU factorization of a square matrix (or how to write Gaussian elimination in terms of matrix multiplication). MAT 2 (Badger, Spring 202) LU Factorization Selected Notes September 2, 202 Abstract: We describe the beautiful LU factorization of a square matrix (or how to write Gaussian elimination in terms of matrix

More information

5.4 Closest Pair of Points

5.4 Closest Pair of Points 5.4 Closest Pair of Points Closest Pair of Points Closest pair. Given n points in the plane, find a pair with smallest Euclidean distance between them. Fundamental geometric primitive. Graphics, computer

More information

Divide-and-conquer algorithms

Divide-and-conquer algorithms Chapter 2 Divide-and-conquer algorithms The divide-and-conquer strategy solves a problem by: 1 Breaking it into subproblems that are themselves smaller instances of the same type of problem 2 Recursively

More information

Lecture 3: Finding integer solutions to systems of linear equations

Lecture 3: Finding integer solutions to systems of linear equations Lecture 3: Finding integer solutions to systems of linear equations Algorithmic Number Theory (Fall 2014) Rutgers University Swastik Kopparty Scribe: Abhishek Bhrushundi 1 Overview The goal of this lecture

More information

Essential Mathematics for Computer Graphics fast

Essential Mathematics for Computer Graphics fast John Vince Essential Mathematics for Computer Graphics fast Springer Contents 1. MATHEMATICS 1 Is mathematics difficult? 3 Who should read this book? 4 Aims and objectives of this book 4 Assumptions made

More information

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS Systems of Equations and Matrices Representation of a linear system The general system of m equations in n unknowns can be written a x + a 2 x 2 + + a n x n b a

More information

1 Determinants and the Solvability of Linear Systems

1 Determinants and the Solvability of Linear Systems 1 Determinants and the Solvability of Linear Systems In the last section we learned how to use Gaussian elimination to solve linear systems of n equations in n unknowns The section completely side-stepped

More information

Systems of Linear Equations

Systems of Linear Equations Systems of Linear Equations Beifang Chen Systems of linear equations Linear systems A linear equation in variables x, x,, x n is an equation of the form a x + a x + + a n x n = b, where a, a,, a n and

More information

a 11 x 1 + a 12 x 2 + + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + + a 2n x n = b 2.

a 11 x 1 + a 12 x 2 + + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + + a 2n x n = b 2. Chapter 1 LINEAR EQUATIONS 1.1 Introduction to linear equations A linear equation in n unknowns x 1, x,, x n is an equation of the form a 1 x 1 + a x + + a n x n = b, where a 1, a,..., a n, b are given

More information

Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs

Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs CSE599s: Extremal Combinatorics November 21, 2011 Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs Lecturer: Anup Rao 1 An Arithmetic Circuit Lower Bound An arithmetic circuit is just like

More information

Torgerson s Classical MDS derivation: 1: Determining Coordinates from Euclidean Distances

Torgerson s Classical MDS derivation: 1: Determining Coordinates from Euclidean Distances Torgerson s Classical MDS derivation: 1: Determining Coordinates from Euclidean Distances It is possible to construct a matrix X of Cartesian coordinates of points in Euclidean space when we know the Euclidean

More information

On the complexity of some computational problems in the Turing model

On the complexity of some computational problems in the Turing model On the complexity of some computational problems in the Turing model Claus Diem November 18, 2013 Abstract Algorithms for concrete problems are usually described and analyzed in some random access machine

More information

Nimble Algorithms for Cloud Computing. Ravi Kannan, Santosh Vempala and David Woodruff

Nimble Algorithms for Cloud Computing. Ravi Kannan, Santosh Vempala and David Woodruff Nimble Algorithms for Cloud Computing Ravi Kannan, Santosh Vempala and David Woodruff Cloud computing Data is distributed arbitrarily on many servers Parallel algorithms: time Streaming algorithms: sublinear

More information

Similarity and Diagonalization. Similar Matrices

Similarity and Diagonalization. Similar Matrices MATH022 Linear Algebra Brief lecture notes 48 Similarity and Diagonalization Similar Matrices Let A and B be n n matrices. We say that A is similar to B if there is an invertible n n matrix P such that

More information

THE DIMENSION OF A VECTOR SPACE

THE DIMENSION OF A VECTOR SPACE THE DIMENSION OF A VECTOR SPACE KEITH CONRAD This handout is a supplementary discussion leading up to the definition of dimension and some of its basic properties. Let V be a vector space over a field

More information

These axioms must hold for all vectors ū, v, and w in V and all scalars c and d.

These axioms must hold for all vectors ū, v, and w in V and all scalars c and d. DEFINITION: A vector space is a nonempty set V of objects, called vectors, on which are defined two operations, called addition and multiplication by scalars (real numbers), subject to the following axioms

More information

Chapter 19. General Matrices. An n m matrix is an array. a 11 a 12 a 1m a 21 a 22 a 2m A = a n1 a n2 a nm. The matrix A has n row vectors

Chapter 19. General Matrices. An n m matrix is an array. a 11 a 12 a 1m a 21 a 22 a 2m A = a n1 a n2 a nm. The matrix A has n row vectors Chapter 9. General Matrices An n m matrix is an array a a a m a a a m... = [a ij]. a n a n a nm The matrix A has n row vectors and m column vectors row i (A) = [a i, a i,..., a im ] R m a j a j a nj col

More information

Notes on Determinant

Notes on Determinant ENGG2012B Advanced Engineering Mathematics Notes on Determinant Lecturer: Kenneth Shum Lecture 9-18/02/2013 The determinant of a system of linear equations determines whether the solution is unique, without

More information

GENERATING SETS KEITH CONRAD

GENERATING SETS KEITH CONRAD GENERATING SETS KEITH CONRAD 1 Introduction In R n, every vector can be written as a unique linear combination of the standard basis e 1,, e n A notion weaker than a basis is a spanning set: a set of vectors

More information

3.2 Matrix Multiplication

3.2 Matrix Multiplication 3.2 Matrix Multiplication Question : How do you multiply two matrices? Question 2: How do you interpret the entries in a product of two matrices? When you add or subtract two matrices, you add or subtract

More information

IRREDUCIBLE OPERATOR SEMIGROUPS SUCH THAT AB AND BA ARE PROPORTIONAL. 1. Introduction

IRREDUCIBLE OPERATOR SEMIGROUPS SUCH THAT AB AND BA ARE PROPORTIONAL. 1. Introduction IRREDUCIBLE OPERATOR SEMIGROUPS SUCH THAT AB AND BA ARE PROPORTIONAL R. DRNOVŠEK, T. KOŠIR Dedicated to Prof. Heydar Radjavi on the occasion of his seventieth birthday. Abstract. Let S be an irreducible

More information

Chapter 7. Matrices. Definition. An m n matrix is an array of numbers set out in m rows and n columns. Examples. ( 1 1 5 2 0 6

Chapter 7. Matrices. Definition. An m n matrix is an array of numbers set out in m rows and n columns. Examples. ( 1 1 5 2 0 6 Chapter 7 Matrices Definition An m n matrix is an array of numbers set out in m rows and n columns Examples (i ( 1 1 5 2 0 6 has 2 rows and 3 columns and so it is a 2 3 matrix (ii 1 0 7 1 2 3 3 1 is a

More information

Kapitel 1 Multiplication of Long Integers (Faster than Long Multiplication)

Kapitel 1 Multiplication of Long Integers (Faster than Long Multiplication) Kapitel 1 Multiplication of Long Integers (Faster than Long Multiplication) Arno Eigenwillig und Kurt Mehlhorn An algorithm for multiplication of integers is taught already in primary school: To multiply

More information

Matrix Algebra. Some Basic Matrix Laws. Before reading the text or the following notes glance at the following list of basic matrix algebra laws.

Matrix Algebra. Some Basic Matrix Laws. Before reading the text or the following notes glance at the following list of basic matrix algebra laws. Matrix Algebra A. Doerr Before reading the text or the following notes glance at the following list of basic matrix algebra laws. Some Basic Matrix Laws Assume the orders of the matrices are such that

More information

Linear Algebra Notes for Marsden and Tromba Vector Calculus

Linear Algebra Notes for Marsden and Tromba Vector Calculus Linear Algebra Notes for Marsden and Tromba Vector Calculus n-dimensional Euclidean Space and Matrices Definition of n space As was learned in Math b, a point in Euclidean three space can be thought of

More information

1 Introduction to Matrices

1 Introduction to Matrices 1 Introduction to Matrices In this section, important definitions and results from matrix algebra that are useful in regression analysis are introduced. While all statements below regarding the columns

More information

1 Sets and Set Notation.

1 Sets and Set Notation. LINEAR ALGEBRA MATH 27.6 SPRING 23 (COHEN) LECTURE NOTES Sets and Set Notation. Definition (Naive Definition of a Set). A set is any collection of objects, called the elements of that set. We will most

More information

Factoring Algorithms

Factoring Algorithms Factoring Algorithms The p 1 Method and Quadratic Sieve November 17, 2008 () Factoring Algorithms November 17, 2008 1 / 12 Fermat s factoring method Fermat made the observation that if n has two factors

More information

GROUPS ACTING ON A SET

GROUPS ACTING ON A SET GROUPS ACTING ON A SET MATH 435 SPRING 2012 NOTES FROM FEBRUARY 27TH, 2012 1. Left group actions Definition 1.1. Suppose that G is a group and S is a set. A left (group) action of G on S is a rule for

More information

1 Homework 1. [p 0 q i+j +... + p i 1 q j+1 ] + [p i q j ] + [p i+1 q j 1 +... + p i+j q 0 ]

1 Homework 1. [p 0 q i+j +... + p i 1 q j+1 ] + [p i q j ] + [p i+1 q j 1 +... + p i+j q 0 ] 1 Homework 1 (1) Prove the ideal (3,x) is a maximal ideal in Z[x]. SOLUTION: Suppose we expand this ideal by including another generator polynomial, P / (3, x). Write P = n + x Q with n an integer not

More information

Lecture 2 Matrix Operations

Lecture 2 Matrix Operations Lecture 2 Matrix Operations transpose, sum & difference, scalar multiplication matrix multiplication, matrix-vector product matrix inverse 2 1 Matrix transpose transpose of m n matrix A, denoted A T or

More information

v w is orthogonal to both v and w. the three vectors v, w and v w form a right-handed set of vectors.

v w is orthogonal to both v and w. the three vectors v, w and v w form a right-handed set of vectors. 3. Cross product Definition 3.1. Let v and w be two vectors in R 3. The cross product of v and w, denoted v w, is the vector defined as follows: the length of v w is the area of the parallelogram with

More information

Math 115A HW4 Solutions University of California, Los Angeles. 5 2i 6 + 4i. (5 2i)7i (6 + 4i)( 3 + i) = 35i + 14 ( 22 6i) = 36 + 41i.

Math 115A HW4 Solutions University of California, Los Angeles. 5 2i 6 + 4i. (5 2i)7i (6 + 4i)( 3 + i) = 35i + 14 ( 22 6i) = 36 + 41i. Math 5A HW4 Solutions September 5, 202 University of California, Los Angeles Problem 4..3b Calculate the determinant, 5 2i 6 + 4i 3 + i 7i Solution: The textbook s instructions give us, (5 2i)7i (6 + 4i)(

More information

SECOND DERIVATIVE TEST FOR CONSTRAINED EXTREMA

SECOND DERIVATIVE TEST FOR CONSTRAINED EXTREMA SECOND DERIVATIVE TEST FOR CONSTRAINED EXTREMA This handout presents the second derivative test for a local extrema of a Lagrange multiplier problem. The Section 1 presents a geometric motivation for the

More information

Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally

Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally Recurrence Relations Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally modeled by recurrence relations. A recurrence relation is an equation which

More information

The Characteristic Polynomial

The Characteristic Polynomial Physics 116A Winter 2011 The Characteristic Polynomial 1 Coefficients of the characteristic polynomial Consider the eigenvalue problem for an n n matrix A, A v = λ v, v 0 (1) The solution to this problem

More information

Parallel Algorithm for Dense Matrix Multiplication

Parallel Algorithm for Dense Matrix Multiplication Parallel Algorithm for Dense Matrix Multiplication CSE633 Parallel Algorithms Fall 2012 Ortega, Patricia Outline Problem definition Assumptions Implementation Test Results Future work Conclusions Problem

More information

AN ALGORITHM FOR DETERMINING WHETHER A GIVEN BINARY MATROID IS GRAPHIC

AN ALGORITHM FOR DETERMINING WHETHER A GIVEN BINARY MATROID IS GRAPHIC AN ALGORITHM FOR DETERMINING WHETHER A GIVEN BINARY MATROID IS GRAPHIC W. T. TUTTE. Introduction. In a recent series of papers [l-4] on graphs and matroids I used definitions equivalent to the following.

More information

Lecture 4: Partitioned Matrices and Determinants

Lecture 4: Partitioned Matrices and Determinants Lecture 4: Partitioned Matrices and Determinants 1 Elementary row operations Recall the elementary operations on the rows of a matrix, equivalent to premultiplying by an elementary matrix E: (1) multiplying

More information

The Assignment Problem and the Hungarian Method

The Assignment Problem and the Hungarian Method The Assignment Problem and the Hungarian Method 1 Example 1: You work as a sales manager for a toy manufacturer, and you currently have three salespeople on the road meeting buyers. Your salespeople are

More information

1 0 5 3 3 A = 0 0 0 1 3 0 0 0 0 0 0 0 0 0 0

1 0 5 3 3 A = 0 0 0 1 3 0 0 0 0 0 0 0 0 0 0 Solutions: Assignment 4.. Find the redundant column vectors of the given matrix A by inspection. Then find a basis of the image of A and a basis of the kernel of A. 5 A The second and third columns are

More information

( ) which must be a vector

( ) which must be a vector MATH 37 Linear Transformations from Rn to Rm Dr. Neal, WKU Let T : R n R m be a function which maps vectors from R n to R m. Then T is called a linear transformation if the following two properties are

More information

DETERMINANTS TERRY A. LORING

DETERMINANTS TERRY A. LORING DETERMINANTS TERRY A. LORING 1. Determinants: a Row Operation By-Product The determinant is best understood in terms of row operations, in my opinion. Most books start by defining the determinant via formulas

More information

Recall that two vectors in are perpendicular or orthogonal provided that their dot

Recall that two vectors in are perpendicular or orthogonal provided that their dot Orthogonal Complements and Projections Recall that two vectors in are perpendicular or orthogonal provided that their dot product vanishes That is, if and only if Example 1 The vectors in are orthogonal

More information

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES I GROUPS: BASIC DEFINITIONS AND EXAMPLES Definition 1: An operation on a set G is a function : G G G Definition 2: A group is a set G which is equipped with an operation and a special element e G, called

More information

ONLINE DEGREE-BOUNDED STEINER NETWORK DESIGN. Sina Dehghani Saeed Seddighin Ali Shafahi Fall 2015

ONLINE DEGREE-BOUNDED STEINER NETWORK DESIGN. Sina Dehghani Saeed Seddighin Ali Shafahi Fall 2015 ONLINE DEGREE-BOUNDED STEINER NETWORK DESIGN Sina Dehghani Saeed Seddighin Ali Shafahi Fall 2015 ONLINE STEINER FOREST PROBLEM An initially given graph G. s 1 s 2 A sequence of demands (s i, t i ) arriving

More information

Reduced echelon form: Add the following conditions to conditions 1, 2, and 3 above:

Reduced echelon form: Add the following conditions to conditions 1, 2, and 3 above: Section 1.2: Row Reduction and Echelon Forms Echelon form (or row echelon form): 1. All nonzero rows are above any rows of all zeros. 2. Each leading entry (i.e. left most nonzero entry) of a row is in

More information

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1.

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1. MATH10212 Linear Algebra Textbook: D. Poole, Linear Algebra: A Modern Introduction. Thompson, 2006. ISBN 0-534-40596-7. Systems of Linear Equations Definition. An n-dimensional vector is a row or a column

More information

Solution to Homework 2

Solution to Homework 2 Solution to Homework 2 Olena Bormashenko September 23, 2011 Section 1.4: 1(a)(b)(i)(k), 4, 5, 14; Section 1.5: 1(a)(b)(c)(d)(e)(n), 2(a)(c), 13, 16, 17, 18, 27 Section 1.4 1. Compute the following, if

More information

2x + y = 3. Since the second equation is precisely the same as the first equation, it is enough to find x and y satisfying the system

2x + y = 3. Since the second equation is precisely the same as the first equation, it is enough to find x and y satisfying the system 1. Systems of linear equations We are interested in the solutions to systems of linear equations. A linear equation is of the form 3x 5y + 2z + w = 3. The key thing is that we don t multiply the variables

More information

Question 2: How do you solve a matrix equation using the matrix inverse?

Question 2: How do you solve a matrix equation using the matrix inverse? Question : How do you solve a matrix equation using the matrix inverse? In the previous question, we wrote systems of equations as a matrix equation AX B. In this format, the matrix A contains the coefficients

More information

Modern Optimization Methods for Big Data Problems MATH11146 The University of Edinburgh

Modern Optimization Methods for Big Data Problems MATH11146 The University of Edinburgh Modern Optimization Methods for Big Data Problems MATH11146 The University of Edinburgh Peter Richtárik Week 3 Randomized Coordinate Descent With Arbitrary Sampling January 27, 2016 1 / 30 The Problem

More information

Matrix-Chain Multiplication

Matrix-Chain Multiplication Matrix-Chain Multiplication Let A be an n by m matrix, let B be an m by p matrix, then C = AB is an n by p matrix. C = AB can be computed in O(nmp) time, using traditional matrix multiplication. Suppose

More information

3.2 The Factor Theorem and The Remainder Theorem

3.2 The Factor Theorem and The Remainder Theorem 3. The Factor Theorem and The Remainder Theorem 57 3. The Factor Theorem and The Remainder Theorem Suppose we wish to find the zeros of f(x) = x 3 + 4x 5x 4. Setting f(x) = 0 results in the polynomial

More information

7. LU factorization. factor-solve method. LU factorization. solving Ax = b with A nonsingular. the inverse of a nonsingular matrix

7. LU factorization. factor-solve method. LU factorization. solving Ax = b with A nonsingular. the inverse of a nonsingular matrix 7. LU factorization EE103 (Fall 2011-12) factor-solve method LU factorization solving Ax = b with A nonsingular the inverse of a nonsingular matrix LU factorization algorithm effect of rounding error sparse

More information

NOTES ON LINEAR TRANSFORMATIONS

NOTES ON LINEAR TRANSFORMATIONS NOTES ON LINEAR TRANSFORMATIONS Definition 1. Let V and W be vector spaces. A function T : V W is a linear transformation from V to W if the following two properties hold. i T v + v = T v + T v for all

More information

Matrix Algebra in R A Minimal Introduction

Matrix Algebra in R A Minimal Introduction A Minimal Introduction James H. Steiger Department of Psychology and Human Development Vanderbilt University Regression Modeling, 2009 1 Defining a Matrix in R Entering by Columns Entering by Rows Entering

More information

Linear Programming. March 14, 2014

Linear Programming. March 14, 2014 Linear Programming March 1, 01 Parts of this introduction to linear programming were adapted from Chapter 9 of Introduction to Algorithms, Second Edition, by Cormen, Leiserson, Rivest and Stein [1]. 1

More information

AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables

AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables AMATH 352 Lecture 3 MATLAB Tutorial MATLAB (short for MATrix LABoratory) is a very useful piece of software for numerical analysis. It provides an environment for computation and the visualization. Learning

More information

By choosing to view this document, you agree to all provisions of the copyright laws protecting it.

By choosing to view this document, you agree to all provisions of the copyright laws protecting it. This material is posted here with permission of the IEEE Such permission of the IEEE does not in any way imply IEEE endorsement of any of Helsinki University of Technology's products or services Internal

More information

6. Cholesky factorization

6. Cholesky factorization 6. Cholesky factorization EE103 (Fall 2011-12) triangular matrices forward and backward substitution the Cholesky factorization solving Ax = b with A positive definite inverse of a positive definite matrix

More information

Subspaces of R n LECTURE 7. 1. Subspaces

Subspaces of R n LECTURE 7. 1. Subspaces LECTURE 7 Subspaces of R n Subspaces Definition 7 A subset W of R n is said to be closed under vector addition if for all u, v W, u + v is also in W If rv is in W for all vectors v W and all scalars r

More information

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8] Code No: R05220502 Set No. 1 1. (a) Describe the performance analysis in detail. (b) Show that f 1 (n)+f 2 (n) = 0(max(g 1 (n), g 2 (n)) where f 1 (n) = 0(g 1 (n)) and f 2 (n) = 0(g 2 (n)). [8+8] 2. (a)

More information

Linear Codes. Chapter 3. 3.1 Basics

Linear Codes. Chapter 3. 3.1 Basics Chapter 3 Linear Codes In order to define codes that we can encode and decode efficiently, we add more structure to the codespace. We shall be mainly interested in linear codes. A linear code of length

More information

A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form

A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form Section 1.3 Matrix Products A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form (scalar #1)(quantity #1) + (scalar #2)(quantity #2) +...

More information

T ( a i x i ) = a i T (x i ).

T ( a i x i ) = a i T (x i ). Chapter 2 Defn 1. (p. 65) Let V and W be vector spaces (over F ). We call a function T : V W a linear transformation form V to W if, for all x, y V and c F, we have (a) T (x + y) = T (x) + T (y) and (b)

More information

A vector is a directed line segment used to represent a vector quantity.

A vector is a directed line segment used to represent a vector quantity. Chapters and 6 Introduction to Vectors A vector quantity has direction and magnitude. There are many examples of vector quantities in the natural world, such as force, velocity, and acceleration. A vector

More information

Efficient Data Storage in Large Nanoarrays

Efficient Data Storage in Large Nanoarrays Efficient Data Storage in Large Nanoarrays Lee-Ad J. Gottlieb, John E. Savage, and Arkady Yerukhimovich Department of Computer Science Brown University {legottli, jes}@cs.brown.edu, arkady@alumni.brown.edu

More information

State of Stress at Point

State of Stress at Point State of Stress at Point Einstein Notation The basic idea of Einstein notation is that a covector and a vector can form a scalar: This is typically written as an explicit sum: According to this convention,

More information

α = u v. In other words, Orthogonal Projection

α = u v. In other words, Orthogonal Projection Orthogonal Projection Given any nonzero vector v, it is possible to decompose an arbitrary vector u into a component that points in the direction of v and one that points in a direction orthogonal to v

More information

DATA ANALYSIS II. Matrix Algorithms

DATA ANALYSIS II. Matrix Algorithms DATA ANALYSIS II Matrix Algorithms Similarity Matrix Given a dataset D = {x i }, i=1,..,n consisting of n points in R d, let A denote the n n symmetric similarity matrix between the points, given as where

More information

Lecture 13: The Knapsack Problem

Lecture 13: The Knapsack Problem Lecture 13: The Knapsack Problem Outline of this Lecture Introduction of the 0-1 Knapsack Problem. A dynamic programming solution to this problem. 1 0-1 Knapsack Problem Informal Description: We have computed

More information

Fractions and Linear Equations

Fractions and Linear Equations Fractions and Linear Equations Fraction Operations While you can perform operations on fractions using the calculator, for this worksheet you must perform the operations by hand. You must show all steps

More information

Lecture 2 Linear functions and examples

Lecture 2 Linear functions and examples EE263 Autumn 2007-08 Stephen Boyd Lecture 2 Linear functions and examples linear equations and functions engineering examples interpretations 2 1 Linear equations consider system of linear equations y

More information

Closest Pair Problem

Closest Pair Problem Closest Pair Problem Given n points in d-dimensions, find two whose mutual distance is smallest. Fundamental problem in many applications as well as a key step in many algorithms. p q A naive algorithm

More information

ON THE COMPLEXITY OF THE GAME OF SET. {kamalika,pbg,dratajcz,hoeteck}@cs.berkeley.edu

ON THE COMPLEXITY OF THE GAME OF SET. {kamalika,pbg,dratajcz,hoeteck}@cs.berkeley.edu ON THE COMPLEXITY OF THE GAME OF SET KAMALIKA CHAUDHURI, BRIGHTEN GODFREY, DAVID RATAJCZAK, AND HOETECK WEE {kamalika,pbg,dratajcz,hoeteck}@cs.berkeley.edu ABSTRACT. Set R is a card game played with a

More information

Lecture 4: AC 0 lower bounds and pseudorandomness

Lecture 4: AC 0 lower bounds and pseudorandomness Lecture 4: AC 0 lower bounds and pseudorandomness Topics in Complexity Theory and Pseudorandomness (Spring 2013) Rutgers University Swastik Kopparty Scribes: Jason Perry and Brian Garnett In this lecture,

More information

Notes on Cholesky Factorization

Notes on Cholesky Factorization Notes on Cholesky Factorization Robert A. van de Geijn Department of Computer Science Institute for Computational Engineering and Sciences The University of Texas at Austin Austin, TX 78712 rvdg@cs.utexas.edu

More information

Report: Declarative Machine Learning on MapReduce (SystemML)

Report: Declarative Machine Learning on MapReduce (SystemML) Report: Declarative Machine Learning on MapReduce (SystemML) Jessica Falk ETH-ID 11-947-512 May 28, 2014 1 Introduction SystemML is a system used to execute machine learning (ML) algorithms in HaDoop,

More information

2.1 Complexity Classes

2.1 Complexity Classes 15-859(M): Randomized Algorithms Lecturer: Shuchi Chawla Topic: Complexity classes, Identity checking Date: September 15, 2004 Scribe: Andrew Gilpin 2.1 Complexity Classes In this lecture we will look

More information

Lecture Notes 2: Matrices as Systems of Linear Equations

Lecture Notes 2: Matrices as Systems of Linear Equations 2: Matrices as Systems of Linear Equations 33A Linear Algebra, Puck Rombach Last updated: April 13, 2016 Systems of Linear Equations Systems of linear equations can represent many things You have probably

More information

(67902) Topics in Theory and Complexity Nov 2, 2006. Lecture 7

(67902) Topics in Theory and Complexity Nov 2, 2006. Lecture 7 (67902) Topics in Theory and Complexity Nov 2, 2006 Lecturer: Irit Dinur Lecture 7 Scribe: Rani Lekach 1 Lecture overview This Lecture consists of two parts In the first part we will refresh the definition

More information

Arithmetic Coding: Introduction

Arithmetic Coding: Introduction Data Compression Arithmetic coding Arithmetic Coding: Introduction Allows using fractional parts of bits!! Used in PPM, JPEG/MPEG (as option), Bzip More time costly than Huffman, but integer implementation

More information

3. Mathematical Induction

3. Mathematical Induction 3. MATHEMATICAL INDUCTION 83 3. Mathematical Induction 3.1. First Principle of Mathematical Induction. Let P (n) be a predicate with domain of discourse (over) the natural numbers N = {0, 1,,...}. If (1)

More information

The Butterfly, Cube-Connected-Cycles and Benes Networks

The Butterfly, Cube-Connected-Cycles and Benes Networks The Butterfly, Cube-Connected-Cycles and Benes Networks Michael Lampis mlambis@softlab.ntua.gr NTUA The Butterfly, Cube-Connected-Cycles and Benes Networks p.1/16 Introduction Hypercubes are computationally

More information

Factoring Algorithms

Factoring Algorithms Institutionen för Informationsteknologi Lunds Tekniska Högskola Department of Information Technology Lund University Cryptology - Project 1 Factoring Algorithms The purpose of this project is to understand

More information

SOLVING LINEAR SYSTEMS

SOLVING LINEAR SYSTEMS SOLVING LINEAR SYSTEMS Linear systems Ax = b occur widely in applied mathematics They occur as direct formulations of real world problems; but more often, they occur as a part of the numerical analysis

More information

Some Polynomial Theorems. John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.

Some Polynomial Theorems. John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom. Some Polynomial Theorems by John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.com This paper contains a collection of 31 theorems, lemmas,

More information

7 Gaussian Elimination and LU Factorization

7 Gaussian Elimination and LU Factorization 7 Gaussian Elimination and LU Factorization In this final section on matrix factorization methods for solving Ax = b we want to take a closer look at Gaussian elimination (probably the best known method

More information

JUST-IN-TIME SCHEDULING WITH PERIODIC TIME SLOTS. Received December May 12, 2003; revised February 5, 2004

JUST-IN-TIME SCHEDULING WITH PERIODIC TIME SLOTS. Received December May 12, 2003; revised February 5, 2004 Scientiae Mathematicae Japonicae Online, Vol. 10, (2004), 431 437 431 JUST-IN-TIME SCHEDULING WITH PERIODIC TIME SLOTS Ondřej Čepeka and Shao Chin Sung b Received December May 12, 2003; revised February

More information

A note on companion matrices

A note on companion matrices Linear Algebra and its Applications 372 (2003) 325 33 www.elsevier.com/locate/laa A note on companion matrices Miroslav Fiedler Academy of Sciences of the Czech Republic Institute of Computer Science Pod

More information