# Directional derivative and hiking

Poetria
Homework Statement:
h(x,y)=x*y
x,y, h are measured in meters

A guy starts walking at the point (2,1) and continues in a straight line to (0,3).
As he starts, he is walking uphills if I understand it correctly.

The slope at the moment he starts is required.
Then a unit vector which is tangent to the level curve of h at height 2 at the point (2,1).
Finally - directional derivative ##D_\vec u h(2,1)##
Relevant Equations:
$$y'=-\frac {F_x} {F_y}$$
$$h_x=y$$
$$h_y=x$$

Substituting the coordinates of a given point:
$$y'=-\frac {y} {x}$$
$$y'=-\frac {1} {2}$$

A unit vector:

$$\frac {1} {\sqrt{5}, \frac {2} {\sqrt{5}}$$

$$D_\vec u h(2,1) = \frac {1} {\sqrt{5}, \frac {2} {\sqrt{5}} \cdot \vec (1,2)$$

$$D_\vec u h(2,1) = \frac {5} {\sqrt{5}}$$

Last edited:

Gold Member
$$\nabla h = y \mathbf{i}+ x \mathbf{j}$$
$$\triangle h = \int_l \nabla h \cdot d\mathbf{l}$$
where integral path l is the line from (2,1) to (0,3)

Poetria
Poetria
We haven't covered integrals yet. :( I will try.

Poetria
Vector (0-2, 3-1) = vector (-2, 2)
Unit vector = ##(\frac {-1} {\sqrt {2}}, \frac {1} {\sqrt{2}})##
Slope = -1
Tangent line: y= -x
f(x,y) = x*y
##f_x=y##
##f_y=x##

##D_\vec u h(2,1) = (\frac {-1} {\sqrt {2}}, \frac {1} {\sqrt{2}}) \cdot \nabla f(2,1)##
## D_\vec u h(2,1) = \frac {1} {\sqrt {2}}##

Is this correct?

Gold Member
Yea, it seems all right.

Poetria
Poetria
Actually I have screwed this up. But I understand now why. :(

docnet
Homework Statement:: h(x,y)=x*y
x,y, h are measured in meters

A guy starts walking at the point (2,1) and continues in a straight line to (0,3).
As he starts, he is walking uphills if I understand it correctly.

The slope at the moment he starts is required.
Then a unit vector which is tangent to the level curve of h at height 2 at the point (2,1).
Finally - directional derivative ##D_\vec u h(2,1)##
Relevant Equations:: $$y'=-\frac {F_x} {F_y}$$

$$h_x=y$$
$$h_y=x$$

Substituting the coordinates of a given point:
$$y'=-\frac {y} {x}$$
$$y'=-\frac {1} {2}$$

A unit vector:

$$\frac {1} {\sqrt{5}, \frac {2} {\sqrt{5}}$$

$$D_\vec u h(2,1) = \frac {1} {\sqrt{5}, \frac {2} {\sqrt{5}} \cdot \vec (1,2)$$

$$D_\vec u h(2,1) = \frac {5} {\sqrt{5}}$$
edit: the unit vector tangent to the level curve is not ##\hat{u}=\{\frac{-1}{2},\frac{1}{2}\}##

Poetria
Leo Liu

I drew a diagram for the second part of the question.
Assuming this diagram represents a unit vector ##\vec u'## at ##(x_0,y_0)##, we have ##\frac{\partial h}{\partial s}\bigg|_{\hat u}=\frac{\|\vec u_z\|}{\|\hat u\|}##; here ##\hat u## is the projection of ##\hat u'##. Since ##\|\hat u\|## is known after you complete the first question, we can infer ##\vec u_z##. At this point we have obtained ##\vec u'=\left\langle u'_x,u'_y,u'_z\right\rangle##, so the last step is to shrink the length of this vector to one (##\hat u'##).

Alternatively you can calculate the normal vector by computing the gradient, assume ##\vec u'## then use the fact that the dot product of it and the normal vector is 0 and that ##\vec u'## have the same x and y components as ##\hat u## to solve for the z component of ##\vec u'##

#### Attachments

• Screen Shot 2021-08-17 at 8.48.22 AM.png
10.4 KB · Views: 56
docnet
View attachment 287647
I drew a diagram for the second part of the question.
Assuming this diagram represents a unit vector ##\vec u'## at ##(x_0,y_0)##, we have ##\frac{\partial h}{\partial s}\bigg|_{\hat u}=\frac{\|\vec u_z\|}{\|\hat u\|}##; here ##\hat u## is the projection of ##\hat u'##. Since ##\|\hat u\|## is known after you complete the first question, we can infer ##\vec u_z##. At this point we have obtained ##\vec u'=\left\langle u'_x,u'_y,u'_z\right\rangle##, so the last step is to shrink the length of this vector to one (##\hat u'##).

Alternatively you can calculate the normal vector by computing the gradient, assume ##\vec u'## then use the fact that the dot product of it and the normal vector is 0 and that ##\vec u'## have the same x and y components as ##\hat u## to solve for the z component of ##\vec u'##
I'm confused. if ##\hat{u}## is tangent to the level curve ##xy=2## at the point ##(x,y)=(2,1)## then ##\hat{u}_z=0##.

##y=2/x##
##y'=-2/x^2##
##\hat{u}=(\frac{2}{\sqrt{5}},-\frac{1}{\sqrt{5}})## or ##\hat{u}=(-\frac{2}{\sqrt{5}},\frac{1}{\sqrt{5}})##

Leo Liu
I'm confused. if ##\hat{u}## is tangent to the level curve ##xy=2## at the point ##(x,y)=(2,1)## then ##\hat{u}_z=0##.

##y=2/x##
##y'=-2/x^2##
##\hat{u}=(\frac{2}{\sqrt{5}},-\frac{1}{\sqrt{5}})## or ##\hat{u}=(-\frac{2}{\sqrt{5}},\frac{1}{\sqrt{5}})##
Hi! ##\hat u## is not tangent to the level curve. Rather, the tangent vector is ##\hat u'##.

docnet
docnet
my confusion was that ##u_z=0## for every ##\hat{u}## that is tangent to the level curve of ##h(x,y)##, and its directional derivative also vanishes on the level curve

in explicit terms:
##X\equiv \vec{e_1}\equiv \frac{d}{dx}, Y\equiv{\vec{e_2}}\equiv\frac{d}{dy}##
##D_{\hat{u}}h(x,y)=D_{\Big(\frac{2}{\sqrt{5}}X-\frac{1}{\sqrt{5}}Y\Big)}[xy]= \frac{2}{\sqrt{5}}\frac{d}{dx}[xy]-\frac{1}{\sqrt{5}}\frac{d}{dy}[xy]=\frac{2y}{\sqrt{5}}-\frac{x}{\sqrt{5}}\Rightarrow 0 ##

Last edited:
Leo Liu
Leo Liu
Nope :p. My two cents: ##\frac{\partial h}{\partial s}\bigg|_{\hat u}=\frac{\|\vec u_z\|}{\|\hat u\|}\neq 0##. As ##\|\hat u\|=1##, ##u_z\neq 0##.

docnet
docnet
Nope :p. My two cents: ##\frac{\partial h}{\partial s}\bigg|_{\hat u}=\frac{\|\vec u_z\|}{\|\hat u\|}\neq 0##. As ##\|\hat u\|=1##, ##u_z\neq 0##.
well I'm trying to explain that the definition of the level curve in OP's question is one that is contained by the plane ##z=2##. any tangent vector to the level curve is also contained in the plane and has a zero z component by definition. also, the directional derivative isn't supposed to be a vector, it's just another scalar function on the xy-space.

Leo Liu
well I'm trying to explain that the definition of the level curve in OP's question is one that is contained by the plane ##z=2##. any tangent vector to the level curve is also contained in the plane and has a zero z component by definition. also, the directional derivative isn't supposed to be a vector, it's just another scalar function on the xy-space.
Well I don't want to be overly skeptical, but I have to point out that he probably meant the tangent vector at (2,1,2) which is on the level curve. I However in that case "above" might be a better word. Idk I could be wrong.

Homework Helper
Gold Member
2022 Award
Actually I have screwed this up. But I understand now why. :(
Why do you think you have screwed it up? It (Post #4) looks OK to me (apart from unnecessary references to ‘slope’ and ‘tangent line’). I would have written something like this:

##h(x, y) = xy ⇒∇h(x, y) = <y, x> ⇒ ∇h(2, 1) = <1, 2>##

From ##A(2, 1)## to ##B(0, 3)## gives ##\vec {AB} = <-2, 2>##. The unit vector in this direction is ##\vec u = <\frac {-1}{√2}, \frac {1}{√2}>##

The rate of change of h in the direction of ##\vec u## is the projection of ##∇h(2,1)## onto ##\vec u##, which is given by the dot product:
##D_\vec u h(2,1) =∇h(2, 1) \cdot \vec u =<1, 2> \cdot <\frac {-1}{√2}, \frac {1}{√2}> = \frac {1}{√2}##
___________

I will also note that the original question’s wording
“A guy starts walking at the point (2,1) and continues in a straight line to (0,3).”

The surface is curved, so he can’t walk in a straight line. It’s the projection on his path onto the xy plane that is a straight line.

Poetria and Delta2
docnet
Well I don't want to be overly skeptical, but I have to point out that he probably meant the tangent vector at (2,1,2) which is on the level curve. I However in that case "above" might be a better word. Idk I could be wrong.
yes, I agree that he probably meant the tangent vector at (2,1,2) which is on the level curve :)

Why do you think you have screwed it up? It (Post #4) looks OK to me (apart from unnecessary references to ‘slope’ and ‘tangent line’). I would have written something like this:

##h(x, y) = xy ⇒∇h(x, y) = <y, x> ⇒ ∇h(2, 1) = <1, 2>##

From ##A(2, 1)## to ##B(0, 3)## gives ##\vec {AB} = <-2, 2>##. The unit vector in this direction is ##\vec u = <\frac {-1}{√2}, \frac {1}{√2}>##

The rate of change of h in the direction of ##\vec u## is the projection of ##∇h(2,1)## onto ##\vec u##, which is given by the dot product:
##D_\vec u h(2,1) =∇h(2, 1) \cdot \vec u =<1, 2> \cdot <\frac {-1}{√2}, \frac {1}{√2}> = \frac {1}{√2}##
___________

I will also note that the original question’s wording
“A guy starts walking at the point (2,1) and continues in a straight line to (0,3).”

The surface is curved, so he can’t walk in a straight line. It’s the projection on his path onto the xy plane that is a straight line.
hmm, i think the OP made the mistake of assuming that ##\vec{u}## is the unit vector in the direction of the guy's walking. As the problem is worded, there are two parts of this question and the second part asks for the derivative of ##h(x,y)## in the direction of the tangent line to the level curve, which is not the same as the vector found in the first part of the question. The second part of the question is designed to make the OP realize one way or another that traveling along the level curve results in no elevation change, because level curve by definition has constant z. But I do agree the original question could have been better worded.

Homework Helper
Gold Member
2022 Award
hmm, i think the OP made the mistake of assuming that ##\vec{u}## is the unit vector in the direction of the guy's walking. As the problem is worded, there are two parts of this question and the second part asks for the derivative of ##h(x,y)## in the direction of the tangent line to the level curve, which is not the same as the vector found in the first part of the question. The second part of the question is designed to make the OP realize one way or another that traveling along the level curve results in no elevation change, because level curve by definition has constant z. But I do agree the original question could have been better worded.
Yes, the wording in Post #1 is unclear. But I’m interpreting the question as having only one part: to find ##D_\vec u h(2,1)##, where ##\vec u## is the unit vector in the direction the guy is walking.

I suspect @Poetria's other statements:
“The slope at the moment he starts is required.​
Then a unit vector which is tangent to the level curve of h at height 2 at the point (2,1).”​
are just ‘thinking aloud’ about possible steps to go through.

We would need to see the complete, original question to tell. But if my interpretation is wrong, I agree with yours.

Delta2, Poetria and docnet
Poetria
Thank you so much. I have to digest all this.
In the meantime I am posting the original problem:

Suppose that Larry is hiking on a hilly landscape. At the point (x,y), the height of the landscape is ##h(x,y) = x*y##. The quantities x, y and h(x, y) are all measured in meters.

a) Larry starts at (2,1) and walks in a straight line to (0,3). As he starts walking, he is going:
uphill
downhill
neither

b) The slope (rise over run) at the moment he starts walking is:

c) Find a unit vector ##\vec u## which is tangent to the level curve of h at height 2 at the point (2,1).

d) Let ##\vec u## be the vector from part c). Compute ##D_\vec u h(2,1)##

Steve4Physics, docnet and Delta2
docnet
Thank you so much. I have to digest all this.
In the meantime I am posting the original problem:

Suppose that Larry is hiking on a hilly landscape. At the point (x,y), the height of the landscape is ##h(x,y) = x*y##. The quantities x, y and h(x, y) are all measured in meters.

a) Larry starts at (2,1) and walks in a straight line to (0,3). As he starts walking, he is going:
uphill
downhill
neither

b) The slope (rise over run) at the moment he starts walking is:

c) Find a unit vector ##\vec u## which is tangent to the level curve of h at height 2 at the point (2,1).

d) Let ##\vec u## be the vector from part c). Compute ##D_\vec u h(2,1)##
in this case it seems like i lucked out and guessed the problem correctly

Steve4Physics and Poetria
Homework Helper
Gold Member
2022 Award
in this case it seems like i lucked out and guessed the problem correctly
Dammit. If I had known the guy's name was Larry, I would have got it right too.

docnet and Poetria
Poetria
I
in this case it seems like i lucked out and guessed the problem correctly
Yeah, silly me. :(

Poetria
Your post (#15) is very illuminating. At first I thought that Larry was walking neither uphill nor downhill.
It was difficult for me to realize that there are two unit vectors involved.
in this case it seems like i lucked out and guessed the problem correctly
Yeah, I think you have got to the bottom of my silliness.

Steve4Physics