You are Here: Home >< Maths

# Function of 2 variables in a certain plane? watch

1. NB This is a physics question which I feel is most suited to maths.

A hill is described h(x,y) = 300exp(-(x^2+y^2)).
A railway runs along the line x-y=2
What's the steepest slope that the train will need to climb?

I want to do as much as I ran myself, so am principally asking for a starting hint please. Specifically: there must be a way to view a 3D surface plot like this side on as defined by the railway line. Then I could parameterise this function h = f(t) and use normal 1D diff' to solve. Is this vaguely correct reasoning? If so, I don't have a clue how to carry put the initial 'projection'

2. (Original post by Sm0key)
NB This is a physics question which I feel is most suited to maths.

A hill is described h(x,y) = 300exp(-(x^2+y^2)).
A railway runs along the line x-y=2
What's the steepest slope that the train will need to climb?

I want to do as much as I ran myself, so am principally asking for a starting hint please. Specifically: there must be a way to view a 3D surface plot like this side on as defined by the railway line. Then I could parameterise this function h = f(t) and use normal 1D diff' to solve. Is this vaguely correct reasoning? If so, I don't have a clue how to carry put the initial 'projection'

Why not plug into to get and then find a way to maximise (this is probably all wrong) - otherwise, this sounds like something that can be tackled by Lagrange Multipliers, something I'm not very familiar with, in which case, I'll let somebody like atsruser or Greg jump in.
3. (Original post by Zacken)
Why not plug into to get and then find a way to maximise
I would do this.
Parametrise x and y, and then h(x, y) = h(t), which is 1 dimensional.
Spoiler:
Show
Gives steepest slope of if I haven't made a mistake.
4. (Original post by EricPiphany)
I would do this.
Parametrise x and y, and then h(x, y) = h(t), which is 1 dimensional.
Spoiler:
Show
Gives steepest slope of if I haven't made a mistake.
Clever.
5. (Original post by Sm0key)
NB This is a physics question which I feel is most suited to maths.
Looks more like a maths question that's turned up in a physics course :-)

A hill is described h(x,y) = 300exp(-(x^2+y^2)).
A railway runs along the line x-y=2
What's the steepest slope that the train will need to climb?
I think that the usual way to approach this is to

a) find the gradient function for the surface in terms of
b) use that to find the directional derivative in the direction of the line, unit vector
c) then reduce the problem to one dimension via

The gradient function encapsulates information about the gradient of the surface at every point . The directional derivative extracts gradient information from the gradient function along a line defined by a vector. A trivial directional derivative is , which extracts gradient information from the function along the line defined by the x-axis, or the vector .
6. Thanks all for the replies - much appreciated.
7. (Original post by atsruser)
Looks more like a maths question that's turned up in a physics course :-)

I think that the usual way to approach this is to

a) find the gradient function for the surface in terms of
b) use that to find the directional derivative in the direction of the line, unit vector
c) then reduce the problem to one dimension via

The gradient function encapsulates information about the gradient of the surface at every point . The directional derivative extracts gradient information from the gradient function along a line defined by a vector. A trivial directional derivative is , which extracts gradient information from the function along the line defined by the x-axis, or the vector .
I wanted to do a directional derivative approach BUT didn't know how to compute the actual scalar product.

Please could you guide me through those steps?
8. (Original post by atsruser)
a) find the gradient function for the surface in terms of
We have

I'll assume that you are happy with computing that unless you say otherwise.

b) use that to find the directional derivative in the direction of the line, unit vector
We need a vector in the direction of the line. Since , we have a line of gradient 1 in the x-y plane, which means that we go 1 unit along the y-axis for 1 unit along the x-axis. A vector in this direction is thus

You must now

1) turn this into a unit vector and
2) compute the dot product of with the gradient that you found above.

When you've done this, you will have a function which computes the gradient of the surface in the *direction* of your line (i.e. along a vector parallel to it), but at any point in the x-y plane...

c) then reduce the problem to one dimension via
... What you want, however, is a function that computes the gradient of the surface specifically on the points that lie on . But to get that function, you merely have to impose the constraint on i.e. use it to substitute for either or in , to give you, say, .

You can then find in the usual way to maximise the gradient.
9. (Original post by Sm0key)
I wanted to do a directional derivative approach BUT didn't know how to compute the actual scalar product.

Please could you guide me through those steps?
Please see my response to my response above.
10. (Original post by atsruser)
We have

I'll assume that you are happy with computing that unless you say otherwise.

We need a vector in the direction of the line. Since , we have a line of gradient 1 in the x-y plane, which means that we go 1 unit along the y-axis for 1 unit along the x-axis. A vector in this direction is thus

You must now

1) turn this into a unit vector and
2) compute the dot product of with the gradient that you found above.

When you've done this, you will have a function which computes the gradient of the surface in the *direction* of your line (i.e. along a vector parallel to it), but at any point in the x-y plane...

... What you want, however, is a function that computes the gradient of the surface specifically on the points that lie on . But to get that function, you merely have to impose the constraint on i.e. use it to substitute for either or in , to give you, say, .

