Why are line integrals not always path independent? The text I am reading says that a line integral,
$$\int_{C}{\mathbf{F}\cdot\textrm{ d}\mathbf{r}}$$
is path-independent whenever $\mathbf{F}$ is a gradient field (or in the realm of physics, a conservative field).
My question is, when is a line integral path-dependent? Under the characterization of path-independence I described above, it seems like every line integral must be path-independent because every vector field is the gradient field of some potential function. Or is this false?
 A: If you stop and think about what these integrals mean, this is obviously false (no need to come up with some clever explicit example!).  For instance, consider two paths $C_1$ and $C_2$ with the same endpoints but which stay away from each other outside the endpoints (say, $C_1$ might be the top half of a circle and $C_2$ the bottom half).  Suppose we have a vector field $\mathbf{F}$ for which it happens to be true that $$\int_{C_1}{\mathbf{F}\cdot\textrm{ d}\mathbf{r}}=\int_{C_2}{\mathbf{F}\cdot\textrm{ d}\mathbf{r}}.$$  Now take $\mathbf{F}$ and modify it on a small open ball in the middle of $C_1$ but leave it alone everywhere else (if you want $\mathbf{F}$ to remain smooth you can do this with a bump function).  This will change the integral on the left (unless by some big coincidence the modification you made ended up cancelling out in the integral) but won't change the integral on the right, so the modified version of $\mathbf{F}$ will have different integrals along $C_1$ and $C_2$.
A: Consider the vector field $\mathbf{F}=(y,-x)$. Is it the gradient field of some potential function?
Note that if $C$ is a circle centered at the origin of radius $R>0$ counterclockwise oriented, then
$$\int_{C}{\mathbf{F}\cdot\textrm{ d}\mathbf{r}}=\int_0^{2\pi} R^2(\sin^2(t)+\cos^2(t))\,dt=2\pi R^2\not=0.$$
So $\mathbf{F}$  is not a conservative field. 
A: Consider this partial answer.
The main point is as follows. Consider this question on an arbitrary open set $U\subset \mathbb{R}^n$. Locally (that is to say on $\mathbb{R}^n$, as every small ball $B_r(x)\subset U$ is diffeomorphic to $\mathbb{R}^n$),we can find a potential (more generally, work with differential forms to avoid use of scalar products etc.) if the so called "local conservativity" equations are satisfied : $\partial_i F_j=\partial_j F_i$ for all $i,j=1,...,n$. This means that locally (for example, when $U$ is simply connected), this property becomes global - every vector field on a simply connected open set has a potential. However, there might arise problems to obtain a global result (like a global potential field) without any global information for $U$ (such as simple connectedness).
As an example, consider $X=\mathbb R^2\setminus \{0\}, f(x,y)=\frac {(-y,x)}{x^2+y^2}$, as in the cited answer.
Let $U=\mathbb R^2\setminus (-\infty,0]$ and $\theta:U\to (-\pi,\pi)$ be the angle from the positive real ray with values in $(-\pi,\pi)$. since $\frac{y}{x}=\tan \theta$
$$ \frac{dy}{x}-\frac{y\,dx}{x^2}=\frac{d\theta}{cos^2\theta}=\frac{x^2+y^2}{x^2}d\theta     \implies d\theta =\frac{-y\,dx+x\,dy}{x^2+y^2}$$
This exactly means that $\theta$ is a potential for $f$ on $U$.
Similarly, consider $V=\mathbb R^2\setminus [0,\infty)$ and $\phi:V\to (0,2\pi)$ be the angle from the positive ray with values in $(0,2\pi)$. again, since $\frac{y}{x}=tan\phi$, we again see that $\phi$ is a potential for $f$ on $V$.
Therefore, we found potentials locally, as $U$ and $V$ are open subsets of $\mathbb R^2\setminus \{0\}$. The problem is that these potentials do not patch up to a global potential on $\mathbb R^2\setminus \{0\}$, as they disagree on (expected, i.e. via continuation) values on the real line. In fact, no two such local potentials will ever patch up to a global potential. 
Now taking a path $:c:[0,2\pi]\to \mathbb R^2\setminus \{0\}$ to be $c(t)=(\cos t,\sin t)$ we can calculate the path integral of the vector field over $c$:
$$c'(t)=(-\sin t,\cos t), \quad f(c(t))=(-\sin t,\cos t)/(\cos ^2 t+\sin^2 t)=(-\sin t,\cos t)$$ 
so
$$\oint_c f\cdot d\textbf{r}=\int_0^{2\pi} (-\sin t,\cos t)\cdot (-\sin t,\cos t)dt=\int_0^{2\pi}\sin^2 t+\cos^2 tdt=\int_0^{2\pi}dt=2\pi.    $$
This implies that if we take two paths from $p=(-1,0)$ to $q=(1,0)$, each of which goes from another side of $(0,0)$, then the result will differ by $2\pi$, which means that this integral is dependent on the path taken.
A: 
... because every vector field is the gradient field of some potential function.  Or is this false?

It is false.  If $\mathbf{A} = \nabla f$ for some scalar function $f$, then it must be the case that $\nabla \times \mathbf{A} = 0$.  This is because the curl of a gradient is always zero. (This is easy, if tedious, to show by just writing out all the second derivatives that arise.)  Therefore, if $\nabla \times \mathbf{A} \neq 0$, $\mathbf{A}$ is not the gradient of a scalar function.  It's pretty straightforward to find a vector field whose curl is non-zero.
FYI, the converse is also true so long as your vector field is well-defined on all of $\mathbb{R}^3$:  if $\nabla \times \mathbf{A} = 0$, then there exists some scalar function $f$ such that $\mathbf{A} = \nabla f$.
