[proofplan]
We construct an explicit primitive (antiderivative) $F \in \mathcal{O}(D)$ satisfying $F' = f$ on $D$, and then apply the fundamental theorem of calculus for contour integrals to conclude that the integral of $f$ over any closed contour vanishes. The primitive is built by integrating $f$ along straight-line segments from the center $z_0$ to each point $w \in D$. The key ingredient is Goursat's lemma (Cauchy's theorem for triangles), which guarantees that $f$ integrates to zero around every triangle in $D$; this is what makes the line-integral definition of $F$ well-behaved enough to differentiate. Once we show $F' = f$, the vanishing of $\oint_\gamma f\, dz$ for closed $\gamma$ follows immediately from $F(\gamma(b)) - F(\gamma(a)) = 0$.
[/proofplan]
[step:Construct a candidate primitive by integrating along radial segments from $z_0$]
Since $D = B(z_0, R)$ is an open disk, for every $w \in D$ the straight-line segment $[z_0, w] := \{z_0 + t(w - z_0) : t \in [0,1]\}$ lies entirely in $D$ (because $D$ is convex). Define
\begin{align*}
F: D &\to \mathbb{C} \\
w &\mapsto \int_{[z_0, w]} f(z)\, dz,
\end{align*}
where the integral is taken along the straight-line contour from $z_0$ to $w$, parametrized by $\gamma(t) = z_0 + t(w - z_0)$ for $t \in [0,1]$. In explicit terms,
\begin{align*}
F(w) &= \int_0^1 f(z_0 + t(w - z_0)) \cdot (w - z_0)\, dt.
\end{align*}
Since $f$ is continuous on $D$ and $[z_0, w] \subset D$ for every $w \in D$, the function $F$ is well-defined on $D$.
[guided]
The strategy is to build a function $F$ whose derivative is $f$. In real analysis, the analogous construction is $F(x) = \int_a^x f(t)\, dt$ — integrate from a fixed basepoint to a variable endpoint, and the fundamental theorem of calculus gives $F' = f$. In $\mathbb{C}$, there is no canonical path from $z_0$ to $w$, so we must choose one. The simplest choice is the straight-line segment $[z_0, w]$, which is available because $D$ is convex: if $z_0, w \in D$, then for every $t \in [0,1]$,
\begin{align*}
|z_0 + t(w - z_0) - z_0| &= t|w - z_0| < |w - z_0| < R,
\end{align*}
so $z_0 + t(w - z_0) \in D$. We define
\begin{align*}
F: D &\to \mathbb{C} \\
w &\mapsto \int_{[z_0, w]} f(z)\, dz = \int_0^1 f(z_0 + t(w - z_0)) \cdot (w - z_0)\, dt.
\end{align*}
The parametrization $\gamma(t) = z_0 + t(w - z_0)$ for $t \in [0,1]$ gives $\gamma'(t) = w - z_0$, so the contour integral becomes the displayed formula. Since $f$ is continuous and the path lies in $D$, the integral is well-defined for every $w \in D$.
Why integrate from the center $z_0$? Any fixed basepoint in $D$ would work (the disk is convex, so the segment to any point stays inside $D$), but $z_0$ is the natural choice since it is equidistant from all boundary points.
[/guided]
[/step]
[step:Show $F' = f$ using Goursat's lemma for triangles]
Fix $w_0 \in D$ and let $h \in \mathbb{C} \setminus \{0\}$ with $|h|$ small enough that $w_0 + h \in D$. We must show
\begin{align*}
\lim_{h \to 0} \frac{F(w_0 + h) - F(w_0)}{h} &= f(w_0).
\end{align*}
Consider the triangle $T$ with vertices $z_0$, $w_0$, and $w_0 + h$, traversed counterclockwise. By [Goursat's Lemma](/theorems/341), since $f \in \mathcal{O}(D)$ and $T \subset D$ (because $D$ is convex), the integral of $f$ around $\partial T$ vanishes:
\begin{align*}
\int_{[z_0, w_0]} f(z)\, dz + \int_{[w_0, w_0+h]} f(z)\, dz + \int_{[w_0+h, z_0]} f(z)\, dz &= 0.
\end{align*}
By definition of $F$, the first integral is $F(w_0)$ and $\int_{[z_0, w_0+h]} f(z)\, dz = F(w_0 + h)$. Using $\int_{[w_0+h, z_0]} = -\int_{[z_0, w_0+h]}$, we rearrange:
\begin{align*}
F(w_0 + h) - F(w_0) &= \int_{[w_0, w_0+h]} f(z)\, dz.
\end{align*}
Since $f(w_0)$ is constant, $\int_{[w_0, w_0+h]} f(w_0)\, dz = f(w_0) \cdot h$ (the integral of a constant along a segment of displacement $h$). Therefore
\begin{align*}
\frac{F(w_0 + h) - F(w_0)}{h} - f(w_0) &= \frac{1}{h} \int_{[w_0, w_0+h]} \bigl(f(z) - f(w_0)\bigr)\, dz.
\end{align*}
We estimate the right-hand side. Since $f$ is continuous at $w_0$, for every $\varepsilon > 0$ there exists $\delta > 0$ such that $|f(z) - f(w_0)| < \varepsilon$ whenever $|z - w_0| < \delta$. For $|h| < \delta$, every point $z$ on the segment $[w_0, w_0 + h]$ satisfies $|z - w_0| \leq |h| < \delta$, so
\begin{align*}
\left|\frac{F(w_0 + h) - F(w_0)}{h} - f(w_0)\right| &\leq \frac{1}{|h|} \cdot \sup_{z \in [w_0, w_0+h]} |f(z) - f(w_0)| \cdot |h| < \varepsilon.
\end{align*}
Here we used the ML-inequality: $\left|\int_\gamma g(z)\, dz\right| \leq \sup_{\gamma^*} |g| \cdot \operatorname{length}(\gamma)$, and the segment $[w_0, w_0+h]$ has length $|h|$. Since $\varepsilon > 0$ was arbitrary, $F'(w_0) = f(w_0)$.
Since $w_0 \in D$ was arbitrary, $F' = f$ on all of $D$. In particular, $F \in \mathcal{O}(D)$.
[guided]
This is the heart of the proof: we must differentiate the line-integral definition of $F$ and show that the derivative equals $f$. The difficulty is that $F(w)$ is defined by integrating along a path that changes as $w$ changes — both the endpoint and the path itself vary. We need a way to express $F(w_0 + h) - F(w_0)$ as an integral along a single short segment.
This is where Goursat's lemma enters. Consider the three line segments: $[z_0, w_0]$, $[w_0, w_0+h]$, and $[w_0+h, z_0]$. Together they form the boundary of a triangle $T$ with vertices $z_0$, $w_0$, $w_0+h$. Since $D$ is convex, $T \subset D$. Goursat's lemma (which states that $\oint_{\partial T} f(z)\, dz = 0$ for any triangle $T$ contained in the domain of a holomorphic function — without any assumption of continuity of $f'$) gives
\begin{align*}
\int_{[z_0, w_0]} f(z)\, dz + \int_{[w_0, w_0+h]} f(z)\, dz + \int_{[w_0+h, z_0]} f(z)\, dz &= 0.
\end{align*}
Now $\int_{[z_0, w_0]} f(z)\, dz = F(w_0)$ and $\int_{[w_0+h, z_0]} f(z)\, dz = -\int_{[z_0, w_0+h]} f(z)\, dz = -F(w_0+h)$, so rearranging:
\begin{align*}
F(w_0 + h) - F(w_0) &= \int_{[w_0, w_0+h]} f(z)\, dz.
\end{align*}
This is the key identity: the difference $F(w_0+h) - F(w_0)$ equals the integral of $f$ along the short segment from $w_0$ to $w_0+h$. If $f$ were constant (equal to $f(w_0)$), this integral would be exactly $f(w_0) \cdot h$, since integrating a constant $c$ along a segment of displacement $h$ gives $c \cdot h$. We subtract this:
\begin{align*}
\frac{F(w_0 + h) - F(w_0)}{h} - f(w_0) &= \frac{1}{h}\int_{[w_0, w_0+h]} \bigl(f(z) - f(w_0)\bigr)\, dz.
\end{align*}
To show this tends to $0$ as $h \to 0$, we use continuity of $f$ at $w_0$. Given $\varepsilon > 0$, choose $\delta > 0$ so that $|z - w_0| < \delta$ implies $|f(z) - f(w_0)| < \varepsilon$. For $|h| < \delta$, every point on $[w_0, w_0+h]$ is within distance $|h| < \delta$ of $w_0$, so $|f(z) - f(w_0)| < \varepsilon$ on the entire segment. The ML-inequality (which states $|\int_\gamma g\, dz| \leq \sup_{\gamma^*}|g| \cdot \operatorname{length}(\gamma)$ for any contour $\gamma$) gives
\begin{align*}
\left|\frac{1}{h}\int_{[w_0, w_0+h]} \bigl(f(z) - f(w_0)\bigr)\, dz\right| &\leq \frac{1}{|h|} \cdot \varepsilon \cdot |h| = \varepsilon.
\end{align*}
Since $\varepsilon$ was arbitrary, $F'(w_0) = f(w_0)$. The point $w_0 \in D$ was arbitrary, so $F' = f$ on $D$, and $F$ is holomorphic (being the antiderivative of a holomorphic function).
Why does this argument require Goursat's lemma rather than a direct manipulation? Without Goursat, we would not know that the integral around the triangle vanishes, and we could not reduce $F(w_0+h) - F(w_0)$ to an integral along a single short segment. The triangle identity is what lets us trade a difference of integrals along two long paths (from $z_0$ to $w_0$ and from $z_0$ to $w_0+h$) for an integral along one short path (from $w_0$ to $w_0+h$), which is the segment we can estimate using continuity.
[/guided]
[/step]
[step:Conclude $\oint_\gamma f\, dz = 0$ for every closed contour via the fundamental theorem]
Let $\gamma: [a, b] \to D$ be any closed contour in $D$, so $\gamma(a) = \gamma(b)$. We have established that $F \in \mathcal{O}(D)$ with $F' = f$ on $D$. By the [Fundamental Theorem of Contour Integration](/theorems/339), for any contour $\gamma$ in $D$ and any holomorphic function $g$ with primitive $G$ (i.e., $G' = g$),
\begin{align*}
\int_\gamma g(z)\, dz &= G(\gamma(b)) - G(\gamma(a)).
\end{align*}
Applying this with $g = f$ and $G = F$:
\begin{align*}
\oint_\gamma f(z)\, dz &= F(\gamma(b)) - F(\gamma(a)) = 0,
\end{align*}
since $\gamma(a) = \gamma(b)$.
[guided]
With the primitive $F$ in hand, the conclusion is immediate. The fundamental theorem of calculus for contour integrals states that if $G: \Omega \to \mathbb{C}$ is holomorphic and $\gamma: [a,b] \to \Omega$ is a contour, then
\begin{align*}
\int_\gamma G'(z)\, dz &= G(\gamma(b)) - G(\gamma(a)).
\end{align*}
This follows from the chain rule and the ordinary fundamental theorem of calculus: $\frac{d}{dt}G(\gamma(t)) = G'(\gamma(t)) \cdot \gamma'(t)$, so
\begin{align*}
\int_\gamma G'(z)\, dz &= \int_a^b G'(\gamma(t)) \gamma'(t)\, dt = \int_a^b \frac{d}{dt}G(\gamma(t))\, dt = G(\gamma(b)) - G(\gamma(a)).
\end{align*}
We apply this with $G = F$ and note $F' = f$. Since $\gamma$ is closed ($\gamma(a) = \gamma(b)$),
\begin{align*}
\oint_\gamma f(z)\, dz &= F(\gamma(b)) - F(\gamma(a)) = 0.
\end{align*}
This completes the proof: every closed contour integral of $f$ over $D$ vanishes, as claimed. The entire argument rested on two ingredients: Goursat's lemma (to construct the primitive) and the fundamental theorem of calculus for contour integrals (to pass from "primitive exists" to "closed integrals vanish"). The convexity of the disk $D$ was used at every stage — to ensure the line segments from $z_0$ lie in $D$, to ensure the triangles lie in $D$, and thus to make the Goursat-based construction valid.
[/guided]
[/step]