Designing Information Devices and Systems I Spring 2018 Homework 5

Similar documents
Designing Information Devices and Systems I Spring 2016 Elad Alon, Babak Ayazifar Homework 12

Designing Information Devices and Systems I Fall 2018 Homework 5

Designing Information Devices and Systems I Spring 2019 Homework 5

Designing Information Devices and Systems I Spring 2017 Babak Ayazifar, Vladimir Stojanovic Homework 4

Designing Information Devices and Systems I Spring 2018 Homework 13

Designing Information Devices and Systems I Discussion 4B

Lecture 10: Powers of Matrices, Difference Equations

Designing Information Devices and Systems I Spring 2017 Babak Ayazifar, Vladimir Stojanovic Midterm 1

Designing Information Devices and Systems I Discussion 4B

Designing Information Devices and Systems I Spring 2016 Elad Alon, Babak Ayazifar Homework 11

Designing Information Devices and Systems I Fall 2015 Anant Sahai, Ali Niknejad Final Exam. Exam location: RSF Fieldhouse, Back Left, last SID 6, 8, 9

Designing Information Devices and Systems I Spring 2018 Homework 11

Designing Information Devices and Systems I Spring 2018 Lecture Notes Note Introduction to Linear Algebra the EECS Way

Activity: Derive a matrix from input-output pairs

Designing Information Devices and Systems I Fall 2017 Homework 3

MATHEMATICS 23a/E-23a, Fall 2015 Linear Algebra and Real Analysis I Module #1, Week 4 (Eigenvectors and Eigenvalues)

Spring 2019 Exam 2 3/27/19 Time Limit: / Problem Points Score. Total: 280

Designing Information Devices and Systems I Fall 2018 Lecture Notes Note Introduction to Linear Algebra the EECS Way

Designing Information Devices and Systems I Spring 2017 Babak Ayazifar, Vladimir Stojanovic Homework 2

Examples True or false: 3. Let A be a 3 3 matrix. Then there is a pattern in A with precisely 4 inversions.

MAT 1302B Mathematical Methods II

Announcements Monday, November 06

Math 250B Midterm III Information Fall 2018 SOLUTIONS TO PRACTICE PROBLEMS

Chapters 5 & 6: Theory Review: Solutions Math 308 F Spring 2015

MAT1302F Mathematical Methods II Lecture 19

Recall : Eigenvalues and Eigenvectors

235 Final exam review questions

Designing Information Devices and Systems II Fall 2018 Elad Alon and Miki Lustig Homework 9

Class President: A Network Approach to Popularity. Due July 18, 2014

Math Linear Algebra Final Exam Review Sheet

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

M340(921) Solutions Practice Problems (c) 2013, Philip D Loewen

LINEAR ALGEBRA 1, 2012-I PARTIAL EXAM 3 SOLUTIONS TO PRACTICE PROBLEMS

1. What is the determinant of the following matrix? a 1 a 2 4a 3 2a 2 b 1 b 2 4b 3 2b c 1. = 4, then det

Total 100

5.) For each of the given sets of vectors, determine whether or not the set spans R 3. Give reasons for your answers.

Math 54 HW 4 solutions

Math 250B Midterm III Information Fall 2018

Lecture 15, 16: Diagonalization

Math 3C Lecture 20. John Douglas Moore

What is A + B? What is A B? What is AB? What is BA? What is A 2? and B = QUESTION 2. What is the reduced row echelon matrix of A =

[Disclaimer: This is not a complete list of everything you need to know, just some of the topics that gave people difficulty.]

Elementary Linear Algebra Review for Exam 3 Exam is Friday, December 11th from 1:15-3:15

Eigenvalues, Eigenvectors, and an Intro to PCA

k is a product of elementary matrices.

DIAGONALIZATION. In order to see the implications of this definition, let us consider the following example Example 1. Consider the matrix

Matrices related to linear transformations

Designing Information Devices and Systems I Fall 2018 Homework 3

Linear Algebra (MATH ) Spring 2011 Final Exam Practice Problem Solutions

