Chapter 4: Partial Differentiation
Section 4.5: Gradient Vector
Example 4.5.1
Let fx,y=5−2 x2−3 y2 and let P be the point 1,2.
Obtain ∇f at P.
Graph the surface z=fx,y.
On the same set of axes, graph the level curve through P, and ∇f at P.
At P, show that ∇f is orthogonal to a vector tangent to the level curve through P.
At P, obtain ψ=∇f·u, the directional derivative of f in the direction u=cost i+sint j . Show that ψ is a maximum when u is along ∇fP and that this maximum is ∇fP.
Solution
Mathematical Solution
For Part (a), ∇fP=−4 x−6 yx=a|f(x)x=1,y=2 = −4−12.
The graphs for Parts (b) and (c) are given in Figures 4.5.1(a) and 4.5.1(b), respectively.
Figure 4.5.1(a) The surface z=fx,y
use plots, Student:-VectorCalculus in module() local f,p1,p2,p3,V; f:=5-2*x^2-3*y^2; V:=RootedVector(root=[1,2],<-4,-12>); p1:=contourplot(f,x=-5..5,y=-10..3,color=black,contours=[-3,-6,-9,-12,-15,-18,-30,-40,-50]); p2:=PlotVector(V,color=red); p3:=display(p1,p2,scaling=constrained); print(p3); end module: end use:
Figure 4.5.1(b) Level curves & gradient vector
For Part (d), solve f1,2=−9=fx,y for y=67−x2/3, giving an explicit representation of the level curve through P. Then, writing this curve as
R=x67−x2/3
its tangent vector at P is R′1=1−1/3, from which it follows that
∇fP·R′1=−4−12·1−1/3=−4+4=0
In Part (e), the maximum of ψ=−4 cost+3 sint is 4 10≐12.65 at t=π+arctan3≐4.4 radians (about 252°) measured from the positive x-axis.
Figure 4.5.1(c) is a graph of ψ, from which the maximum can be approximated.
Figure 4.5.1(d) is an animation showing ∇fP as the transparent red arrow, and ut as the rotating black arrow. The value of t appears above the y-axis, and the corresponding value of ψ is written in the fourth quadrant. The maximum value of ψ is attained when ut is aligned with ∇fP. This maximum value is ∇fP=410.
Figure 4.5.1(c) Graph of ψ
use Student:-VectorCalculus,plots in module() local p1,p2,V,F; V:=RootedVector(root=[1,2],<-4,-12>); p1:=PlotVector(V,width=.3,color=red,transparency=.5); F:=proc(t) local g1,g2,U; U:=RootedVector(root=[1,2],<cos(t),sin(t)>); g1:=PlotVector(U,color=black,unconstrainedview=false); g2:=textplot([1,-5,convert(evalf(-4*(cos(t)+3*sin(t)),5),string)]); display(g1,g2); end proc; p2:=animate(F,[t],t=0..2*Pi,frames=63,background=p1,paraminfo=true,scaling=constrained); print(p2); end module: end use:
Figure 4.5.1(d) ∇fP and u
Maple Solution - Interactive
Initialize
Tools≻Load Package: Student Multivariate Calculus
Loading Student:-MultivariateCalculus
Context Panel: Assign Name
f=5−2 x2−3 y2→assign
u=cost,sint→assign
Part (a)
Type the name f. Context Panel: Evaluate and Display Inline
Context Panel: Student Multivariate Calculus≻Differentiate≻Gradient See Figure 4.5.1(e).
Context Panel: Select Element≻1
Context Panel: Assign to a Name≻Gf
Figure 4.5.1(e) Gradient dialog
f = −2⁢x2−3⁢y2+5→gradient→select entry 1→assign to a nameGf
Part (b) - Generate Figure 4.5.1(a)
From the Context Panel, launch the Plot Builder on the rule for f.
Plots≻Plot Builder≻3-D plot
Set x∈−2,2 and y∈−2,2 view → 0 to 5
f = −2⁢x2−3⁢y2+5→
Part (c)
To generate Figure 4.5.1(b) interactively, first obtain a 2D contour map of f via the Plot Builder, launched from the Context Panel. Select "2-D contour plot"
Obtain a graph of ∇fP via the Context Panel's Plot option, "Arrow from point" See Figure 4.5.1(f).
Copy/paste the arrow onto the contour map.
Figure 4.5.1(f) Dialog for graphing an arrow
f
−2⁢x2−3⁢y2+5
→
Gf
→plot arrow
Part (d)
Expression palette: Evaluation template Form the equation fx,y=f1,2
Context Panel: Solve≻Obtain Solutions for≻y
Control-drag to form the equation Yx=…
Context Panel: Assign Function
f=fx=a|f(x)x=1,y=2
−2⁢x2−3⁢y2+5=−9
→solutions for y
−6⁢x2+423,−−6⁢x2+423
Yx=13⁢−6⁢x2+42→assign as functionY
T=1,Y′1→assign
Common Symbols palette: Dot product operator
Context Panel: Evaluate and Display Inline
Context Panel: Simplify≻Simplify
T·Gf = −4+2⁢363= simplify 0
Part (e)
Common Symbols palette: Dot Product operator
ψ=Gf·u→assign
Context Panel: Optimization≻Maximize (local)
ψ = −4⁢cos⁡t−12⁢sin⁡t→maximize12.6491106406735181,t=−1.89254688119156
Write ψ and press the Enter key.
Context Panel: Differentiate≻With Respect To≻t
Context Panel: Conversions≻Equate to 0
Context Panel: Solve≻Solve (general solution)
Expression palette: Evaluation template Context Panel: Evaluate and Display Inline
ψ
−4⁢cos⁡t−12⁢sin⁡t
→differentiate w.r.t. t
4⁢sin⁡t−12⁢cos⁡t
→equate to 0
4⁢sin⁡t−12⁢cos⁡t=0
→solve
t=arctan⁡3+π⁢_Z1
ψx=a|f(x)t=π+arctan3 = 4⁢10
Context Panel: Norm≻Euclidean
Gf = →Euclidean-norm4⁢10
Form a sequence of the vectors ∇fP and i.
Context Panel: Student Multivariate Calculus≻Lines & Planes≻Angle
Context Panel: Assign to a Name≻lambda
Gf,1,0 = ?,?→angleπ−arccos⁡1010→assign to a nameλ
Context Panel: Approximate≻5 (digits)
π+arctan3−2 π−λ→at 5 digits0.
Maple Solution - Coded
Install the Student MultivariateCalculus package.
withStudent:-MultivariateCalculus:
Define f.
f≔5−2 x2−3 y2:
Use the eval and Gradient commands to obtain ∇fP.
Gf≔Gradientf,x,y=1,2
Gf≔
Part (b)
Figure 4.5.1(a), a graph of the surface z=fx,y, can be drawn with the plot3d command, below.
plot3df,x=−3..3,y=−3..3view=−8..5,scaling=constrained,axes=frame,tickmarks=4,4,8,labels=x,y,z:
The following conjunction of the RootedVector, contourplot, PlotVector, and display commands will generate Figure 4.5.1(b).
V≔VectorCalculus:-RootedVectorroot=1,2,−4,−12;p1≔plots:-contourplotf,x=−5..5,y=−10..3,color=black,contours=−3,−6,−9,−12,−15,−18,−30,−40,−50;p2≔VectorCalculus:-PlotVectorV,color=red;plots:-displayp1,p2,scaling=constrained;
Use the solve and eval commands to obtain an explicit representation of yx, the level curve passing through 1,2.
Y≔solveevalf,x=1,y=2=f,y1
Y≔−6⁢x2+423
Use the simplify, eval, and diff commands to obtain at 1,2, a vector T tangent to the level curve yx.
T≔simplifyevaldiffx,Y,x,x=1
T≔
Use the DotProduct command to obtain ∇fP·T.
DotProductGf,T = 0
The vanishing of the dot product between the tangent vector and the gradient vector verifies that the gradient vector is orthogonal to the level curve.
Define the unit vector u.
u≔cost,sint:
Use the DirectionalDiff command in the Student VectorCalculus package to obtain ψ. Although there is a DirectionalDerivative command in the Student MultivariateCalculus package, it accepts only numeric direction vectors, so would fail with the generic unit vector u.
ψ≔Student:-VectorCalculus:-DirectionalDifff,u,point=1,2
ψ≔−4⁢cos⁡t−12⁢sin⁡t
Obtain Figure 4.5.1(c) with the plot command.
plotψ,t=0..2 π:
Maximize ψ by using the solve and diff commands to obtain all solutions of ψ′=0.
solvediffψ,t=0,AllSolutions
arctan⁡3+π⁢_Z2
Use the eval command to obtain the maximum value of ψ, namely, ψπ+arctan3.
evalψ,t=π+arctan3 = 4⁢10
Apply the Norm command to the gradient vector and evaluate at the point 1,2.
NormGf1,2 = 4⁢10
Use the eval command to obtain uπ+arctan3, the direction giving the maximum value of the directional derivative, ψ. This vector is a positive multiple of ∇fP.
evalu,t=π+arctan3 =
Obtain the (smaller) angle between ∇fP and the horizontal vector i by using the simplify and Angle commands. Note that the angle, clockwise from i to ∇fP, is returned as an arccosine.
λ≔simplifyAngleGf,1,0 = π−arccos⁡110⁢10
Define Λ as the counterclockwise angle from i to ∇fP.
Λ≔2 π−λ:
Use the evalf command to show that the difference between Λ and π+arctan3 is zero.
evalfπ+arctan3−Λ = 0.
<< Chapter Overview Section 4.5 Next Example >>
© Maplesoft, a division of Waterloo Maple Inc., 2024. All rights reserved. This product is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation.
For more information on Maplesoft products and services, visit www.maplesoft.com
Download Help Document