# Checking if vector field is conservative

If I can find a potential function for a vector field, does that necessarily mean that the vector field is conservative?

For example if I had a vector field that is not defined on the x-axis and I am able to find a potential function that is defined everywhere but the x-axis, is the field conservative?

I know this is true when the vector field is undefined at finitely many points, but not too sure when there are infinitely many undefined points.

Edit: Another question I have is; Suppose a vector field has divergence $= 0$ everywhere but undefined at the origin and am trying to find the outward flux. to use the divergence theorem I have to do $$\int\int\int_{V-\{0\}} \text{div} \textbf F \space \text{d}V = \int\int_{\partial V} (\textbf {F \cdot n})\text{d}S + \int\int_{B\epsilon} (\textbf {F \cdot n})\text{d}S = 0$$ $$\int\int_{\partial V} (\textbf {F \cdot n})\text{d}S = -\int\int_{B\epsilon} (\textbf {F \cdot n})\text{d}S$$

Where $B\epsilon$ is the ball with radius $\epsilon$ around the origin

When I solve for $\int\int_{\partial V} (\textbf {F$\cdot$n})\text{d}S$ I will get an answer depending on epsilon(if it doesn't get cancelled out). If epsilon remains, would I take the limit as epsilon goes to zero, or would I keep my answer with respect to epsilon?

(1) First question: The answer is yes, as long as the potential field is globally well-defined. To see this, take any (compact) curve $C$ from points $A$ to $B$ in the domain of the vector field. We can divide this curve into a finite number of segments $C_1, C_2, \dots, C_n$, each one being contained in an open ball in the domain. Say $C_i$ joins points $P_i$ to $P_{i+1}$. That is, $P_1 = A$ and $P_{n+1} = B$. If the potential function is $f$, then the line integral of the vector field over $C_i$ is $f(P_{i+1}) - f(P_{i})$. Adding all of these integrals together, the cancellation gives us $f(P_{n+1}) - f(P_1)$, which is $f(B)-f(A)$. That is, the integral over $C$ only depends on the value of the potential function at the endpoints of $C$.
Being globally well-defined is really important. For instance, consider the vector field $\vec{F}(x,y,z) = \frac{-y}{x^2+y^2} \vec{i} + \frac{x}{x^2+y^2} \vec{j}$. This is a vector field that rotates around the $z$-axis. (In particular, it is not defined on the $z$-axis.) A local calculation for the potential function yields
$$f(x,y,z) = \text{angle of rotation from positive x-axis}.$$ This function is not globally well-defined since the angle depends on how many times you wind around the $z$-axis. So, the vector field is not conservative. (In fact, the line integral around a curve measures the total change in the angle around the $z$-axis.)
(2) Technically, you should write $$\iiint_{V-B_\epsilon} \text{div \vec{F}}\: dV = \iint_{\partial V} \left(\vec{F} \cdot \vec{n} \right) \: dS + \iint_{\partial B_\epsilon} \left(\vec{F} \cdot \vec{n} \right) \: dS= 0.$$ Since the divergence is 0, the second equality is always true (independent of $\epsilon$). So, it doesn't matter what (positive) radius you take. That is, $$\iint_{\partial V} \left(\vec{F} \cdot \vec{n} \right) \: dS = - \iint_{\partial B_\epsilon} \left(\vec{F} \cdot \vec{n} \right) \: dS$$ actually does not depend on $\epsilon$. In other words, the left-hand side is independent of $\epsilon$, so the right-hand side must also be independent of $\epsilon$.