7.6 The Inverse of a Square Matrix

Romeo, Romeo, What Art Thou Differential Equations?

Math 504 (Fall 2011) 1. (*) Consider the matrices

MATH 1120 (LINEAR ALGEBRA 1), FINAL EXAM FALL 2011 SOLUTIONS TO PRACTICE VERSION

Designing Information Devices and Systems I Spring 2019 Lecture Notes Note 6

Designing Information Devices and Systems I Discussion 2A

Computational Methods. Eigenvalues and Singular Values

MATH 315 Linear Algebra Homework #1 Assigned: August 20, 2018

Designing Information Devices and Systems I Spring 2016 Official Lecture Notes Note 21

(b) Why is this a coherent FFL? Show by drawing a diagram using activating ( ) and / or inhibiting ( -- ) interactions between S, R and X.

Lab #2 - Two Degrees-of-Freedom Oscillator

Eigenvalues and Eigenvectors

EXAM 2 REVIEW DAVID SEAL

Math 301 Final Exam. Dr. Holmes. December 17, 2007

a j x j. j=0 The number R (possibly infinite) which Theorem 1 guarantees is called the radius of convergence of the power series.

EXAM. Exam #3. Math 2360, Spring April 24, 2001 ANSWERS

Chapter 5. Eigenvalues and Eigenvectors

Designing Information Devices and Systems I Fall 2016 Babak Ayazifar, Vladimir Stojanovic Final Exam

Problem # Max points possible Actual score Total 120

TMA Calculus 3. Lecture 21, April 3. Toke Meier Carlsen Norwegian University of Science and Technology Spring 2013

2 Two-Point Boundary Value Problems

Study Guide for Linear Algebra Exam 2

CS 246 Review of Linear Algebra 01/17/19

Eigenvectors and Hermitian Operators

Test 3, Linear Algebra

Designing Information Devices and Systems I Fall 2016 Babak Ayazifar, Vladimir Stojanovic Midterm 1. Exam location: 145 Dwinelle, last SID# 2

MATH 341 MIDTERM 2. (a) [5 pts] Demonstrate that A and B are row equivalent by providing a sequence of row operations leading from A to B.

UCSD ECE269 Handout #8 Prof. Young-Han Kim Wednesday, February 7, Homework Set #4 (Due: Wednesday, February 21, 2018)

PUTNAM TRAINING MATHEMATICAL INDUCTION. Exercises

Solutions to Final Exam

4. Linear transformations as a vector space 17

Math/Phys/Engr 428, Math 529/Phys 528 Numerical Methods - Summer Homework 3 Due: Tuesday, July 3, 2018

REVIEW FOR EXAM III SIMILARITY AND DIAGONALIZATION

Final Review Written by Victoria Kala SH 6432u Office Hours R 12:30 1:30pm Last Updated 11/30/2015

MIT Final Exam Solutions, Spring 2017

= main diagonal, in the order in which their corresponding eigenvectors appear as columns of E.

Review problems for MA 54, Fall 2004.

Summer Session Practice Final Exam

Chapter 4 & 5: Vector Spaces & Linear Transformations

Eigenvalues, Eigenvectors, and Diagonalization

Notes on singular value decomposition for Math 54. Recall that if A is a symmetric n n matrix, then A has real eigenvalues A = P DP 1 A = P DP T.

Announcements Monday, October 29

Lecture 6: Lies, Inner Product Spaces, and Symmetric Matrices

Math Fall Final Exam

No books, no notes, no calculators. You must show work, unless the question is a true/false, yes/no, or fill-in-the-blank question.

Vectors To begin, let us describe an element of the state space as a point with numerical coordinates, that is x 1. x 2. x =

Designing Information Devices and Systems I Fall 2015 Anant Sahai, Ali Niknejad Homework 2. This homework is due September 14, 2015, at Noon.

Computationally, diagonal matrices are the easiest to work with. With this idea in mind, we introduce similarity:

A linear model for a ranking problem

