[Math] Multivariable calculus finding steepest slope with no given coordinates

calculusgradient descentmultivariable-calculus

A hill can be described by $h(x,y) = 300e^{-(x^2+y^2)}$, where $x$ and $y$ are horizontal distances (in km) measured in the directions East and North, respectively, and $h$ is the height (in m) of the ground above the sea level.

A rail way runs SW to NE and follows the straight line $x-y=2$. What is the steepest slope that the trains will have to climb?

My working

First I found the partial derivatives
$$\frac{\partial h}{\partial x} = -600000xe^{-(x^2+y^2)}$$
and
$$\frac{\partial y}{\partial x} = -600000ye^{-(x^2+y^2)}$$
and then I know that $y=x-2$ is a straight line passing through (0,-2), therefore its directional vector is just gonna be $(\vec{i} + \vec{j})$, and naturally its unit vector would be $\frac{1}{\sqrt{2}}(\vec{i} + \vec{j})$
Now I understand that if I take the dot product of the $\nabla$ and unit vector $\hat{\vec{r}}$, that would give me the steepest ascent. However, I'm not sure how I would go about finding the steepest slope since I wasn't given any coordinates?

Best Answer

First, as two commenters have indicated, your leading coefficients are way too large. But once you've fixed that, you're almost there. Take the dot product you mention to get

$\displaystyle \frac{dh}{dl} = \frac{1}{\sqrt{2}}( \partial_x h + \partial_y h)$

This is a function of both $x$ and $y$, but you know the relationship between $x$ and $y$: $x-y=2$. So substitute for either $x$ or $y$ in $dh/dl$ to get a function in one variable, $x$ say. Fortunately in this example, you don't have to worry about any scaling between $\partial_x$ and $\partial_y$. (Do you understand why?) Now take the derivative of that function with respect to whichever independent variable you chose and find where that derivative is zero and there is your maximum slope. If you need the actual value of that slope, you will have to account for the difference in scaling between $\partial_x$ and $d/dl$.