8. A tiered classroom is equipped with connected desks, with a row accommodating 6 people in total. Students can only exit the classroom from the ends of the desks. Currently, an exam is taking place in this classroom. If a student sitting in the middle needs to submit their paper early, they will disturb others. Let the number of students in a row who need to disturb others to submit their papers be denoted as the random variable X. Then the mathematical expectation of X equals $\qquad$
8. $\frac{21}{10}$

Analysis: Let a row of connected desks seat $n(n \geq 3)$ people, then the possible values of the random variable $X$ are $1, 2, \ldots, n-2$. When $n=3$, denote the candidates as $A B C$. When the first candidate to submit the paper is $A, C$, $X=0$; when the first candidate to submit the paper is $B$, $X=1$. Thus,
\begin{tabular}{|c|c|c|}
\hline$X$ & 0 & 1 \\
\hline$P_{3}$ & $\frac{4}{3!}$ & $\frac{2}{3!}$ \\
\hline
\end{tabular}

When $n=4$, denote the candidates as $A B C D$. When the first candidate to submit the paper is $A, D$, the situation reduces to the case when $n=3$. When the first candidate to submit the paper is $B, C$, the situation reduces to the case when $n=3$ with each $X$ increased by 1. For example, $P_{4}(X=1)=\frac{2}{4} P_{3}(X=0)+\frac{2}{4} P_{3}(X=1)=\frac{8+4}{4!}$. Thus, we have
\begin{tabular}{|c|c|c|c|}
\hline$X$ & 0 & 1 & 2 \\
\hline$P_{4}$ & $\frac{8}{4!}$ & $\frac{12}{4!}$ & $\frac{4}{4!}$ \\
\hline
\end{tabular}

Similarly, for $n=5$ and $n=6$, the distribution tables are as follows:
\begin{tabular}{|c|c|c|c|c|}
\hline$X$ & 0 & 1 & 2 & 3 \\
\hline$P_{5}$ & $\frac{16}{5!}$ & $\frac{48}{5!}$ & $\frac{44}{5!}$ & $\frac{12}{5!}$ \\
\hline
\end{tabular}
\begin{tabular}{|c|c|c|c|c|c|}
\hline$X$ & 0 & 1 & 2 & 3 & 4 \\
\hline$P_{6}$ & $\frac{32}{6!}$ & $\frac{160}{6!}$ & $\frac{280}{6!}$ & $\frac{200}{6!}$ & $\frac{48}{6!}$ \\
\hline
\end{tabular}

Therefore, the expected value of $X$ is $X=\frac{160+560+600+192}{6!}=\frac{21}{10}$.