# Path integrals for special potentials; use of classical action

Shankar, R. (1994), Principles of Quantum Mechanics, Plenum Press. Chapter 8. Section 8.6, Exercises 8.6.1 – 8.6.2.

We’ve seen that if we use the path integral formulation for a free particle, we get the exact propagator by considering only one path (the classical path) between the starting point ${\left(x^{\prime},t^{\prime}\right)}$ and the end point ${\left(x,t\right)}$. In this case, the propagator has the form

$\displaystyle U\left(x,t;x^{\prime},t^{\prime}\right)=A\left(t\right)e^{iS_{cl}/\hbar} \ \ \ \ \ (1)$

where ${S_{cl}}$ is the classical action. It turns out that this form is true for a wider set of potentials, beyond just the free particle. The general form of the potential for which this is true is

$\displaystyle V=a+bx+cx^{2}+d\dot{x}+ex\dot{x} \ \ \ \ \ (2)$

where ${a,b,c,d}$ and ${e}$ are constants. The general expression for the propagator is (where we’re taking the starting time to be ${t^{\prime}=0}$):

$\displaystyle U\left(x,t;x^{\prime}\right)=\int_{x^{\prime}}^{x}e^{iS\left[x\left(t^{\prime\prime}\right)\right]/\hbar}\mathfrak{D}\left[x\left(t^{\prime\prime}\right)\right] \ \ \ \ \ (3)$

where the notation ${\mathfrak{D}\left[x\left(t^{\prime\prime}\right)\right]}$ means an integration over all possible paths from ${x^{\prime}}$ to ${x}$ in the given time interval.

For a given path, we can write the location of the particle ${x\left(t^{\prime\prime}\right)}$ as composed of its position on the classical path ${x_{cl}\left(t^{\prime\prime}\right)}$ plus the deviation ${y\left(t^{\prime\prime}\right)}$ from the classical path:

$\displaystyle x\left(t^{\prime\prime}\right)=x_{cl}\left(t^{\prime\prime}\right)+y\left(t^{\prime\prime}\right) \ \ \ \ \ (4)$

As the endpoints are fixed

$\displaystyle y\left(0\right)=y\left(t\right)=0 \ \ \ \ \ (5)$

Also, since for any given potential and choice of endpoints, ${x_{cl}\left(t^{\prime\prime}\right)}$ is fixed for all times, it is effectively a constant with regard to the path integration. Therefore

$\displaystyle dx=dy \ \ \ \ \ (6)$

Making these substitutions into 3, we get, using Shankar’s slightly misleading notation:

$\displaystyle U\left(x,t;x^{\prime}\right)=\int_{0}^{0}e^{iS\left[x_{cl}\left(t^{\prime\prime}\right)+y\left(t^{\prime\prime}\right)\right]/\hbar}\mathfrak{D}\left[y\left(t^{\prime\prime}\right)\right] \ \ \ \ \ (7)$

Usually, when the limits on an integral are the same, the integral evaluates to zero. However, in this case, the notation ${\int_{0}^{0}\mathfrak{D}\left[y\left(t^{\prime\prime}\right)\right]}$ means that ${y}$ starts and ends at zero, but covers all possible paths between these endpoints.

The action is the integral of the Lagrangian which, for the potential 2 is

 $\displaystyle L$ $\displaystyle =$ $\displaystyle T-V\ \ \ \ \ (8)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{1}{2}m\dot{x}^{2}-a-bx-cx^{2}-d\dot{x}-ex\dot{x} \ \ \ \ \ (9)$

Because ${L}$ is quadratic in both ${x}$ and ${\dot{x}}$, we can expand it in a Taylor series up to second order without any approximation. That is

 $\displaystyle L\left(x_{cl}+y,\dot{x}_{cl}+\dot{y}\right)$ $\displaystyle =$ $\displaystyle L\left(x_{cl},\dot{x}_{cl}\right)+\left.\frac{\partial L}{\partial x}\right|_{x_{cl}}y+\left.\frac{\partial L}{\partial\dot{x}}\right|_{x_{cl}}\dot{y}+\ \ \ \ \ (10)$ $\displaystyle$ $\displaystyle$ $\displaystyle \frac{1}{2}\left(\left.\frac{\partial^{2}L}{\partial x^{2}}\right|_{x_{cl}}y^{2}+2\left.\frac{\partial^{2}L}{\partial x\partial\dot{x}}\right|_{x_{cl}}y\dot{y}+\left.\frac{\partial^{2}L}{\partial\dot{x}^{2}}\right|_{x_{cl}}\dot{y}^{2}\right) \ \ \ \ \ (11)$

