Tensor product of Quantum States using Dirac's BraKet Notation  2018
There has been increasing interest in the details of the Maple implementation of tensor products using Dirac's notation, developed during 2018. Tensor products of Hilbert spaces and related quantum states are relevant in a myriad of situations in quantum mechanics, and in particular regarding quantum information. Below is a presentation uptodate of the design and implementation, with input/output and examples, organized in four sections:
• 
The basic ideas and design implemented

• 
Tensor product notation and the hideketlabel option

• 
Entangled States and the Bell basis

• 
Entangled States, Operators and Projectors

Part of this development is present in Maple 2018.2. To reproduce what you see below, however, you need a more recent version, as the one distributed within the Maplesoft Physics Updates (version 272 or higher).

The basic ideas and design implemented


Suppose and are quantum operators and are, respectively, their eigenkets. The following works since the introduction of the Physics package in Maple
> 

> 


(1.1) 
> 


(1.2) 
> 


(1.3) 
In previous Maple releases, all quantum operators are supposed to act on the same Hillbert space. New: suppose that and act on different, disjointed, Hilbert spaces.
1) To represent that situation, a new keyword in Setup , , is introduced. With it you can indicate the quantum operators that act on a Hilbert space, say as in with the meaning that the operator acts on one Hilbert space while acts on another one.
The Hilbert space thus has no particular name (as in 1, 2, 3 ...) and is instead identified by the operators that act on it. There can be one or more, and operators acting on one space can act on other spaces too. The disjointedspaces keyword is a synonym for hilbertspaces and hereafter all Hilbert spaces are assumed to be disjointed.
NOTE: noncommutative quantum operators acting on disjointed spaces commute between themselves, so after setting  for instance  , automatically, become quantum operators satisfying (see comment (ii) on page 156 of ref.[1])
2) Product of Kets and Bras that belong to different Hilbert spaces, are understood as tensor products satisfying (see footnote on page 154 of ref. [1]):
while
3) All the operators of one Hilbert space act transparently over operators, Bras and Kets of other Hilbert spaces. For example

and the same for the Dagger of this equation, that is


Hence, when we write the lefthand sides of the two equations above and press enter, they are automatically rewritten (returned) as the righthand sides.

4) Every other quantum operator, set as such using Setup , and not indicated as acting on any particular Hilbert space, is assumed to act on all spaces.
5) Notation:
• 
A new Setup option hideketlabel , makes all the labels in Kets and Bras to be hidden at the time of displaying Kets, Bras and Bracket, so when you set it entering ,


This is the notation frequently used when working with angular momentum or in quantum information, where tensor products of Hilbert spaces are used.



Tensor product notation and the hideketlabel option


According to the design section, set now two disjointed Hilbert spaces with operators acting on one of them and on the other one (you can think of )
> 


(2.1) 
Consider a tensor product of Kets, each of which belongs to one of these different spaces, note the new notation using
> 


(2.2) 
• 
As explained in the Details of the design section, the ordering of the Hilbert spaces in tensor products is now preserved: Bras (Kets) of the first space always appear before Bras (Kets) of the second space. For example, construct a projector into the state (2.2)

> 


(2.3) 
You see that in the product of Bras, and also in the product of Kets, A comes first, then B.
Remark: some textbooks prefer a diadic style for sorting the operands in products of Bras and Kets that belong to different spaces, for example, instead of the projector sorting style of (2.3). Both reorderings of Kets and Bras are mathematically equal.
• 
Because that ordering is preserved, one can now hide the label of Bras and Kets without ambiguity, as it is usual in textbooks (e.g. in Quantum Information). For that purpose use the new keyword option hideketlabel

> 


(2.4) 
The display for (2.3) is now
> 


(2.5) 
Important: this new option only hides the label while displaying the Bra or Ket. The label, however, is still there, both in the input and in the output. One can "see" what is behind this new display using show, that works the same way as it does in the context of CompactDisplay . The actual contents being displayed in (2.5) is thus (2.3)
> 


(2.6) 
Operators of each of these spaces act on their eigenkets as usual. Here we distribute over both sides of an equation, using `*` on the lefthand side, to see the product uncomputed, and `.` on the righthand side to see it computed:
> 


(2.7) 
> 


