Ahinf Norm Proof

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

HW #2 Solutions: M552 Spring 2006

1. (3.1-Trefethen & Bau) Prove that if W is an arbitrary nonsingular matrix, the function k kW
defined by kxkW = kW xk is a vector norm.
ANS: We need to show

(i) kxkW 0, kxkW = 0 x = 0


Given any x, kxkW = kW xk 0 since k k 0. Let y = W x, and note since W is
nonsingular y = 0 x = 0. Then kxkW = kyk = 0 y = 0 x = 0.
(ii) kxkW = ||kxkW
kxkW = kW (x)k = kW xk = ||kW xk, since this is true for the k k norm. Thus,
kxkW = ||kW xk = ||kxkW .
(iii) kx + ykW kxkW + kykW
kx + ykW = kW (x + y)k = kW x + W yk kW xk + kW yk, since ku + vk kuk + kvk for
any u, v. Thus, kx + ykW kW xk + kW yk = kxkW + kykW .
2. (3.2-Trefethen & Bau) Let k k denote any norm on Cm and also the induced matrix norm on
Cmm . Show that (A) kAk, where (A) is the spectral radius of A, i.e., the largest absolute
value || of an eigenvalue of A.
ANS: First note that for any x, kAxk kAkkxk since this is a property of any induced matrix
norm. Now, let (, x) be any e-pair of A, i.e., Ax = x.Then

||kxk = kxk = kAxk kAkkxk || kAk.

Note we divided by kxk =6 0 since x is and e-vector, so we must have x 6= 0. Thus || kAk,
and taking the sup over all on the left-handside (in fact a max since their are only a finite
number of e-values), and noting the the right-handside is independent of gives the result.
3. (3.3-Trefethen & Bau) Vector and matrix p-norms are related by various inequalities, often
involving the dimensions m or n. For each of the following, verify the inequality and give an
example of a nonzero vector or matrix (for general m,n) for which equality is achieved. In this
problem x is a m-vector and A is a m n matrix.

(a) kxk kxk2 ,



(b) kxk2 mkxk ,

(c) kAk nkAk2 ,

(d) kAk2 mkAk .

ANS:
2 1/2
(a) kxk = maxi |xi | = maxi (|xi |2 )1/2 ( m
P
i=1 |xi | ) = kxk2 . Equality is achieved for
x = ek , k = 1, . . . , m, where ek is one of the standard basis vectors for Cm .
2 1/2 2 1/2 2 1/2

(b) kxk2 = ( m ( m
P P
i=1 |xi | ) i=1 maxi |xi | ) = (mkxk ) = mkxk . For equality
take x = (1, 1, . . . , 1)T Cm . Then kxk = 1 and kxk2 = m.
(c) We have
kAxk
kAk = sup
x6=0 kxk
kAxk2
sup using (a) in the numerator
x6=0 kxk
kAxk2
sup using (b) in the denominator, and noting x Cn
x6=0 kxk2 / n

= nkAk2
For equality, let A Cmn be the matrix whose first row is all ones, and zeros elsewhere.
Clearly kAk = n. Now, A A is an n n matrix whose entries are all equal to one (check!)
and its rank is 1. So 0 is an e-value of A A of multiplicity n1. What is the remaining e-value?
It is n = n, which is easily seenp to be the case
since x = (1, 1, . . . , 1)T Cnis
a corresponding

e-vector (check!). Thus kAk2 = (A A) = n. So we have kAk = n = n n = nkAk2 .
(d) We have
kAxk2
kAk2 = sup
x6=0 kxk2

mkAxk
sup using (b) in the numerator, and noting Ax Cm
x6=0 kxk2

mkAxk
sup using (a) in the denominator
x6=0 kxk

= mkAk
For equality, let A Cmn be the matrix whose first column is all ones, and zeros elsewhere.
Clearly kAk = 1. Now, A A is an n n diagonal matrix whose entries p are all equal
to zero,
except for the (1,1) entry,
equal to m (check!). Thus, kAk2 = (A A) = m. So
which is
we have kAk2 = m = m 1 = mkAk .
kAxk
4. Prove that given a vector norm kxk, the formula kAk = sup defines a matrix norm for a
x6=0 kxk
square matrix A. Recall, this is referred to as the induced matrix norm.
ANS: Suppose A Cmm . We need to show:

(i) kAk 0, and kAk = 0 only if A = 0.


kAk 0 since it is the supremum of the ratio of kxk, kAxk 0. Now suppose kAk = 0
but A 6= 0. Since A 6= 0 there exists an x 6= 0 such that Ax = y 6= 0. For example, if
ak 6= 0 where ak is the k th column of A (and there must be one since A 6= 0) let x = ek .
Then y = ak and kAxk/kxk = kyk/kxk > 0, hence so is the suprmum over all x 6= 0.
Contradiction. So A = 0.
(ii) kA + Bk kAk + kBk.
We have kx + yk kxk + kyk for any x, y Cm . Then