Look first at the last two terms on the RHS of the first line. Using the equations of motion, we have

$\displaystyle \left.\frac{\partial L}{\partial x}\right|_{x_{cl}}=\frac{d}{dt}\left(\left.\frac{\partial L}{\partial\dot{x}}\right|_{x_{cl}}\right) \ \ \ \ \ (12)$

To get the action, we need to integrate the Lagrangian over the time interval of interest. Integrating these two terms gives

 $\displaystyle \int_{0}^{t}\left[\left.\frac{\partial L}{\partial x}\right|_{x_{cl}}y+\left.\frac{\partial L}{\partial\dot{x}}\right|_{x_{cl}}\dot{y}\right]dt^{\prime\prime}$ $\displaystyle =$ $\displaystyle \int_{0}^{t}\left[\frac{d}{dt}\left(\left.\frac{\partial L}{\partial\dot{x}}\right|_{x_{cl}}\right)y+\left.\frac{\partial L}{\partial\dot{x}}\right|_{x_{cl}}\dot{y}\right]dt^{\prime\prime}\ \ \ \ \ (13)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \left.\left(\left.\frac{\partial L}{\partial\dot{x}}\right|_{x_{cl}}\right)y\right|_{0}^{t}-\int_{0}^{t}\left.\frac{\partial L}{\partial\dot{x}}\right|_{x_{cl}}\dot{y}dt^{\prime\prime}+\int_{0}^{t}\left.\frac{\partial L}{\partial\dot{x}}\right|_{x_{cl}}\dot{y}dt^{\prime\prime}\ \ \ \ \ (14)$ $\displaystyle$ $\displaystyle =$ $\displaystyle 0 \ \ \ \ \ (15)$

where we integrated the first term by parts. The integrated term in the second line is zero because ${y=0}$ at both endpoints, and the last two terms cancel each other.

Returning to 11, we can calculate the three second derivatives explicitly:

 $\displaystyle \frac{1}{2}\frac{\partial^{2}L}{\partial x^{2}}$ $\displaystyle =$ $\displaystyle -c\ \ \ \ \ (16)$ $\displaystyle \left.\frac{\partial^{2}L}{\partial x\partial\dot{x}}\right|_{x_{cl}}$ $\displaystyle =$ $\displaystyle -e\ \ \ \ \ (17)$ $\displaystyle \frac{1}{2}\frac{\partial^{2}L}{\partial\dot{x}^{2}}$ $\displaystyle =$ $\displaystyle m \ \ \ \ \ (18)$

The integral of the first term on the RHS of 10 is just the classical action, so we get for the propagator 7:

$\displaystyle U\left(x,t;x^{\prime}\right)=e^{iS_{cl}/\hbar}\int_{0}^{0}\exp\left[\frac{i}{\hbar}\int_{0}^{t}\left(\frac{m\dot{y}^{2}}{2}-cy^{2}-ey\dot{y}\right)dt^{\prime\prime}\right]\mathfrak{D}\left[y\left(t^{\prime\prime}\right)\right] \ \ \ \ \ (19)$

The remaining path integral can still be difficult to evaluate, but we can observe a few properties that it has. First, for any given path in the path integral, we must be able to express both ${y}$ and ${\dot{y}}$ as functions of time ${t^{\prime\prime}}$, so the complete path integral can depend only on the end time ${t}$ (and, of course, on the constants ${m}$, ${c}$ and ${e}$). That is, the propagator will always have the form 1:

$\displaystyle U\left(x,t;x^{\prime},t^{\prime}\right)=A\left(t\right)e^{iS_{cl}/\hbar} \ \ \ \ \ (20)$

We have already evaluated the integral for the free particle where ${c=e=0}$ and we found there that

$\displaystyle U\left(x,t;x^{\prime}\right)=\sqrt{\frac{m}{2\pi\hbar it}}e^{iS_{cl}/\hbar} \ \ \ \ \ (21)$

