[proofplan]
We prove density by showing that every nonempty basic cylinder in $\Sigma_M$ contains a periodic point. A nonempty cylinder prescribes a finite admissible word $a_{-r},\dots,a_s$. Primitivity gives an admissible path of sufficiently large length from the terminal symbol $a_s$ back to the initial symbol $a_{-r}$. Concatenating the prescribed word with this return path produces an admissible loop, and repeating that loop bi-infinitely gives a periodic sequence lying in the original cylinder.
[/proofplan]
[step:Reduce density to intersecting every nonempty interval cylinder]
Let $A := \{1,\dots,m\}$ denote the alphabet. For integers $r,s \in \mathbb{N} \cup \{0\}$ and symbols $a_{-r},\dots,a_s \in A$, define the interval cylinder
\begin{align*}
C[-r,s; a_{-r},\dots,a_s] := \{x \in \Sigma_M : x_j = a_j \text{ for every } j \in \{-r,\dots,s\}\}.
\end{align*}
The family of all such cylinders is a basis for the [product topology](/page/Product%20Topology) restricted to $\Sigma_M$: every product-open neighbourhood of a point fixes finitely many coordinates, and enlarging that finite coordinate set to an interval gives an interval cylinder contained in the original neighbourhood.
Therefore it suffices to prove that every nonempty interval cylinder $C[-r,s; a_{-r},\dots,a_s]$ contains a point of $\operatorname{Per}(\sigma)$.
[guided]
We want to prove that $\operatorname{Per}(\sigma)$ is dense in $\Sigma_M$. By definition of density, this means every nonempty open subset of $\Sigma_M$ must meet $\operatorname{Per}(\sigma)$.
The product topology on $A^{\mathbb{Z}}$ has basic open sets obtained by fixing finitely many coordinates. Since $\Sigma_M$ has the [subspace topology](/page/Subspace%20Topology), a basic neighbourhood in $\Sigma_M$ is obtained by intersecting such a finite-coordinate condition with $\Sigma_M$. If a neighbourhood fixes coordinates in a finite set $F \subset \mathbb{Z}$, choose integers $r,s \in \mathbb{N} \cup \{0\}$ such that
\begin{align*}
F \subset \{-r,\dots,s\}.
\end{align*}
For prescribed symbols $a_{-r},\dots,a_s \in A$, the corresponding interval cylinder is
\begin{align*}
C[-r,s; a_{-r},\dots,a_s] := \{x \in \Sigma_M : x_j = a_j \text{ for every } j \in \{-r,\dots,s\}\}.
\end{align*}
If this interval cylinder is chosen using the coordinates of a point already lying in the original neighbourhood, then it is nonempty and contained in that neighbourhood.
Thus, to prove density, it is enough to show that every nonempty interval cylinder contains a periodic point. This reduction is useful because the theorem is really a finite-word construction: we only need to build a bi-infinite admissible sequence that agrees with one prescribed finite admissible block.
[/guided]
[/step]
[step:Use primitivity to close the prescribed admissible word into a loop]
Fix a nonempty interval cylinder
\begin{align*}
C := C[-r,s; a_{-r},\dots,a_s].
\end{align*}
Since $C \neq \varnothing$, there exists $y \in C$. Because $y \in \Sigma_M$, the prescribed word is admissible:
\begin{align*}
M_{a_j a_{j+1}} = 1
\end{align*}
for every $j \in \{-r,\dots,s-1\}$.
Since $M$ is primitive, there exists $N \in \mathbb{N}$ such that every entry of $M^n$ is positive for every $n \geq N$. Choose $L \geq N$. Then
\begin{align*}
(M^L)_{a_s a_{-r}} > 0.
\end{align*}
By the path-counting interpretation of matrix powers, there exist symbols $b_0,\dots,b_L \in A$ such that
\begin{align*}
b_0 = a_s, \qquad b_L = a_{-r},
\end{align*}
and
\begin{align*}
M_{b_{\ell} b_{\ell+1}} = 1
\end{align*}
for every $\ell \in \{0,\dots,L-1\}$.
Define the finite word $w_0,\dots,w_{p-1}$ of length
\begin{align*}
p := r+s+L
\end{align*}
as follows:
\begin{align*}
(w_0,\dots,w_{p-1}) := (a_{-r},a_{-r+1},\dots,a_s,b_1,\dots,b_{L-1}).
\end{align*}
If $L=1$, the list $b_1,\dots,b_{L-1}$ is empty. The admissibility of $a_{-r},\dots,a_s$ and of $b_0,\dots,b_L$, together with $b_0=a_s$ and $b_L=a_{-r}$, gives
\begin{align*}
M_{w_i w_{i+1}} = 1
\end{align*}
for every $i \in \{0,\dots,p-2\}$, and also
\begin{align*}
M_{w_{p-1}w_0} = 1.
\end{align*}
Thus $w_0,\dots,w_{p-1}$ is an admissible loop.
[guided]
Fix a nonempty interval cylinder
\begin{align*}
C := C[-r,s; a_{-r},\dots,a_s].
\end{align*}
The nonemptiness assumption is important. It means there is some point $y \in \Sigma_M$ whose coordinates from $-r$ through $s$ are exactly $a_{-r},\dots,a_s$. Since $y \in \Sigma_M$, adjacent symbols of $y$ satisfy the transition rule, so for every $j \in \{-r,\dots,s-1\}$ we have
\begin{align*}
M_{a_j a_{j+1}} = 1.
\end{align*}
Thus the prescribed finite block is already admissible.
The only missing transition needed for periodic repetition is a path from the last prescribed symbol $a_s$ back to the first prescribed symbol $a_{-r}$. This is exactly where primitivity is used. Since $M$ is primitive, there exists $N \in \mathbb{N}$ such that every entry of $M^n$ is positive for every $n \geq N$. Choose $L \geq N$. Then
\begin{align*}
(M^L)_{a_s a_{-r}} > 0.
\end{align*}
The entry $(M^L)_{a_s a_{-r}}$ counts admissible paths with $L$ transitions starting at $a_s$ and ending at $a_{-r}$. Therefore there exist symbols $b_0,\dots,b_L \in A$ such that
\begin{align*}
b_0 = a_s, \qquad b_L = a_{-r},
\end{align*}
and each consecutive transition is allowed:
\begin{align*}
M_{b_{\ell}b_{\ell+1}} = 1
\end{align*}
for every $\ell \in \{0,\dots,L-1\}$.
Now concatenate the prescribed block with the interior of this return path. Define
\begin{align*}
p := r+s+L
\end{align*}
and define the word $w_0,\dots,w_{p-1}$ by
\begin{align*}
(w_0,\dots,w_{p-1}) := (a_{-r},a_{-r+1},\dots,a_s,b_1,\dots,b_{L-1}).
\end{align*}
The symbols $b_0$ and $b_L$ are not both inserted as new symbols because they are already accounted for as the endpoint $a_s$ and the return to the initial symbol $a_{-r}$. If $L=1$, there are no interior bridge symbols, and the bridge is simply the single allowed transition from $a_s$ to $a_{-r}$.
Every adjacent transition inside $w_0,\dots,w_{p-1}$ is allowed: the transitions within $a_{-r},\dots,a_s$ are allowed by nonemptiness of the cylinder, and the transitions from $a_s=b_0$ through $b_1,\dots,b_{L-1}$ are allowed by the bridge. Finally, the wrap-around transition from $w_{p-1}$ to $w_0$ is allowed because the bridge ends at $b_L=a_{-r}=w_0$. Hence
\begin{align*}
M_{w_i w_{i+1}} = 1
\end{align*}
for every $i \in \{0,\dots,p-2\}$, and
\begin{align*}
M_{w_{p-1}w_0} = 1.
\end{align*}
Thus $w_0,\dots,w_{p-1}$ is an admissible loop.
[/guided]
[/step]
[step:Repeat the admissible loop to obtain a periodic point in the cylinder]
Define $x \in A^{\mathbb{Z}}$ by periodic repetition of the loop, with the indexing aligned to the cylinder:
\begin{align*}
x_n := w_{n+r \bmod p}
\end{align*}
for every $n \in \mathbb{Z}$, where $n+r \bmod p$ denotes the unique element of $\{0,\dots,p-1\}$ congruent to $n+r$ modulo $p$.
The loop admissibility proved above implies $M_{x_n x_{n+1}}=1$ for every $n \in \mathbb{Z}$, so $x \in \Sigma_M$. Also $x_{j}=a_j$ for every $j \in \{-r,\dots,s\}$, because $w_{j+r}=a_j$ for those indices. Hence $x \in C$.
Finally, for every $n \in \mathbb{Z}$,
\begin{align*}
(\sigma^p x)_n = x_{n+p} = x_n,
\end{align*}
so $\sigma^p x=x$. Therefore $x \in \operatorname{Per}(\sigma) \cap C$. Since every nonempty interval cylinder $C$ contains such a point, $\operatorname{Per}(\sigma)$ is dense in $\Sigma_M$.
[/step]