We show how to visualize the process of diagonalizing the Hamiltonian matrix to find the energy eigenvalues and eigenvectors of a generic one-dimensional quantum system. Starting in the familiar sine-wave basis of an embedding infinite square well, we display the Hamiltonian matrix graphically with the basis functions alongside. Each step in the diagonalization process consists of selecting a nonzero off-diagonal matrix element and then rotating the two corresponding basis vectors in their own subspace until this element is zero. We provide mathematica code to display the effects of these rotations on both the matrix and the basis functions. As an electronic supplement, we also provide a javascript web app to interactively carry out this process.

1.
F.
Marsiglio
, “
The harmonic oscillator in quantum mechanics: A third way
,”
Am. J. Phys.
77
(
3
),
253
258
(
2009
).
2.
V.
Jelic
and
F.
Marsiglio
, “
The double-well potential in quantum mechanics: A simple, numerically exact formulation
,”
Eur. J. Phys.
33
(
6
),
1651
1666
(
2012
).
3.
T.
Dauphinee
and
F.
Marsiglio
, “
Asymmetric wave functions from tiny perturbations
,”
Am. J. Phys.
83
(
10
),
861
866
(
2015
).
4.
B. A.
Jugdutt
and
F.
Marsiglio
, “
Solving for three-dimensional central potentials using numerical matrix methods
,”
Am. J. Phys.
81
(
5
),
343
350
(
2013
).
5.
R. L.
Pavelich
and
F.
Marsiglio
, “
The Kronig-Penney model extended to arbitrary potentials via numerical matrix mechanics
,”
Am. J. Phys.
83
(
9
),
773
781
(
2015
).
6.
Felipe
Le Vot
,
Juan J.
Meléndez
, and
Santos B.
Yuste
, “
Numerical matrix method for quantum periodic potentials
,”
Am. J. Phys.
84
(
6
),
426
433
(
2016
).
7.
R. L.
Pavelich
and
F.
Marsiglio
, “
Calculation of 2D electronic band structure using matrix mechanics
,”
Am. J. Phys.
84
(
12
),
924
935
(
2016
).
8.
Joel
Hutchinson
,
Marc
Baker
, and
Frank
Marsiglio
, “
The spectral decomposition of the helium atom two-electron configuration in terms of hydrogenic orbitals
,”
Eur. J. Phys.
34
(
1
),
111
128
(
2013
).
9.
Robert C.
Massé
and
Thad G.
Walker
, “
Accurate energies of the He atom with undergraduate quantum mechanics
,”
Am. J. Phys.
83
(
8
),
730
732
(
2015
).
10.
MengXing
Na
and
Frank
Marsiglio
, “
Two and three interacting particles in a one-dimensional trap
,”
Am. J. Phys.
85
(
10
),
769
782
(
2017
).
11.
Wolfram Mathematica
, “
The eigensystem function
,” <http://www.wolfram.com/mathematica/>.
12.
Maple
, “
The eigenvectors function in the LinearAlgebra package
,” <https://www.maplesoft.com/products/maple/>.
13.
MATLAB
, “
The numeric::eigenvectors function
,” <https://www.mathworks.com/products/matlab.html>.
14.
SciPy Python Library
, “
The linalg.eig function
,” <https://www.scipy.org/>.
15.
C. G. J.
Jacobi
, “
Über ein leichtes Verfahren die in der Theorie der Säcularstörungen vorkommenden Gleichungen numerisch aufzulösen [A simple procedure for numerically solving the equations found in the theory of secular perturbations]
,”
Journal für die reine und angewandte Mathematik
30
,
51
94
(
1846
).
16.
See supplemental material at http://dx.doi.org/10.1119/10.0000014 for a copy of the mathematica code shown in Fig. 1, additional mathematica code, and an implementation of the diagonalization algorithm as an interactive javascript web app. The web app is also available at <http://physics.weber.edu/schroeder/software/QMatrixDiagVis.html>.
17.
Brute-force numerical integration of Eq. (6) is feasible on personal computers for up to a few dozen rows and columns. When larger matrices are needed, one should use a product-to-sum trigonometric identity to reduce the number of distinct integrals that must be evaluated. Sometimes it is even possible to evaluate the integrals analytically. See Ref. 1.
18.
W. H.
Press
,
S. A.
Teukolsky
,
W. T.
Vetterling
, and
B. P.
Flannery
,
Numerical Recipes
, 3rd ed. (
Cambridge U. P
.,
Cambridge
,
2007
), Chap. 11.

Supplementary Material

AAPT members receive access to the American Journal of Physics and The Physics Teacher as a member benefit. To learn more about this member benefit and becoming an AAPT member, visit the Joining AAPT page.