Since the constant ${b}$ doesn’t appear in 19, the propagator must have the same form for the more general case where ${V=a+bx}$. For more complex potentials, such as the harmonic oscillator, the function ${A\left(t\right)}$ will in general have a different form and will have to be calculated explicitly in these cases.

As an example, we’ll consider the case of a particle subject to a constant force in the ${x}$ direction, so that the potential is given by

$\displaystyle V\left(x\right)=-fx \ \ \ \ \ (22)$

This gives a constant force of

$\displaystyle F=-\frac{dV}{dx}=f \ \ \ \ \ (23)$

and thus a constant acceleration of ${f/m}$. For such a particle, its classical position is (from first year physics)

 $\displaystyle x_{cl}\left(t^{\prime\prime}\right)$ $\displaystyle =$ $\displaystyle x_{0}+v_{0}t^{\prime\prime}+\frac{1}{2}\frac{f}{m}t^{\prime\prime2}\ \ \ \ \ (24)$ $\displaystyle \dot{x}_{cl}\left(t^{\prime\prime}\right)$ $\displaystyle =$ $\displaystyle v_{0}+\frac{f}{m}t^{\prime\prime} \ \ \ \ \ (25)$

To find ${x_{0}}$ and ${v_{0}}$, we impose boundary conditions. At ${t^{\prime\prime}=0}$

$\displaystyle x_{cl}\left(0\right)=x_{0}=x^{\prime} \ \ \ \ \ (26)$

At ${t^{\prime\prime}=t}$, its position is

 $\displaystyle x_{cl}\left(t\right)$ $\displaystyle =$ $\displaystyle x=x^{\prime}+v_{0}t+\frac{f}{2m}t^{2} \ \ \ \ \ (27)$

This gives

$\displaystyle v_{0}=\frac{x-x^{\prime}}{t}-\frac{f}{2m}t \ \ \ \ \ (28)$

The classical Lagrangian is

 $\displaystyle L$ $\displaystyle =$ $\displaystyle T-V\ \ \ \ \ (29)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{1}{2}m\dot{x}_{cl}^{2}+fx_{cl}\ \ \ \ \ (30)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{1}{2}m\left(v_{0}+\frac{f}{m}t^{\prime\prime}\right)^{2}+f\left(x_{0}+v_{0}t^{\prime\prime}+\frac{1}{2}\frac{f}{m}t^{\prime\prime2}\right)\ \ \ \ \ (31)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{1}{2}m\left(\frac{x-x^{\prime}}{t}-\frac{f}{2m}t+\frac{f}{m}t^{\prime\prime}\right)^{2}+f\left(x^{\prime}+\left(\frac{x-x^{\prime}}{t}-\frac{f}{2m}t\right)t^{\prime\prime}+\frac{1}{2}\frac{f}{m}t^{\prime\prime2}\right) \ \ \ \ \ (32)$

Note that ${t}$ is a constant, as it is the time of the endpoint of the motion. To find the classical action, we must integrate this from ${t^{\prime\prime}=0}$ to ${t}$. The integral is a straightforward integral of a quadratic in ${t^{\prime\prime}}$, although the algebra is tedious if done by hand, so is best done with Maple.

 $\displaystyle S_{cl}$ $\displaystyle =$ $\displaystyle \int_{0}^{t}L\;dt^{\prime\prime}\ \ \ \ \ (33)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{1}{3}{\frac{{f}^{2}{t}^{3}}{m}}+\left({\frac{x-x^{\prime}}{t}}-\frac{1}{2}{\frac{ft}{m}}\right)f{t}^{2}+\frac{1}{2}m\left({\frac{x-x^{\prime}}{t}}-\frac{1}{2}{\frac{ft}{m}}\right)^{2}t+fxt\ \ \ \ \ (34)$ $\displaystyle$ $\displaystyle =$ $\displaystyle -\frac{f^{2}t^{3}}{24m}+\frac{1}{2}ft\left(x+x^{\prime}\right)+\frac{m\left(x-x^{\prime}\right)^{2}}{2t} \ \ \ \ \ (35)$

From 21, this gives a propagator of

