# Gradient theorem (Fundamental Theorem of Calculus for Line Integrals)

Let ${\mathbf {\phi } }({\mathbf {x} })$ be a smooth (differentiable) scalar field on the three dimensional space and the vector field $\nabla {\mathbf {\phi } }=\left[{\frac {\partial \mathbf {\phi } }{\partial x}},{\frac {\partial \mathbf {\phi } }{\partial y}},{\frac {\partial \mathbf {\phi } }{\partial z}}\right]$ is its gradient then the integral of the field gradient projection onto the unite length vector field $\mathbf {m} (\mathbf {x} )$ always tangent to the curve and pointing continuously along the curve over the arbitrary 3-dimensional curve ${\mathcal {C}}$ with the start point $\mathbf {A}$ and the end point $\mathbf {B}$ equals only to the difference of the values of the field itself at those points or otherwise the along-line values of the field make virtually no contributions to the integral over the curve providing that the field is sufficiently smooth that its gradient exists along the curve i.e.
$\int \limits _{\mathcal {C}}\nabla {\mathbf {\phi } }\cdot d\mathbf {l} =\phi (\mathbf {B} )-\phi (\mathbf {A} )$
where $d\mathbf {l} =\mathbf {m} dl$ and the $\mathbf {A}$ and $\mathbf {B}$ are the consecutive endpoints of ${\mathcal {C}}$.

#### Proof

