$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
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.