# HOMEWORK 02 Solution

\$30.00

Category:

## Description

First of all, carefully reread Chapter 2, especially the sections on vector norms and operator norms.

Problem 01 Using MATLAB, do the following procedure.

HW_02.mat

from Canvas to your working directory, and load it into your MATLAB session. Check what variables (i.e., arrays) are defined in this data file by running

>> whos

(b) Plot the data by typing

>> plot(x,y); grid;

(c) Create the Vandermonde matrix for polynomials of degree 1; (i.e., lines) by typing

>> A=[x.^0 x.^1];

(d) Compute the least squares line over the given data by typing

>> sol = inv(A’*A)*A’*y;

Then, overlay the least squares line over the current plot by typing

>> hold on; plot(x, sol(1)+sol(2)*x, ’–’);

Create the title and axis labels by typing

>> title(’Least Squares Linear Fit’); xlabel(’x’); ylabel(’y’);

Print out this plot and include a the PDF copy of the plot in you HW PDF file also with a carefully written description of how you obtained the plot and what it is.

(e) Finally, create a MATLAB file HW_02.m from the above commands with appropriate comments. Use the MAT-LAB listing in the Solutions to HW_01 as an example of good commenting practice.

(f) Write a detailed explanation of what this MATLAB program does and put it in your PDF file.

Problem 02 Prove that for a square matrix A, null(A) ˘ {0} implies A is invertible.

Problem 03 Find the minimum value of kxk1 subject to kxk2 ˘ 1 in R2. Which x achieves such minimum? [ Hint: set x ˘ [cos µ, sin µ]T, 0 • µ • 2…. ]

© Professor E. G. Puckett – 1 – Revision 1.04 Fri 27th Apr, 2018 at 14:43

1•im

MAT 167–001 HOMEWORK 02

Problem 04 Let k ¢ k denote any norm on Rm and also the induced matrix norm on Rm£m . Let ‰(A) be the spectral radius

def

of A; i.e., ‰(A) ˘ max j‚i (A)j, where ‚i (A) is the i th eigenvalue of A. Prove ‰(A) • kAk.

Problem 05 Let A ˘ uvT where u 2 Rm and v 2 Rn . Prove kAk2 ˘ kuk2kvk2.

Problem 06 (a) Define the following matrix

21 23

40 25,

1 3

in MATLAB. Then, compute the 2-norm by the norm function, and report the result in a long format (16 digits) via

• format long

• norm(A)

(b) Compute the 2-norm explicitly using the largest eigenvalue of AT A using the eig function, i.e.,

>> sqrt(max(eig(A’*A)))

Then, compare the result with that of Part (a). What is the relative error between the norm computed in Part (a) and that in Part (b)?

(c) Compute the 1-norm, 1-norm, and Frobenius norm of A by hand using the formulas derived in the class. Then, using the norm function, compare the MATLAB outputs with your hand-computed results. You should check how to use the norm function using the help utility:

>> help norm

(d) ] Let’s load the MATLAB data file

that you used for HW 01 again. It’s located on both Piazza and Canvas Then, compute first the coefficient vector by

>> a = U’*x;

Now, compute kxkp and kakp , p ˘ 1, 2, 1, using the norm function, and report the results. Which value of p, you got kxkp ˘ kakp ?

(e) Now, compute the matrix norms, kUkp , p ˘ 1, 2, 1 as well as kUkF using the norm function, then report the results.

Problem 07 Linear Least Squares: You are meant to do this problem by hand calculation as you would on a test.

(a) Set up the normal equation for the linear least squares approximation for the data (1, ¡1), (2, 3), and (3, 1).

MAT 167–001 HOMEWORK 02 SPRING QUARTER 2018

(b) Solve for the least squares approximation from Problem 07 (a).

© Professor E. G. Puckett – 3 – Revision 1.04 Fri 27th Apr, 2018 at 14:43

error: Content is protected !!