$\displaystyle U\left(x,t;x^{\prime}\right)=\sqrt{\frac{m}{2\pi\hbar it}}\exp\left[\frac{i}{\hbar}\left(-\frac{f^{2}t^{3}}{24m}+\frac{1}{2}ft\left(x+x^{\prime}\right)+\frac{m\left(x-x^{\prime}\right)^{2}}{2t}\right)\right] \ \ \ \ \ (36)$

This agrees with Shankar’s result in his equation 5.4.31.

As another example, consider the harmonic oscillator, where the potential is

$\displaystyle V=\frac{1}{2}m\omega^{2}x^{2} \ \ \ \ \ (37)$

This potential is also of the form 2, so the propagator must have the form 20. This time, however, since ${c\ne0}$, the function ${A\left(t\right)}$ will probably not have the form used in 21. The best we can say therefore is that

$\displaystyle U\left(x,t;x^{\prime},t^{\prime}\right)=A\left(t\right)e^{iS_{cl}/\hbar} \ \ \ \ \ (38)$

where ${A\left(t\right)}$ has the form (from 19):

$\displaystyle A\left(t\right)=\int_{0}^{0}\exp\left[\frac{i}{\hbar}\int_{0}^{t}\left(\frac{m\dot{y}^{2}}{2}-\frac{1}{2}m\omega^{2}y^{2}\right)dt^{\prime\prime}\right]\mathfrak{D}\left[y\left(t^{\prime\prime}\right)\right] \ \ \ \ \ (39)$

We worked out the classical action for the harmonic oscillator earlier and found

$\displaystyle S_{cl}=\frac{m\omega}{2\sin\omega t}\left[\left(x^{\prime2}+x^{2}\right)\cos\omega t-2x^{\prime}x\right] \ \ \ \ \ (40)$

where the particle is at ${x^{\prime}}$ at ${t^{\prime\prime}=0}$ and at ${x}$ at ${t^{\prime\prime}=t}$. The propagator is therefore

$\displaystyle U\left(x,t;x^{\prime}\right)=A\left(t\right)\exp\left[\frac{im\omega}{2\hbar\sin\omega t}\left(\left(x^{\prime2}+x^{2}\right)\cos\omega t-2x^{\prime}x\right)\right] \ \ \ \ \ (41)$

with ${A\left(t\right)}$ given by 39.

# Relation between action and energy

References: Shankar, R. (1994), Principles of Quantum Mechanics, Plenum Press. Section 2.8; Exercises 2.8.6 – 2.8.7.

Here we’ll examine an interesting relation between the action ${S}$ and the total energy of a system, as given by the Hamiltonian ${H}$. Suppose a single particle moving in one dimension follows a classical path given by ${x_{cl}\left(t\right)}$, and moves from an initial position at time ${t_{i}}$ of ${x_{cl}\left(t_{i}\right)=x_{i}}$ to a final position at time ${t_{f}}$ of ${x_{cl}\left(t_{f}\right)=x_{f}}$. The action ${S_{cl}}$ of this classical path is given by the integral of the Lagrangian

$\displaystyle S_{cl}=\int_{t_{i}}^{t_{f}}L\left(x,\dot{x}\right)dt \ \ \ \ \ (1)$

What can we say about the rate of change of the action with respect to the final time ${t_{f}}$? That is, we want to calculate ${\partial S_{cl}/\partial t_{f}}$, where all other parameters ${t_{i},x_{i}}$and ${x_{f}}$ are held constant. The situation can be illustrated as shown:

Since the only thing that is changing is ${t_{f}}$, the particle starts at the same initial time (which we’ve taken to be ${t_{i}=0}$ in the diagram) and moves to the same location ${x_{f}}$, but at a different time (in the diagram, later time). This means that the particle must follow a different path, possibly over its entire trajectory. This path, which we’ll call ${x\left(t\right)}$, is related to the original path ${x_{cl}\left(t\right)}$ by perturbing the original path by an amount ${\eta\left(t\right)}$:

$\displaystyle x\left(t\right)=x_{cl}\left(t\right)+\eta\left(t\right) \ \ \ \ \ (2)$

In the diagram, the original path ${x_{cl}}$ is shown in red and the perturbed path ${x}$ in blue. The amount ${\eta}$ is seen to be the vertical distance between these two curves at each time, and in the case of the paths shown in the diagram, ${\eta\left(t\right)<0}$.

