# Dirac bracket

The Dirac bracket is a generalization of the Poisson bracket developed by Paul Dirac to treat classical systems with second class constraints in Hamiltonian mechanics, and to thus allow them to undergo canonical quantization. It is an important part of Dirac's development of Hamiltonian mechanics to elegantly handle more general Lagrangians; specifically, when constraints are at hand, so that the number of apparent variables exceeds that of dynamical ones. More abstractly, the two-form implied from the Dirac bracket is the restriction of the symplectic form to the constraint surface in phase space.
This article assumes familiarity with the standard Lagrangian and Hamiltonian formalisms, and their connection to canonical quantization. Details of Dirac's modified Hamiltonian formalism are also summarized to put the Dirac bracket in context.

## Inadequacy of the standard Hamiltonian procedure

The standard development of Hamiltonian mechanics is inadequate in several specific situations:
* When the Lagrangian is at most linear in the velocity of at least one coordinate; in which case, the definition of the canonical momentum leads to a constraint. This is the most frequent reason to resort to Dirac brackets. For instance, the Lagrangian (density) for any fermion is of this form.
* When there are gauge (or other unphysical) degrees of freedom which need to be fixed.
* When there are any other constraints that one wishes to impose in phase space.

### Example of a Lagrangian linear in velocity

An example in classical mechanics is a particle with charge q and mass m confined to the x - y plane with a strong constant, homogeneous perpendicular magnetic field, so then pointing in the z-direction with strength B.
The Lagrangian for this system with an appropriate choice of parameters is
    $L={\tfrac {1}{2}}m{\vec {v}}^{2}+{\frac {q}{c}}{\vec {A}}\cdot {\vec {v}}-V({\vec {r}}),$
where →A is the vector potential for the magnetic field, →B; c is the speed of light in vacuum; and V(→r) is an arbitrary external scalar potential; one could easily take it to be quadratic in x and y, without loss of generality. We use
    ${\vec {A}}={\frac {B}{2}}(x{\hat {y}}-y{\hat {x}})$
as our vector potential; this corresponds to a uniform and constant magnetic field B in the z direction. Here, the hats indicate unit vectors. Later in the article, however, they are used to distinguish quantum mechanical operators from their classical analogs. The usage should be clear from the context.
Explicitly, the Lagrangian amounts to just
    $L={\frac {m}{2}}({\dot {x}}^{2}+{\dot {y}}^{2})+{\frac {qB}{2c}}(x{\dot {y}}-y{\dot {x}})-V(x,y)~,$
which leads to the equations of motion
    $m{\ddot {x}}=-{\frac {\partial V}{\partial x}}+{\frac {qB}{c}}{\dot {y}}$
    $m{\ddot {y}}=-{\frac {\partial V}{\partial y}}-{\frac {qB}{c}}{\dot {x}}.$
For a harmonic potential, the gradient of V amounts to just the coordinates, −(x,y).
Now, in the limit of a very large magnetic field, qB/mc ≫ 1. One may then drop the kinetic term to produce a simple approximate Lagrangian,
    $L={\frac {qB}{2c}}(x{\dot {y}}-y{\dot {x}})-V(x,y)~,$
with first-order equations of motion
    ${\dot {y}}={\frac {c}{qB}}{\frac {\partial V}{\partial x}}$
    ${\dot {x}}=-{\frac {c}{qB}}{\frac {\partial V}{\partial y}}~.$
Note that this approximate Lagrangian is linear in the velocities, which is one of the conditions under which the standard Hamiltonian procedure breaks down. While this example has been motivated as an approximation, the Lagrangian under consideration is legitimate and leads to consistent equations of motion in the Lagrangian formalism.
Following the Hamiltonian procedure, however, the canonical momenta associated with the coordinates are now
    $p_{x}={\frac {\partial L}{\partial {\dot {x}}}}=-{\frac {qB}{2c}}y$
    $p_{y}={\frac {\partial L}{\partial {\dot {y}}}}={\frac {qB}{2c}}x~,$