k(A + B)xk kAx + Bxk


kA + Bk = sup = sup
x6=0 kxk x6=0 kxk
kAxk + kBxk
sup
x6=0 kxk
kAxk kBxk
= sup + sup
x6=0 kxk x6=0 kxk

= kAk + kBk.

(iii) kAk = ||kAk.


We have kxk = ||kxk for any x Cm , C. Then

kAxk ||kAxk
kAk = sup = sup
x6=0 kxk x6=0 kxk
kAxk kAxk
= sup = sup
x6=0 kxk x6=0 kxk

= ||kAk.
X
5. Prove that kAk = max |aij |, the maximum absolute row sum of the matrix A.
i
j

ANS: Assume A Cmn and x Cn . Then


X X X
kAxk = max |(Ax)i | = max | aij xj | = max |aij ||xj | kxk max |aij |.
i i i i
j j j

kAxk X X X
So max |aij | for all x 6= 0. Now let k be such that max |aij | = |akj |. If
kxk i
j
i
j j
there is more than one such k choose the minimum. We can then write akj = rj eij for some
real number rj 0 and 0 j < 2. Note |akj | = |rj eij | = |rj ||eij | = |rj | = rj . Define
x Cn by xj = eij for j = 1, . . . , n. Notice that is A were a real matrix then we would have
xj = 1 = ei(0,) . Then k xk = 1 and
X X X X X
| akj xj | = | rj eij eij | = | rj | = rj = |akj |.
j j j j j

Finally,

kAxk X X kAxk kAxk


kAxk = sup max |aij | = |akj | = sup = kAxk .
x6=0 kxk i
j j
k
x k x6=0 kxk