The difference in the action between the two paths is due to two contributions: first, there is the contribution due to the extra time, from ${t_{f}}$ to ${t_{f}+\Delta t}$, that the particle takes to complete its path. Second, there is the difference in the two actions over the path from ${t_{i}}$ to ${t_{f}}$. The first contribution is entirely new and, for an infinitesimal extra time ${\Delta t}$, it is given by

$\displaystyle \delta S_{1}=L\left(t_{f}\right)\Delta t \ \ \ \ \ (3)$

where ${L\left(t_{f}\right)}$ is the Lagrangian evaluated at time ${t_{f}}$. The other contribution can be obtained by varying the action over the path from ${t_{i}=0}$ to ${t_{f}}$:

$\displaystyle \delta S_{2}=\int_{0}^{t_{f}}\delta L\;dt \ \ \ \ \ (4)$

Since ${L}$ depends on ${x}$ and ${\dot{x}}$, we have

$\displaystyle \delta L=\frac{\partial L}{\partial x}\delta x+\frac{\partial L}{\partial\dot{x}}\delta\dot{x} \ \ \ \ \ (5)$

For infinitesimally different trajectories, we can see from the diagram above that ${\delta x=\eta\left(t\right)}$ at each point on the curve, so ${\delta\dot{x}=\dot{\eta}\left(t\right)}$, so we get

 $\displaystyle \delta S_{2}$ $\displaystyle =$ $\displaystyle \int_{0}^{t_{f}}\left[\frac{\partial L}{\partial x}\eta\left(t\right)+\frac{\partial L}{\partial\dot{x}}\dot{\eta}\left(t\right)\right]\;dt\ \ \ \ \ (6)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \int_{0}^{t_{f}}\left[-\frac{d}{dt}\frac{\partial L}{\partial\dot{x}}+\frac{\partial L}{\partial x}\right]\eta\left(t\right)dt+\int_{0}^{t_{f}}\frac{d}{dt}\left(\frac{\partial L}{\partial\dot{x}}\eta\left(t\right)\right)dt\ \ \ \ \ (7)$ $\displaystyle$ $\displaystyle =$ $\displaystyle 0+\left.\frac{\partial L}{\partial\dot{x}}\eta\left(t\right)\right|_{t_{f}} \ \ \ \ \ (8)$

In these equations, the derivatives of ${L}$ are evaluated on the original curve ${x_{cl}}$. To verify the second line, use the product rule on the second integrand and cancel terms to get the first line. The second term in the last is evaluated at ${t=t_{f}}$ only since we’re assuming that ${\eta\left(0\right)=0}$.

The quantity in brackets in the first integral is zero, because of the Euler-Lagrange equations which are valid on the original curve ${x_{cl}}$:

$\displaystyle \frac{d}{dt}\frac{\partial L}{\partial\dot{x}}-\frac{\partial L}{\partial x}=0 \ \ \ \ \ (9)$

Putting everything together, we get for the total variation in the action:

 $\displaystyle \delta S_{cl}$ $\displaystyle =$ $\displaystyle \delta S_{1}+\delta S_{2}\ \ \ \ \ (10)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \left[\frac{\partial L}{\partial\dot{x}}\eta\left(t\right)+L\Delta t\right]_{t_{f}} \ \ \ \ \ (11)$

Looking at the diagram above, the slope of the blue curve ${x\left(t_{f}\right)}$ at the time ${t_{f}}$ is given by

$\displaystyle \dot{x}\left(t_{f}\right)=\frac{\left|\eta\left(t_{f}\right)\right|}{\Delta t} \ \ \ \ \ (12)$

From the definition 2 of ${\eta}$ we see that ${\eta\left(t_{f}\right)<0}$, so

$\displaystyle \eta\left(t_{f}\right)=-\dot{x}\left(t_{f}\right)\Delta t \ \ \ \ \ (13)$

This gives the final equation for the variation of the action:

 $\displaystyle \delta S_{cl}$ $\displaystyle =$ $\displaystyle \left[-\frac{\partial L}{\partial\dot{x}}\dot{x}+L\right]_{t_{f}}\Delta t\ \ \ \ \ (14)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \left(-p\dot{x}+L\right)\Delta t\ \ \ \ \ (15)$ $\displaystyle$ $\displaystyle =$ $\displaystyle -H\Delta t \ \ \ \ \ (16)$

