curl free field not neccessarily implies existence of scalar function $S=\mathbb{R}^2$\{(0,0)}. Let 
$$F(x,y)=(\frac{-y}{x^2+y^2},\frac{x}{x^2+y^2})=(P(x,y),Q(x,y)).$$
Show that $$ \frac{\partial P}{\partial y}=\frac{\partial Q}{\partial x}$$ on S while F is not gradient of a scalar field on S.
I came across this question and I don't understand why curl(F)= zero on S is not sufficient for F to be written as a gradient of a scalar function
 A: To be ''curl free'' is a necessary condition for the existence of a scalar potential, but it is not sufficient. It is sufficient only if the vector filed is defined on a contractable subset of $\mathbb{R}^n$, i.e a set $X$ that is simply connected, in the sense that any  loop  on $X$ can be contracted to a point . 
This is the Poincaré lemma(better formulated in the language of differential form where the curl is an exterior derivative).
The domain of your field $f$ has a hole in $(0,0)$ so it is not simply connected.
A: Being curl free is enough to be locally the gradient of a family of scalar fields but when you want to extend one of these scalar fields to be globally defined in a coherent way all over the domain it can turn out to be impossible. Here is why it is actually impossible in your example:
Consider the curve 
$$
\Gamma: \theta \mapsto (\cos\theta,\sin\theta)
$$
the vector field $F$ on the curve is 
$$
F(\cos\theta,\sin\theta)=(-\sin\theta,\cos\theta)
$$
that is $F(\cos\theta,\sin\theta)$ is a unit vector tangent to the curve.
Suppose there exists a scalar function $U(x,y)$ defined on $\mathbb R^2 \backslash \{0\}$ such that $F(x,y)=-\nabla U(x,y)$ then  let's compute it on $\Gamma$: we define $g(\theta)=U(\cos\theta,\sin\theta)$ and we look at the derivative:
$$
g'(\theta)=-\nabla U(\cos\theta,\sin\theta) \cdot (-\sin \theta,\cos \theta)=\sin^2\theta+\cos^2\theta=1
$$
so it must be strictly increasing but this is impossible because $g$ is periodic.
