# 1.27: The Dirac Notation Applied to Variational Calculations


The particle-in-a-box problem is exactly soluble and the solution is calculated below for the first 20 eigenstates. All calculations will be carried out in atomic units.

$\psi(n,x) = \sqrt{2} \sin(n \pi x) \nonumber$

$E_n = \dfrac{n^{2} \pi^{2}}{2} \nonumber$

with $$n = 1, 2, ..., 20$$

##### The First five EigenValues

The first five energy eigenvalues are:

$$E_{1} = 4.935$$ $$E_{2} = 19.739$$ $$E_{3} = 44.413$$ $$E_{4} = 78.957$$ $$E_{5} = 123.37$$

The first three eigenfunctions are displayed below:

%matplotlib inline

import matplotlib.pyplot as plt
import numpy as np

t = np.linspace(0,1,100)
t1 = t*np.pi
t2 = t*np.pi*2
t3 = t*np.pi*3
a = np.sin(t1)
b = np.sin(t2)
c = np.sin(t3)
plt.xlim(0,1)
plt.plot(t,a,color = "red", label= "\u03C8 (1,x)")
plt.plot(t,b,color = "blue",label = "\u03c8 (2,x)")
plt.plot(t,c,color = "limegreen",label = "\u03c8 (3,x)")
plt.plot(t,(t*0), color ="black")

plt.xticks([0,0.5,1])
plt.yticks([-.5,0,.5],[])
plt.xlabel("x")
leg = plt.legend(loc = "center", bbox_to_anchor=[-.11,.5],frameon=False)
plt.tick_params(top=True,right=True,direction="in")

plt.show()


The set of eigenfunctions forms a complete basis set and any other functions can be written as a linear combinations in this basis set. For examples, $$\Phi$$, $$\chi$$, and $$\Gamma$$ are three trial functions that satisfy the boundary conditions for the particle in a 1 bohr box.

$\Phi(x) = \sqrt{30}(x-x^{2}) \nonumber$

$\chi(x) = \sqrt{105}(x^{2}-x^{3}) \nonumber$

$\Gamma(x) = \sqrt{105}x(1-x)^{2} \nonumber$

In Dirac bra-ket notation we can express and of these functions as a linear combination in the basis set as follows:

\begin{align} \langle x | \Phi \rangle &= \sum_{n}^{\infty} \langle x | \psi_{n} \rangle \langle \psi_{n} | \Phi \rangle \\[4pt] &= \sum_{n}^{\infty} \langle x | \psi_{n} \rangle \int_{0}^{1} \langle \psi_{n} | x \rangle \langle x | \Phi \rangle dx \end{align} \nonumber

The various overlap integral for the three trial function are evaluated below.

$a_{n} = \int_{0}^{1} \psi(n,x) \Phi(x)dx \nonumber$

$b_{n} = \int_{0}^{1} \psi(n,x) \chi(x)dx \nonumber$

$c_{n} = \int_{0}^{1} \psi(n,x) \Gamma(x)dx \nonumber$

%matplotlib inline

import matplotlib.pyplot as plt
import numpy as np
import math

t = np.arange(0,1,.001)
plt.plot(t,math.sqrt(2)*np.sin(t*np.pi),color = "red", label = "\u03C8 (1,x)")
plt.plot(t,math.sqrt(30)*(t-t**2),color ="blue", linestyle = "--",label = "\u03A6(x)")
plt.plot(t,math.sqrt(105)*t*(1-t)**2,color = "lime", linestyle = "--", label = "\u0393 (x)")
plt.plot(t,math.sqrt(105)*(t**2 - t**3),color = "magenta", linestyle = "-.", label = "\u03A7 (x)")
plt.xticks([0.2,0.4,0.6,0.8])
plt.yticks([.5,1,1.5],[ ])
plt.tick_params(direction="in")
plt.xlabel("x")
leg = plt.legend(loc = "center",bbox_to_anchor=[-.11,.5], frameon=False)
plt.tick_params(top=True, right=True)
plt.xlim(0,1)
plt.ylim(0,2)
plt.show()



The figure shown below demonstrate that only $$\Phi$$ is a reasonable representative for the ground state wavefunction.

##### First Five Particle in a BOx EigenFunctions

If $$\chi$$ is written as a linear combination of the first 5 PIB eigenfunctions, one gets two functions that are essentially indistinguishable from one another.

The same, of course, is true for $$\chi$$ and $$\Gamma$$, as is demonstrated in the graphs shown below.

Traditionally we use energy as a criterion for the quality of a trial wavefunction by evaluating the variational integral in the following way.

$\int_{0}^{1} \Phi(x)-\frac{1}{2} \cdot \frac{d^{2}}{d x^{2}} \Phi(x) d x=5 \quad \int_{0}^{1} \chi(x)-\frac{1}{2} \cdot \frac{d^{2}}{d x^{2}} \chi(x) d x=7 \quad \int_{0}^{1} \Gamma(x) \cdot \frac{1}{2} \cdot \frac{d^{2}}{d x^{2}} \Gamma(x) d x=7 \nonumber$

In Dirac notation we write:

$\langle E\rangle=\langle\Phi|\hat{H}| \Phi\rangle=\sum_{n}\langle\Phi|\hat{H}| \Psi_{n}\rangle\left\langle\Psi_{n} | \Phi\right\rangle=\sum\langle\Phi | \Psi_{n}\rangle E_{n}\left\langle\Psi_{n} | \Phi\right\rangle=\sum_{n} a_{n}^{2} E_{n} \nonumber$

Thus we easily show the same result.

$\sum_{\mathrm{n}}\left[\left(\mathrm{a}_{\mathrm{n}}\right)^{2} \cdot \mathrm{E}_{\mathrm{n}}\right]=5 \quad \sum_{\mathrm{n}}\left[\left(\mathrm{b}_{\mathrm{n}}\right)^{2} \cdot \mathrm{E}_{\mathrm{n}}\right]=6.999 \quad \sum_{\mathrm{n}}\left[\left(\mathrm{c}_{\mathrm{n}}\right)^{2} \cdot \mathrm{E}_{\mathrm{n}}\right]=6.999 \nonumber$

We now show, belatedly, that the three trial functions are normalized by both methods.

$\int_{0}^{1} \Phi(x)^{2} d x=1 \quad \int_{0}^{1} \chi(x)^{2} d x=1 \quad \int_{0}^{1} \Gamma(x)^{2} d x=1 \nonumber$

In Dirac notation this is formulated as:

$\langle\Phi | \Phi\rangle=\sum_{n}\langle\Phi | \Psi_{n}\rangle\left\langle\Psi_{n} | \Phi\right\rangle=\sum_{n} a_{n}^{2} \nonumber$

$\sum_{\mathrm{n}}\left(a_{n}\right)^{2}=1 \quad \sum_{n}\left(b_{n}\right)^{2}=1 \quad \sum_{n}\left(c_{n}\right)^{2}=1 \nonumber$

We now calculate some over-lap integrals:

$\int_{0}^{1} \Phi(x) \cdot \chi(x) d x=0.935 \quad \quad \int_{0}^{1} \Phi(x) \cdot \Gamma(x) d x=0.935 \quad \int_{0}^{1} \chi(x) \cdot \Gamma(x) d x=0.75 \nonumber$

In Dirac notation this is formulated as:

$\langle\Phi | \Gamma\rangle=\sum_{n}\langle\Phi | \Psi_{n}\rangle\left\langle\Psi_{n} | \Gamma\right\rangle=\sum_{n} a_{n} c_{n} \nonumber$

$\sum_{\mathrm{n}}\left(\mathrm{a}_{\mathrm{n}} \cdot \mathrm{b}_{\mathrm{n}}\right)=0.935 \quad \sum_{\mathrm{n}}\left(\mathrm{a}_{\mathrm{n}}-\mathrm{c}_{\mathrm{n}}\right)=0.935 \quad \sum_{\mathrm{n}}\left(\mathrm{b}_{\mathrm{n}}-\mathrm{c}_{\mathrm{n}}\right)=0.75 \nonumber$

This page titled 1.27: The Dirac Notation Applied to Variational Calculations is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Frank Rioux via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.