# SymmetricProjection

SymmetricProjection | |

Produces the projection onto the symmetric subspace | |

Other toolboxes required | none |
---|---|

Related functions | AntisymmetricProjection PermutationOperator SwapOperator |

Function category | Permutations and symmetry of subsystems |

` SymmetricProjection` is a function that computes the orthogonal projection onto the symmetric subspace of two or more subsystems. The output of this function is always a sparse matrix.

## Syntax

`PS = SymmetricProjection(DIM)``PS = SymmetricProjection(DIM,P)``PS = SymmetricProjection(DIM,P,PARTIAL)``PS = SymmetricProjection(DIM,P,PARTIAL,MODE)`

## Argument descriptions

`DIM`: The dimension of each of the subsystems.`P`(optional, default 2): The number of subsystems.`PARTIAL`(optional, default 0): If`PARTIAL = 1`then`PS`isn't the orthogonal projection itself, but rather a matrix whose columns form an orthonormal basis for the symmetric subspace (and hence`PS*PS'`is the orthogonal projection onto the symmetric subspace).`MODE`(optional, default -1): A flag that determines which of two algorithms is used to compute the symmetric projection. If`MODE = -1`then this script chooses which algorithm it thinks will be faster based on the values of`DIM`and`P`. If you wish to force the script to use a specific one of the algorithms (not recommended!), they are as follows:`MODE = 0`: Computes the symmetric projection by explicitly constructing an orthonormal basis of the symmetric subspace. The details of how to construct such a basis can be found in^{[1]}. This method is typically fast when`DIM`is small compared to`P`.`MODE = 1`: Computes the symmetric projection by averaging all`P!`permutation operators (in the sense of the`PermutationOperator`function). Because`P!`grows very quickly, this method is only practical when`P`is small.

## Examples

### Two subsystems

To compute the symmetric projection on two-qubit space, the following code suffices:

```
>> SymmetricProjection(2)
ans =
(1,1) 1.0000
(2,2) 0.5000
(3,2) 0.5000
(2,3) 0.5000
(3,3) 0.5000
(4,4) 1.0000
```

Note that the output of this function is always sparse. If you want a full matrix (not recommended for even moderately large `DIM` or `P`), you must explicitly convert it (as in the following example).

### Three subsystems

To compute a matrix whose columns form an orthonormal basis for the symmetric subspace of three-qubit space, set `PARTIAL = 1`:

```
>> PS = full(SymmetricProjection(2,3,1))
PS =
1.0000 0 0 0
0 0 -0.5774 0
0 0 -0.5774 0
0 0 0 -0.5774
0 0 -0.5774 0
0 0 0 -0.5774
0 0 0 -0.5774
0 1.0000 0 0
```

Note that `PS` is an isometry from the symmetric subspace to the full three-qubit space. In other words, `PS'*PS` is the identity matrix and `PS*PS'` is the orthogonal projection onto the symmetric subspace, which we can verify as follows:

```
>> PS'*PS
ans =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
>> PS*PS'
ans =
1.0000 0 0 0 0 0 0 0
0 0.3333 0.3333 0 0.3333 0 0 0
0 0.3333 0.3333 0 0.3333 0 0 0
0 0 0 0.3333 0 0.3333 0.3333 0
0 0.3333 0.3333 0 0.3333 0 0 0
0 0 0 0.3333 0 0.3333 0.3333 0
0 0 0 0.3333 0 0.3333 0.3333 0
0 0 0 0 0 0 0 1.0000
```

## Source code

Click here to view this function's source code on github.

## Notes

When using `PARTIAL = 1` and `MODE = 1`, there is no guarantee about what the orthonormal basis of the symmetric subspace will look like. If you want control over this, specify `MODE = 0`, which forces the basis (i.e., the columns of `PS`) to be symmetric tensors \(|i_1\rangle \vee |i_1\rangle \vee \cdots \vee |i_p\rangle\). Since May 2, 2022, the columns of `PS` are these symmetric tensors in lexicographical order (prior to that date they were returned in a different order).

## References

- ↑ John Watrous. Lecture 21: The quantum de Finetti theorem,
*Theory of Quantum Information Lecture Notes*, 2008.