Chapter 1 Solutions Exercise 1.1 f (x, y) = x: a level curve f (x, y) =constant is a vertical line x = c. Curves for c = −1, 0, 1/2, 3 and 4 are graphed below: Level sets x=c for c=-1,0,1/2,3, and 4 2 1.5 1 0.5 c=-1 c=1/2 c=4 y 0 c=0 c=3 -0.5 -1 -1.5 -2 -1 0 1 2 3 4 x Here is a surface plot of graph(f ): z=x 2 1.5 1 0.5 0 z -0.5 -1 -1.5 -2 2 1.5 1 y 0.5 0 -0.5 -1 -1.5 -2 -2 The Matlab m-file used for this problem is % level sets and graph(f) for f: (x,y)-->x clear clf x=-2:0.1:2; y=x; -1.5 -1 -0.5 0 0.5 x 1 1.5 2 % level curves f(x,y)=c for c=-1.0,1/2,3,4 c=[-1,0,0.5,3,4]; % generate level curves all at once xx=c’*ones(size(x)); plot(xx,y,’k’); % put in axes, curve labels and title xlabel(’x’), ylabel(’y’) text(-0.9,0.25,’c=-1’) text(-0.25,-0.25,’c=0’) text(0.2,0.25,’c=1/2’) text(2.75,-0.25,’c=3’) text(3.75,0.25,’c=4’) title(’Level sets x=c for c=-1,0,1/2,3, and 4’) print -deps contour1.eps pause close % print plot to .eps file % hit a key to continue % close plot % surface plot of the graph of f [X,Y]=meshgrid(x,y); mesh(X,Y,X) % plot labels and title xlabel(’x’), ylabel(’y’), zlabel(’z’) title(’z=x’) print -deps surface1.eps pause close 2 Exercise 1.3 f (x, y) = x2 − y 2 : a level curve f (x, y) =constant is a hyperbola x2 − y 2 = c if c 6= 0. Vertices are on the y-axis if c < 0 and on the x-axis if c > 0. If c = 0 the level curve is the graph of the equation |x| = |y|, that is, the set of all points for which y = ±x. x2-y2=c for c=-1,0,1/2,3,4 2 c=-1 1.5 1 c=3 c=3 c=0 y 0.5 0 c=1/2 -0.5 c=1/2 c=4 c=4 c=0 -1 -1.5 c=-1 -2 -2 -1 0 1 2 x A surface plot of graph(f ): z=x2-y2 4 3 2 1 0 z -1 -2 -3 -4 2 1.5 2 1 1.5 0.5 1 0 y 0.5 0 -0.5 -0.5 -1 -1 -1.5 x -1.5 -2-2 3 The Matlab m-file used for this problem is: % level sets and graph(f) for f: (x,y)-->x^2-y^2 clear clf x=-2:0.1:2; y=-2:0.1:2; % level curves f(x,y)=c for c=-1.0,1/2,3,4 % superimpose level curves hold on % label x & y axes and give plot a title xlabel(’x’) ylabel(’y’) title(’x^2-y^2=c for c=-1,0,1/2,3,4’) % c=-1 plot(x,[sqrt(x.^2+1); -sqrt(x.^2+1)],’k’); text(-1.25,1.8,’c=-1’) text(-1.25,-1.8,’c=-1’) % c=0 plot(x,[x;-x],’k’) text(-0.35,0.55,’c=0’) text(-0.35,-0.55,’c=0’) % c=1/2 plot([sqrt(y.^2+0.5); -sqrt(y.^2+0.5)],y,’k’) text(-1.1,0,’c=1/2’) text(0.75,0,’c=1/2’) % c=3 plot([sqrt(y.^2+3); -sqrt(y.^2+3)],y,’k’) text(-1.8,0.65,’c=3’) text(1.6,0.65,’c=3’) % c=4 plot([sqrt(y.^2+4); -sqrt(y.^2+4)],y,’k’) text(-2.4,-0.5,’c=4’) text(2.2,-0.5,’c=4’) pause % print plot to .eps file print -dps contour3.eps % release plot hold off % surface plot of graph(f) % close above plot close [X,Y]=meshgrid(x,y); Z=X.^2-Y.^2; 4 mesh(X,Y,Z) % set axis labels and title xlabel(’x’) ylabel(’y’) zlabel(’z’) title(’z=x^2-y^2’) % print surface plot print -dps surface3.eps pause close 5 Exercise 1.4 f (x, y) = 3R8 − 8R6 + 6R4 where R2 = x2 + y 2 : the values of f depend only on how far the point (x, y) is from the origin (0, 0). So level sets f (x, y) =constant are concentric circles centered at (0, 0). f(x,y)=c 1 c=1.04287843 0.5 c=67/256 y c=1411/4,294,967,296 0 . c=0 c=1 -0.5 -1 -1 -0.5 0 0.5 1 x Here is a surface plot of graph(f ): graph(f) 350 300 250 200 z 150 100 50 01 1 0.5 0.5 0 0 y -0.5 -0.5 -1-1 6 x It’s hard to see detail in the surface plot because f grows so rapidly for R > 1. The values of f near the corners of the grid are much larger than values of f within and on the unit circle. Since graph(f ) has radial symmetry with the z-axis as the axis of the symmetry then we can look at a profile of the surface by slicing it with any plane containing the z-axis. f(R)=3R8-8R6+6R4 1.4 1.2 1 f(R) 0.8 0.6 0.4 0.2 0 -1 -0.5 0 0.5 1 R The profile of graph(f ) above esposes detail of f near the unit circle R = 1. The last two plots show graph(f ) in a neighborhood of the point (−1, 0, 1), a point on the unit circle, and some corresponding level curves. graph(f) in a neighborhood of (-1,0,1)] 1.015 1.01 1.005 z 1 0.995 0.1 -0.97 0.05 -0.98 -0.99 0 -1 y -1.01 -0.05 x -1.02 -1.03 -0.1 7 40 35 30 25 20 15 10 5 2 4 6 8 10 12 Here is a Matlab m-file used for this problem: % level sets and graph(f) for f: (x,y)-->3r^8-8r^6+6r^4 % where r=x^2+y^2 clear clf % % % % f has "radial" symmetry, i.e., its value at (x,y) depends only on how far (x,y) is from (0,0). Level sets are nested circles with center (0,0): if f(r)=c then circle x^2+y^2=r^2 is level set. % superimpose level sets hold on % label x & y axes and title xlabel(’x’) ylabel(’y’) title(’f(x,y)=c’) % c=0 (circle text(0,0,’.’) text(0.05,0,’c=0’) % c=67/256 (circle of radius 1/2) x=linspace(-0.5,0.5); plot(x,[sqrt(0.25-x.^2);-sqrt(0.25-x.^2)],’k’) text(0.4,0.4,’c=67/256’) % c=1411/(2^32) (circle of radius 1/4) x=linspace(-0.25,0.25); 8 plot(x,[sqrt(0.0625-x.^2);-sqrt(0.0625-x.^2)],’k’) text(-0.25,0.3,’c=1411/4,294,967,296’) % c=1 (unit circle) x=linspace(-1,1); plot(x,[sqrt(1-x.^2);-sqrt(1-x.^2)],’k’) text(0.9,-0.05,’c=1’) % c=1.04287843 (circle of radius 1.1) x=linspace(-1.1,1.1); plot(x,[sqrt((1.1)^2-x.^2);-sqrt((1.1)^2-x.^2)],’k’) text(0.8,0.8,’c=1.04287843’) print -dps contour4a.eps % release plot hold off pause % surface plot of graph(f) % close previous plot close x=-1:0.1:1; [X,Y]=meshgrid(x); % for square grids meshgrid() needs only one argument R=X.^2+Y.^2; Z=R.^4.*(3*R.^4-8*R.^2+6); mesh(X,Y,Z) % label axes and title xlabel(’x’) ylabel(’y’) zlabel(’z’) title(’graph(f)’) print -dps surface4a.eps pause % z-axis is axis of symmetry: a slice through graph(f) using a plane % containing the z-axis gives following profile close R=-1.2:0.01:1.2; Z=R.^4.*(3*R.^4-8*R.^2+6); plot(R,Z) % label axes and title xlabel(’R’) ylabel(’f(R)’) title(’f(R)=3R^8-8R^6+6R^4’) 9 print -dps profile4.eps pause close % above profile shows some detail for R near 1 that are not seen on % previous surface plot of graph(f). So plot a portion of surface in % a neighborhood he point of (-1,0,1). x=-1.03:0.005:-0.97; y=-0.1:0.005:0.1; [X,Y]=meshgrid(x,y); R=X.^2+Y.^2; Z=R.^4.*(3*R.^4-8*R.^2+6); mesh(X,Y,Z) % label axes and title xlabel(’x’) ylabel(’y’) zlabel(’z’) title(’graph(f) in a neighborhood of (-1,0,1)]’) print -dps surface4b.eps pause % now look at some contour lines corresponding to this part of surface contour(Z,’k’) print -dps contour4b.eps pause close 10 Exercise 1.5 (a) n = 0: in this case f (x) = x and level sets of f corresponding to c = −1, 0, 1, 2 are {−1} {0}, {1}, and {2}, respectively. These level sets are superimposed on the number line below. • −1 −2 • 0 • 1 • 2 (b) n = 1: f (x, y) = y and level sets are horizontal lines y = c. level sets y=c for c=-1,0,1 & 2 (horizontal lines) 2 c=2 1.5 c=1 y 1 0.5 c=0 0 -0.5 c=-1 -1 -2 -1.5 -1 -0.5 0 0.5 1 1.5 x (c) n = 2: f (x, y, z) = z and level sets are stacked planes parallel to the xy-plane. level sets for f(x,y,z)=z 2 1.5 1 0.5 z 0 -0.5 -1 2 1.5 2 1 1.5 0.5 1 0 y 0.5 0 -0.5 -0.5 -1 -1 -1.5 -1.5 -2-2 11 x 2 Exercise 1.7 (a) n = 0: f (x) = x and level sets of f corresponding to c = −1, 0, 1, 2 are {−1} {0}, {1} {2}, just like the previous problem. • −1 −2 • 0 • 1 • 2 (b) n = 1: f (x, y) = x − y 2 and level sets are nested parabolas along the x-axis opening to the right. level sets for f(x,y)=x-y2 2 1.5 1 y 0.5 0 -0.5 -1 -1.5 -2 -1 0 1 2 3 4 5 6 x (c) n = 2: f (x, y) = x − y 2 − z 2 and level sets are nested paraboloids opening along the positive x-axis. The first surface plot is the level set z − y 2 − z 2 = −1. The subsequent plot contains all four level sets. 2 1.5 1 0.5 0 -0.5 -1 -1.5 -2 2 1.5 7 1 6 0.5 5 0 4 3 -0.5 2 -1 1 -1.5 0 -2-1 12 level sets for f(x,y,z)=x-y2-z2 2 1.5 1 0.5 0 z -0.5 -1 -1.5 -2 2 1.5 10 1 8 0.5 0 y 6 -0.5 4 -1 2 -1.5 -2 x 0 Here is the Matlab m-file I used on this problem: clear clf % n=0 -- draw by hand % n=1: f(x,y)=x-y^2. So level sets are parabolas x=y^2+c. % Plot them all at once y=-2:0.1:2; c=[-1,0,1,2]; % put all level curves on one plot a=ones(size(y)); b=ones(size(c)); x=c’*a+b’*y.^2; plot(x,y,’k’) title(’& level sets for f(x,y)=x-y^2’) xlabel(’& x’), ylabel(’& y’) print -dps contour7n1.eps pause % n=2: f(x,y,z)=x-y^2-z^2. So level sets are stacked paraboloids x=c+y^2+z^2. % plot each one separately and superimpose on one plot. close [Y,Z]=meshgrid(y); X=c(1)+Y.^2+Z.^2; surf(X,Y,Z) print -dps surface7c_1.eps % save one surface pause 13 hold X=c(2)+Y.^2+Z.^2; surf(X,Y,Z) X=c(3)+Y.^2+Z.^2; surf(X,Y,Z) X=c(4)+Y.^2+Z.^2; surf(X,Y,Z) title(’& level sets for f(x,y,z)=x-y^2-z^2’) xlabel(’& x’), ylabel(’& y’), zlabel(’& z’) print -dps surface7c_all.eps % all plots superimposed hold off pause close 14 Exercise 1.10 The graph of any function f : Rn → R is a level set for some function F : Rn+1 → R. Here is a proof: graph(f ) = {(x1 , . . . , xn , xn+1 ) | xn+1 = f (x1 , . . . , xn )} so if F is defined by F (x1 , . . . , xn , xn+1 ) = xn+1 − f (x1 , . . . , xn ) then F −1 (0) = graph(f ). 15