(2.8) 
• 
The tensor product of operators belonging to different Hilbert spaces is also displayed using 5

> 


(2.9) 
• 
As mentioned in the preceding design section, using the commutativity between operators, Bras and Kets that belong to different Hilbert spaces, within a product, operators are placed contiguous to the Kets and Bras belonging to the space where the operator acts. For example, consider the delayed product represented using the start `*` operator

> 


(2.10) 
Release the product
> 


(2.11) 
The same operation but now using the dot product `.` operator. Start by delaying the operation
> 


(2.12) 
Recalling that this product is mathematically the same as (2.11), and that
> 


(2.13) 
by releasing the delayed product (2.12) we have
> 


(2.14) 
Reset hideketlabel
> 


(2.15) 


Entangled States and the Bell basis


With the introduction of disjointed Hilbert spaces in Maple it is possible to represent entangled quantum states in a simple way, basically as done with paper and pencil.
Recalling the Hilbert spaces set at this point are,
> 


(3.1) 
where acts on the tensor product of the spaces where and act. A state of can then always be written as
> 


(3.2) 
where is a matrix of complex coefficients. Bra states of are formed as usual taking the Dagger
> 


(3.3) 
• 
By definition, all states that can be written exactly as , that is, the product of a arbitrary state of the subspace A and another of the subspace B, are product states, and all the other ones are entangled states. Entangelment is a property that is independent of the basis used in (3.2).
The physical interpretation is the standard one: when the state of a system constituted by two subsystems A and B is represented by a product state, the properties of the subsystem A are well defined and all given by while those for the subsystem B by . When the system is in an entangled state one typically cannot assign definite properties to the individual subsystems A or B, each subsystem has no independent reality.
To determine whether a state is or not entangled it then suffices to check the rank R of the matrix (see LinearAlgebra:Rank ): when the state is a product state, otherwise it is an entangled state. When the state being analized belongs to the tensor product of two subspaces, .is equivalent to having the determinant of equal to 0. The condition , however, is more general, and suffices to determine whether a state is a product state also on a Hilbert space that is the tensor product of three or more subspaces: , in which case the matrix M will have more rows and columns and a determinant equal to 0 would only warrant the possibility of factorizing one Ket.

Example: the Bell basis for a system of two qubits
Consider a 2dimensional space of states acted upon by the operator , and let act upon another, disjointed, Hilbert space that is a replica of the Hilbert space on which acts. Set the dimensions of , and respectively equal to 2, 2 and 2x2 (see Setup)
> 


(3.4) 
The system C with the two subsystems A and B represents the a two qubits system. The standard basis for C can be constructed in a natural way from the basis of Kets of A and B, , by taking their tensor products:
> 


(3.5) 
Set a more mathematical display for the imaginary unit
> 

The four entangled Bell states also form a basis of C and are given by
> 


(3.6) 
> 


(3.7) 
> 


(3.8) 
> 


(3.9) 
> 


(3.10) 
There is no standard notation for denoting a Bell state (the linar combinations of the righthand sides above). The convention used here relates to the definition of the Bell states related to the Pauli matrices shown below. Regardless fo the convention used, this basis is orthonormal. That can be verified by taking dot products, for example:
> 


(3.11) 
In steps, perform the same operation but using the star (`*`) operator, so that the contraction is represented but not performed
> 


(3.12) 
Evaluate now the result at `*` = `.`, that is transforming the star product into a dot product
> 


(3.13) 
> 


(3.14) 
> 


(3.15) 
The Bell basis and its relation with the Pauli matrices
The Bell basis can be constructed departing from using the Pauli matrices . For that purpose, using a Vector representation for ,

(3.16) 
> 


(3.17) 
Multiplying by each of the Pauli Matrices and performing the matrix operations we have
> 


(3.18) 
> 


(3.19) 
In this result we see that and flip the state, transforming into , also multiplies the state by the imaginary unit , while leaves the state unchanged.
We can rewrite all that by removeing from (3.19) the Vector representations of (3.17). For that purpose, create a list of substitution equations, replacing the Vectors by the Kets
> 


(3.20) 
So the action of in is given by
> 


(3.21) 
For , the same operations result in
> 


(3.22) 
> 


(3.23) 
> 


