[guided]Let $u \in \operatorname{Dom}(S_0^*)$. The definition of the adjoint says that the map
\begin{align*}
\phi \in C_c^\infty(0,L) \mapsto (S_0\phi,u)_{L^2(0,L)} \in \mathbb{C}
\end{align*}
is represented by [inner product](/page/Inner%20Product) against a unique element of $L^2(0,L)$. Thus there is a function $w \in L^2(0,L)$ such that, for every [test function](/page/Test%20Function) $\phi \in C_c^\infty(0,L)$,
\begin{align*}
(S_0\phi,u)_{L^2(0,L)}=(\phi,w)_{L^2(0,L)}.
\end{align*}
Now substitute the definition $S_0\phi=-\phi''$. Since the $L^2$ inner product is linear in the first variable and conjugate-linear in the second variable, this becomes
\begin{align*}
\int_0^L -\phi''(x)\overline{u(x)}\,d\mathcal{L}^1(x)
=
\int_0^L \phi(x)\overline{w(x)}\,d\mathcal{L}^1(x).
\end{align*}
This identity is exactly the weak formulation of the statement that the [distributional derivative](/page/Distributional%20Derivative) of $u$ of second order is the $L^2$ function $-w$. More explicitly, conjugating the identity gives
\begin{align*}
\int_0^L -\overline{\phi''(x)}u(x)\,d\mathcal{L}^1(x)
=
\int_0^L \overline{\phi(x)}w(x)\,d\mathcal{L}^1(x),
\end{align*}
which says that $-u''=w$ in the sense of distributions on $(0,L)$.
The relevant one-dimensional Sobolev regularity fact for intervals is the following: if a function $f \in L^2(0,L)$ has second distributional derivative $f''$ represented by an element of $L^2(0,L)$, then $f \in H^2(0,L)$. This formulation is important because at this point we have proved exactly two facts about the present function: $u \in L^2(0,L)$, since $u$ is a vector in the [Hilbert space](/page/Hilbert%20Space), and $u''=-w \in L^2(0,L)$ in the distributional sense. The theorem supplies the missing first-derivative regularity as part of its conclusion, so it gives $u \in H^2(0,L)$. Since the representing vector in the adjoint relation is unique, we also obtain
\begin{align*}
S_0^*u=w=-u''.
\end{align*}
Thus every element of $\operatorname{Dom}(S_0^*)$ belongs to $H^2(0,L)$, and on this domain the adjoint is the differential operator $-d^2/dx^2$.[/guided]