Problem 2. Consider a
Also calculate the partial trace with the basis:
Solution. The key thing to recall is ta the partial trace defines an operator of a subspace so:
where
xxxxxxxxxx
1
1
using SymPy
x
10
9
10
1
begin
2
⊗(x,y)=kron(x,y)
3
⊗(x::Array{Sym,2},y::Array{Sym,2}) = kron(x,y)
4
⊗(x::Sym,y) = sympy.Matrix(kron(x.as_explicit(),y))
5
⊗(x,y::Sym) = sympy.Matrix(kron(x,y.as_explicit()))
6
𝐓(x::Array{Sym,2}) = sympy.Matrix(sympy.transpose(x))
7
𝚝𝚛(x) = sympy.trace(x)
8
⋅(x,y) = x*y
9
⋅(x::Union{Sym,SymMatrix},y) = sympy.MatMul(x.as_explicit(),y,evaluate=true)
10
⋅(x,y::Union{Sym,SymMatrix}) = sympy.MatMul(x,y.as_explicit(),evaluate=true)
11
end;
x
10
1
begin
2
A = sympy.MatrixSymbol("A",6,6)
3
4
b₁ = [1;
5
0]
6
7
b₂ = [0;
8
1]
9
10
I₃ = sympy.Identity(3)
11
end;
Calculate the matrices associated with subspace basis.
x
1
begin
2
n₁,n₁ᵀ = b₁⊗I₃,𝐓(b₁⊗I₃)
3
n₂,n₂ᵀ = b₂⊗I₃,𝐓(b₂⊗I₃)
4
end;
Now calculate the partial trace in this basis using the equation above
x
1
n₁ᵀ ⋅ A ⋅ n₁ + n₂ᵀ ⋅ A ⋅ n₂
Now looking at the other basis:
xxxxxxxxxx
1
10
1
begin
2
c₁ = [1;
3
0;
4
0]
5
6
c₂ = [0;
7
1;
8
0]
9
10
c₃ = [0;
11
0;
12
1]
13
14
I₂ = sympy.Identity(2)
15
end;
x
1
begin
2
m₁,m₁ᵀ = c₁⊗I₂,𝐓(c₁⊗I₂)
3
m₂,m₂ᵀ = c₂⊗I₂,𝐓(c₂⊗I₂)
4
m₃,m₃ᵀ = c₃⊗I₂,𝐓(c₃⊗I₂)
5
end;
x
1
m₁ᵀ ⋅ A ⋅ m₁ + m₂ᵀ ⋅ A ⋅ m₂ + m₃ᵀ ⋅ A ⋅ m₃