Given a vector field $\vec{v}(x)$ on $\mathbb{R}^3$, with standard euclidian metric, you can asociate a 1-form $\tilde{\omega}$ and the question of when you can write the vector field as: $$ \vec{v}= f \, \vec{\nabla}\phi $$ for some functions $f$ and $\phi$, is equivalent to writing the 1-form as: $$ \tilde{\omega} = g \, d\psi $$ for some functions $g$ and $\psi$. All functions from $\mathbb{R}^3$ to $\mathbb{R}$.
I know that a $\textit{necessary}$ condition is $\vec{v} \cdot \vec{\nabla}\times \vec{v}=0$ which is equivalent to $\tilde{\omega} \, \wedge \, d \tilde{\omega}=0$
Now I was reading the forum and came across this question:
How does an integrating factor geometrically "uncurl" a vector field?
And in two of the answers they claim that it is also a $\textit{sufficient}$ condition as a corollary of Frobenius' theorem. I must confess that I am not very familiar with that theorem, but that result seems so counter intuitive and wrong (to me) as some examples may ilustrate:
Consider $\textit{any}$ two-dimensional vector field, for example $\vec{v}(x,y,z)= (-x-y,x-y,0)$ (spirals) then it follows that the curl is always pointing in the $z$-direction. And therefore $\vec{v} \cdot \vec{\nabla}\times \vec{v}=0$, so according to the condition I should be able to write $\vec{v}=f\, \vec{\nabla}\phi$. But consider the orthogonal vector field $\vec{w}(x,y,z)= (x-y, x+y,0)$ (also spirals) the solutions to that vector field parametrize the level-curves of $\phi$, but the level-curves "approach" the origin and that never happens with level-curves. So, what just happen?
Perhaps the problems is that $\vec{v}(0,0,0)= \vec{0}$ and the $\textit{sufficient}$ condition also needs that the vector field is not equal to zero in an open set or something like that. (Something like a foliation I imagine).
My question is where have I gone wrong about Frobenius' theorem? Is that really the (necessary)-sufficient condition? Or under what circumstances I can write a vector/ 1-form as multiple of a gradient? It is also equivalent to when a integral-factor exist. Is there a stronger condition that does not require the vector field to be different from zero? If someone could also recommend a place where I can read Frobenius' theorem in a not-very-advance level I would appreciate it as I am fairly new to differential-forms.
Thank you :)