which are unusual in that they are not invertible to the velocities; instead, they are constrained to be functions of the coordinates: the four phase-space variables are linearly dependent, so the variable basis is overcomplete.
A Legendre transformation then produces the Hamiltonian
    $H(x,y,p_{x},p_{y})={\dot {x}}p_{x}+{\dot {y}}p_{y}-L=V(x,y).$
Note that this "naive" Hamiltonian has no dependence on the momenta, which means that equations of motion (Hamilton's equations) are inconsistent.
The Hamiltonian procedure has broken down. One might try to fix the problem by eliminating two of the components of the 4-dimensional phase space, say y and p$_y$, down to a reduced phase space of 2 dimensions, that is sometimes expressing the coordinates as momenta and sometimes as coordinates. However, this is neither a general nor rigorous solution. This gets to the heart of the matter: that the definition of the canonical momenta implies a constraint on phase space (between momenta and coordinates) that was never taken into account.

## Generalized Hamiltonian procedure

In Lagrangian mechanics, if the system has holonomic constraints, then one generally adds Lagrange multipliers to the Lagrangian to account for them. The extra terms vanish when the constraints are satisfied, thereby forcing the path of stationary action to be on the constraint surface. In this case, going to the Hamiltonian formalism introduces a constraint on phase space in Hamiltonian mechanics, but the solution is similar.
Before proceeding, it is useful to understand the notions of weak equality and strong equality. Two functions on phase space, f and g, are weakly equal if they are equal when the constraints are satisfied, but not throughout the phase space, denoted f ≈ g. If f and g are equal independently of the constraints being satisfied, they are called strongly equal, written f = g. It is important to note that, in order to get the right answer, no weak equations may be used before evaluating derivatives or Poisson brackets.
The new procedure works as follows, start with a Lagrangian and define the canonical momenta in the usual way. Some of those definitions may not be invertible and instead give a constraint in phase space (as above). Constraints derived in this way or imposed from the beginning of the problem are called primary constraints. The constraints, labeled φ$_j$, must weakly vanish, φ$_j$(p,q) ≈ 0.
Next, one finds the naive Hamiltonian, H, in the usual way via a Legendre transformation, exactly as in the above example. Note that the Hamiltonian can always be written as a function of qs and ps only, even if the velocities cannot be inverted into functions of the momenta.

### Generalizing the Hamiltonian

Dirac argues that we should generalize the Hamiltonian (somewhat analogously to the method of Lagrange multipliers) to
    $H^{*}=H+\sum _{j}c_{j}\phi _{j}\approx H,$
where the c$_j$ are not constants but functions of the coordinates and momenta. Since this new Hamiltonian is the most general function of coordinates and momenta weakly equal to the naive Hamiltonian, H$^*$ is the broadest generalization of the Hamiltonian possible so that δH * ≈ δH when δϕ$_j$ ≈ 0.
To further illuminate the c$_j$, consider how one gets the equations of motion from the naive Hamiltonian in the standard procedure. One expands the variation of the Hamiltonian out in two ways and sets them equal (using a somewhat abbreviated notation with suppressed indices and sums):
    $\delta H={\frac {\partial H}{\partial q}}\delta q+{\frac {\partial H}{\partial p}}\delta p\approx {\dot {q}}\delta p-{\dot {p}}\delta q~,$
where the second equality holds after simplifying with the Euler-Lagrange equations of motion and the definition of canonical momentum. From this equality, one deduces the equations of motion in the Hamiltonian formalism from
    $\left({\frac {\partial H}{\partial q}}+{\dot {p}}\right)\delta q+\left({\frac {\partial H}{\partial p}}-{\dot {q}}\right)\delta p=0~,$
where the weak equality symbol is no longer displayed explicitly, since by definition the equations of motion only hold weakly. In the present context, one cannot simply set the coefficients of δq and δp separately to zero, since the variations are somewhat restricted by the constraints. In particular, the variations must be tangent to the constraint surface.
One can demonstrate that the solution to
    $\sum _{n}A_{n}\delta q_{n}+\sum _{n}B_{n}\delta p_{n}=0,$
for the variations δq$_n$ and δp$_n$ restricted by the constraints Φ$_j$ ≈ 0 (assuming the constraints satisfy some regularity conditions) is generally
    $A_{n}=\sum _{m}u_{m}{\frac {\partial \phi _{m}}{\partial q_{n}}}$
    $B_{n}=\sum _{m}u_{m}{\frac {\partial \phi _{m}}{\partial p_{n}}},$
where the u$_m$ are arbitrary functions.
Using this result, the equations of motion become
    ${\dot {p}}_{j}=-{\frac {\partial H}{\partial q_{j}}}-\sum _{k}u_{k}{\frac {\partial \phi _{k}}{\partial q_{j}}}$
    ${\dot {q}}_{j}={\frac {\partial H}{\partial p_{j}}}+\sum _{k}u_{k}{\frac {\partial \phi _{k}}{\partial p_{j}}}$
    $\phi _{j}(q,p)=0,$
where the u$_k$ are functions of coordinates and velocities that can be determined, in principle, from the second equation of motion above.
The Legendre transform between the Lagrangian formalism and the Hamiltonian formalism has been saved at the cost of adding new variables.

### Consistency conditions

The equations of motion become more compact when using the Poisson bracket, since if f is some function of the coordinates and momenta then
    ${\dot {f}}\approx \{f,H^{*}\}_{PB}\approx \{f,H\}_{PB}+\sum _{k}u_{k}\{f,\phi _{k}\}_{PB},$
if one assumes that the Poisson bracket with the u$_k$ (functions of the velocity) exist; this causes no problems since the contribution weakly vanishes. Now, there are some consistency conditions which must be satisfied in order for this formalism to make sense. If the constraints are going to be satisfied, then their equations of motion must weakly vanish, that is, we require
    ${\dot {\phi _{j}}}\approx \{\phi _{j},H\}_{PB}+\sum _{k}u_{k}\{\phi _{j},\phi _{k}\}_{PB}\approx 0.$
There are four different types of conditions that can result from the above:
* An equation that is inherently false, such as 1=0 .
* An equation that is identically true, possibly after using one of our primary constraints.
* An equation that places new constraints on our coordinates and momenta, but is independent of the u$_k$.
* An equation that serves to specify the u$_k$.
The first case indicates that the starting Lagrangian gives inconsistent equations of motion, such as L = q. The second case does not contribute anything new.
The third case gives new constraints in phase space. A constraint derived in this manner is called a secondary constraint. Upon finding the secondary constraint one should add it to the extended Hamiltonian and check the new consistency conditions, which may result in still more constraints. Iterate this process until there are no more constraints. The distinction between primary and secondary constraints is largely an artificial one (i.e. a constraint for the same system can be primary or secondary depending on the Lagrangian), so this article does not distinguish between them from here on. Assuming the consistency condition has been iterated until all of the constraints have been found, then ϕ$_j$ will index all of them. Note this article uses secondary constraint to mean any constraint that was not initially in the problem or derived from the definition of canonical momenta; some authors distinguish between secondary constraints, tertiary constraints, et cetera.
Finally, the last case helps fix the u$_k$. If, at the end of this process, the u$_k$ are not completely determined, then that means there are unphysical (gauge) degrees of freedom in the system. Once all of the constraints (primary and secondary) are added to the naive Hamiltonian and the solutions to the consistency conditions for the u$_k$ are plugged in, the result is called the total Hamiltonian.

### Determination of the u$_k$

The u$_k$ must solve a set of inhomogeneous linear equations of the form
    $\{\phi _{j},H\}_{PB}+\sum _{k}u_{k}\{\phi _{j},\phi _{k}\}_{PB}\approx 0.$
The above equation must possess at least one solution, since otherwise the initial Lagrangian is inconsistent; however, in systems with gauge degrees of freedom, the solution will not be unique. The most general solution is of the form
    $u_{k}=U_{k}+V_{k},$
where U$_k$ is a particular solution and V$_k$ is the most general solution to the homogeneous equation
    $\sum _{k}V_{k}\{\phi _{j},\phi _{k}\}_{PB}\approx 0.$
The most general solution will be a linear combination of linearly independent solutions to the above homogeneous equation. The number of linearly independent solutions equals the number of u$_k$ (which is the same as the number of constraints) minus the number of consistency conditions of the fourth type (in previous subsection). This is the number of unphysical degrees of freedom in the system. Labeling the linear independent solutions V$_k$$^a$ where the index a runs from 1 to the number of unphysical degrees of freedom, the general solution to the consistency conditions is of the form
    $u_{k}\approx U_{k}+\sum _{a}v_{a}V_{k}^{a},$
where the $v_{a}$ are completely arbitrary functions of time. A different choice of the $v_{a}$ corresponds to a gauge transformation, and should leave the physical state of the system unchanged.

### The total Hamiltonian

At this point, it is natural to introduce the total Hamiltonian
    $H_{T}=H+\sum _{k}U_{k}\phi _{k}+\sum _{a,k}v_{a}V_{k}^{a}\phi _{k}$
and what is denoted
    $H'=H+\sum _{k}U_{k}\phi _{k}.$
The time evolution of a function on the phase space, f , is governed by
    ${\dot {f}}\approx \{f,H_{T}\}_{PB}.$
Later, the extended Hamiltonian is introduced. For gauge-invariant (physically measurable quantities) quantities, all of the Hamiltonians should give the same time evolution, since they are all weakly equivalent. It is only for non gauge-invariant quantities that the distinction becomes important.

## The Dirac bracket

Above is everything needed to find the equations of motion in Dirac's modified Hamiltonian procedure. Having the equations of motion, however, is not the endpoint for theoretical considerations. If one wants to canonically quantize a general system, then one needs the Dirac brackets. Before defining Dirac brackets, first-class and second-class constraints need to be introduced.
We call a function f(q, p) of coordinates and momenta first class if its Poisson bracket with all of the constraints weakly vanishes, that is,
    $\{f,\phi _{j}\}_{PB}\approx 0,$
for all j. Note that the only quantities that weakly vanish are the constraints ϕ$_j$, and therefore anything that weakly vanishes must be strongly equal to a linear combination of the constraints. One can demonstrate that the Poisson bracket of two first-class quantities must also be first class. The first-class constraints are intimately connected with the unphysical degrees of freedom mentioned earlier. Namely, the number of independent first-class constraints is equal to the number of unphysical degrees of freedom, and furthermore, the primary first-class constraints generate gauge transformations. Dirac further postulated that all secondary first-class constraints are generators of gauge transformations, which turns out to be false; however, typically one operates under the assumption that all first-class constraints generate gauge transformations when using this treatment.
When the first-class secondary constraints are added into the Hamiltonian with arbitrary $v_{a}$ as the first-class primary constraints are added to arrive at the total Hamiltonian, then one obtains the extended Hamiltonian. The extended Hamiltonian gives the most general possible time evolution for any gauge-dependent quantities, and may actually generalize the equations of motion from those of the Lagrangian formalism.
For the purposes of introducing the Dirac bracket, of more immediate interest are the second class constraints. Second class constraints are constraints that have a nonvanishing Poisson bracket with at least one other constraint.
For instance, consider second-class constraints ϕ$_1$ and ϕ$_2$ whose Poisson bracket is simply a constant, c,
    $\{\phi _{1},\phi _{2}\}_{PB}=c~.$
Now, suppose one wishes to employ canonical quantization, then the phase-space coordinates become operators whose commutators become iħ times their classical Poisson bracket. Assuming there are no ordering issues that give rise to new quantum corrections, this implies that
    $[{\hat {\phi }}_{1},{\hat {\phi }}_{2}]=i\hbar ~c,$
where the hats emphasize the fact that the constraints are on operators.
On one hand, canonical quantization gives the above commutation relation, but on the other hand ϕ$_1$ and ϕ$_2$ are constraints that must vanish on physical states, whereas the right-hand side cannot vanish. This example illustrates the need for some generalization of the Poisson bracket which respects the system's constraints, and which leads to a consistent quantization procedure. This new bracket should be bilinear, antisymmetric, satisfy the Jacobi identity as does the Poisson bracket, reduce to the Poisson bracket for unconstrained systems, and, additionally, the bracket of any second-class constraint with any other quantity must vanish.
At this point, the second class constraints will be labeled ${\tilde {\phi }}_{a}$. Define a matrix with entries
    $M_{ab}=\{{\tilde {\phi }}_{a},{\tilde {\phi }}_{b}\}_{PB}.$
In this case, the Dirac bracket of two functions on phase space, f and g, is defined as
$\{f,g\}_{DB}=\{f,g\}_{PB}-\sum _{a,b}\{f,{\tilde {\phi }}_{a}\}_{PB}M_{ab}^{-1}\{{\tilde {\phi }}_{b},g\}_{PB}~,$
where M$^{−1}$$_{ab}$ denotes the ab entry of M 's inverse matrix. Dirac proved that M will always be invertible.
It is straightforward to check that the above definition of the Dirac bracket satisfies all of the desired properties, and especially the last one, of vanishing for an argument which is a second-class constraint.
When applying canonical quantization on a constrained Hamiltonian system, the commutator of the operators is supplanted by iħ times their classical Dirac bracket. Since the Dirac bracket respects the constraints, one need not be careful about evaluating all brackets before using any weak equations, as is the case with the Poisson bracket.
Note that while the Poisson bracket of bosonic (Grassmann even) variables with itself must vanish, the Poisson bracket of fermions represented as a Grassmann variables with itself need not vanish. This means that in the fermionic case it is possible for there to be an odd number of second class constraints.

## Illustration on the example provided

Returning to the above example, the naive Hamiltonian and the two primary constraints are
    $H=V(x,y)$
    $\phi _{1}=p_{x}+{\tfrac {qB}{2c}}y,\qquad \phi _{2}=p_{y}-{\tfrac {qB}{2c}}x.$
Therefore, the extended Hamiltonian can be written
    $H^{*}=V(x,y)+u_{1}\left(p_{x}+{\tfrac {qB}{2c}}y\right)+u_{2}\left(p_{y}-{\tfrac {qB}{2c}}x\right).$
The next step is to apply the consistency conditions {Φ$_j$, H$^*$}$_{PB}$ ≈ 0, which in this case become
    $\{\phi _{1},H\}_{PB}+\sum _{j}u_{j}\{\phi _{1},\phi _{j}\}_{PB}=-{\frac {\partial V}{\partial x}}+u_{2}{\frac {qB}{c}}\approx 0$
    $\{\phi _{2},H\}_{PB}+\sum _{j}u_{j}\{\phi _{2},\phi _{j}\}_{PB}=-{\frac {\partial V}{\partial y}}-u_{1}{\frac {qB}{c}}\approx 0.$
These are not secondary constraints, but conditions that fix u$_1$ and u$_2$. Therefore, there are no secondary constraints and the arbitrary coefficients are completely determined, indicating that there are no unphysical degrees of freedom.
If one plugs in with the values of u$_1$ and u$_2$, then one can see that the equations of motion are
    ${\dot {x}}=\{x,H\}_{PB}+u_{1}\{x,\phi _{1}\}_{PB}+u_{2}\{x,\phi _{2}\}=-{\frac {c}{qB}}{\frac {\partial V}{\partial y}}$
    ${\dot {y}}={\frac {c}{qB}}{\frac {\partial V}{\partial x}}$
    ${\dot {p}}_{x}=-{\frac {1}{2}}{\frac {\partial V}{\partial x}}$
    ${\dot {p}}_{y}=-{\frac {1}{2}}{\frac {\partial V}{\partial y}},$
which are self-consistent and coincide with the Lagrangian equations of motion.
A simple calculation confirms that ϕ$_1$ and ϕ$_2$ are second class constraints since
    $\{\phi _{1},\phi _{2}\}_{PB}=-\{\phi _{2},\phi _{1}\}_{PB}={\frac {qB}{c}},$
hence the matrix looks like
    $M={\frac {qB}{c}}\left({\begin{matrix}0&1\\-1&0\end{matrix}}\right),$
which is easily inverted to
    $M^{-1}={\frac {c}{qB}}\left({\begin{matrix}0&-1\\1&0\end{matrix}}\right)\quad \Rightarrow \quad M_{ab}^{-1}=-{\frac {c}{qB_{0}}}\varepsilon _{ab},$
where ε$_{ab}$ is the Levi-Civita symbol. Thus, the Dirac brackets are defined to be
    $\{f,g\}_{DB}=\{f,g\}_{PB}+{\frac {c\varepsilon _{ab}}{qB}}\{f,\phi _{a}\}_{PB}\{\phi _{b},g\}_{PB}.$
If one always uses the Dirac bracket instead of the Poisson bracket, then there is no issue about the order of applying constraints and evaluating expressions, since the Dirac bracket of anything weakly zero is strongly equal to zero. This means that one can just use the naive Hamiltonian with Dirac brackets, instead, to thus get the correct equations of motion, which one can easily confirm on the above ones.
To quantize the system, the Dirac brackets between all of the phase space variables are needed. The nonvanishing Dirac brackets for this system are
    $\{x,y\}_{DB}=-{\frac {c}{qB}}$
    $\{x,p_{x}\}_{DB}=\{y,p_{y}\}_{DB}={\tfrac {1}{2}}$
while the cross-terms vanish, and
    $\{p_{x},p_{y}\}_{DB}=-{\frac {qB}{4c}}.$
Therefore, the correct implementation of canonical quantization dictates the commutation relations,
    $[{\hat {x}},{\hat {y}}]=-i{\frac {\hbar c}{qB}}$
    $[{\hat {x}},{\hat {p}}_{x}]=[{\hat {y}},{\hat {p}}_{y}]=i{\frac {\hbar }{2}}$
with the cross terms vanishing, and
    $[{\hat {p}}_{x},{\hat {p}}_{y}]=-i{\frac {\hbar qB}{4c}}~.$
This example has a nonvanishing commutator between ∧x and ∧y, which means this structure specifies a noncommutative geometry. (Since the two coordinates do not commute, there will be an uncertainty principle for the x and y positions.)

## Further illustration for a hypersphere

Similarly, for free motion on a hypersphere S$^n$, the n + 1 coordinates are constrained, x$_i$ x$^i$ = 1. From a plain kinetic Lagrangian, it is evident that their momenta are perpendicular to them, x$_i$ p$^i$ = 0. Thus the corresponding Dirac Brackets are likewise simple to work out,
    $\{x_{i},x_{j}\}_{DB}=0,$
    $\{x_{i},p_{j}\}_{DB}=\delta _{ij}-x_{i}x_{j},$
    $\{p_{i},p_{j}\}_{DB}=x_{j}p_{i}-x_{i}p_{j}~.$
The (2n + 1) constrained phase-space variables (x$_i$, p$_i$) obey much simpler Dirac brackets than the 2n unconstrained variables, had one eliminated one of the xs and one of the ps through the two constraints ab initio, which would obey plain Poisson brackets. The Dirac brackets add simplicity and elegance, at the cost of excessive (constrained) phase-space variables.
For example, for free motion on a circle, n = 1, for x$_1$ ≡ z and eliminating x$_2$ from the circle constraint yields the unconstrained
    $L={\frac {1}{2}}{\frac {{\dot {z}}^{2}}{1-z^{2}}}~,$
with equations of motion
    ${\ddot {z}}=-z{\frac {{\dot {z}}^{2}}{1-z^{2}}}=-z2E~,$
an oscillation; whereas the equivalent constrained system with H = p$^2$/2 = E yields
    ${\dot {x}}^{i}=\{x^{i},H\}_{DB}=p^{i}~,$
    ${\dot {p}}^{i}=\{p^{i},H\}_{DB}=-x^{i}~p^{2}~,$
whence, instantly, virtually by inspection, oscillation for both variables,
    ${\ddot {x}}^{i}=-x^{i}2E~.$