Potential function of the vector field $\left(\frac{-y}{x^2+y^2}, \frac{x}{x^2+y^2}\right)$ I was given this vector field
$$F:=\left(\frac{-y}{x^2+y^2}, \frac{x}{x^2+y^2}\right).$$
When $x \ne 0$, its potential function is $\theta(x,y) = \arctan\left(\frac{y}{x}\right)$.  I was asked if I can extend this $\theta$ function to become a smooth function over the domain of $F$.
What I did was
$$\theta(x,y) = \begin{cases}
\arctan\left(\frac{y}{x}\right), &x \ne 0, \\
-\ln|y|, &x = 0, y \ne 0.
\end{cases}$$
I think it's wrong.  I already read this link that it's impossible to find a potential function in this case.  How can I explain it without actually using the simply connected domain information?  Thank you.
 A: You don't need simple-connectivity assumptions to understand why this is not a gradient field.  Suppose to the contrary that $F = \nabla f$ for some potential $f$ defined across the entire plane.  Then it is immediate that the integral around any loop is $0$.  But, you can compute the integral of $F$ along the positively oriented unit circle just by using a pure parametrization, and you will get an answer of $2\pi$.  Hence $F$ has no potential.  (Note that the curve I used here goes through the $y$-axis.)
Your $\theta$ does not work for continuity reasons.  Here is a lower-dimensional analogy which may be easier to see.  Suppose I wanted to find an antiderivative (think: potential) for the function
$$
g(x) = \begin{cases} -1, & x < 0\\ 1 , & x \geq 0. \end{cases}
$$
You would try to integrate in cases and get supposed-antiderivative
$$
G(x) = \begin{cases} -x + C, & x < 0\\ x+C , & x \geq 0 \end{cases}
$$
namely that $G(x) = |x|$ perhaps with a constant shift. (At the outset you could have different constants on each piece, but you need $G$ to be continuous if you want any chance of it being differentiable, and this forces the two constants to be the same.)  But this cannot work because derivatives must have the intermediate value property (Darboux's theorem) and $g$ does not have this (the value $0$ is never assumed, for example).  Or, you can try to take the derivative of $G$ at $x=0$, and you will see it fails to have a derivative at $0$ no matter what.  So you cannot find an antiderivative of $g$ even though you can on each piece.
In other words, just because you can find a correct antiderivative on each piece, this doesn't mean they sew together correctly to give a total antiderivative.  You get praise for finding out how to rig up $\theta$ to make the derivatives work in pieces, but as a total function it doesn't work out.
