Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

QuantumPlaybook

Guides

  • QuantumPlaybook

Tech Notes

  • Addition of Numbers
  • Baker-Hausdorff Lemma
  • Chiral Fermion Random Circuit
  • Clifford Operators: How to Test
  • Commutation Relations for Qubits
  • Entanglement Distillation
  • Generalized Pauli Operators: Implementation
  • Hatano-Nelson-Kitaev Model: Monte Carlo Simulation
  • Hatano-Nelson Model: Monte Carlo Simulation
  • Kitaev Chain
  • Kitaev Random Circuit
  • Λ-Matter in a Cavity
  • Measurement of Total Pauli Z
  • Non-Unitary Dynamics of Quantum States
  • Partial Trace: Physical Meaning
  • Quantum Dot Systems
  • A Quantum Playbook
  • Magnetic Exchange Coupling
  • Solovay-Kitaev Algorithm
  • Spin Code
  • Symmetry Effects On Quantum Master Equations
  • Transmon: Quantum Phase Model
  • Transposition as a Supermap
  • Variational Quantum Classifier: Iris
  • Variational Quantum Classifier: Parity
  • Variational Quantum Eigensolver: Transverse-Field Ising Model

Symbols

  • BlochEnergy
  • BlochFunction
  • QuantumPlaybookCheckUpdate
  • QuantumPlaybookEdition
  • QuantumPlaybookUpdate
  • TransmonEnergy
  • TransmonExponent
  • TransmonFunction
  • TransmonHamiltonian
Partial Trace: Physical Meaning
See also Section 1.3 and Appendix B.3 of the
Quantum Workbook (Springer, 2022)
.
The physical meaning of partial trace is examined through a toy model and demonstration with it.
PartialTrace
Partial trace over a subsystem of the system
Functions related to this tutorial.
Make sure to load Q3.
In[304]:=
Needs["QuantumMob`Q3`"]
In[305]:=
Let[Qubit,S]​​Let[Complex,c]
Consider a system of two qubits. The first and second qubit are regarded as the system and environment, respectively.
In[307]:=
bs=Basis[S@{1,2}]
Out[307]=

0
S
1
0
S
2
,
0
S
1
1
S
2
,
1
S
1
0
S
2
,
1
S
1
1
S
2

In[309]:=
cc=Flatten@Array[c,{2,2}]
Out[309]=
{
c
1,1
,
c
1,2
,
c
2,1
,
c
2,2
}
Consider a state vector for the total system.
In[310]:=
ket=bs.cc
Out[310]=
c
1,1

0
S
1
0
S
2
+
c
1,2

0
S
1
1
S
2
+
c
2,1

1
S
1
0
S
2
+
c
2,2

1
S
1
1
S
2

The state of the “system” qubit is determined by the state of the “environment” qubit.
In[321]:=
KetFactor[ket,S[2]]
Out[321]=

0
S
2
⊗
c
1,1

0
S
1
+
c
2,1

1
S
1
+
1
S
2
⊗
c
1,2

0
S
1
+
c
2,2

1
S
1

The above dependence may also be seen by measuring the “environment” qubit.
In[350]:=
odds=MeasurementOdds[S[2,3]][ket]
Out[350]=
0
2

c
1,1

+
2

c
2,1

2

c
1,1

+
2

c
1,2

+
2

c
2,1

+
2

c
2,2

,
c
1,1

0
S
1
0
S
2
+
c
2,1

1
S
1
0
S
2
,1
2

c
1,2

+
2

c
2,2

2

c
1,1

+
2

c
1,2

+
2

c
2,1

+
2

c
2,2

,
c
1,2

0
S
1
1
S
2
+
c
2,2

1
S
1
1
S
2

In the above expressions, the normalization of state vector ket is not implied. Imposing the normalization, the above expression reads as follows.
In[352]:=
odds=MeasurementOdds[S[2,3]][ket]/.{Total[Abs[cc]^2]1}//SimplifyThrough
Out[352]=
0
2

c
1,1