Answers in blue. If you have questions or spot an error, let me know. 1. Find all matrices that commute with A =. 4 3

COMS 4721: Machine Learning for Data Science Lecture 20, 4/11/2017

Transcription:

EECS 16A Designing Information Devices and Systems I Spring 2018 Homework All problems on this homework are practice, however all concepts covered here are fair game for the exam. 1. Sports Rank Every year in college sports, specifically football and basketball, debate rages over team rankings. The rankings determine who will get to compete for the ultimate prize, the national championship. However, ranking teams is quite challenging in the setting of college sports for a few reasons: there is uneven paired competition (not every team plays each other), there is a sparsity of matches (every team plays a small subset of all the teams available), and there is no well-ordering (team A beats team B who beats team C who beats A). In this problem, we will come up with an algorithm to rank the teams with real data drawn from the 2014 Associated Press (AP) poll of the top 2 college football teams. Given N teams we want to determine the rating r i for the i th team for i = 1,2,...,N, after which the teams can be ranked in order from highest to lowest rating. Given the wins and losses of each team, we can assign each team a score s i. s i = N j where q i j represents the number of times team i has beaten team j divided by the number 1 of games played s 1 s 2 by team i. If we define the vectors s =., and r = r 2 we can express their relationship as a system of. q i j r j, r 1 equations s N r N s = Q r, q 11 q 12... q 1N q 21 q 22... q 2N where Q =..... is an N N matrix.. q N1 q N2... q NN (a) Consider a specific case where we have three teams, team A, team B, and team C. Team A beats team C twice and team B once. Team B beats team A twice and never beats team C. Team C beats team B three times. What is the matrix Q? (b) Returning to the general setting, if our scoring metric is good, then it should be the case that teams with better ratings have higher scores. Let s make the assumption that s i = λr i with λ > 0. Show that r is an eigenvector of Q. 1 We normalize by the number of games played to prevent teams from getting a high score by just repeatedly playing against weak opponents. EECS 16A, Spring 2018, Homework, Last Updated: 2018-02-20 00:41 1

To find our rating vector, we need to find an eigenvector of Q with all nonnegative entries (ratings can t be negative) and a positive eigenvalue. If the matrix Q satisfies certain conditions (beyond the scope of this course), the dominant eigenvalue λ D, i.e. the largest eigenvalue in absolute value, is positive and real. In addition, the dominant eigenvector, i.e. the eigenvector associated with the dominant eigenvalue, is unique and has all positive entries. We will now develop a method for finding the dominant eigenvector for a matrix if it is unique. (c) Given v, an eigenvector of Q with eigenvalue λ, and a real nonzero number c, express Q n c v in terms of v, c,n, and λ. (d) Now given multiple eigenvectors v 1, v 2,..., v m of Q, their eigenvalues λ 1,λ 2,...,λ m, and real nonzero numbers c 1,c 2,...,c m, express Q n ( m i=1 c i v i ) in terms of v s, λ s, and c s. (e) Assuming that λ 1 > λ i for i = 2,...,m, argue or prove that Hints: lim n 1 λ n 1 Q n ( m i=1 c i v i ) = c 1 v 1. i. For sequences of vectors { a n } and { b n }, lim n ( a n + b n ) = lim n a n + lim n b n. ii. For a scalar w with w < 1, lim n w n = 0. (f) Now further assuming that λ 1 is positive, show that Hints: Q n ( m i=1 lim c i v i ) n Q n ( m i=1 c i v i ) = c 1 v 1 c 1 v 1 i. Divide the numerator and denominator by λ1 n and use the result from the previous part. ii. For the sequence of vectors { a n }, lim n a n = lim n a n. iii. For a sequence of vectors { a n } and a sequence of scalars {α n }, if lim n α n is not equal to zero a then the lim n n α n = lim n a n lim n α n. Let s assume that any vector b in R N can be expressed as a linear combination of the eigenvectors of any square matrix A in R N N, i.e. A has N rows and N columns. Let s tie it all together. Given the eigenvectors of Q, v 1, v 2,..., v N, we arbitrarily choose the dominant eigenvector to be v 1 = v D. If we can find a vector b = m i=1 c i v i, such that c 1 is nonzero, then 2 Q n b lim n Q n b = c 1 v D c 1 v D. This is the idea behind the power iteration method, which is a method for finding the unique dominant eigenvector (up to scale) of a matrix whenever one exists. In the IPython notebook, we will use this method to rank our teams. Note: For this application we know the rating vector (which will be the dominant eigenvector) has all positive entries, but c 1 might be negative resulting in our method returning a vector with all negative entries. If this happens, we simply multiply our result by 1. (g) From the method you implemented in the IPython notebook, name the top five teams, the fourteenth team, and the seventeenth team. 2 If we select a vector at random, c 1 will be almost certainly non-zero. EECS 16A, Spring 2018, Homework, Last Updated: 2018-02-20 00:41 2

