HO CHI MINH UNIVERSITY OF TECHNOLOGY Faculty of Applied Science Assignment Calculus 2 Instructor Hoang Hai Ha Group member Hoang Hung – 2152097 Dinh Viet Thanh – 21520966 Tran Duy Minh – 2152773 Pham Anh Hoang – 2152082 Vo Hoang Anh Duy – 2152082 HO CHI MINH CITY, May, 2022 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE Contents 1 Problem 1 2 2 Problem 2 10 3 Problem 3 13 Calculus 2 Page 119 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE 1 Problem 1 Let z = f(x.
HO CHI MINH UNIVERSITY OF TECHNOLOGY Faculty of Applied Science Assignment: Calculus Instructor: Hoang Hai Ha Group member: Hoang Hung – 2152097 Dinh Viet Thanh – 21520966 Tran Duy Minh – 2152773 Pham Anh Hoang – 2152082 Vo Hoang Anh Duy – 2152082 HO CHI MINH CITY, May, 2022 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE Contents Problem 2 Problem 10 Problem 13 Calculus Page 1/19 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE Problem Let z = f (x, y) = 10x2 y − 5x2 − 4y − x4 − 2y a) Draw the graph of the function b) Draw the contour plot of the function Point out the local extreme and the saddle point on that figure c) Find the exact local extreme and saddle point (using calculus technique) Theory Calculus technique to find local extremes and saddle points We need to those two steps: Step : We find the critical points by solving two equations fx = 0, fy = Step : Substituting those critical points that we find from step to D(x, y) = fxx fyy − fxy We apply the second derivative test here If D(x, y) > it is a saddle point Otherwise if D(x, y) < 0, f xx < 0, it is local maximum, else if D(x, y) < 0, f xx > 0, it is local minimum Therefore, we can seek local extreme, saddle point Solution a) Draw the graph of the function Matlab code %% SETTING UP clc ; clear all ; close all ; %% DECLARATION syms x y Fx Fy Fxx Fyy Fxy D; %% INPUTED FUNCTION F = 10∗ x^2∗y − 5∗ x^2 − 4∗ y^2 − x^4 − 2∗ y ^ ; %Draw t h e graph clf ; subplot (1 ,2 ,1); f s u r f (F , [ − , ] , ’ ShowContours ’ , ’ on ’ ) ; h o l d on f o r i = : nMax zVal = s u b s (F , [ x , y ] , [ max( i , ) , max( i , ) ] ) ; s c a t t e r (max( i , ) , max( i , ) , zVal , , ’ r e d ’ , ’ f i l l e d ’ ) ; Calculus Page 2/19 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE end f o r i = : nMin zVal = s u b s (F , [ x , y ] , [ ( i , ) , ( i , ) ] ) ; s c a t t e r ( ( i , ) , ( i , ) , zVal , , ’ g r e e n ’ , ’ f i l l e d ’ ) ; end f o r i = : nSaddle zVal = s u b s (F , [ x , y ] , [ s a d d l e ( i , ) , s a d d l e ( i , ) ] ) ; s c a t t e r ( s a d d l e ( i , ) , s a d d l e ( i , ) , zVal , , ’ b l u e ’ , ’ f i l l e d ’ ) ; end hold o f f g r i d on ; a x i s on ; a x i s e q u a l ; a x i s s q u a r e ; x l a b e l ( ’ x ’ ) ; y l a b e l ( ’ y ’ ) ; z l a b e l ( ’ z ␣=␣ f ( x ) ’ ) ; t i t l e ( ’ The␣ graph ␣ o f : ␣ 10 x^2y␣−␣ 5x^2␣−␣ 4y^2␣−␣x^4␣−␣ 2y^4 ’ ) ; The result b) Draw the contour plot of the function Point out the local extreme and the saddle point on that figure Matlab code Calculus Page 3/19 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE %% SETTING UP clc ; clear all ; close all ; %% DECLARATION syms x y Fx Fy Fxx Fyy Fxy D; %% INPUTED FUNCTION F = 10∗ x^2∗y − 5∗ x^2 − 4∗ y^2 − x^4 − 2∗ y ^ 4; subplot (1 ,2 ,2); f c o n t o u r (F , [ − , ] ) ; hold on f o r i = : nMax p l o t (max( i , ) , max( i , ) , ’ r ’ , ’ m a r k e r s i z e ’ , ) ; end f o r i = : nMin p l o t ( ( i , ) , ( i , ) , ’ g ’ , ’ m a r k e r s i z e ’ , ) ; end f o r i = : nSaddle plot ( saddle ( i ,1 ) , saddle ( i , ) , ’b ’ , ’ markersize ’ ,20); end hold o f f g r i d on ; xlabel ( ’x ’ ); ylabel ( ’y ’ ); a x i s on ; a x i s e q u a l ; a x i s s q u a r e ; t i t l e ( ’ The␣ Contour ␣ l i n e ’ ) ; % Maximum p o i n t − r ed % Minimum p o i n t − g r e e n % Saddle p o i n t − b l u e colormap ( ’ p a r u l a ’ ) ; %% The End Calculus Page 4/19 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE local extremes are red and saddle points are blue c) Find the exact local extreme and saddle point (using calculus technique) Solved by hand We have partial derivative of f (x, y) fx = 20xy − 10x − 4x3 fy = 10x2 − 8y − 8y We need to solve the following system of equations: fx = fy = x(20y − 10 − 4x2 ) = 0(1) 10x2 − 8y − 8y = 0(2) With x = , we get a root of this system of equations: (0,0) 20y − 10 − 4x2 = With x ̸= , from (1) we get the new system of equations: 10x2 − 8y − 8y = Calculus y = 51 x2 + 10x2 − 8y − 8y = Page 5/19 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE y = 15 x2 + 12 10x2 − 8y − 8y = y = 15 x2 + 12 10x2 − 8( 15 x2 + 12 )3 − 8( 15 x2 + 21 ) = y = 15 x2 + 12 10x2 − 8y − 8y = y = 15 x2 + 12 −8 12 36 125 x − 25 x + x − = 0(3) To solve (3), let t = x2 (t > 0) then (3) becomes −8 12 36 t − t + t−5=0 125 25 t = 6.991922 t = 0.733861 t = −15.22578 Because t > we just select of roots: t = 6.991922, t = 0.733861 x = 2.64422 x = −2.64422 => x = 0.85666 x = −0.85666 So we get special points (x1 , y1 ) = (0, 0) (x2 , y2 ) = (2.64422, 1.89838) (x3 , y3 ) = (−2.64422, 1.89838) (x4 , y4 ) = (0.85666, 0.64677) (x5 , y5 ) = (−0.85666, 0.64677) fxx = −12x + 20y − 10 We have : fyy = −24y − fxy = 20x Let D(x, y) = fxx fyy − fxy Following the above equation, we calculate the value ofD(x, y) : Calculus Page 6/19 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE D(x1 , y1 ) = 80 > fxx (x1 , y1 ) = −10 < D(x2 , y2 ) ≈ 2488.7172 > fxx (x2 , y2 ) ≈ −55.9354 < => So (x2 , y2 ) is local maximum of f D(x3 , y3 ) ≈ 2488.7172 > fxx (x3 , y3 ) ≈ −55.9354 < => So (x3 , y3 ) is local maximum of f => So (x1 , y1 ) is local maximum of f D(x4 , y4 ) ≈ 187.6363 > => So (x4 , y4 ) is saddle point of f D(x5 , y5 ) ≈ 187.6363 > => So (x5 , y5 ) is saddle point of f Therefore, we have local maximum and saddle points Solved by Matlab %% CALCULATION Fx = d i f f (F , x ) ; Fy = d i f f (F , y ) ; Fxx = d i f f ( Fx , x ) ; Fyy = d i f f ( Fy , y ) ; Fxy = d i f f ( Fx , y ) ; D = Fxx∗Fyy − Fxy ^ 2; f p r i n t f ( ’ Fx␣␣=␣ ’ ) ; d i s p ( Fx ) ; f p r i n t f ( ’ Fy␣␣=␣ ’ ) ; d i s p ( Fy ) ; %% SETTING UP clc ; clear all ; close all ; %% DECLARATION syms x y Fx Fy Fxx Fyy Fxy D; %% INPUTED FUNCTION F = 10∗ x^2∗y − 5∗ x^2 − 4∗ y^2 − x^4 − 2∗ y ^ 4; Calculus Page 7/19 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE f p r i n t f ( ’ Fxx␣=␣ ’ ) ; d i s p ( Fxx ) ; f p r i n t f ( ’ Fyy␣=␣ ’ ) ; d i s p ( Fyy ) ; f p r i n t f ( ’ Fxy␣=␣ ’ ) ; d i s p ( Fxy ) ; %% FINDING SPECIAL POINTS SysoEqn = [ Fx == , Fy == ] ; %System o f e q u a t i o n s Fx = and Fy = s o l = v p a s o l v e ( SysoEqn , x , y ) ; x = sol x; y = sol y; tmp = x + y ; nAllRoots = s i z e ( tmp ) ; % nAllRoots ( ) = Number o f r e a l and i m a g i n a r y r o o t s nRealRoots = ; % nRoots = Number o f r e a l r o o t s Roots = [ , ] ; f o r ( i = : nAllRoots ( ) ) i f ( imag ( tmp ( i ) ) == ) Roots = [ Roots ; x ( i ) , y ( i ) ] ; nRealRoots = nRealRoots + ; end end f p r i n t f ( ’ Number␣ o f ␣ s p e c i a l ␣ p o i n t s : ␣%i ␣\n\n ’ , nRealRoots ) ; %% CLASSIFYING POINTS INTO LOCAL MAXIMUM, MINIMUM, SADDLE POI Roots = Roots ( : end , : ) ; max = [ , ] ; = [ , ] ; saddle = [ , ] ; f o r i = : nRealRoots syms x y DVal = subs (D, [ x , y ] , [ Roots ( i , ) , Roots ( i , ) ] ) ; FxxVal = subs ( Fxx , [ x , y ] , [ Roots ( i , ) , Roots ( i , ) ] ) ; i f ( DVal > ) i f ( FxxVal > ) = [ ; Roots ( i , ) , Roots ( i , ) ] ; e l s e i f ( FxxVal < ) Calculus Page 8/19 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE max = [ max ; Roots ( i , ) , Roots ( i , ) ] ; end e l s e i f ( DVal < ) s a d d l e = [ s a d d l e ; Roots ( i , ) , Roots ( i , ) ] ; end end %% DISPLAYING POINTS = ( : end , : ) ; max = max ( : end , : ) ; s a d d l e = s a d d l e ( : end , : ) ; nMin = s i z e ( ) ; nMax = s i z e (max ) ; nSaddle = s i z e ( s a d d l e ) ; i f ( nMin ( ) > ) d i s p ( ’ ∗ ␣Minimum␣ p o i n t s : ’ ) ; d i s p ( ) ; end i f (nMax ( ) > ) d i s p ( ’ ∗ ␣Maximum␣ p o i n t s : ’ ) ; d i s p (max ) ; end i f ( nSaddle ( ) > ) d i s p ( ’ ∗ ␣ Saddle ␣ p o i n t s : ’ ) ; disp ( saddle ) ; end So we have the final result: Calculus Page 9/19 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE The result Problem Find the maximum and minimum values of z = 2x2 − 2xy + y subject to the single constraint x2 + y = a) Using Lagrange multiplier method b) Using contour plot (Draw the contour plot of the function and the constraint curve in the same figure) Theory Lagrange multiplier technique Lagrange multiplier technique lets you find the maximum or minimum of a multi -variable function f (x, y, ) where there is some constraint on the input values you are allowed to use This technique only applies to constraints that look something like this: Suppose that (x0 , y0 ) is an extreme of z = f (x, y) subject to G(x, y) = k We define Lagrange function L(x, y, λ) = f (x, y) − λ(G(x, y) − k) - If d2 L(x0, y0, fl0) > then (x0 , y0 ) is a minimum point subject to the constraint G(x, y) = k - If d2 L(x0, y0, fl0) < then (x0 , y0 ) is a maximum point subject to the constraint G(x, y) = k Calculus Page 10/19 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE - If d2 L(x0, y0, fl0) is indefinite then (x0 , y0 ) is not an extreme point Solution a) Using Lagrange multiplier method We have Lagrange function L(x, y, λ) = 2x2 − 2xy + y − λ(x2 + y ) We need to find stationary points (x, y) which satisfies the system of Lx = 4x − 2y − 2λx = 0(1) equation Ly = 3y − 2x − 2λy = 0(2) x + y = 4(3) With x = , from (1) we get y = 0, which does not satisfies (3) With y = , from (2) we get x = 0, which does not satisfies (3) With xy ̸= from (1) we have 2λxy = 4xy − 2y and from (2) we have 2λxy = 3xy − 2x2 , therefore 3xy − 2x2 − 4xy + 2y = 0(4) From (3) we have two cases: √ √ * First case: y = − x2 Substitute y = − x2 in (4) we have the equation : √ −3x3 − 4x2 − 4x − x2 + 12x + = x = 1.442 x = −1.324 √ Because y = − x2 so we have two solutions (x1 , y1 ) = (1.4418, 1.3860); (x2 , y2 ) = (−1.3243, 1.4987) √ √ * Second case: y = − − x2 Substitute y = − − x2 in (4) we have the equation : √ −3x3 − 4x2 + 4x − x2 + 12x + = x = −0.3820 x = 1.9092 √ Because y = − − x2 so we have two solutions: (x3 , y3 ) = (−0.3820, −1.9360); (x4 , y4 ) = (1.9092, −0.5956) Substitute (x1 , y1 ), (x2 , y2 ), (x3 , y3 ), (x4 , y4 ) in z(x, y) = 2x2 − 2xy + y we have: z(x1 , y1 ) = 2.8236 z(x2 , y2 ) = 9.3535 Calculus Page 11/19 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE z(x3 , y3 ) = −8.7743 => This is minimum value z(x4 , y4 ) = 10.8436 => This is maximum value To conclude, the maximum and minimum values of z = 2x2 − 2xy + y subject to the single constraint x2 + y = is 10.8436 and -8.7743, respectively b) Using contour plot (Draw the contour plot of the function and the constraint curve in the same figure) Matlab code: %S e t t i n g up clc clear all x = −2:0.1:2; y = −2:0.1:2; [ X,Y] = meshgrid ( x , y ) ; %Input t h e f u n c t i o n Z = 2∗X.^2 −2∗X ∗Y+Y ^ ; c o n t o u r (X, Y, Z , 0 ) %Draw t h e c o n t o u r p l o t o f t h e f u n c t i o n hold on t = −2:0.01:2; z = −2:0.01:2; [ X,Y] = meshgrid ( t , z ) ; Z2 = X.^2+Y.^2 −4; c o n t o u r (X, Y, Z2 , ) hold o f f Calculus Page 12/19 HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE The result Problem Let C is the intersection of the given surface x2 + y + z = and the cylinder x2 + 3y = 4, z > a) Draw the surfaces and the curve C b) Find the length of the curve c) At any given point (x0 ; y0 ; z0 ) belongs to the curve, draw the unit tangent vector Theory Find length of the curve using line integral The line L which have function f (x(t), y(t), z(t)) and a