← Background
Background · Quadratic Forms and Gaussians

What Does Completing the Square Buy in Quantum Chemistry?

A linear term added to a quadratic one does not change its shape. It moves the centre and lowers the value there. That one rewriting evaluates Gaussian integrals, multiplies Gaussian basis functions, solves an oscillator in a field, and eliminates the electrostatic potential.

1. One Variable

Adding 2x to x2 moves the parabola so that its vertex is at (−1,−1).
  1. Start with q(x)=ax2+bx+c, a≠0. Factor a from the terms with x: q=a[x2+(b/a)x]+c.
  2. Add and subtract the square of half the linear coefficient: x2+(b/a)x=(x+b/(2a))2−b2/(4a2).
  3. Multiply back: q=a(x+b/(2a))2+c−b2/(4a).
  4. Read off, for a>0: the minimum is at x*=−b/(2a) with value c−b2/(4a). Setting q=0 gives the quadratic formula, x=[−b±b2−4ac]/(2a).

2. Many Variables

Let x and b be real vectors and A a real symmetric positive definite matrix. Then A−1 exists and is symmetric.

  1. Guess the form 12(x−x*)𝖳A(x−x*)+k and expand: 12x𝖳Ax−x𝖳Ax*+12x*𝖳Ax*+k. The two cross terms are equal because A𝖳=A.
  2. Match the linear term with −b𝖳x: Ax*=b, so x*=A−1b.
  3. Match the constant with zero: k=−12x*𝖳Ax*=−12b𝖳A−1b.
Completed square, A symmetric positive definite12x𝖳Ax−b𝖳x=12(x−A−1b)𝖳A(x−A−1b)−12b𝖳A−1b.
A has rows (2, 1) and (1, 2), and b=(1,0). The ellipses keep their shape and axes; the centre moves to A−1b.

One Block at a Time

  1. Split x=(u,v) with x𝖳Ax=u𝖳Pu+2u𝖳Qv+v𝖳Rv.
  2. Complete the square in v: (v+R−1Q𝖳u)𝖳R(v+R−1Q𝖳u)+u𝖳(P−QR−1Q𝖳)u.
  3. The matrix left for u, P−QR−1Q𝖳, is the Schur complement. It is what remains after integrating v out.

3. The Gaussian Integral

  1. Let I=∫−∞∞e−x2/2dx. Square it and use polar coordinates: I2=∫02π∫0∞e−r2/2rdrdθ=2π.
  2. Rotate to the eigenvectors of A, x=Oy with |det⁡O|=1 and eigenvalues λk>0. The integral factorizes: ∫e−x𝖳Ax/2dnx=∏k2π/λk=(2π)n/2(det⁡A)−1/2.
  3. Add the linear term, complete the square, and shift the integration variable by A−1b.
Gaussian integral with a source∫ℝne−12x𝖳Ax+b𝖳xdnx=(2π)n/2det⁡Ae12b𝖳A−1b.

Numerical check for the A and b above: a grid sum gives 5.0627218587, the formula (2π/3)e1/3 gives 5.0627218587.

4. The Gaussian Product Theorem

Take two spherical Gaussians, e−α|𝐫−𝐀|2 and e−β|𝐫−𝐁|2, with α,β>0.

  1. Add the exponents and expand: α|𝐫−𝐀|2+β|𝐫−𝐁|2=(α+β)r2−2𝐫⋅(α𝐀+β𝐁)+αA2+βB2.
  2. Complete the square with p=α+β and 𝐏=(α𝐀+β𝐁)/p: the expression is p|𝐫−𝐏|2+αA2+βB2−pP2.
  3. Simplify the constant: p(αA2+βB2)−|α𝐀+β𝐁|2=αβ|𝐀−𝐁|2. Divide by p.
Product of two Gaussians is one Gaussiane−α|𝐫−𝐀|2e−β|𝐫−𝐁|2=e−μ|𝐀−𝐁|2e−p|𝐫−𝐏|2,μ=αβα+β,S=∫e−α|𝐫−𝐀|2e−β|𝐫−𝐁|2dV=(πα+β)3/2e−μ|𝐀−𝐁|2.
One dimension, α=1 at A=−1 and β=0.5 at B=1.5. The product is centred at P= −0.1667 with prefactor 0.1245. Pointwise difference between the two sides: at most 5.6 × 10−17. One-dimensional overlap by grid sum 0.1801976555, by formula 0.1801976555.

This is why Gaussian basis functions are used (Boys 1950): a product on two centres becomes a function on one centre, so overlap, kinetic and Coulomb integrals reduce to closed forms and the one-variable Boys function. The price is the shape at a point nucleus, where a finite sum of Gaussians has no cusp; see Gaussian and exponential bases.

5. A Harmonic Oscillator Dressed by a Field

In atomic units, a unit-mass particle of charge q in a uniform static field F along x has the added potential −qFx. For an electron, q=−1:

Ĥ=−12d2dx2+12ω2x2+Fx.
  1. Complete the square: 12ω2x2+Fx=12ω2(x+F/ω2)2−F2/(2ω2).
  2. Shift u=x+F/ω2. The kinetic term is unchanged, since d/dx=d/du.
  3. The spectrum is the free one, lowered: En=ω(n+12)−F2/(2ω2), with ψn(x)=ϕn(x+F/ω2).
  4. The mean position is ⟨x⟩=−F/ω2, so the dipole −⟨x⟩=F/ω2 and the polarizability is 1/ω2.
Finite-difference check at ω=1, F=0.8 with 1801 points: E0= 0.18000 (exact 0.18000), E1= 1.17998 (exact 1.18000), ⟨x⟩= −0.80000 (exact −0.80000).

6. The Same Field on a Molecule: H2 and Its Atoms

A molecule is not quadratic, so its density is not moved rigidly. In ℒchem a static external field enters through −ρcφext, with ρc the net charge density of nuclei and electrons, and QTAIM reads the response atom by atom.

H2, restricted Hartree–Fock, def2-TZVP (Cartesian), nuclei fixed at z=±0.7 bohr, field along +z. Critical points, bond paths and densities from libqtaim. With a uniform field the potential is unbounded below; these are finite-basis states.

The dipole along the axis splits exactly into a charge-transfer part, ∑Aq(A)zA, and an atomic polarization part, ∑Aμz(A), with q(A)=ZA−N(A) and μz(A)=−∫A(z−zA)ρdV.

libqtaim basin integrals, angular grid (48, 96), as computed. Atomic units.
Fbond point zN(lower H)N(upper H)charge transferatomic polarizationsumPySCF dipole
00.000001.000001.000000.000000.000000.000000.00000
0.020.020391.084780.915230.118690.014240.132920.13293
0.050.050951.209590.790310.293500.039760.333260.33318
  1. ∑N(Ω)−N at F=0.05: −1.0 × 10−4. L(Ω) of the two atoms: 8.2 × 10−5 and 1.9 × 10−6.
  2. For small fields E(F)≈E(0)−μ0F−12αF2, the many-electron counterpart of the oscillator result in section 5. From the SCF energies at F=0,±0.02, the second difference gives αzz= 6.6447; the dipole at F=0.02 divided by F gives 6.6464.

7. Eliminating φ: The Square in ℒchem

The electrostatic part of ℒBO is ℒφ=−ρcφ+|∇φ|2/(8π), with ρc the microscopic net charge density. Define φ*(𝐫)=∫ρc(𝐫′)/|𝐫−𝐫′|dV′, so that ∇2φ*=−4πρc.

  1. Expand the square: 18π∫|∇(φ−φ*)|2=18π∫|∇φ|2−14π∫∇φ⋅∇φ*+18π∫|∇φ*|2.
  2. Integrate the cross term by parts: −14π∫∇φ⋅∇φ*=14π∫φ∇2φ*=−∫ρcφ.
  3. The last term, by the same rule: 18π∫|∇φ*|2=12∫ρcφ*.
The square in the potential∫ℒφdV=18π∫|∇(φ−φ*)|2dV−12∬ρc(𝐫)ρc(𝐫′)|𝐫−𝐫′|dVdV′.

The first term vanishes at φ=φ* and the second is minus the Coulomb energy, with the self-interaction of point particles dropped by convention. Kept local instead of integrated over all space, the same field terms are where the local three-dimensional IQA energy of an atom comes from.

Hubbard–Stratonovich: The Identity Read Backwards

  1. For a>0 and a number n, complete the square in s: −s2/(2a)+sn=−(s−an)2/(2a)+an2/2. Integrating gives ean2/2=(2πa)−1/2∫e−s2/(2a)+snds.
  2. Replace n by in: e−an2/2=(2πa)−1/2∫e−s2/(2a)+isnds.
  3. A repulsive interaction has the weight e−V in imaginary time, so its auxiliary field couples with an imaginary factor. This matches the line above: the field-theory weight built from ℒφ converges only on an imaginary contour for φ. In real time, stationary elimination, as in the first steps of this section, gives the result directly.

A Displaced Photon Mode

  1. One field mode of frequency ω coupled to a Hermitian matter quantity n that commutes with a: H=ωa†a+gn(a+a†).
  2. Complete the square: H=ω(a†+gn/ω)(a+gn/ω)−g2n2/ω.
  3. If n is a fixed number, b=a+gn/ω obeys [b,b†]=1: the mode is displaced and the energy lowered. If n is an operator that does not commute with the rest of the matter Hamiltonian, the displacement also dresses that part, and the problem is not solved by this step.

The photon lines are background for extending ℒchem; no quantized field is computed on this page.

8. Exercises

  1. Complete the square in 3x2−12x+7.
    Answer

    3(x−2)2−5.

  2. Where is the product of two Gaussians of equal exponent centred?
    Answer

    At the midpoint, P=(A+B)/2, with μ=α/2.

  3. Evaluate ∫e−x2+4xdx.
    Answer

    −(x−2)2+4, so the integral is πe4.

  4. For the oscillator, find the work done by switching the field on slowly in the ground state.
    Answer

    It equals the energy change, −F2/(2ω2).

References

Comments, questions or contributions? Please open an issue or a pull request on GitHub.