where the second line follows from the definition of the canonical momentum ${p=\partial L/\partial\dot{x}}$.

The required derivative is

$\displaystyle \boxed{\frac{\partial S_{cl}}{\partial t_{f}}=-H\left(t_{f}\right)} \ \ \ \ \ (17)$

Using a similar technique, we can work out ${\partial S_{cl}/\partial x_{f}}$. In this case, the situation is as shown in this diagram:

The two trajectories now take the same time, but in the modified trajectory, the particle moves a distance ${\Delta x}$ further. Since both paths take the same time, there is no extra contribution ${L\Delta t}$. In this case ${\eta\left(t\right)>0}$, since the new (blue) curve ${x\left(t\right)}$ is above the old (red) one ${x_{cl}\left(t\right)}$. The derivation is the same as above up to 8, and the total variation in the action is now

$\displaystyle \delta S_{cl}=\left.\frac{\partial L}{\partial\dot{x}}\eta\left(t\right)\right|_{t_{f}} \ \ \ \ \ (18)$

At ${t=t_{f}}$, ${\eta\left(t_{f}\right)=\Delta x}$, so we get

 $\displaystyle \delta S_{cl}$ $\displaystyle =$ $\displaystyle \left.\frac{\partial L}{\partial\dot{x}}\right|_{t_{f}}\Delta x\ \ \ \ \ (19)$ $\displaystyle \frac{\partial S_{cl}}{\partial x_{f}}$ $\displaystyle =$ $\displaystyle \left.\frac{\partial L}{\partial\dot{x}}\right|_{t_{f}}=p\left(t_{f}\right) \ \ \ \ \ (20)$

Example We can verify 17 for the case of the one-dimensional harmonic oscillator. The general solution for the position is given by

 $\displaystyle x\left(t\right)$ $\displaystyle =$ $\displaystyle A\cos\omega t+B\sin\omega t\ \ \ \ \ (21)$ $\displaystyle \dot{x}\left(t\right)$ $\displaystyle =$ $\displaystyle -A\omega\sin\omega t+B\omega\cos\omega t \ \ \ \ \ (22)$

The total energy is given by

 $\displaystyle E$ $\displaystyle =$ $\displaystyle \frac{1}{2}m\dot{x}^{2}+\frac{1}{2}m\omega^{2}x^{2}\ \ \ \ \ (23)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m}{2}\left(\left(-A\omega\sin\omega t+B\omega\cos\omega t\right)^{2}+\omega^{2}\left(A\cos\omega t+B\sin\omega t\right)^{2}\right)\ \ \ \ \ (24)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m\omega^{2}}{2}\left(A^{2}+B^{2}\right) \ \ \ \ \ (25)$

where we just multiplied out the second line, cancelled terms and used ${\cos^{2}x+\sin^{2}x=1}$.

To get the action, we need the Lagrangian:

 $\displaystyle L$ $\displaystyle =$ $\displaystyle T-V\ \ \ \ \ (26)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{1}{2}m\dot{x}^{2}-\frac{1}{2}m\omega^{2}x^{2}\ \ \ \ \ (27)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m}{2}\left(\left(-A\omega\sin\omega t+B\omega\cos\omega t\right)^{2}-\omega^{2}\left(A\cos\omega t+B\sin\omega t\right)^{2}\right)\ \ \ \ \ (28)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m\omega^{2}}{2}\left[A^{2}\left(\sin^{2}\omega t-\cos^{2}\omega t\right)+B^{2}\left(\cos^{2}\omega t-\sin^{2}\omega t\right)-4AB\sin\omega t\cos\omega t\right]\ \ \ \ \ (29)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m\omega^{2}}{2}\left(\left(B^{2}-A^{2}\right)\cos2\omega t-2AB\sin2\omega t\right) \ \ \ \ \ (30)$

