<s>[INST] Given a directional derivative to find a point Let $ f(x,y,z)$ be differentiable, and assume that
$$ f(x, y, x^2 + y) = 3x - y $$
(for all values of $x,y$).
Also, given the direct-derivative of the point $A=(0, 12, 12)$ and the direction vector is $(1, 0, 1)$ is equal to $3$, I need to find the gradient of $f$ at $A$.
I have no idea how to even start, because $f$ is not given explicitly, only the derivative — but again, not explicitly for $f(x,y,z)$, but for this weird combination $f(x, y, x^2 + y)$.
What should I do?
 [/INST] Using the chain rule:

$$\frac{ \partial}{ \partial x} f(x,y,x^2 + y) = f_x(x,y,x^2 + y) \cdot \frac{ \partial}{ \partial x} (x) + f_y (x,y, x^2 + y) \cdot \frac{ \partial }{ \partial x}(y) + f_z(x,y,x^2 + y) \cdot \frac{\partial }{\partial x} (x^2 + y) = f_x(x,y,x^2 + y) + 2x \cdot f_z(x,y,x^2 + y) = \frac{\partial}{ \partial x}(3x -y) = 3 
f_x(x,y,x^2 +y) = 3- 2x f_z(x,y,x^2+y) $$

Notice that $A$ fits perfectly to the $x,y, x^2 + y$ pattern ($0^2 + 12 = 12 = A_z$) Thus:
$$ f_x(0,12,12) = 3- 2 \cdot 0 \cdot f_z(x,y,x^2+y) = 3$$
So we have one third of the gradient at the point $A$.

Using the chain rule again but now differentiating on $y$:
$$ f_y(x,y,x^2 + y) = f_x(x,y,x^2 + y) \cdot (x)_y + f_y(x,y,x^2 + y) \cdot (y)_y + f_z(x,y,x^2 + y) \cdot (x^2  +y)_y \\=  f_y(x, y,x^2 +y) + f_z(x,y,x^2 + y) = (3x -y)_y = -1 \\ \Rightarrow \color{red}{f_y(0,12,12) + f_z(0,12,12) = -1} $$

Now using the directional derivative:
First we need to normalize the direction vector, which is given by $$ \frac{1}{||(1,0,1)||} \cdot (1,0,1) = ( \frac{1}{\sqrt{2}} , 0, \frac{1}{\sqrt{2}})$$
Now using the fact that the function is differentiable, you don't need to actually calculate the derivative by definition, we can just use this known formula (which is equal to $3$ according to the question):
$$ \nabla f(0,12,12) \cdot ( \frac{1}{\sqrt{2}} , 0, \frac{1}{\sqrt{2}}) = 3$$
By the definition of the gradient at point $A$, it is equal to all the vector of all partial derivatives at that point:
$$ \nabla f(0,12,12) = \left ( f_x(0,12,12), f_y(0,12,12) , f_z(0,12,12) \right ) $$
Regular dot multiplication gives us:
$$ f_x(0,12,12) \cdot \frac{1}{\sqrt{2}} + 0 \cdot f_y(0,12,12) + f_z(0,12,12) \cdot \frac{1}{ \sqrt{2}} = 3$$
Now, we already know what is the value of $f_x(0,12,12)$ and it is equal to $3$. Substituting back gives us:
$$f_z(0,12,12) \cdot \frac{1}{\sqrt{2}}  = 3 - \frac{3}{\sqrt{2}} \\ f_z(0,12,12) = 3 \sqrt{2} - 3$$
Recall the red equation, we can substitute $f_z$ back and get:
$$ f_y(0,12,12) = -1 -f_z(0,12,12) = -1 -3 \sqrt{2} + 3 = 2 - 3 \sqrt{2} $$
Thus we can finally say that the answer is:
$$ \nabla f(0,12,12) = (3, 2-3\sqrt{2}, 3 \sqrt{2} -3 ) $$
And rest.
</s>