Find function whose gradient is Ax, with A antisymmetric I have two variables $x_1,x_2\in\mathbb{R}$, and the vector function $g(x)=[x_2,-x_1]^T=Ax$, where A=[0,1;-1,0], and $x=[x_1,x_2]^T$. Is there any way to find a function $f:\mathbb{R^2}\rightarrow \mathbb{R}$, such that $\nabla f(x)=g(x)$? 
 A: The answer is no, for something that goes by the fancy name of Frobenius's Integrability Criterion. This is just about the simplest example, however, so we can get a sufficiently powerful version with just bare hands. Each number in the list below gives a different way of showing we cannot find a $\phi$ of which your function is the gradient.


*

*Suppose I have a vector field $\mathbf{F}(\mathbf{x})$, and I want to know if there is a $\phi(\mathbf{x})$ so that $\mathbf{F} = \nabla \phi$. If there is such a $\phi$, then for any reasonable path $\gamma$ with endpoints $\mathbf{a}$ and $\mathbf{b}$,
$$ \int_{\gamma} \mathbf{F}(\mathbf{x}) \cdot d\mathbf{x} = \phi(\mathbf{b})-\phi(\mathbf{a}), $$
essentially by the Fundamental Theorem of Calculus. In particular, if $\gamma$ is a closed curve, i.e. $\mathbf{b}=\mathbf{a}$, the integral is always zero. If you pick an easy closed path like a circle or a square, you can easily check this doesn't hold for the vector field $(y,-x)$.

*Another identity that we believe for sufficiently differentiable functions is that
$$ \frac{\partial^2}{\partial x \partial y} \phi(x,y) - \frac{\partial^2}{\partial y \partial x} \phi(x,y) = 0: $$
the second partial derivatives commute. Suppose now that $\mathbf{F} = (F_x,F_y) =\nabla\phi = (\partial_x \phi,\partial_y \phi)$. ($\partial_x$ being shorthand for $\partial/\partial x$, &c.) Then if we apply the rule, we have
$$ 0 = \partial_x \partial_y \phi - \partial_y \partial_x \phi = \partial_x F_y - \partial_y F_x. $$
Hence it is only possible for $\mathbf{F}$ to be $\nabla$ of some $\phi$ if
$$ \partial_x F_y - \partial_y F_x = 0; $$
this is the Frobenius criterion in the case of a two-dimensional vector field (it turns out that this condition is in fact sufficient on simply connected sets, but this is harder to prove and we don't care about this direction, so never mind). If you calculate $\partial_x F_y - \partial_y F_x$ for $F_x = y$, $F_y = -x$, you find that this is not zero, so again there can be no such $\phi$.

*To link the previous two approaches together, you may notice that $\partial_x F_y - \partial_y F_x$ is the $z$-component of $\nabla \times\mathbf{F}$. Stokes's theorem says that if $\gamma$ is a simple closed curve bounding a surface $S$, then
$$ \int_{\gamma} \mathbf{F} \cdot d\mathbf{x} = \int_S \nabla \times \mathbf{F} \cdot d\mathbf{S}. $$
If we extend $\mathbf{F}$ to live in three dimensions with zero third component, and take $\gamma$ and $S$ in the $xy$-plane, this simplifies into precisely the first criterion.
A: Alternatively, suppose the contrary that $\nabla f=g$ on $\mathbb R^2$. Then $(\nabla f(\mathbf x))\cdot\mathbf x\equiv0$. That is, the directional derivative of $f$ along every line pointing out from the origin is zero. Therefore $f$ is constant on every such line and in turn, $f$ is constant on $\mathbb R^2$. Hence $\nabla f=0$, contradicting that $\nabla f=g\ne0$.
A: $$
\nabla f(x, y) = 
\left[ \begin{array}{c}
 \partial_{x} f \\
 \partial_{y} f
\end{array} \right]
%
=
%
\left[ \begin{array}{r}
  y \\
 -x
\end{array} \right]
$$
There is no solution because of the minus sign. 
Consider $f(x,y) = \pm xy$
$$
\nabla f(x, y) = 
\left[ \begin{array}{c}
 \partial_{x} f \\
 \partial_{y} f
\end{array} \right]
%
=
%
\left[ \begin{array}{r}
  \pm y \\
  \pm x
\end{array} \right]
$$
