# On Gradients and their use - did I do this correctly?

1. Apr 25, 2013

### Emspak

On Gradients and their use -- did I do this correctly?

The problem statement, all variables and given/known data

I have a function that describes a surface. (It doesn't matter what it is, as I want to be sure I am doing the problem correctly, not get the answer to a particular one, so here's a "random" one)

f(x,y) = 25-5x2-3y2

I am starting from a point on the surface (5,1,-3). So I want to know what direction to go in where I am ascending at the maximum rate -- the greatest slope.

The attempt at a solution

To solve this problem I took the gradient of the function above,

$\nabla f(x,y) = (\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}) = (-10x, -6y)$

which gives me a directional vector. I take the point I am on (5,1,-3) and ignore the z coordinate for the moment. I look at (5,1). Evaluating ∇f at (a,b) gets me (-10(5), -6(1)) = (-50, -6).

That's the direction I am wanting to go towards. So to describe the vector I should travel in, is it correct to say that I want to go along (-50-5, 1-(-6)) = (-55, 7)? I feel like I missed something here, because it seems to me the z-coordinate should be in there. But if someone could let me know that I didn't make a stupid mistake, that would be much appreciated. I've looked up a lot of examples of this kind of problem and I guess I just don't trust myself.

Thanks.

2. Apr 25, 2013

### dx

You calculated the gradient and got the correct direction. Why did you subtract 5 from -50, and why did you change -6 into 1 - (-6)?

3. Apr 25, 2013

### Emspak

I figured now that I had the directional vector, I needed to get the one from the point I started at towards that vector if I wanted to show the vector one would move in from (5, 1, -3). So I subtracted the starting vector from the one I thought was at the end. Plainly that's not right...

4. Apr 25, 2013

### dx

If you have two points, whose position vectors are v and w, then you can get the vector from v to w as

w - v

But here you already have the final vector, in the correct direction. No need to subtract anything from it.

5. Apr 25, 2013

### Emspak

A ha. Thanks!

BTW, presumably if I want to know which direction I need to go in to maintain a specific slope, I can take that direction vector that I calculated (-50, -6) and a unit vector and multiply those by the cosine of theta, (where theta is the unknown). The inverse cosine will tell me what angle (in radians) I should go in to maintain whatever slope I am interested in. Yes?

From there, if I want to express the vector in other notation, I can, for example, just convert the polar coordinate to a cartesian one (using my starting point (-50, -6) as the origin and I have my vector. This is true?

Again, thanks a lot.

6. Apr 25, 2013

### dx

Try drawing the vector (-50, -6).

If this vector makes an angle θ with the negative x axis, then you can see that tan θ = 6/50

So θ = tan-1(6/50)