2. The Dynamics of Romeo and Juliet s Love Affair In this problem, we will study a discrete-time model of the dynamics of Romeo and Juliet s love affair adapted from Steven H. Strogatz s original paper, Love Affairs and Differential Equations, Mathematics Magazine, 61(1), p.3, 1988, which describes a continuous-time model. Let R[n] denote Romeo s feelings about Juliet on day n, and let J[n] quantify Juliet s feelings about Romeo on day n. If R[n] > 0, it means that Romeo loves Juliet and inclines toward her, whereas if R[n] < 0, it means that Romeo is resentful of her and inclines away from her. A similar interpretation holds for J[n], which represents Juliet s feelings about Romeo. A larger R[n] represents a more intense feeling of love (if R[n] > 0) or resentment (if R[n] < 0). If R[n] = 0, it means that Romeo has neutral feelings toward Juliet on day n. Similar interpretations hold for larger J[n] and the case of J[n] = 0. We model the dynamics of Romeo and Juliet s relationship using the following coupled system of linear evolutionary equations: and which we can rewrite as where denotes the state vector and R[n + 1] = ar[n] + bj[n], n = 0,1,2,... J[n + 1] = cr[n] + d J[n], n = 0,1,2,..., s[n + 1] = A s[n], s[n] = [ ] R[n] J[n] [ ] a b A = c d the state transition matrix for our dynamic system model. The parameters a and d capture the linear fashion in which Romeo and Juliet respond to their own feelings, respectively, about the other person. It s reasonable to assume that a, d > 0, to avoid scenarios of fluctuating day-to-day mood swings. Within this positive range, if 0 < a < 1, then the effect of Romeo s own feelings about Juliet tend to fizzle away with time (in the absence of influence from Juliet to the contrary), whereas if a > 1, Romeo s feelings about Juliet intensify with time (in the absence of influence from Juliet to the contrary). A similar interpretation holds when 0 < d < 1 and d > 1. The parameters b and c capture the linear fashion in which the other person s feelings influence R[n] and J[n], respectively. These parameters may or may not be positive. If b > 0, it means that the more Juliet shows affection for Romeo, the more he loves her and inclines toward her. If b < 0, it means that the more Juliet shows affection for Romeo, the more resentful he feels and the more he inclines away from her. A similar interpretation holds for the parameter c. All in all, each of Romeo and Juliet has four romantic styles, which makes for a combined total of sixteen possible dynamic scenarios. The fate of their interactions depends on the romantic style each of them exhibits, the initial state, and the values of the entries in the state transition matrix A. In this problem, we ll explore a subset of the possibilities. EECS 16A, Spring 2018, Homework, Last Updated: 2018-02-20 00:41 3

