How would I undo a gradient function? If we are given a vector, how can we tell if that is a gradient of a vector? And how would we find the original function? I was assigned this problem, and I know how to get a gradient of a function, but not how to go backwards.
$$\bigl(6\cos(x^2+4y^2) - 12x^2 \sin(x^2+4y^2)\bigr)\vec \imath + \bigl(-48xy\sin(x^2+4y^2)\bigr)\vec\jmath$$
Thank you for all and any help you could provide.
 A: To undo, you need to play a guessing game: Note that if $\vec{v} = \vec{\nabla}f$, then for your case, we have
$$\dfrac{\partial f}{\partial x} = 6 \cos(x^2+4y^2) - 12x^2\sin(x^2+4y^2) \tag{$\star$}$$
and
$$\dfrac{\partial f}{\partial y} = - 48xy\sin(x^2+4y^2)\tag{$\dagger$}$$
It is easier to deal with $\dagger$ than $\star$. Note that
$$\dfrac{\partial f}{\partial y} = 6x\dfrac{d(y^2)}{dy}\dfrac{d\left(\cos(x^2+4y^2)\right)}{d(y^2)} = \dfrac{\partial}{\partial y}\left(6x \cos(x^2+4y^2)\right)$$
Hence,
$$f(x,y) = 6x \cos(x^2+4y^2) + g(x)$$ Now plug in $f(x,y)$ into $\star$; we then get that $g(x) = \text{constant}$. Hence,
$$f(x,y) = 6x \cos(x^2+4y^2) + \text{constant}$$
A: $$f(x,y)\vec \imath + g(x,y)\vec\jmath$$
If this is a gradient, then you have
$$
\frac{\partial h}{\partial x} = f\text{ and }\frac{\partial h}{\partial y} = g.
$$
Since
$$
\frac{\partial^2 h}{\partial y\,\partial x} = \frac{\partial^2 h}{\partial x\,\partial y},
$$
one must have
$$
\frac{\partial f}{\partial y}=\frac{\partial g}{\partial x}.
$$
If those are not equal, then what you have is not a gradient.