(3.24) 
To obtain the other three Bell states using the results (3.21) and (3.24), indicate to the system that the Pauli matrices operate in the subspace where operates
> 


(3.25) 
Multiplying given in (3.7) by each of the three we get the other three Bell states
> 


(3.26) 
> 


(3.27) 
Substitute in this result the first equations of (3.21) and (3.24)
> 


(3.28) 
> 


(3.29) 
> 


(3.30) 
> 


(3.31) 
This is defined in (3.8)
> 


(3.32) 
> 


(3.33) 
Multiplying now by and substituting using the equations of (3.21) and (3.24) we get
> 


(3.34) 
> 


(3.35) 
> 


(3.36) 
> 


(3.37) 
The above is defined in (3.9)
> 


(3.38) 
> 


(3.39) 
Finally, multiplying by
> 


(3.40) 
Substituting
> 


(3.41) 
> 


(3.42) 
We get
> 


(3.43) 
which is
> 


(3.44) 
> 


(3.45) 


Entangled States, Operators and Projectors


Consider a fourth operator, , that is Hermitian and acts on the same space of , and then it has the same dimension,
> 


(4.1) 
To operate in a practical way with these operators, Bras and Kets, however, bracket rules reflecting their relationship are necessary. From the definition of as acting on the tensor product of spaces where and act (see (3.2)) and taking into account the dimensions specified for , and we have
> 


(4.2) 
> 


(4.3) 
> 


(4.4) 
> 


(4.5) 
The bracket rules for , and are the first two of these; Set these rules, so that the system can take them into account
> 


(4.6) 
If we now recompute (4.5), the lefthand side is also computed
> 


(4.7) 
> 


(4.8) 
Suppose now that you want to compute with the Hermitian operator , that operates on the same space as , both using C using the operators and , as in
where = when is a product (not entagled) state.
For it suffices to set a bracket rule
> 


(4.9) 
After that, the system operates taking the rule into account
> 


(4.10) 
Regarding , since belongs to the tensor product of spaces A and B, it can be an entangled operator, one that you cannot represent just as a product of one operator acting on A times another one acting on B. A computational representation for the operator (that is not just itself or as abstract) is not possible in the general case. For that you can use a different feature: define the action of the operator on Kets of and .
Basically, we want:
A program sketch for that would be:
if H is applied to a Ket of A or B then
if H itself is indexed then
return H accumulating its indices, followed by the index of the Ket
else
return H indexed by the index of the Ket;
otherwise
return the dot product operation uncomputed, unevaluated
In Maple language, that programsketch becomes
> 

Let's see it in action. Start erasing the Physics performance remember tables, that remember results like computed before the definition of
> 

> 


(4.11) 
Recalling that is Hermitian,
> 


(4.12) 
> 


(4.13) 
> 


(4.14) 
> 


(4.15) 
Note that the definition of as a procedure does not interfer with the setting of an bracket rule for it with , that is still working
> 


(4.16) 
but the definition takes precedence, so if in it you indicate what to do with a Ket, that will be taken into account before the bracket rule. Finally, In the typical case, the first four results, (4.11), (4.12), (4.13) and (4.14) are operators while (4.15) is a scalar; you can always represent the scalar aspect by substituing the noncommutative operator by a related scalar, say H.
• 
You can set the projectors for all these operators / spaces. For example,

> 


(4.17) 
Since the algebra rules for computing with eigenkets of , and were already set in (4.6), from the projectors above you can construct any subspace projector, for example
> 


(4.18) 
> 


(4.19) 
The conjugate of is due to the contraction or attachment from the right of (4.18), that is with
> 


(4.20) 
The coefficients satisfy constraints due to the normalization of Kets of and . One can derive these contraints by inserting the unit operator constructing this identity

(4.21) 
> 


(4.22) 
Transform this result into a function P to explore the identity further
> 


(4.23) 
The first and third indices refer to the quantum numbers of , the second and fourth to , so the the righthand sides in the following are respectively 1 and 0
> 


(4.24) 
> 


(4.25) 
To get the whole system of equations satisfied by the coefficients , use P to construct an Array with four indices running from 0..1
> 


(4.26) 
Convert the whole Array into a set of equations
> 


(4.27) 

> 

