Let $y\in\mathbb{R}^n$.
I want to find an unknown scalar-valued function $F(y)$ such that $\nabla_y F = f(y)$, where $\nabla_y$ is the gradient w.r.t. $y$ and $f : \mathbb{R}^n \to \mathbb{R}^n$ is a known function that's given to me.
To do this, I do a linear substitution $y = A z$ and consider $f(A z)$. Let's say that I can find a scalar-valued function $G(z)$ such that $\nabla_z G(z) = f(A z)$. Then can I figure out what $F$ is using $G$?
A simple concrete example:
$$f(y) = M y$$ $$f(A z) = M A z$$ $$G(z) = \frac{1}{2} z^\intercal M A z$$ $$F(y)=?$$
If it's not obvious, $F(y)$ should be $\frac{1}{2} y^\intercal M y$ in this case.
Also, if there's an answer for this problem when using a more general nonlinear substitution, that'd be great, but I think I only need the answer in the linear substitution case.
P.S.: If this doesn't have a solution, then if you could answer this: if one knows how to go from $f(y)$ back to $F(y)$, then how can one use that knowledge to find the "anti-gradient" of $A \cdot f(y)$?