# Directional derivative and hiking

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:

anuttarasammyak
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
We haven't covered integrals yet. :( I will try.

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?

anuttarasammyak
Gold Member
Yea, it seems all right.

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

docnet
Gold Member
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 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

docnet
Gold Member
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}})##

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
Gold Member
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
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
Gold Member
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.

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.

Steve4Physics
Homework Helper
Gold Member
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
Gold Member
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.

Steve4Physics
Homework Helper
Gold Member
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
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
Gold Member
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
Steve4Physics
Homework Helper
Gold Member
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
I
in this case it seems like i lucked out and guessed the problem correctly Yeah, silly me. :(

Your post (#15) is very illuminating. At first I thought that Larry was walking neither uphill nor downhill.
It was difficult for me to realise 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