The action for a trajectory from ${t=0}$ to ${t=T}$ is then

 $\displaystyle S$ $\displaystyle =$ $\displaystyle \int_{0}^{T}Ldt\ \ \ \ \ (31)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m\omega}{4}\left[\left(B^{2}-A^{2}\right)\sin2\omega t+2AB\cos2\omega t\right]_{0}^{T}\ \ \ \ \ (32)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m\omega}{4}\left[\left(B^{2}-A^{2}\right)\sin2\omega T+2AB\left(\cos2\omega T-1\right)\right]\ \ \ \ \ (33)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m\omega}{2}\left[\left(B^{2}-A^{2}\right)\sin\omega T\cos\omega T+AB\left(\cos^{2}\omega T-\sin^{2}\omega T-1\right)\right]\ \ \ \ \ (34)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m\omega}{2}\left[\left(B^{2}-A^{2}\right)\sin\omega T\cos\omega T-2AB\sin^{2}\omega T\right] \ \ \ \ \ (35)$

To proceed further, we need to specify ${A}$ and ${B}$, since these depend on the boundary conditions (that is, on where we require the mass to be at ${t=0}$ and ${t=T}$). If we require ${x\left(0\right)=x_{1}}$ and ${x\left(T\right)=x_{2}}$, then

 $\displaystyle A$ $\displaystyle =$ $\displaystyle x_{1}\ \ \ \ \ (36)$ $\displaystyle x_{1}\cos\omega T+B\sin\omega T$ $\displaystyle =$ $\displaystyle x_{2}\ \ \ \ \ (37)$ $\displaystyle B$ $\displaystyle =$ $\displaystyle \frac{x_{2}-x_{1}\cos\omega T}{\sin\omega T} \ \ \ \ \ (38)$

Plugging these into 25 gives the energy as

 $\displaystyle E$ $\displaystyle =$ $\displaystyle \frac{m\omega^{2}}{2}\left(x_{1}^{2}+\left(\frac{x_{2}-x_{1}\cos\omega T}{\sin\omega T}\right)^{2}\right)\ \ \ \ \ (39)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m\omega^{2}}{2\sin^{2}\omega T}\left(x_{1}^{2}+x_{2}^{2}-2x_{1}x_{2}\cos\omega T\right) \ \ \ \ \ (40)$

Plugging ${A}$ and ${B}$ into 35, we get (using ${c\equiv\cos\omega T}$ and ${s\equiv\sin\omega T}$, so that ${s^{2}+c^{2}=1}$):

 $\displaystyle S$ $\displaystyle =$ $\displaystyle \frac{m\omega}{2s}\left[\left(x_{2}-x_{1}c\right)^{2}c-x_{1}s^{2}c-2x_{1}s^{2}\left(x_{2}-x_{1}c\right)\right]\ \ \ \ \ (41)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m\omega}{2s}\left[\left(x_{2}^{2}-2x_{1}x_{2}c+x_{1}^{2}c^{2}\right)c-x_{1}^{2}s^{2}c-2x_{1}x_{2}s^{2}+2x_{1}s^{2}c\right]\ \ \ \ \ (42)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m\omega}{2s}\left[\left(x_{1}^{2}+x_{2}^{2}\right)c-2x_{1}x_{2}\right]\ \ \ \ \ (43)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m\omega}{2\sin\omega T}\left[\left(x_{1}^{2}+x_{2}^{2}\right)\cos\omega T-2x_{1}x_{2}\right] \ \ \ \ \ (44)$

Taking the derivative, we get

 $\displaystyle \frac{\partial S}{\partial T}$ $\displaystyle =$ $\displaystyle \frac{m\omega}{2s^{2}}\left[-\omega\left(x_{1}^{2}+x_{2}^{2}\right)s^{2}-\left(\left(x_{1}^{2}+x_{2}^{2}\right)c-2x_{1}x_{2}\right)\omega c\right]\ \ \ \ \ (45)$ $\displaystyle$ $\displaystyle =$ $\displaystyle \frac{m\omega^{2}}{2s^{2}}\left[-\left(x_{1}^{2}+x_{2}^{2}\right)+2x_{1}x_{2}c\right]\ \ \ \ \ (46)$ $\displaystyle$ $\displaystyle =$ $\displaystyle -\frac{m\omega^{2}}{2\sin^{2}\omega T}\left(x_{1}^{2}+x_{2}^{2}-2x_{1}x_{2}\cos\omega T\right)\ \ \ \ \ (47)$ $\displaystyle$ $\displaystyle =$ $\displaystyle -E \ \ \ \ \ (48)$

Thus the result is verified for the harmonic oscillator.