+
2

c
2,1

,
c
1,1

0
S
1
0
S
2
+
c
2,1

1
S
1
0
S
2
,1
2

c
1,2

+
2

c
2,2

,
c
1,2

0
S
1
1
S
2
+
c
2,2

1
S
1
1
S
2

Note also that the post-measurement states are not normalized; this is typically the case when the state before measurement is not numeric. Let us thus normalize them.
In[356]:=
odds=Map[KetNormalize,odds,{2}]
Out[356]=
0
2

c
1,1

+
2

c
2,1

,
c
1,1

0
S
1
0
S
2

c
1,1
*
c
1,1
+
c
2,1
*
c
2,1
+
c
2,1

1
S
1
0
S
2

c
1,1
*
c
1,1
+
c
2,1
*
c
2,1
,1
2

c
1,2

+
2

c
2,2

,
c
1,2

0
S
1
1
S
2

c
1,2
*
c
1,2
+
c
2,2
*
c
2,2
+
c
2,2

1
S
1
1
S
2

c
1,2
*
c
1,2
+
c
2,2
*
c
2,2

The above expression specifies the statistical ensemble of pure states for the “system” qubit. This ensemble can be described by the density operator.
In[358]:=
rho=Total[First[#]*Dyad[Last[#],Last[#],S[1]]&/@KetDrop[odds,S[2]]]//FullGarner
Out[358]=

2

c
1,1

+
2

c
1,2


0
S
1

0
S
1
+
c
1,1
*
c
2,1
+
c
1,2
*
c
2,2

0
S
1

1
S
1
+
c
2,1
*
c
1,1
+
c
2,2
*
c
1,2

1
S
1

0
S
1
+
2

c
2,1

+
2

c
2,2


1
S
1

1
S
1

In[360]:=
rho=Elaborate@Total[First[#]*Dyad[Last[#],Last[#],S[1]]&/@KetDrop[odds,S[2]]]
Out[360]=
1
2

c
1,1
*
c
1,1
+
c
1,2
*
c
1,2
+
c
2,1
*
c
2,1
+
c
2,2
*
c
2,2
+
1
2

c
2,1
*
c
1,1
+
c
2,2
*
c
1,2
+
c
1,1
*
c
2,1
+
c
1,2
*
c
2,2

x
S
1
-
1
2

c
2,1
*
c
1,1
+
c
2,2
*
c
1,2
-
c
1,1
*
c
2,1
-
c
1,2
*
c
2,2

y
S
1
+
1
2

c
1,1
*
c
1,1
+
c
1,2
*
c
1,2
-
c
2,1
*
c
2,1
-
c
2,2
*
c
2,2

z
S
1
You can see this is identical to the result when one takes the partial trace over the “environment” qubit.
In[362]:=
new=Elaborate@PartialTrace[ket,S[2]]
Out[362]=
1
2

c
1,1
*
c
1,1
+
c
1,2
*
c
1,2
+
c
2,1
*
c
2,1
+
c
2,2
*
c
2,2
+
1
2

c
2,1
*
c
1,1
+
c
2,2
*
c
1,2
+
c
1,1
*
c
2,1
+
c
1,2
*
c
2,2

x
S
1
-
1
2

c
2,1
*
c
1,1
+
c
2,2
*
c
1,2
-
c
1,1
*
c
2,1
-
c
1,2
*
c
2,2

y
S
1
+
1
2

c
1,1
*
c
1,1
+
c
1,2
*
c
1,2
-
c
2,1
*
c
2,1
-
c
2,2
*
c
2,2

z
S
1
In[364]:=
new-rho//Simplify
Out[364]=
0
From this example, we conclude that taking the partial trace over a subsystem corresponds to ignoring the subsystem.
RelatedGuides
▪
Quantum Computation and Information
RelatedTechNotes
▪
A Quantum Playbook
▪
Quantum States
RelatedLinks
▪
Mahn-Soo Choi (2022)
, A Quantum Computation Workbook (Springer, 2022).
""

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com