[proofplan]
We construct the decimal digits by a greedy recursion. At stage $n$, the digit $d_n$ is chosen so that the $n$-th partial sum stays below $x$ while making the remaining error smaller than $10^{-n}$. The partial sums then form a convergent increasing [sequence](/page/Sequence), and the error estimate forces their [limit](/page/Limit) to be exactly $x$.
[/proofplan]
[step:Choose each digit by a greedy remainder estimate]
Let $D := \{0,1,\ldots,9\}$ denote the set of decimal digits. Define $S_0 := 0$ and $R_0 := x$. Since $0 \le x < 1$, we have $0 \le R_0 < 1$.
Assume for some $n \in \mathbb{N}$ that digits $d_1,\ldots,d_{n-1} \in D$ have been chosen and that
\begin{align*}
S_{n-1} := \sum_{j=1}^{n-1} \frac{d_j}{10^j},
\qquad
R_{n-1} := x - S_{n-1},
\qquad
0 \le R_{n-1} < \frac{1}{10^{n-1}},
\end{align*}
where for $n=1$ the empty sum is $S_0=0$. Choose $d_n \in D$ maximal subject to
\begin{align*}
\frac{d_n}{10^n} \le R_{n-1}.
\end{align*}
Such a digit exists because $0 \in D$ satisfies the inequality and $D$ is finite.
Define
\begin{align*}
S_n := S_{n-1} + \frac{d_n}{10^n}
= \sum_{j=1}^{n} \frac{d_j}{10^j},
\qquad
R_n := x - S_n.
\end{align*}
The choice of $d_n$ gives $R_n \ge 0$. To prove the upper bound, consider two cases. If $d_n \le 8$, maximality gives
\begin{align*}
R_{n-1} < \frac{d_n+1}{10^n},
\end{align*}
and hence
\begin{align*}
R_n = R_{n-1} - \frac{d_n}{10^n} < \frac{1}{10^n}.
\end{align*}
If $d_n = 9$, the induction hypothesis gives
\begin{align*}
R_n = R_{n-1} - \frac{9}{10^n}
< \frac{1}{10^{n-1}} - \frac{9}{10^n}
= \frac{1}{10^n}.
\end{align*}
Thus, for every $n \in \mathbb{N}$,
\begin{align*}
0 \le x - S_n < \frac{1}{10^n}.
\end{align*}
[guided]
The goal of the construction is to keep track not only of the digits but also of the error after each chosen digit. Let $D := \{0,1,\ldots,9\}$ be the set of possible decimal digits. Define the initial partial sum and remainder by
\begin{align*}
S_0 := 0,
\qquad
R_0 := x.
\end{align*}
The hypothesis $0 \le x < 1$ gives
\begin{align*}
0 \le R_0 < 1.
\end{align*}
Now suppose that $d_1,\ldots,d_{n-1} \in D$ have already been chosen. Define the current partial sum and current remainder by
\begin{align*}
S_{n-1} := \sum_{j=1}^{n-1} \frac{d_j}{10^j},
\qquad
R_{n-1} := x - S_{n-1}.
\end{align*}
For $n=1$, this means $S_0=0$. The induction invariant is
\begin{align*}
0 \le R_{n-1} < \frac{1}{10^{n-1}}.
\end{align*}
We choose $d_n$ greedily: among all digits $k \in D$ satisfying
\begin{align*}
\frac{k}{10^n} \le R_{n-1},
\end{align*}
take the largest one. This maximum exists because the admissible set is a nonempty finite subset of $D$: it is nonempty since $0 \in D$ and $0 \le R_{n-1}$.
After choosing $d_n$, define
\begin{align*}
S_n := S_{n-1} + \frac{d_n}{10^n},
\qquad
R_n := x - S_n.
\end{align*}
Since $d_n$ was chosen to satisfy $d_n/10^n \le R_{n-1}$, we get
\begin{align*}
R_n
= R_{n-1} - \frac{d_n}{10^n}
\ge 0.
\end{align*}
It remains to prove that the new remainder is smaller than $10^{-n}$. If $d_n \le 8$, then $d_n+1$ is also a digit. Because $d_n$ was maximal, $d_n+1$ cannot satisfy the admissibility inequality, so
\begin{align*}
R_{n-1} < \frac{d_n+1}{10^n}.
\end{align*}
Subtracting $d_n/10^n$ gives
\begin{align*}
R_n
= R_{n-1} - \frac{d_n}{10^n}
< \frac{d_n+1}{10^n} - \frac{d_n}{10^n}
= \frac{1}{10^n}.
\end{align*}
If $d_n=9$, there is no next digit in $D$, so maximality alone does not give the same comparison. Instead we use the induction hypothesis:
\begin{align*}
R_{n-1} < \frac{1}{10^{n-1}} = \frac{10}{10^n}.
\end{align*}
Therefore
\begin{align*}
R_n
= R_{n-1} - \frac{9}{10^n}
< \frac{10}{10^n} - \frac{9}{10^n}
= \frac{1}{10^n}.
\end{align*}
In both cases,
\begin{align*}
0 \le R_n < \frac{1}{10^n}.
\end{align*}
Since $R_n=x-S_n$, this proves that for every $n \in \mathbb{N}$,
\begin{align*}
0 \le x - S_n < \frac{1}{10^n}.
\end{align*}
[/guided]
[/step]
[step:Show the greedy partial sums converge]
The sequence $S:\mathbb{N}\to\mathbb{R}$ is defined by
\begin{align*}
S(n) := S_n = \sum_{j=1}^{n} \frac{d_j}{10^j}.
\end{align*}
For every $n \in \mathbb{N}$,
\begin{align*}
S_{n+1}-S_n = \frac{d_{n+1}}{10^{n+1}} \ge 0,
\end{align*}
so $(S_n)_{n=1}^{\infty}$ is increasing. The estimate from the previous step gives $S_n \le x$ for every $n$, so $(S_n)_{n=1}^{\infty}$ is bounded above. By the [Monotone Convergence Theorem for Sequences](/theorems/743), there exists $L \in \mathbb{R}$ such that
\begin{align*}
\lim_{n\to\infty} S_n = L.
\end{align*}
[/step]
[step:Identify the limit with the original number]
From the greedy remainder estimate, for every $n \in \mathbb{N}$,
\begin{align*}
0 \le x - S_n < \frac{1}{10^n}.
\end{align*}
The sequence $a:\mathbb{N}\to\mathbb{R}$ defined by $a(n):=10^{-n}$ satisfies
\begin{align*}
\lim_{n\to\infty} \frac{1}{10^n}=0.
\end{align*}
Applying the [Squeeze Theorem](/theorems/627) for Sequences to the sequence $(x-S_n)_{n=1}^{\infty}$ gives
\begin{align*}
\lim_{n\to\infty} (x-S_n)=0.
\end{align*}
Since $S_n \to L$, the limit laws for sequences give
\begin{align*}
x-L = 0.
\end{align*}
Hence $L=x$.
[guided]
The construction gives a quantitative error bound:
\begin{align*}
0 \le x - S_n < \frac{1}{10^n}
\end{align*}
for every $n \in \mathbb{N}$. The right-hand side tends to zero:
\begin{align*}
\lim_{n\to\infty} \frac{1}{10^n}=0.
\end{align*}
We now apply the Squeeze Theorem for Sequences to the sequence $(x-S_n)_{n=1}^{\infty}$. Its lower comparison sequence is constantly $0$, its upper comparison sequence is $10^{-n}$, and both comparison sequences converge to $0$. Therefore
\begin{align*}
\lim_{n\to\infty} (x-S_n)=0.
\end{align*}
From the previous step, there is a real number $L$ such that
\begin{align*}
\lim_{n\to\infty} S_n=L.
\end{align*}
Using the limit law for the difference of convergent sequences, we obtain
\begin{align*}
0
= \lim_{n\to\infty} (x-S_n)
= x - \lim_{n\to\infty} S_n
= x-L.
\end{align*}
Thus $L=x$. The reason this completes the identification is that the partial sums were already known to converge; the error estimate forces the only possible limit to be the original number $x$.
[/guided]
[/step]
[step:Convert convergence of partial sums into a decimal expansion]
By definition of an infinite [series](/page/Series), the convergence of the partial sums to $x$ means
\begin{align*}
\sum_{n=1}^{\infty} \frac{d_n}{10^n}
=
\lim_{n\to\infty} \sum_{j=1}^{n} \frac{d_j}{10^j}
=
x.
\end{align*}
Each $d_n$ belongs to $D=\{0,1,\ldots,9\}$ by construction. Therefore the digit sequence $(d_n)_{n=1}^{\infty}$ is a decimal expansion of $x$, written
\begin{align*}
x = 0.d_1d_2d_3\ldots.
\end{align*}
This proves the theorem.
[/step]