[proofplan]
The direct implication is the chain rule plus the [Fundamental Theorem of Calculus](/theorems/632) applied piece by piece: on each smooth segment of $\gamma$, the integrand $(\gamma^* df)$ equals $\frac{d}{dt}(f \circ \gamma)$, and summing the telescoping increments yields $f(\gamma(b)) - f(\gamma(a))$. For the converse, we fix a basepoint $x_0 \in U$ and define $f(x)$ as the integral of $\omega$ along any piecewise smooth path from $x_0$ to $x$; path independence makes $f$ well-defined, and probing $f$ along axis-parallel line segments inside a small ball around $x$ shows $\partial_i f = \omega_i$, so $df = \omega$. Smoothness of $f$ follows from smoothness of the components $\omega_i$. Uniqueness up to a constant is connectedness applied to the difference of two primitives.
[/proofplan]
[step:Reduce the forward direction to a sum of smooth pieces via the partition defining piecewise smoothness]
By definition, a piecewise smooth path $\gamma: [a,b] \to U$ admits a partition
\begin{align*}
a = t_0 < t_1 < \cdots < t_N = b
\end{align*}
such that $\gamma_k := \gamma|_{[t_{k-1}, t_k]}$ extends to a smooth map on an open neighbourhood of $[t_{k-1}, t_k]$ for each $k \in \{1, \dots, N\}$. The line integral of a $1$-form along a piecewise smooth path is defined by
\begin{align*}
\int_\gamma \omega \;:=\; \sum_{k=1}^N \int_{t_{k-1}}^{t_k} (\gamma_k^* \omega)(t),
\end{align*}
where, writing $\omega = \sum_{i=1}^n \omega_i \, dx_i$, the pullback is
\begin{align*}
(\gamma_k^* \omega)(t) \;=\; \Big( \sum_{i=1}^n \omega_i(\gamma(t))\, \dot\gamma_i(t) \Big) dt
\end{align*}
on each smooth piece. Thus
\begin{align*}
\int_\gamma \omega \;=\; \sum_{k=1}^N \int_{t_{k-1}}^{t_k} \sum_{i=1}^n \omega_i(\gamma(t))\, \dot\gamma_i(t)\, d\mathcal{L}^1(t).
\end{align*}
[guided]
A piecewise smooth path is by definition a continuous map $\gamma : [a,b] \to U$ which is smooth on each piece of a partition of its domain; the partition $a = t_0 < t_1 < \cdots < t_N = b$ is part of the data (only its existence matters, not its choice). To attack the integral $\int_\gamma \omega$ we must first unpack what that symbol means for a piecewise smooth path. The line integral of a $1$-form $\omega \in \Omega^1(U)$ along $\gamma$ is defined by summing the integrals of the pullback $\gamma_k^* \omega$ over each smooth piece $\gamma_k := \gamma|_{[t_{k-1}, t_k]}$:
\begin{align*}
\int_\gamma \omega \;:=\; \sum_{k=1}^N \int_{t_{k-1}}^{t_k} (\gamma_k^* \omega)(t).
\end{align*}
Each $\gamma_k$ extends smoothly to a neighbourhood of $[t_{k-1}, t_k]$, so its pullback is well-defined. Writing the form in coordinates $\omega = \sum_{i=1}^n \omega_i \, dx_i$ and using the [Coordinate Formula for the Pullback of a Differential Form](/theorems/3570),
\begin{align*}
(\gamma_k^* \omega)(t) \;=\; \sum_{i=1}^n \omega_i(\gamma(t)) \, d(x_i \circ \gamma)(t) \;=\; \Big( \sum_{i=1}^n \omega_i(\gamma(t))\, \dot\gamma_i(t) \Big) dt.
\end{align*}
This gives the expansion
\begin{align*}
\int_\gamma \omega \;=\; \sum_{k=1}^N \int_{t_{k-1}}^{t_k} \sum_{i=1}^n \omega_i(\gamma(t))\, \dot\gamma_i(t)\, d\mathcal{L}^1(t).
\end{align*}
The strategy is now clear: on each piece, recognise the integrand as a total derivative of $f \circ \gamma$ via the chain rule, then apply the [Fundamental Theorem of Calculus](/theorems/632).
[/guided]
[/step]
[step:Identify the integrand on each smooth piece as the derivative of $f \circ \gamma$ via the chain rule]
Assume $\omega = df$, so $\omega_i = \partial_{x_i} f$ for each $i \in \{1, \dots, n\}$. Fix $k \in \{1, \dots, N\}$. The composition $f \circ \gamma_k : [t_{k-1}, t_k] \to \mathbb{R}$ is smooth as a composition of smooth maps. By the [Chain Rule for Maps Between Euclidean Spaces](/theorems/323), for every $t \in (t_{k-1}, t_k)$,
\begin{align*}
\frac{d}{dt}\big[ f \circ \gamma_k \big](t) \;=\; \sum_{i=1}^n \partial_{x_i} f(\gamma(t)) \, \dot\gamma_i(t) \;=\; \sum_{i=1}^n \omega_i(\gamma(t))\, \dot\gamma_i(t).
\end{align*}
Hence the integrand on the $k$-th piece equals $\frac{d}{dt}[f \circ \gamma_k](t)$.
[/step]
[step:Apply the Fundamental Theorem of Calculus on each piece and telescope]
The map $f \circ \gamma_k$ is $C^1$ on a neighbourhood of $[t_{k-1}, t_k]$ (in fact smooth). Therefore the [Fundamental Theorem of Calculus](/theorems/632) applies, giving
\begin{align*}
\int_{t_{k-1}}^{t_k} \frac{d}{dt}\big[ f \circ \gamma_k \big](t)\, d\mathcal{L}^1(t) \;=\; f(\gamma(t_k)) - f(\gamma(t_{k-1})).
\end{align*}
Continuity of $\gamma$ ensures consistency of endpoint values across adjacent pieces. Summing over $k$:
\begin{align*}
\int_\gamma \omega \;=\; \sum_{k=1}^N \big( f(\gamma(t_k)) - f(\gamma(t_{k-1})) \big) \;=\; f(\gamma(t_N)) - f(\gamma(t_0)) \;=\; f(\gamma(b)) - f(\gamma(a)),
\end{align*}
where the second equality is the telescoping cancellation of internal terms. This proves the direct part: $\int_\gamma \omega$ is determined by the endpoints $\gamma(a)$ and $\gamma(b)$ alone.
[guided]
With $\omega = df$ identified, Step 2 has rewritten each piece of the line integral as the integral of a one-variable derivative:
\begin{align*}
\int_{t_{k-1}}^{t_k} \sum_{i=1}^n \omega_i(\gamma(t))\, \dot\gamma_i(t)\, d\mathcal{L}^1(t) \;=\; \int_{t_{k-1}}^{t_k} \frac{d}{dt}\big[ f \circ \gamma_k \big](t)\, d\mathcal{L}^1(t).
\end{align*}
The classical [Fundamental Theorem of Calculus](/theorems/632) requires only that the integrand be the derivative of a $C^1$ function on the closed interval; $f \circ \gamma_k$ is $C^\infty$ on a neighbourhood of $[t_{k-1}, t_k]$, so the hypothesis is comfortably satisfied. We obtain
\begin{align*}
\int_{t_{k-1}}^{t_k} \frac{d}{dt}\big[ f \circ \gamma_k \big](t)\, d\mathcal{L}^1(t) \;=\; (f \circ \gamma_k)(t_k) - (f \circ \gamma_k)(t_{k-1}) \;=\; f(\gamma(t_k)) - f(\gamma(t_{k-1})).
\end{align*}
The continuity of $\gamma$ at each breakpoint $t_k$ guarantees that the value $f(\gamma(t_k))$ entering the $k$-th piece as an upper limit agrees with the value entering the $(k+1)$-th piece as a lower limit — i.e., there is no jump to fix. Summing,
\begin{align*}
\int_\gamma \omega \;=\; \sum_{k=1}^N \big( f(\gamma(t_k)) - f(\gamma(t_{k-1})) \big).
\end{align*}
This is a telescoping sum: every interior value $f(\gamma(t_k))$ for $1 \le k \le N-1$ appears once with a $+$ and once with a $-$ sign, and cancels. Only the extreme endpoints survive:
\begin{align*}
\int_\gamma \omega \;=\; f(\gamma(b)) - f(\gamma(a)).
\end{align*}
In particular, the path $\gamma$ enters the answer only through its endpoints. This proves the forward direction.
[/guided]
[/step]
[step:For the converse, fix a basepoint and define a candidate primitive by line integration]
Assume now that $\int_{\gamma_1} \omega = \int_{\gamma_2} \omega$ for every pair of piecewise smooth paths $\gamma_1, \gamma_2$ in $U$ sharing both endpoints. Fix any point $x_0 \in U$; this is possible because $U \ne \varnothing$.
We first record that for every $x \in U$ there exists a piecewise smooth path in $U$ from $x_0$ to $x$. Indeed, $U$ is open and connected (since it is path-connected), so by [Connected Open Subsets of Euclidean Space are Path-Connected](/theorems/301) (and inspection of its proof), $U$ is path-connected by polygonal paths — paths consisting of finitely many straight line segments. Polygonal paths are piecewise smooth, since each segment $t \mapsto (1-t)p + tq$ is smooth and the joins are continuous.
For each $x \in U$, choose any piecewise smooth path $\eta_x : [0,1] \to U$ with $\eta_x(0) = x_0$ and $\eta_x(1) = x$, and define
\begin{align*}
f : U &\to \mathbb{R} \\
x &\mapsto \int_{\eta_x} \omega.
\end{align*}
By the path-independence hypothesis, $f(x)$ does not depend on the choice of $\eta_x$, only on $x$, so $f$ is well-defined.
[guided]
The converse direction needs a candidate function $f$ such that $df = \omega$. The natural guess, motivated by the forward direction, is to integrate $\omega$ from a fixed basepoint: if $\omega$ were $dg$ for some $g$, then $\int_{\eta_x} \omega = g(x) - g(x_0)$, so up to the additive constant $g(x_0)$ the function $g$ is recovered as a line integral. We use this guess as the definition of $f$.
For the definition to make sense we need two things: (i) for every target point $x \in U$ there is a piecewise smooth path in $U$ from $x_0$ to $x$, and (ii) the integral does not depend on which such path we pick.
(ii) is exactly the path-independence hypothesis. For (i), $U$ is open and path-connected, hence connected. [Connected Open Subsets of Euclidean Space are Path-Connected](/theorems/301) gives more than continuous path-connectedness: an open connected subset of $\mathbb{R}^n$ is connected by *polygonal* paths — finite concatenations of straight line segments. Each segment $t \mapsto (1-t)p + tq$ is $C^\infty$, so a polygonal path is piecewise smooth in the sense required.
Choose for each $x \in U$ some piecewise smooth path $\eta_x : [0,1] \to U$ from $x_0$ to $x$, and set
\begin{align*}
f : U &\to \mathbb{R} \\
x &\mapsto \int_{\eta_x} \omega.
\end{align*}
Path independence makes $f(x)$ independent of the choice of $\eta_x$, so $f$ is a well-defined function $U \to \mathbb{R}$.
[/guided]
[/step]
[step:Compute the partial derivatives of $f$ by extending paths along axis-parallel segments]
Fix $x \in U$ and $i \in \{1, \dots, n\}$. Since $U$ is open, there exists $r > 0$ with $\overline{B}(x, r) \subseteq U$. For each $h \in \mathbb{R}$ with $|h| < r$, define the segment
\begin{align*}
\sigma_h : [0, 1] &\to U \\
s &\mapsto x + s h e_i,
\end{align*}
which is smooth and lies in $B(x, r) \subseteq U$ because the ball is convex and $|sh e_i| \le |h| < r$ for $s \in [0,1]$.
Let $\eta_{x+h e_i}$ be the concatenation $\eta_x * \sigma_h$, which is a piecewise smooth path from $x_0$ to $x + h e_i$. By definition of $f$ and the additivity of the line integral over concatenations,
\begin{align*}
f(x + h e_i) \;=\; \int_{\eta_x * \sigma_h} \omega \;=\; \int_{\eta_x} \omega + \int_{\sigma_h} \omega \;=\; f(x) + \int_{\sigma_h} \omega.
\end{align*}
Computing the second integral using the coordinate formula for the pullback, and writing $\dot\sigma_h(s) = h\, e_i$,
\begin{align*}
\int_{\sigma_h} \omega \;=\; \int_0^1 \sum_{j=1}^n \omega_j(x + s h e_i)\, h\, \delta_{ji}\, d\mathcal{L}^1(s) \;=\; h \int_0^1 \omega_i(x + s h e_i)\, d\mathcal{L}^1(s).
\end{align*}
Substituting $u = sh$ when $h \ne 0$ (with $du = h\, ds$, so $h\, ds = du$, and $s = 0 \leftrightarrow u = 0$, $s = 1 \leftrightarrow u = h$):
\begin{align*}
\int_{\sigma_h} \omega \;=\; \int_0^h \omega_i(x + u e_i)\, d\mathcal{L}^1(u).
\end{align*}
(For $h < 0$ the formula reads with the orientation reversed, $\int_0^h = -\int_h^0$, which the substitution handles automatically.) Therefore
\begin{align*}
\frac{f(x + h e_i) - f(x)}{h} \;=\; \frac{1}{h} \int_0^h \omega_i(x + u e_i)\, d\mathcal{L}^1(u).
\end{align*}
Since $\omega_i \in C^\infty(U)$ is in particular continuous at $x$, the right-hand side converges to $\omega_i(x)$ as $h \to 0$ by the [Fundamental Theorem of Calculus](/theorems/632) (continuity of the integrand at $0$ in the variable of integration is precisely what makes the difference quotient of an indefinite integral converge to the integrand). Thus
\begin{align*}
\partial_{x_i} f(x) \;=\; \omega_i(x) \qquad \text{for every } x \in U,\ i \in \{1, \dots, n\}.
\end{align*}
[guided]
We want to compute $\partial_{x_i} f(x)$ from the definition of $f$ as a line integral. The trick is that the choice of path $\eta_{x+he_i}$ from $x_0$ to $x + h e_i$ is at our disposal: path independence lets us pick the path that makes the calculation easiest. We pick the path that goes from $x_0$ to $x$ along $\eta_x$, then from $x$ to $x + h e_i$ along the axis-parallel segment $\sigma_h$.
For this to be a valid path we need the segment to stay inside $U$. Since $U$ is open, $\overline{B}(x, r) \subseteq U$ for some $r > 0$; for $|h| < r$ the segment $\{x + s h e_i : s \in [0,1]\}$ lies in $\overline{B}(x, r) \subseteq U$ by convexity of the ball. Define
\begin{align*}
\sigma_h : [0, 1] &\to U \\
s &\mapsto x + s h e_i,
\end{align*}
which is smooth, and concatenate to get the piecewise smooth path $\eta_x * \sigma_h$ from $x_0$ to $x + h e_i$. By path independence of $f$ and additivity of line integrals under concatenation,
\begin{align*}
f(x + h e_i) \;=\; \int_{\eta_x} \omega + \int_{\sigma_h} \omega \;=\; f(x) + \int_{\sigma_h} \omega.
\end{align*}
Now compute $\int_{\sigma_h} \omega$. With $\dot\sigma_h(s) = h e_i$, only the $i$-th coordinate contributes:
\begin{align*}
\int_{\sigma_h} \omega \;=\; \int_0^1 \sum_{j=1}^n \omega_j(\sigma_h(s))\, (h e_i)_j\, d\mathcal{L}^1(s) \;=\; h \int_0^1 \omega_i(x + s h e_i)\, d\mathcal{L}^1(s).
\end{align*}
Substituting $u = sh$ (valid for $h \ne 0$; for $h < 0$ this reverses the orientation of $[0, h]$, which is handled by the standard convention $\int_0^h = -\int_h^0$),
\begin{align*}
\int_{\sigma_h} \omega \;=\; \int_0^h \omega_i(x + u e_i)\, d\mathcal{L}^1(u).
\end{align*}
This gives
\begin{align*}
\frac{f(x + h e_i) - f(x)}{h} \;=\; \frac{1}{h} \int_0^h \omega_i(x + u e_i)\, d\mathcal{L}^1(u).
\end{align*}
The right-hand side is the average of $u \mapsto \omega_i(x + u e_i)$ over $[0, h]$ (or $[h, 0]$ if $h < 0$). Because $\omega \in \Omega^1(U)$ has smooth coefficients, $\omega_i$ is in particular continuous, so as $h \to 0$ this average converges to the value at $0$, namely $\omega_i(x)$. (This is the version of the [Fundamental Theorem of Calculus](/theorems/632) saying the derivative of an indefinite integral at a point of continuity recovers the integrand.) Therefore
\begin{align*}
\partial_{x_i} f(x) \;=\; \omega_i(x).
\end{align*}
This is exactly what we needed: in every coordinate direction the partial derivative of our candidate matches the corresponding component of $\omega$.
[/guided]
[/step]
[step:Upgrade $f$ from $C^1$ to $C^\infty$ and conclude $df = \omega$]
Each partial derivative $\partial_{x_i} f = \omega_i$ belongs to $C^\infty(U)$ since $\omega \in \Omega^1(U)$ has smooth coefficients. In particular all partials of $f$ exist and are continuous on $U$, so $f$ is $C^1(U)$. Iterating: every partial derivative $\partial_{x_{i_1}} \cdots \partial_{x_{i_k}} f$ equals a partial derivative of order $k-1$ applied to some $\omega_{i_1}$, hence is smooth. Therefore $f \in C^\infty(U)$.
The [exterior derivative](/theorems/1525) of $f \in C^\infty(U)$ is
\begin{align*}
df \;=\; \sum_{i=1}^n \partial_{x_i} f \, dx_i \;=\; \sum_{i=1}^n \omega_i \, dx_i \;=\; \omega.
\end{align*}
This establishes the existence claim of the converse.
[/step]
[step:Establish uniqueness of $f$ up to an additive constant]
Suppose $f, \tilde f \in C^\infty(U)$ both satisfy $df = d\tilde f = \omega$. Set $g := f - \tilde f \in C^\infty(U)$. Then $dg = 0$, i.e. $\partial_{x_i} g \equiv 0$ on $U$ for every $i \in \{1, \dots, n\}$.
Fix any two points $p, q \in U$. By the path-connectedness established in Step 4, there is a polygonal (hence piecewise smooth) path $\gamma : [a, b] \to U$ from $p$ to $q$. Applying the already-proved direct part of the theorem to $g \in C^\infty(U)$ with $dg = 0$,
\begin{align*}
g(q) - g(p) \;=\; \int_\gamma dg \;=\; \int_\gamma 0 \;=\; 0.
\end{align*}
Hence $g$ is constant on $U$, so $f = \tilde f + c$ for some $c \in \mathbb{R}$. This completes the proof.
[/step]