We can approximate the integral of the gradient over the curve by the finite sum by dividing densely the space around the curve ${\mathcal {C}}$ into small cubes with the edges $dx=dy=dz$ and the corners $[x_{i},y_{j},z_{k}]$ and approximating the curve ${\mathcal {C}}$ by the edges of those cubes which are the closet to the curve as well as the coordinate derivatives of the field $\phi$ in the gradient by their difference quotients. We will keep the edges coordinate names for the convenience even if they are equal and keep the cube corners coordinate indices $i,j,k$ even if they are constrained by the closeness to the curve.
We get
$\int \limits _{\mathcal {C}}\nabla {\mathbf {\phi } }\cdot d\mathbf {l} =\sum _{i,j,k}\operatorname {sgn} _{x}(i,j,k)\left[{\frac {{\mathbf {\phi } }(x_{i+1},y_{j},z_{k})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dx}}\right]dx+\operatorname {sgn} _{y}(i,j,k)\left[{\frac {{\mathbf {\phi } }(x_{i},y_{j+1},z_{k})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dy}}\right]dy+\operatorname {sgn} _{z}(i,j,k)\left[{\frac {{\mathbf {\phi } }(x_{i},y_{j},z_{k+1})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dz}}\right]dz+$ $\Theta (dx)+\Theta (dy)+\Theta (dz),$
where $\operatorname {sgn} _{l}(i,j,k)$ is the sign of the contribution depending if the integration over the edge of the cube is in the positive or the negative direction of the perpendicular coordinate.
Note that while $dx$ (and so analogically for $dy$ and $dy$) is an infinitesimal (small) element of the line parallel to the $x$ axis and for the unite vector $\mathbf {n} _{x}=[1,0,0]$ parallel to it $\pm \nabla {\mathbf {\phi } }\cdot \mathbf {n} _{x}=\pm \left[{\frac {{\mathbf {\phi } }(x_{i+1},y_{j},z_{k})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dx}}\right]$ and each term if the sum is an approximate to the growth $\nabla {\mathbf {\phi } }\cdot d{\mathbf {l} }$ of the line integral $\int \limits _{\mathcal {C}}\nabla {\mathbf {\phi } }\cdot d{\mathbf {l} }$ i.e.
$\operatorname {sgn} _{x}(i,j,k)\left[{\frac {{\mathbf {\phi } }(x_{i+1},y_{j},z_{k})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dx}}\right]dx=\nabla {\mathbf {\phi } }\cdot d{\mathbf {l} }+\Theta (dx)$.
Now the essential in proving the theorem is to focus on the various types of contributions to the finite sum approximating the gradient line integral from the $\nabla {\mathbf {\phi } }$ field and notice that because of the cancelation of the sign alternating terms the sums reduce to only the end points difference. We simply have
$\sum _{i,j,k}\operatorname {sgn} _{x}(i,j,k)\left[{\frac {{\mathbf {\phi } }(x_{i+1},y_{j},z_{k})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dx}}\right]dx+\operatorname {sgn} _{y}(i,j,k)\left[{\frac {{\mathbf {\phi } }(x_{i},y_{j+1},z_{k})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dy}}\right]dy+\operatorname {sgn} _{z}(i,j,k)\left[{\frac {{\mathbf {\phi } }(x_{i},y_{j},z_{k+1})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dz}}\right]dz=$
${\mathbf {\phi } }(x_{n},y_{n},z_{n})-{\mathbf {\phi } }(x_{1},y_{1},z_{1})$,
where $x_{n},y_{n},z_{n}$ and $x_{1},y_{1},z_{1}$, are the coordinates of the cubic lattice edges near the endpoints $\mathbf {A}$ and $\mathbf {B}$ of the approximate curve.
To notice that one may consider three cases of the pieces of the approximate curve: 1) When the piece is the long line consisting of many segments with the length $dx$, (or $dy$, $dz$). The sign-alternating terms cancel directly in the sum of difference quotients of the type $\sum _{i,j,k}\operatorname {sgn} _{x}(i,j,k)\left[{\frac {{\mathbf {\phi } }(x_{i+1},y_{j},z_{k})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dx}}\right]dx$ to the difference of the endpoint values which later cancel with joining contributions. 2) The piece is the 1-dimensional "stairs" embedded in one 2-dimensional plane of the width $dx$ climbing up or down by $dy$ (or similarly in two other planes of pairs of directions). In that case the terms differences in one direction cross-cancel to the end points to further cancel with joining contributions between the sum
$\sum _{i,j,k}\operatorname {sgn} _{x}(i,j,k)\left[{\frac {{\mathbf {\phi } }(x_{i+1},y_{j},z_{k})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dx}}\right]dx$ and $\sum _{i,j,k}\operatorname {sgn} _{y}(i,j,k)\left[{\frac {{\mathbf {\phi } }(x_{i},y_{j+1},z_{k})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dy}}\right]dy$.
3) The 1-dimensional "stairs" are fully 3-dimensional and not in any plane i.e. $dx$, $dy$, $dz$ coordinates increments are periodically sequential. In that case the full sum $\sum _{i,j,k}\operatorname {sgn} _{x}(i,j,k)\left[{\frac {{\mathbf {\phi } }(x_{i+1},y_{j},z_{k})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dx}}\right]dx+\operatorname {sgn} _{y}(i,j,k)\left[{\frac {{\mathbf {\phi } }(x_{i},y_{j+1},z_{k})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dy}}\right]dy+\operatorname {sgn} _{z}(i,j,k)\left[{\frac {{\mathbf {\phi } }(x_{i},y_{j},z_{k+1})-{\mathbf {\phi } }(x_{i},y_{j},z_{k})}{dz}}\right]dz$ cancels to the endpoints because the shared values of the $\phi$ at the "stairs" joining points enter the chain sum with the opposite signs.
So summing up all the all the contributions over all of the possible approximate types of the curve pieces approximating fully the curve we get $\int \limits _{\mathcal {C}}\nabla {\mathbf {\phi } }\cdot d{\mathbf {l} }={\mathbf {\phi } }(x_{n},y_{n},z_{n})-{\mathbf {\phi } }(x_{1},y_{1},z_{1})$
and so finally prove $\int \limits _{\mathcal {C}}\nabla {\mathbf {\phi } }\cdot d{\mathbf {l} }=\phi (\mathbf {B} )-\phi (\mathbf {A} )$.