X
Thus, kAxk = max |aij |, the maximum absolute row sum of A.
i
j
6. Consider the 2-point BVP
(
y + (4x2 + 2)y = 2x(1 + 2x2 )
y(0) = 1, y(1) = 1 + e
2
The exact solution is y(x) = x + ex . Write a MATLAB function M-file to solve the problem
using the 4th order centered compact FD scheme
 h2   h2 
D+ D 1 ci ui + ci ui = 1 + D+ D fi .
12 12
Use meshsize h = 1/2p , where p is a positive integer. Your code should use your M-files trilu
and trilu solve. For p = 1 : 4, plot the exact solution (y(x) vs. x) and the numerical solution
(ui vs. xi ), including the boundary points. The 4 plots should appear separately in one figure,
with axes labeled and a title for each indicating p. Investigate subplot in MATLAB for how to
have multiple plots in a single figure window. For p = 1 : 20 present a table with the following
data - column 1: h; column 2: kuh yh k ; column 3: kuh yh k /h4 ; column 4: cpu time;
column 5: (cpu time)/m, where h = 1/(m + 1). Discuss the trends in each column. Also,
compare the accuracy for each h with the results of the 2nd order code from HW #1. How do
the computational times compare? Include a copy of your code.
ANS: Writing out the discretization gives
h2 2 h2
(1 c )u
12 i1 i1
+ (2 + 5h6 ci )ui (1 c )u
12 i+1 i+1 (fi1 2fi + fi+1 )
= fi + .
h2 12

Here is the code for the first part of the problem, followed by a listing of the M-file function
bvp solve4. The latter requires the M-files trilu and trilu solve from problem 7 (hw #1).

xx=0:0.01:1;xx=xx;
yy=xx+exp(xx.^2);
c=4.*x.^2+2; f=2*x.*(1+2*x.^2);
clf;
for p=1:4
[x,u]=bvp_solve4(2^p-1,0,1,1,1+exp(1),c,f);
max(abs(u-(x+exp(x.^2))))
subplot(2,2,p),plot(xx,yy,x,u,*),grid
axis(tight),xlabel(x),ylabel(y),title([p=,num2str(p)])
end

function [xv,uv,stime]=bvp_solve4(m,a,b,ya,yb,c,f)
%
h=(b-a)/(m+1);
xv=a:h:b; xv=xv;
fv=zeros(m+2,1);
cv=zeros(m+2,1);
%
x=xv;
cfv=eval(c);
fv=eval(f);
%
% setup tridiagonal matrix and rhs
%
av=(2+(5/6)*h^2*cfv(2:m+1))/(h^2);
bv=zeros(m,1); bv(2:m) =-(1-(h^2/12)*cfv(2:m ))/(h^2); bv(1)=0;
cv=zeros(m,1); cv(1:m-1)=-(1-(h^2/12)*cfv(3:m+1))/(h^2); cv(m)=0;
fv=fv(2:m+1)+(1/12)*(fv(1:m)-2*fv(2:m+1)+fv(3:m+2));
%
% BC adjustment
%
fv(1)=fv(1)+(1-(h^2/12)*cfv(1) )*ya/(h*h);
fv(m)=fv(m)+(1-(h^2/12)*cfv(m+2))*yb/(h*h);
%
% solve tridiagonal system; collect cpu time
%
tic;
[alpha,beta]=trilu(av,bv,cv);
uv=trilu_solve(alpha,beta,cv,fv);
stime=toc;
uv=[ya;uv;yb];

Here is the graph for p = 1, 2, 3 and 4.

p=1 p=2

3.5 3.5

3 3

2.5 2.5
y

2 2

1.5 1.5

1 1
0 0.5 1 0 0.5 1
x x
p=3 p=4

3.5 3.5

3 3

2.5 2.5
y

2 2

1.5 1.5

1 1
0 0.5 1 0 0.5 1
x x
Next we solve the BVP with m = 2p 1 for p = 1, . . . , 20. Here is the code:

c=4*x.^2+2; f=2*x.*(1+2*x.^2);
clf;
h=zeros(20,1); m=zeros(20,1);
times=zeros(20,1);
err_inf=zeros(20,1);
for p=1:20
[x,u,stime]=bvp_solve4(2^p-1,0,1,1,1+exp(1),c,f);
h(p)=1/(2^p);
m(p)=2^p-1;
times(p)=stime;
y=x+exp(x.^2);
err_inf(p)=max(abs(u-y));
end
format short e
disp( )
disp( h inf_err err/h^4 cputime cputime/m )
disp( ----------------------------------------------------------------)
disp( )
disp([h err_inf err_inf./h.^4 times times./m])

The results are:

h inf_err err/h^4 cputime cputime/m


----------------------------------------------------------------

5.0000e-01 1.2852e-02 2.0563e-01 9.2100e-04 9.2100e-04


2.5000e-01 9.7605e-04 2.4987e-01 1.9500e-04 6.5000e-05
1.2500e-01 6.3927e-05 2.6185e-01 1.3600e-04 1.9429e-05
6.2500e-02 4.0888e-06 2.6796e-01 1.3100e-04 8.7333e-06
3.1250e-02 2.5615e-07 2.6859e-01 1.5300e-04 4.9355e-06
1.5625e-02 1.6019e-08 2.6875e-01 2.1600e-04 3.4286e-06
7.8125e-03 1.0013e-09 2.6878e-01 2.5800e-03 2.0315e-05
3.9062e-03 6.1728e-11 2.6512e-01 6.3200e-04 2.4784e-06
1.9531e-03 1.0814e-12 7.4310e-02 1.0260e-03 2.0078e-06
9.7656e-04 1.3562e-11 1.4911e+01 2.2850e-03 2.2336e-06
4.8828e-04 5.5336e-11 9.7347e+02 4.4010e-03 2.1500e-06
2.4414e-04 2.1187e-10 5.9635e+04 8.8300e-03 2.1563e-06
1.2207e-04 8.7924e-10 3.9597e+06 1.6935e-02 2.0675e-06
6.1035e-05 1.2362e-09 8.9078e+07 3.5043e-02 2.1390e-06
3.0518e-05 2.3403e-09 2.6982e+09 6.8585e-02 2.0931e-06
1.5259e-05 1.3832e-09 2.5516e+10 1.3560e-01 2.0692e-06
7.6294e-06 1.3652e-08 4.0293e+12 2.6766e-01 2.0421e-06
3.8147e-06 4.3051e-07 2.0330e+15 5.3457e-01 2.0392e-06
1.9073e-06 1.3555e-07 1.0242e+16 1.0638e+00 2.0291e-06
9.5367e-07 7.0937e-07 8.5757e+17 2.1305e+00 2.0318e-06

We can see from the err/h4 column that the expected O(h4 ) error is observed until h
3.9062e 3 since err/h4 rapidly approaches a constant. But then we lose accuracy. Why?
Roundoff error begins to dominate, as well as the conditioning of the matrix! Note, however,
that the cputime stills scales linearly with m as evidenced by the cputime/m column.
Comparing with the second order method of HW #1 we see that the cpu timeS for the solvers
are close. However, for moderate p the fourth order solution is clearly superior. For example,
the error is 6.1728e 1 for h = 3.9062e 03, while for the second order method with the same
h the error is 5.4521e 06.
Note: I have only timed the linear solver portion of the code.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy