# 1.27: The Dirac Notation Applied to Variational Calculations

$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$

$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$

( \newcommand{\kernel}{\mathrm{null}\,}\) $$\newcommand{\range}{\mathrm{range}\,}$$

$$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$

$$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$

$$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$

$$\newcommand{\Span}{\mathrm{span}}$$

$$\newcommand{\id}{\mathrm{id}}$$

$$\newcommand{\Span}{\mathrm{span}}$$

$$\newcommand{\kernel}{\mathrm{null}\,}$$

$$\newcommand{\range}{\mathrm{range}\,}$$

$$\newcommand{\RealPart}{\mathrm{Re}}$$

$$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$

$$\newcommand{\Argument}{\mathrm{Arg}}$$

$$\newcommand{\norm}[1]{\| #1 \|}$$

$$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$

$$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\AA}{\unicode[.8,0]{x212B}}$$

$$\newcommand{\vectorA}[1]{\vec{#1}} % arrow$$

$$\newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow$$

$$\newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vectorC}[1]{\textbf{#1}}$$

$$\newcommand{\vectorD}[1]{\overrightarrow{#1}}$$

$$\newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}}$$

$$\newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}}$$

$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$

$$\newcommand{\avec}{\mathbf a}$$ $$\newcommand{\bvec}{\mathbf b}$$ $$\newcommand{\cvec}{\mathbf c}$$ $$\newcommand{\dvec}{\mathbf d}$$ $$\newcommand{\dtil}{\widetilde{\mathbf d}}$$ $$\newcommand{\evec}{\mathbf e}$$ $$\newcommand{\fvec}{\mathbf f}$$ $$\newcommand{\nvec}{\mathbf n}$$ $$\newcommand{\pvec}{\mathbf p}$$ $$\newcommand{\qvec}{\mathbf q}$$ $$\newcommand{\svec}{\mathbf s}$$ $$\newcommand{\tvec}{\mathbf t}$$ $$\newcommand{\uvec}{\mathbf u}$$ $$\newcommand{\vvec}{\mathbf v}$$ $$\newcommand{\wvec}{\mathbf w}$$ $$\newcommand{\xvec}{\mathbf x}$$ $$\newcommand{\yvec}{\mathbf y}$$ $$\newcommand{\zvec}{\mathbf z}$$ $$\newcommand{\rvec}{\mathbf r}$$ $$\newcommand{\mvec}{\mathbf m}$$ $$\newcommand{\zerovec}{\mathbf 0}$$ $$\newcommand{\onevec}{\mathbf 1}$$ $$\newcommand{\real}{\mathbb R}$$ $$\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}$$ $$\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}$$ $$\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}$$ $$\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}$$ $$\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}$$ $$\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}$$ $$\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}$$ $$\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}$$ $$\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}$$ $$\newcommand{\laspan}[1]{\text{Span}\{#1\}}$$ $$\newcommand{\bcal}{\cal B}$$ $$\newcommand{\ccal}{\cal C}$$ $$\newcommand{\scal}{\cal S}$$ $$\newcommand{\wcal}{\cal W}$$ $$\newcommand{\ecal}{\cal E}$$ $$\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}$$ $$\newcommand{\gray}[1]{\color{gray}{#1}}$$ $$\newcommand{\lgray}[1]{\color{lightgray}{#1}}$$ $$\newcommand{\rank}{\operatorname{rank}}$$ $$\newcommand{\row}{\text{Row}}$$ $$\newcommand{\col}{\text{Col}}$$ $$\renewcommand{\row}{\text{Row}}$$ $$\newcommand{\nul}{\text{Nul}}$$ $$\newcommand{\var}{\text{Var}}$$ $$\newcommand{\corr}{\text{corr}}$$ $$\newcommand{\len}[1]{\left|#1\right|}$$ $$\newcommand{\bbar}{\overline{\bvec}}$$ $$\newcommand{\bhat}{\widehat{\bvec}}$$ $$\newcommand{\bperp}{\bvec^\perp}$$ $$\newcommand{\xhat}{\widehat{\xvec}}$$ $$\newcommand{\vhat}{\widehat{\vvec}}$$ $$\newcommand{\uhat}{\widehat{\uvec}}$$ $$\newcommand{\what}{\widehat{\wvec}}$$ $$\newcommand{\Sighat}{\widehat{\Sigma}}$$ $$\newcommand{\lt}{<}$$ $$\newcommand{\gt}{>}$$ $$\newcommand{\amp}{&}$$ $$\definecolor{fillinmathshade}{gray}{0.9}$$

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.