How to prove that there is no differentiable function with given partial derivatives

In my opinion, I think this exercise is the most important exercise in calculus since it is a starting point of the de Rham cohomology, which shows an interaction between topology and functions on it. Anyway, this question is equivalent to the following: can we find $f:U \to \mathbb{R}$ s.t. $$ \nabla f = \left(\frac{y}{x^{2}+y^{2}}, -\frac{x}{x^{2}+y^{2}}\right)? $$ If such $f$ exists, the vector field on the right-hand side will be called as a conservative field, and by the fundamental theorem of a line integral, if we integrate the vector field over any given (simple) closed curve, the result should be zero. However, if you try to integrate it over a unit circle centered at origin, the result became $2\pi$.


Assume that such a $f$ exists and let $\gamma\colon[0,1]\to U$ defined by $\gamma(t)=(\cos(2\pi t),\sin(2\pi t))$, then: $$\int_\gamma\mathrm{d}f=f(\gamma(1))-f(\gamma(0))=0,$$ however using the given formula for $\mathrm{d}f$, one finds that: $$\int_\gamma\mathrm{d}f=\int_0^1 \mathrm{d}f_{\gamma(t)}\cdot\dot{\gamma}(t)\,\mathrm{d}t=2\pi\int_0^1\frac{-\sin(2\pi t)^2-\cos^2(2\pi t)}{\cos^2(2\pi t)+\sin^2(2\pi t)}=-2\pi,$$ whence a contradiction.

The intuition behind this reasoning is that the angular form $\frac{y\mathrm{d}x-x\mathrm{d}y}{x^2+y^2}$ is not exact on $U$.