(a) Consider the case where a + b = c + d in the state-transition matrix [ ] a b A =. c d i. Show that v 1 = is an eigenvector of A, and determine its corresponding eigenvalue λ 1. Also determine the other eigenpair (λ 2, v 2 ). Your expressions for λ 1, λ 2, and v 2 must be in terms of one or more of the parameters a, b, c, and d. ii. Consider the following state-transition matrix: [ ] 0.7 0.2 A = 0.2 0.7 i. Determine the eigenpairs for this system. ii. Determine all the fixed points of the system. That is, find the set of points such that if Romeo and Juliet start at, or enter, any of those points, they ll stay in place forever: { s A s = s }. Show these points on a diagram where the x and y-axes are R[n] and J[n]. iii. Determine representative points along the state trajectory s[n], n = 0, 1, 2,..., if Romeo and Juliet start from the initial state [ ] 1 s[0] =. 1 iv. Suppose the initial state is s[0] = [ 3 ] T. Determine a reasonably simple expression for the state vector s[n]. Find the limiting state vector (b) Consider the setup in which [ a b A = c d [ ] 1 1 lim s[n]. n ] = [ ] 0 1. 1 0 In this scenario, if Juliet shows affection toward Romeo, Romeo s love for her increases, and he inclines toward her. The more intensely Romeo inclines toward her, the more Juliet distances herself. The more Juliet withdraws, the more Romeo is discouraged and retreats into his cave. But the more Romeo inclines away, the more Juliet finds him attractive and the more intensely she conveys her affection toward him. Juliet s increasing warmth increases Romeo s interest in her, which prompts him to incline toward her again! Predict the outcome of this scenario before you write down a single equation. Then determine a complete solution s[n] in the simplest of terms, assuming an initial state given by s[0] = [ 1 0 ] T. As part of this, you must determine the eigenvalues and eigenvectors of the A. Plot (by hand, or otherwise without the assistance of any scientific computing software package), on a two-dimensional plane (called a phase plane) where the horizontal axis denotes R[n] and the vertical axis denotes J[n] representative points along the trajectory of the state vector s[n], starting from the initial state given in this part. Describe, in plain words, what Romeo and Juliet are doing in this scenario. In other words, what does their state trajectory look like? Determine s[n] 2 for all n = 0,1,2,... to corroborate your description of the state trajectory. EECS 16A, Spring 2018, Homework, Last Updated: 2018-02-20 00:41 4

3. Image Compression In this question, we explore how eigenvalues and eigenvectors can be used for image compression. A grayscale image can be represented as a data grid. Say a symmetric, square image is represented by a symmetric matrix A, such that A T = A. We can transform the images to vectors to make it easier to process them as data, but here, we will understand them as 2D data. Let λ 1,...,λ n be the eigenvalues of A with corresponding eigenvectors v 1,..., v n. Also, let these eigenvectors be normalized (unit norm). Then, the matrix can be represented as the expansion A = λ 1 v 1 v T 1 + λ 2 v 2 v T 2 + + λ n v n v T n. Note that the eigenvectors must be normalized for this expansion to be valid because we know that if v i is an eigenvector, then any scalar multiple α v i is also an eigenvector. If we scaled every eigenvector on the right hand side of the equation by α, then the left hand side would change from A to α 2 A. The previous expansion shows that the matrix A can be synthesized by its n eigenvalues and eigenvectors. However, A can also be approximated with the k largest eigenvalues and the corresponding eigenvectors. That is, A λ 1 v 1 v T 1 + λ 2 v 2 v T 2 + + λ k v k v T k. (a) Construct appropriate matrices V, W (using v i s as rows and columns) and a matrix Λ with the eigenvalues λ i as components such that A = VΛW. (b) Use the IPython notebook prob.ipynb and the image file pattern.npy. Use the numpy.linalg.eig command to find the V and Λ matrices for the image. Note that numpy.linalg.eig returns normalized eigenvectors by default. Mathematically, how many eigenvectors are required to fully capture the information within the image? (c) In the IPython notebook, find an approximation for the image using the 100 largest eigenvalues and eigenvectors. (d) Repeat part (c) with k = 0. By further experimenting with the code, what seems to be the lowest value of k that retains most of the salient features of the given image? 4. Noisy Images In lab, we used the single pixel camera to successfully capture a few images with various masks. The only restriction on a mask is that the mask only could only consist of 0 s or 1 s as elements and that the mask matrix, that is, the matrix with the masks as row vectors, is invertible. There are many such matrices that satisfy this condition. One simple example of such a matrix is the identity matrix. In this problem, we are going to explore the design space of matrices that can be used as masks and see the effects of our choice of the matrix. Specifically, we will be analyzing what the effect of noise will be in our system and how we can pick matrices that mitigate the effects of noise. Suppose that we are trying to capture 10 10 images using the single pixel camera from lab. Each mask is then a 10 10 image, represented by a vector of length 100. Since there are 100 unknowns, there will be 100 such vectors leading to a 100 100 mask matrix. We will call this matrix of masks A. The image we are trying to capture will be x, and we will refer to the measurements we make (i.e., after applying all the different masks to the object we are trying to image) as b. Thus, A x = b. (a) Suppose that the measurement process adds noise. Then, rather than measuring b, we measure b + n, where n is a vector representing the added noise. Express x in terms of A, b, and n. EECS 16A, Spring 2018, Homework, Last Updated: 2018-02-20 00:41