You can then find in the usual way to maximise the gradient.
What if the curve in the x-y plane wasn't a line?
Say , the unit 'direction vector' of the curve varies.

I suppose you could parametrise the 'direction vector' in terms of x too, in my head that looks very messy.
11. (Original post by EricPiphany)
I would do this.
Parametrise x and y, and then h(x, y) = h(t), which is 1 dimensional.
Spoiler:
Show
Gives steepest slope of if I haven't made a mistake.
Just realized why this won't work in the general case.
You would have to parametrise in terms of curve length l think.
12. (Original post by EricPiphany)
What if the curve in the x-y plane wasn't a line?
Say , the unit 'direction vector' of the curve varies.

I suppose you could parametrise the 'direction vector' in terms of x too, in my head that looks very messy.
The tangent line to at any point has the gradient , so the tangent vector at P has components "1 along x, along y" i.e. it is giving

So you can follow the prescription as above with that unit vector, and finally constrain the gradient to to get a 1D problem, then differentiate.
13. (Original post by Zacken)
Why not plug into to get and then find a way to maximise (this is probably all wrong) - otherwise, this sounds like something that can be tackled by Lagrange Multipliers, something I'm not very familiar with, in which case, I'll let somebody like atsruser or Greg jump in.
This looks fine, except that I think you may end up out by a constant factor of if you do it naively, due to the fact that you have ended up with a function of , and a unit increment in does not equate to a unit increment along , which defines the direction that you are really interested in.

In fact, a unit increment along gives you an increment of along so this will make the calculated gradient too big (too small?). The gradient method that I showed evades this, since it allows us to differentiate naturally in the direction of the line in question, and at one point we calculate a unit tangent along that direction to make sure that we are working in terms of unit increments along that line.

[edit: in calculating the gradient along the line via Zacken's method, this happens: Suppose that the height of the function above the x-y plane is . We work with an x-change of along the x-axis - however, due to the slope of , this corresponds to points on the function that are really apart along , so our z-delta turns out to be and the slope of is computed as which is too big.]
14. (Original post by EricPiphany)
I would do this.
Parametrise x and y, and then h(x, y) = h(t), which is 1 dimensional.
Spoiler:
Show
Gives steepest slope of if I haven't made a mistake.
I don't think that this is fundamentally different from Zacken's suggestion, but it suffers from the same problem (of step size) which I described above.
15. (Original post by atsruser)
I don't think that this is fundamentally different from Zacken's suggestion, but it suffers from the same problem (of step size) which I described above.
Thanks. Realised that eventually over here.

(Original post by EricPiphany)
Just realized why this won't work in the general case.
You would have to parametrise in terms of curve length l think.
16. (Original post by Zacken)
Why not plug into to get and then find a way to maximise (this is probably all wrong) - otherwise, this sounds like something that can be tackled by Lagrange Multipliers, something I'm not very familiar with, in which case, I'll let somebody like atsruser or Greg jump in.
You can, in fact, do this via Lagrange multipliers, but I couldn't see how for a bit (because I'm quite thick). You need to first find the directional derivative function then maximise subject to the constraint . So you form:

and then solve the series of equations:

The last one is boring; it just reproduces the constraint that you started with, but the other two give you the equations in that you need to solve to find the extrema. This looks like it's equivalent to the gradient method in some sense, though [Maybe Gregorius can explain the exact connection?]
17. (Original post by atsruser)
[Maybe Gregorius can explain the exact connection?]
Eeek! I was never any good at this sort of stuff. But from a geometric point of view, one needs to observe that to do the parametrization approach correctly (the idea of if x-y=2 then y = x - 2) the resulting curve must be normalized by arc-length - or you end up out by a factor of root two as has already been observed. My guess is getting the unit vector corresponds to the arc length normalization step.
18. (Original post by Gregorius)
Eeek! I was never any good at this sort of stuff. But from a geometric point of view, one needs to observe that to do the parametrization approach correctly (the idea of if x-y=2 then y = x - 2) the resulting curve must be normalized by arc-length - or you end up out by a factor of root two as has already been observed. My guess is getting the unit vector corresponds to the arc length normalization step.
This is correct (see my insightful geometric explanation earlier ) but the question that I was a little hazy on was the connection between solving the problem via Lagrange multipliers and by merely substituting for y to reduce the problem to 1D.

Having thought about it a bit, in this simple case, these are indeed merely the same thing, since once we have got our 3 equations by partial differentiation (one of which just gives us back the constraint) we then have to solve them (by substitution..) so Lagrange multipliers gives us nothing here.

My question was fairly stupid, in fact.
19. (Original post by atsruser)
My question was fairly stupid, in fact.
They're often the best sorts of questions!

### Related university courses

TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: March 17, 2016
Today on TSR

### A-Level OCR Biology Unofficial Markscheme

Find out how you've done here

### 3,559

students online now

Exam discussions

Poll
Useful resources

### Maths Forum posting guidelines

Not sure where to post? Read the updated guidelines here

### How to use LaTex

Writing equations the easy way

### Study habits of A* students

Top tips from students who have already aced their exams