Directional derivative and gradient of a differentiable function Let $u = f(x,y,z)$ be a differentiable function in $\mathbb{R^3}$
Given the function satisfies: $f(x,y,x^2 + y^2) = 2x+y$ for all $x,y$
And the directional derivative of the point $(0,2,4)$ in the direction: $(-2,1,2)$ is equal to $-\frac{5}{3}$.
Calculate: $\nabla f(0,2,4)$
My try so far:
I first normalized the vector: $\frac{(-2,1,2)}{||(-2,1,2)||} = (-\frac{2}{3}, \frac{1}{3}, \frac{2}{3})$
we know that $f(0,2,4) = f(x,y,x^2 + y^2)$ because $x=0, y=2 , x^2+y^2 = 4$ and so:
$f(0,2,4) = 2 \cdot 0 + 2 = 2$.
By the definition: $\frac{\partial f}{\partial (-2,1,2)}(0,2,4) = -\frac{5}{3} \Rightarrow \nabla f(0,2,4) \cdot (-\frac{2}{3}, \frac{1}{3}, \frac{2}{3}) = -\frac{5}{3}$
Even by the definition I am stuck:
$\nabla f(0,2,4) = \lim_{h \rightarrow 0} \frac{f( (0,2,4) + h(-2,1,2)) - f(0,2,4)}{h} = \lim_{h \rightarrow 0} \frac{f(-2h,2+h, 4+2h) - 2}{h}$
Because the point $(-2h,2+h, 4+2h)$ does not satisfy that $x^2 + y^2 = z$ (coordinates) ...
The problem is that I don't know how to find the gradient of that point, because the function is not given in its explicit form.. I would appreciate your help, thank you!
 A: For simplicity, I will denote $\nabla f(0,2,4) = (f_x(0,2,4), f_y(0,2,4) , f_z(0,2,4)) = (a,b,c)$
You need to use the chain rule on this known fact $f(x,y,x^2+y^2) = 2x+y$:
$$\frac{ \partial }{\partial x}f(x,y,x^2+y^2) = f_x(x,y,x^2+y^2) \cdot \frac{\partial}{\partial x}x + f_y(x,y,x^2+y^2) \cdot \frac{\partial}{\partial x}y + f_z(x,y,x^2+y^2) \cdot \frac{\partial}{\partial x}(x^2 + y^2) = \overbrace{f_x(x,y,x^2+y^2) +2xf_z(x,y,x^2+y^2)}^{\text{left side}} = \overbrace{\frac{ \partial }{ \partial x}(2x+y)}^{\text{right side}} = 2$$
You want to find $\nabla f(0,2,4)$ and thus we can substitute:
$$f_x(0,2,4) + 0 = a =  2$$
$2x \cdot f_z(0,2,4) = 0$ because it is being multiplied by the $x$ value - which is $0$.
Same thing for $\frac{\partial}{\partial y}$:
$$\frac{ \partial }{\partial y}f(x,y,x^2+y^2) = f_x(x,y,x^2+y^2) \cdot \frac{\partial}{\partial y}x + f_y(x,y,x^2+y^2) \cdot \frac{\partial}{\partial y}y + f_z(x,y,x^2+y^2) \cdot \frac{\partial}{\partial y}(x^2 + y^2) = f_y(x,y,x^2+y^2) +2yf_z(x,y,x^2+y^2) = \frac{ \partial }{ \partial y}(2x+y) = 1$$
And so keep in mind this equation (1): $$ \fbox{b+4c =1}$$
Now we can use the fact that the directional derivative at $(-2,1,2)$ at the point $(0,2,4)$ is $-\frac{5}{3}$ by definition, the directional derivative for this differentiable function at the given point and direction is:
$$ \nabla(0,2,4) \cdot ( -\frac{2}{3}, \frac{1}{3}, \frac{2}{3}) = - \frac{5}{3}$$
Recall that $\nabla f(0,2,4) = (a,b,c)$:
$$ - \frac{2a}{3} + \frac{b}{3} + \frac{2c}{3} = - \frac{5}{3}$$
$$ -2a +b +2c = -5$$
We found that $a=2$:
$$ \fbox{ b + 2c = -1}$$
Now we have a set of two equations with two unknowns, this should be fast forward:
$$ \left\{\begin{matrix}
b+4c =1\\ b + 2c = -1
\end{matrix}\right.$$
We get that $$a=2, ~~~~  b = -3 , ~~~~ c = 1$$
And thus the answer is:
$$ \nabla f(0,2,4) = (2,-3,1)$$
