Solution (source code)

= Solution

Put $\mathcal T=\beta\hbar>0$, the interval of <imaginary time>, and assume $m,\omega>0$. For a <variation> $x_0+\epsilon\eta$ with $\eta(0)=\eta(\mathcal T)=0$, the <first variation> of the <Euclidean action> is
$$
\delta S=m\int_0^{\mathcal T}(\dot x_0\dot\eta+\omega^2x_0\eta)\,d\tau
=m[\dot x_0\eta]_0^{\mathcal T}
+m\int_0^{\mathcal T}(-\ddot x_0+\omega^2x_0)\eta\,d\tau.
$$
The <boundary term> vanishes. The <fundamental lemma of the calculus of variations> therefore gives the <Euler-Lagrange equation>
$$
\boxed{\ddot x_0=\omega^2x_0.}
$$
Its sign differs from the real-<time> <harmonic oscillator equation> because the <Euclidean action> contains positive <kinetic energy> and positive <potential energy>. The general solution is $A\cosh(\omega\tau)+B\sinh(\omega\tau)$. Applying the two endpoint conditions gives $A=x$ and $B=-x\tanh(\omega\mathcal T/2)$. Equivalently, the <equal-endpoint Euclidean oscillator path> is
$$
\boxed{x_0(\tau)=x\frac{\cosh[\omega(\tau-\mathcal T/2)]}{\cosh(\omega\mathcal T/2)}.}
$$
This form displays reflection about the midpoint and satisfies both endpoints immediately. On this path,
$$
\frac d{d\tau}(x_0\dot x_0)=\dot x_0^2+x_0\ddot x_0
=\dot x_0^2+\omega^2x_0^2.
$$
Thus the <Euclidean action> reduces to a <boundary term>. Since $\dot x_0(\mathcal T)=\omega x\tanh(\omega\mathcal T/2)$ and $\dot x_0(0)=-\omega x\tanh(\omega\mathcal T/2)$,
$$
S[x_0]=\frac m2[x_0\dot x_0]_0^{\mathcal T}
=\boxed{m\omega x^2\tanh\!\left(\frac{\beta\hbar\omega}{2}\right).}
$$
The positive <quadratic form> $m\int_0^{\mathcal T}(\dot\eta^2+\omega^2\eta^2)\,d\tau$ is the <second variation>, so this stationary path is the unique minimum, rather than merely an arbitrary <stationary point>.