In James Stewart's Multivariable Calculus: Concepts and Contexts, this theorem is stated:
"Suppose $\mathbf{\vec F}$ is a vector field that is continuous on an open connected region $\mathit{D}$. If $\int_C \mathbf{\vec F} \cdot d\mathbf{\vec r}$ is independent of path in $\mathit{D}$, then $\mathbf{\vec F}$ is a conservative vector field on $\mathit{D}$; that is, there exists a function $\mathit{f}$ such that $\nabla \mathit{f} = \mathbf{\vec F}$."
The proof is as follows:
"Let $\mathit{A(a,b)}$ be a fixed point in $\mathit{D}$. We construct the desired potential function $\mathit{f}$ by defining $$ \mathit{f\,(x,y)} = \int_\mathit{(a,b)}^\mathit{(x,y)} \mathbf{\vec F} \cdot d\mathbf{\vec r}$$ for any point in $\mathit{(x,y)}$ in $\mathit{D}$. Since $\int_C \mathbf{\vec F}\,d\mathbf{\vec r}$ is independent of path, it does not matter which path $\mathit{C}$ from $\mathit{(a,b)}$ to $\mathit{(x,y)}$ is used to evaluate $\mathit{f\,(x,y)}$. Since $\mathit{D}$ is open, there exists a disk contained in $\mathit{D}$ with center $\mathit{(x,y)}$. Choose any point $\mathit{(x_1,y)}$ in the disk with $\mathit{x_1 \lt x}$ and let $\mathit{C}$ consist of any path $\mathit{C_1}$ from $\mathit{(a,b)}$ to $\mathit{(x_1,y)}$ followed by the horizontal line segment $\mathit{C_2}$ from $\mathit{(x_1,y)}$ to $\mathit{(x,y)}$. Then $$ \mathit{f\,(x,y)} = \int_\mathit{C_1} \mathbf{\vec F} \cdot d\mathbf{\vec r}\, + \int_\mathit{C_2} \mathbf{\vec F} \cdot d\mathbf{\vec r} = \int_\mathit{(a,b)}^\mathit{(x_1,y)} \mathbf{\vec F} \cdot d\mathbf{\vec r}\, + \int_\mathit{C_2} \mathbf{\vec F} \cdot d\mathbf{\vec r}$$ Notice that the first of these integrals does not depend on $\mathit{x}$, so $$ \frac{\partial}{\partial x}\;\mathit{f\,(x,y)} = 0 + \frac{\partial}{\partial x}\int_\mathit{C_2} \mathbf{\vec F} \cdot d\mathbf{\vec r}$$ If we write $\mathbf{\vec F} = \mathit{P}\,\mathbf{\vec i} + \mathit{Q}\,\mathbf{\vec j}$, then $$ \int_\mathit{C_2} \mathbf{\vec F} \cdot d\mathbf{\vec r} = \int_\mathit{C_2} P\,dx + Q\,dy$$ On $\mathit{C_2}$, $y$ is constant, so $dy = 0$. Using $t$ as the parameter, where $x_1 \leqslant t \leqslant x$, we have $$ \frac{\partial}{\partial x}\;\mathit{f\,(x,y)} = \frac{\partial}{\partial x} \int_\mathit{C_2} P\,dx + Q\,dy = \frac{\partial}{\partial x} \int_\mathit{x_1}^x P(t,y)\,dt = P(x,y)$$ by Part 1 of the Fundamental Theorem of Calculus."
A similar process of deriving $\frac{\partial}{\partial y} \;\mathit{f\,(x,y)}$ is used to show that $\mathbf{\vec F} = \mathit{P}\,\mathbf{\vec i} + \mathit{Q}\,\mathbf{\vec j} = \frac{\partial f}{\partial x}\;\mathbf{\vec i} + \frac{\partial f}{\partial y}\;\mathbf{\vec j} = \nabla f$.
I have two questions:
How is $\int_\mathit{(a,b)}^\mathit{(x_1,y)} \mathbf{\vec F} \cdot d\mathbf{\vec r}$ not dependent on $x$?
How does writing $\mathbf{\vec F} = \mathit{P}\,\mathbf{\vec i} + \mathit{Q}\,\mathbf{\vec j}$ show $ \int_\mathit{C_2} \mathbf{\vec F} \cdot d\mathbf{\vec r} = \int_\mathit{C_2} P\,dx + Q\,dy$?
Thank you so much for reading through the long post, and apologies in advance for poor formatting. Any help is greatly appreciated.
For your first question, the value of the integral is, by definition, $f(x_1,y)$, where $x_1$ is a constant).
For the second question, you need to work out what $\int_C {\bf F} \cdot d{\bf r}$ means.
Suppose ${\bf F} = P \, {\bf i} + Q \, {\bf j}$. Suppose we had a parametrization $x = x(t)$, $y=y(t)$, $a \leq t \leq b$ of $C$ so that ${\bf r}(t) = x(t) \, {\bf i} + y(t) \, {\bf j}$ is a vector-valued function that traces out the curve $C$.
Write out the integral. Then write out what you would get if you used the same parametrization and tried to setup $\int_C P \, dx + Q \, dx$. You will see that both integrals are equal to the following:
$$\int_a^b \left( P(x(t),y(t)) x'(t) + Q(x(t),y(t)) y'(t) \right) \, dt$$.