Determine using paper and pencil the partial derivatives of the first order of $\,f\,$ and $\,g\,.$ State the gradient for each of the functions.
hint
$\displaystyle{\frac{\partial f}{\partial x}}$ is found by differentiating $f(x,y)$ with respect to $x$ while $y$ is considered to be constant.
answer
Partial derivatives:
$$\frac{\partial f}{\partial x}(x,y)=2x$$
$$\frac{\partial f}{\partial y}(x,y)=3y^2$$
$$\frac{\partial g}{\partial x}(x,y)=-y\sin(x)$$
$$\frac{\partial g}{\partial y}(x,y)=\cos(x)$$
Gradients:
$$\nabla f(x,y)=(2x,3y^2)$$
$$\nabla g(x,y)=(-y\sin(x),\cos(x))$$
B
Determine using paper and pencil the four partial derivatives of the partial derivatives (i.e. the 2nd-order partial derivatives) of $\,f\,$ and $\,g\,.$
hint
$\displaystyle{\frac{\partial^2 f}{\partial x\partial y}}$ is found by differentiating $\displaystyle{\frac{\partial f}{\partial x}(x,y)}$ with respect to $y$ while $x$ is considered to be a constant.
This is Schwarz’s Theorem which is always true for a smooth function whose second-order partial derivatives are continuous.
Exercise 2: Level Curves and Gradients
We consider the function $\,f:\reel^2\rightarrow\reel\,$ given by the expression
$$\,f(x,y)=x^2-2y\,$$
and its level curves
$$\,f(x,y)=c\,,\,\,c\in\reel\,.$$
A
Show that the level curve for an arbitrary $\,c\,$ can be described by an equation on the form $\,y=g_c(x)\,$ where $\,g_c\,$ is a real function of $\,x\,,$ and draw the level curves that correspond to $\,c\in\lbrace-2,-1,0,1,2\rbrace\,.$
hint
Set the function equal to $c$ and isolate $y$. Then $y$ is expressed as a function of $x$ for any $c$.
answer
The level curves are 5 parabolas that are displaced parallel to each other in the direction of the $\,y$ axis. What is the distance between them?
B
Show that the point $\,P=(2,1)\,$ is located on the level curve corresponding to $\,c=2\,,$ and provide a parametric representation of this level curve.
hint
A parametric representation of the level curve is a coordinate expression of it. Consider what the general first and second coordinates of the curve are, written with a free parameter. There are several ways to make a correct parametric representation - plot it after you have created it to ensure that it looks as expected.
answer
A possible parametric representation:
$$r(u)=(u,\frac{u^2}2-1) , u \in \reel\,.$$
C
Determine the tangent vector at $\,P\,$ to this parametric representation, and show that the tangent vector is orthogonal to the gradient of $f$ at $\,P\,.$
hint
You get a tangent vector by differentiating the parametrization vector. This tangent vector expression will contain two coordinates that may contain $u$.
hint
Now find out which value of $u$ that corresponds to point $P$ and insert it into the tangent vector expression.
hint
Remember that orthogonality means a dot product of zero.
answer
Tangent vector at $P$:
$$(1,2)\,.$$
D
In Maple, make an inclusive plot of the level curves and the gradient vector field for $\,f\,.$
hint
Use the contourplot and gradplot commands. See today’s Maple demo if you are stuck on the syntax.
Exercise 3: Visualizations
On a mountain with an elevation map as shown below we are hiking along a trail with an elliptic shape as seen from above (shown in red). The circles on the map show level curves of and the arrows the gradient vector field of the elevation function.
A
Where on the trail is the rate of increase of the path equal to $0\,?$
hint
There are four points on the trail that fulfill this.
answer
The elevation is constant along a level curve. So, the four points of zero elevation change are found where the trail tangent is parallel to a level curve tangent. You should be able to see three obvious points where the level-curve tangent would be parallel to the red-path tangent. The fourth point is found at the very top.
B
Why are the gradient vectors always perpendicular to the level curves?
hint
Follow one of the level curves on the drawing for a total revolution and consider the direction of gradient vectors nearby.
answer
If we consider the level curve to be another path that we walk along, then the hike is horizontal, nice and quiet. Naturally, the ascent will always be largest by suddenly changing direction by 90 degrees towards the top.
C
Now draw another path that you choose arbitrarily on the shown map. It may bend and curve as you wish. Where is your path ascending, and where is it descending?
Exercise 4: Gradient Vector Fields and Directional Derivatives
Two real functions $\,f\,$ and $\,g\,$ of two real variables are given by the expressions
Determine the domains of $\,f\,$ and $\,g\,,$ respectively, and sketch these domains in the $\,(x,y)$ plane.
hint
By domain we are referring to the total set of points in $\,\reel^2\,$ at which the expression of $\,f\,$ is defined (all points that mathematically are “possible” for this function). The $\,(x,y)$ plane is the geometric representation of $\,\reel^2\,.$ To answer a question that asks for the domain, use set notation if possible - otherwise a clear text description - followed by a sketch.
Use Maple to draw a suitable section of the graphs of the functions. Use Maple to show the gradient vector fields and some level curves of the functions. Discuss with a fellow student why the graphs of the functions are drawn in an $(x,y,z)$ coordinate system, when gradient vectors and level curve contourplots are drawn in an $(x,y)$ coordinate system.
hint
A vector field is the set of vectors defined from every point within the domain. Use the gradplot command and Maple will draw a bunch of representative gradient vectors to represent the entirety of the vector field.
D
Can you from the two gradient plots determine whether the functions increase or decrease at point
$P = (0,2)$ in the direction determined by vector $\mv = (-1,-1)$?
hint
Which way does the arrow point? Will you be ascending or descending if you walked in this direction on each graph?
answer
Yes, in both cases the functions decrease in the direction defined by $\mv$.
E
Determine for each of the two functions the directional derivative at point $P$ in the direction given by vector $\mv$.
hint
The directional derivative is found as the scalar product of the gradient vector at the point with the unit direction vector. See the definition of the directional derivative in eNote 19.
Discuss the following statement: “We can characterize the gradient as the vector that points in the direction in which the function $f$ increases the most”.
Exercise 5: Clarification about Differentiability
We are given a function $\,f:\reel^2\rightarrow\reel\,$ where
$$f(x,y)=x^2-4x+y^2\,.$$
A
Show that $f$ is differentiable and determine the gradient of $f$. Show it the hardcore way directly via the definition of differentiability in Definition 19.27.
hint
As we remember from differentiability work in highschool, we will consider the relation between $\Delta f$ and $\mathbf{h}$ in connection with the limit process $\mathbf{h}\to\mnul$. The only thing to note is that $\mathbf{h}$ is now a vector that represents the vector difference that must be minimized.
hint
Set $\mathbf{h}=(\Delta x,\Delta y)$, where $\Delta x=x-x_0$ and $\Delta y=y-y_0$.
Write up an expression of $\Delta f$ and rewrite it in terms of $x_0$, $y_0$, $\Delta x$ and $\Delta y$.
Show again that $f$ is differentiable, but this time the softcore way via Theorem 19.36.
Why is it required in Theorem 19.36 that the partial derivatives must be continuous - why is it not sufficient that the partial derivatives exist?
hint
To the latter part, see Example 19.37.
answer
As for functions of one variable, it applies for functions of two or more variables that if the function is differentiable at a point, then it is also continuous at the point. Conversely, it generally applies that if the function is not continuous at the point, it cannot be differentiable at the point. In example 19.37 we have the funny situation that the partial derivatives exist at a point where the function is not continuous. This situationen does not occur if the partial derivatives are continuous.
Exercise 6: More Visualizations (Advanced but Rewarding)
In the middle of an otherwise flat landscape, a mountain rises high. The mountain has the shape of the graph of the function
$$f(x,y)=x^2-y^2+4$$
above a rectangular region in the $(x,y)$ plane that is bounded by
Outside this region, the landscape is at sea level, i.e given by $f(x,y)=0$. At the boundary of the rectangular region, the mountain has vertical sides.
A
Draw a plot of the “mountain graph” using Maple.
hint
Remember to limit your plot of the given function to only the given rectangular region (the domain). Outside of this region, the landscape must be at sea level. (Vertical sides can be difficult to work with in Maple, so you can ignore these for now.) You will have to construct these parts in Maple via several plots - use the display command to collect all parts in the same plotting window.
B
What are the coordinates of the highest point, $B$, on the mountain?
You can start by to a good approximation reading the coordinates from the graph. But reading from a graph is inherently imprecise and might be slightly off. Argue precisely for the exact answer mathematically as well, and then use the reading from the graph as a rough verification afterwards.
hint
The highest point is the function maximum. Where can the maximum be found on a bounded graph?
hint
The maximum may be found somewhere at the boundary of the region, at the corners of the region, or at stationary points within the interior of the region. These three categories must be investigated separately.
hint
The region that defines the mountain is bounded by four separate curves that constitute the boundary. If these four curves are considered as individual functions $\reel\rightarrow\reel$, then their extrema points can be found, as usual for functions of one variable, by equating their derivatives to zero and solving for the unknown. So, first, create parametrizations for each curve and then find maximum points for each of them.
hint
After having found maximum points on the boundary curves, don’t forget to also find interior maxima (stationary points), and don’t forget to compare with the corner values. The point(s) among all these that has the highest function value, is the global maximum of the function.
answer
$$B=(2,0,8)$$
C
Show that the straight line segment given by the parametric representation
is entirely embedded within the mountain surface and connects the point $\,A=(0,-2,0)\,$ (at sea level) with the highest point found above, $\,B\,.$
hint
If the line is embedded within the surface, every point $(x,y,z)$ on the line must satisfy $f(x,y)=z$.
hint
Try to insert the first two coordinate functions from $\mathbf{r}(t)$ in $f$.
hint
$f(\mathbf{r}(t))=4t$, but what does this mean?
answer
By inserting the two first coordinate functions of $\mathbf{r}(t)$ in $\,f\,$ we find that $\,f(\mathbf{r}(t))=4t\,$, which is exactly the $\,z$-coordinate of $\,\mathbf{r}(t)\,$. Therefore all points on the line coincide with points located on the surface, and thus it is fully embedded.
D
The shortest path from the mountain point $\,A =(0,-2,0)\,$ (at sea level) to the summit of the mountain at point $\,B\,$ is therefore the above straight line. Why is that?
hint
Which path is always the shortest?
answer
The shortest path between tow points is always the straight line between them.
E
Use Maple’s contourplot command to draw in an $(x,y)$ coordinate system a system of level curves of $\,f\,$ from the rectangular mountain region. This is then an elevation map or altitude map of the mountain.
Draw this elevation map using a number of level curves of your choice, e.g. seven.
Then add to your elevation map the two points $\,A\,$ and $\,B\,$.
Finally, add the shortest path between $\,A\,$ to $\,B\,$ that you found above.
F
Compute the gradient of $\,f\,$ at three points of your choice along the straight line between $A$ and $B$ on the map, and draw their three gradient vectors on the figure.
G
Show that there is one and only one point on the curve where the gradient of $\,f\,$ points along with (is parallel to) the line projection on the $(x,y)$ plane. For a visual overview of what you are looking for, use the gradplot command to plot many gradient vectors at once.
hint
Is the gradient found in 2D space or 3D space?
hint
Gradient vectors are defined and drawn on the $(x,y)$ plane which is why we must compare gradient vectors with the projection of the line on this plane. The line projection is easily extracted as the first two of its parametrization coordinates unaltered.
hint
The line has in the $(x,y)$ plane a direction vector projection of $(1,1)$.
hint
Any gradient vector parallel to the line projection will have equal $x$ and $y$ coordinates. Solve for this and then find out where this parallel gradient is found.
answer
The gradient of $f$ is parallel to the line projection in the $(x,y)$ plane only at the point $\,(1,-1)\,$.
H
Isn’t the above result in contradiction to the usual claim that: “We can characterize the gradient as the vector that points in the direction in which the function $f$ increases the most”?
hint
In which context did we choose this formulation?
answer
No, there is no contradiction. The shortest path between the two points $A$ and $B$ just happens to follow the steepest direction at a point. This path has no relation to level curves which always are orthogonal to the gradient.