(b) We are going to try different A matrices in this problem and compare how they deal with noise. Run the associated cells in the attached IPython notebook. What special matrix is A 1? Are there any differences between the matrices A 2 and A 3? (c) Run the associated cells in the attached IPython notebook. Notice that each plot returns the result of trying to image a noisy image as well as the minimum absolute value of the eigenvalue of each matrix. Comment on the effect of small eigenvalues on the noise in the image. (d) The associated IPython notebook also prints out how many eigenvectors each matrix has. Notice each matrix has 100 eigenvectors. What does this imply about the span of the eigenvectors? Can the noise vector be written as a linear combination of the eigenvectors? (e) Small eigenvalues of A seem to cause problems for our imaging system. Inverting the matrix A turns these small eigenvalues into large eigenvalues. Show that if λ is an eigenvalue of a matrix A, then 1 λ is an eigenvalue of the matrix A 1. Hint: Start with an eigenvalue λ and one corresponding eigenvector v, such that they satisfy A v = λ v.. Is There A Steady State? So far, we ve seen that for a conservative state transition matrix A, we can find the eigenvector, v, corresponding to the eigenvalue λ = 1. This vector is the steady state since A v = v. However, we ve so far taken for granted that the state transition matrix even has the eigenvalue λ = 1. Let s try to prove this fact. (a) Show that if λ is an eigenvalue of a matrix A, then it is also an eigenvalue of the matrix A T. Hint: Recall that the determinants of A and A T are the same. (b) Let a square matrix A have rows that sum to one. Show that 1 = [ 1 1 1 ] T is an eigenvector of A. What is the corresponding eigenvalue? (c) Let s put it together now. From the previous two parts, show that any conservative state transition matrix will have the eigenvalue λ = 1. Recall that conservative state transition matrices are those that have columns that sum to 1. 6. Fibonacci Sequence One of the most useful things about diagonalization is that it allows us to easily compute polynomial functions of matrices. This in turn lets us do far more, including solving many linear recurrence relations. This problem shows you how this can be done for the Fibonacci numbers, but you should notice that the same exact technique can be applied far more generally. (a) The Fibonacci sequence can be constructed according to the following relation. The Nth number in the Fibonacci sequence, F N, is computed by adding the previous two numbers in the sequence together: F N = F N 1 + F N 2 We select the first two numbers in the sequence to be F 1 = 0 and F 2 = 1 and then we can compute the following numbers as 0,1,1,2,3,,8,13,21,34,,... Write the operation of computing the next Fibonacci numbers from the previous two using matrix multiplication: [ ] [ ] FN FN 1 = A F N 1 F N 2 EECS 16A, Spring 2018, Homework, Last Updated: 2018-02-20 00:41 6

(b) Diagonalize A to show that ( F N = 1 1 + ) N 1 ( 1 2 is an analytical expression for the Nth Fibonacci number. 1 ) N 1 2 EECS 16A, Spring 2018, Homework, Last Updated: 2018-02-20 00:41 7