[proofplan]
We reduce to showing that a single analytic function $h = f - g$ with a limit point of zeros must vanish identically. At the limit point, we show all Taylor coefficients vanish by contradiction: if some coefficient were nonzero, factoring out the leading power would produce a continuous nonzero factor, making the zeros isolated. We then propagate to all of $I$ by showing that the set of points where all derivatives vanish is simultaneously open (by analyticity) and closed (by continuity), hence equals the connected interval $I$.
[/proofplan]
[step:Reduce to showing a single analytic function with a limit point of zeros vanishes]
Define $h := f - g$. Since $f$ and $g$ are analytic on $I$, the function $h$ is analytic on $I$ (the difference of analytic functions is analytic). The set $\{x \in I : h(x) = 0\} \supseteq \{x \in I : f(x) = g(x)\}$ has a limit point $p \in I$ by hypothesis. It suffices to show $h = 0$ on all of $I$.
[/step]
[step:Show all Taylor coefficients of $h$ at $p$ vanish by contradiction]
Since $p$ is a limit point of the zero set of $h$, there exists a sequence $(x_n)_{n=1}^{\infty}$ with $x_n \neq p$, $h(x_n) = 0$ for all $n$, and $x_n \to p$. By continuity of $h$, $h(p) = \lim_{n \to \infty} h(x_n) = 0$.
Since $h$ is analytic at $p$, there exist $\rho > 0$ and coefficients $c_k = h^{(k)}(p)/k!$ such that
\begin{align*}
h(x) = \sum_{k=0}^{\infty} c_k (x - p)^k \quad \text{for all } |x - p| < \rho.
\end{align*}
Suppose for contradiction that $h$ is not identically zero near $p$. Let $m$ be the smallest index with $c_m \neq 0$. Then for $|x - p| < \rho$:
\begin{align*}
h(x) = (x - p)^m \left(c_m + \sum_{k=m+1}^{\infty} c_k (x - p)^{k - m}\right) =: (x - p)^m \cdot \psi(x),
\end{align*}
where $\psi$ is analytic near $p$ with $\psi(p) = c_m \neq 0$. Since $\psi$ is continuous and $\psi(p) \neq 0$, there exists $\delta > 0$ such that $\psi(x) \neq 0$ for all $|x - p| < \delta$. For any $x_n$ with $0 < |x_n - p| < \delta$, we have $(x_n - p)^m \neq 0$ and $\psi(x_n) \neq 0$, so $h(x_n) = (x_n - p)^m \psi(x_n) \neq 0$, contradicting $h(x_n) = 0$. Therefore $c_k = 0$ for all $k \geq 0$, meaning $h^{(k)}(p) = 0$ for all $k \geq 0$.
[guided]
The argument hinges on the *order of vanishing*. Since $h$ is analytic at $p$, it has a Taylor expansion $h(x) = \sum_{k=0}^{\infty} c_k(x-p)^k$ convergent on $|x-p| < \rho$. If $h$ is not identically zero near $p$, let $m$ be the smallest index with $c_m \neq 0$. Then we factor:
\begin{align*}
h(x) = (x - p)^m\left(c_m + \sum_{k=m+1}^{\infty} c_k(x-p)^{k-m}\right) =: (x-p)^m \cdot \psi(x),
\end{align*}
where $\psi$ is analytic near $p$ with $\psi(p) = c_m \neq 0$. Since $\psi$ is [continuous](/page/Continuity) and $\psi(p) \neq 0$, there exists $\delta > 0$ such that $\psi(x) \neq 0$ for all $|x - p| < \delta$. For any zero $x_n$ of $h$ with $0 < |x_n - p| < \delta$, we have $(x_n - p)^m \neq 0$ and $\psi(x_n) \neq 0$, so $h(x_n) = (x_n - p)^m \psi(x_n) \neq 0$ -- contradicting $h(x_n) = 0$.
Therefore no finite order $m$ exists, which means $c_k = 0$ for all $k \geq 0$, i.e., $h^{(k)}(p) = k!\,c_k = 0$ for every $k$.
The key insight is that an analytic function can only have *isolated* zeros unless it vanishes identically near that point. This is the fundamental difference between analytic and merely smooth functions: a smooth function like $e^{-1/x^2}$ (extended by $0$ at $x = 0$) can have a zero of infinite order without being identically zero, but analyticity forces the Taylor series to converge to the function, so infinite-order vanishing implies $h \equiv 0$ near $p$.
[/guided]
[/step]
[step:Propagate to all of $I$ via a connected open-and-closed argument]
Define the set
\begin{align*}
A := \{x \in I : h^{(k)}(x) = 0 \text{ for all } k \geq 0\}.
\end{align*}
The previous step showed $p \in A$, so $A \neq \varnothing$.
**$A$ is closed in $I$:** Let $(x_n)_{n=1}^{\infty} \subset A$ with $x_n \to x_{\infty} \in I$. For each $k \geq 0$, the $k$-th derivative $h^{(k)}$ is continuous on $I$ (since $h$ is analytic, all its derivatives exist and are continuous). Therefore $h^{(k)}(x_{\infty}) = \lim_{n \to \infty} h^{(k)}(x_n) = 0$ for every $k$, so $x_{\infty} \in A$.
**$A$ is open in $I$:** Let $x_0 \in A$. Since $h$ is analytic at $x_0$, there exists $\rho_{x_0} > 0$ such that $h(x) = \sum_{k=0}^{\infty} \frac{h^{(k)}(x_0)}{k!}(x - x_0)^k$ for $|x - x_0| < \rho_{x_0}$. Since $x_0 \in A$, every coefficient $h^{(k)}(x_0)/k! = 0$, so $h(x) = 0$ for all $|x - x_0| < \rho_{x_0}$. Differentiating the zero function, all derivatives of $h$ vanish in the interval $(x_0 - \rho_{x_0}, x_0 + \rho_{x_0}) \cap I$, so this neighbourhood is contained in $A$.
Since $I$ is an interval, it is connected. The set $A$ is non-empty, open, and closed in $I$. The only subsets of a connected space that are both open and closed are the empty set and the whole space, so $A = I$. In particular, $h(x) = 0$ for all $x \in I$, giving $f = g$ on $I$.
[guided]
This final step uses a standard topological argument called the "open-and-closed" or "clopen" argument. In a connected [topological space](/page/Topological%20Space), the only subsets that are simultaneously open and closed are $\varnothing$ and the entire space. An interval $I \subseteq \mathbb{R}$ is connected (this is a consequence of the completeness of $\mathbb{R}$).
We define the set
\begin{align*}
A := \{x \in I : h^{(k)}(x) = 0 \text{ for all } k \geq 0\},
\end{align*}
and verify it is non-empty ($p \in A$), open, and closed in $I$.
**Why is $A$ open?** At any point $x_0 \in A$, all Taylor coefficients of $h$ at $x_0$ vanish: $h^{(k)}(x_0)/k! = 0$ for every $k \geq 0$. Since $h$ is analytic at $x_0$, the Taylor series $h(x) = \sum_{k=0}^{\infty} \frac{h^{(k)}(x_0)}{k!}(x - x_0)^k$ converges to $h$ on some interval $(x_0 - \rho, x_0 + \rho)$. With all coefficients zero, this forces $h(x) = 0$ for $|x - x_0| < \rho$. Differentiating the zero function, all derivatives of $h$ vanish on this interval, so $(x_0 - \rho, x_0 + \rho) \cap I \subseteq A$.
**Why is $A$ closed?** Each derivative $h^{(k)}$ is a [continuous](/page/Continuity) function (since $h$ is analytic), so the preimage $\{x \in I : h^{(k)}(x) = 0\}$ is closed. The set $A = \bigcap_{k=0}^{\infty}\{x \in I : h^{(k)}(x) = 0\}$ is an intersection of closed sets, hence closed.
With $A$ non-empty, open, and closed in the connected set $I$, we conclude $A = I$, so $h \equiv 0$ on $I$.
With $A$ nonempty, open, and closed in the connected set $I$, we conclude $A = I$.
[/guided]
[/step]