Part I: Matrix Mechanics

Representation of Operator

Definition of an operator:

(OverHat[O])=(∑_(i,j))(Ket[i])(Subscript[O, i,j])(Bra[j]).

Action of an operator on a basis state:

(OverHat[O])(Ket[j])=(∑_i)(Ket[i])(Subscript[O, i j]).

Matrix representation of an operator

(OverHat[O])≏(({{(Subscript[O, 11]), (Subscript[O, 12]), ⋯}, {(Subscript[O, 21]), (Subscript[O, 22]), ⋯}, {⋮, ⋮, ⋱}})).

(OverHat[O])(Ket[j])→(Subscript[O, i j])(Ket[i])=>({{ , ⋯, j, ⋯}, {⋮,  , ↓,  }, {i, ←, (Subscript[O, i j]),  }, {⋮,  ,  ,  }})

Write down matrix representations of the following single-qubit operators (OverHat[X]), (OverHat[Y]), (OverHat[Z]): 
(OverHat[X])(Ket[0])=(Ket[1]), (OverHat[X])(Ket[1])=(Ket[0]);
(OverHat[Y])(Ket[0])=i (Ket[1]), (OverHat[Y])(Ket[1])=-i(Ket[0]);
(OverHat[Z])(Ket[0])=(Ket[0]), (OverHat[Z])(Ket[1])=-(Ket[1]).

({{ ,  , 0, 1}, { ,  ,  ,  }, {0,  ,  ,  }, {1,  ,  ,  }})(Overscript[=>, (OverHat[X])(Ket[0])=(Ket[1])])({{ ,  , 0, 1}, { ,  , ↓,  }, {0,  , ↓,  }, {1, ←, 1,  }})(Overscript[=>, (OverHat[X])(Ket[1])=(Ket[0])])({{ ,  , 0, 1}, { ,  ,  , ↓}, {0, ←, ←, 1}, {1,  , 1,  }})
therefore:(OverHat[X])≏(({{0, 1}, {1, 0}})).

({{ ,  , 0, 1}, { ,  ,  ,  }, {0,  ,  ,  }, {1,  ,  ,  }})(Overscript[=>, (OverHat[Y])(Ket[0])=i(Ket[1])])({{ ,  , 0, 1}, { ,  , ↓,  }, {0,  , ↓,  }, {1, ←, i,  }})(Overscript[=>, (OverHat[Y])(Ket[1])=-i(Ket[0])])({{ ,  , 0, 1}, { ,  ,  , ↓}, {0, ←, ←, -i}, {1,  , i,  }})
therefore:(OverHat[Y])≏(({{0, -i}, {i, 0}})).

({{ ,  , 0, 1}, { ,  ,  ,  }, {0,  ,  ,  }, {1,  ,  ,  }})(Overscript[=>, (OverHat[Z])(Ket[0])=(Ket[0])])({{ ,  , 0, 1}, { ,  , ↓,  }, {0, ←, 1,  }, {1,  ,  ,  }})(Overscript[=>, (OverHat[Z])(Ket[1])=-(Ket[1])])({{ ,  , 0, 1}, { ,  ,  , ↓}, {0,  , 1, ↓}, {1, ←, ←, -1}})
therefore:(OverHat[Z])≏(({{1, 0}, {0, -1}})).

Consider a system of two qubits, called A and B. Write down the matrix representation of (Subscript[(OverHat[X]), A]), (Subscript[(OverHat[Z]), B]), and (Subscript[(OverHat[X]), A])(Subscript[(OverHat[Z]), B]) in the {(Ket[00]), (Ket[01]), (Ket[10]), (Ket[11])} basis.

Rules for (Subscript[(OverHat[X]), A]):

(Subscript[(OverHat[X]), A])(Ket[0?])=(Ket[1?]), (Subscript[(OverHat[X]), A])(Ket[1?])=(Ket[0?]).

Method I: Filling the table

({{ , 00, 01, 10, 11}, {00,  ,  , 1,  }, {01,  ,  ,  , 1}, {10, 1,  ,  ,  }, {11,  , 1,  ,  }})=>(Subscript[(OverHat[X]), A])≏(({{0, 0, 1, 0}, {0, 0, 0, 1}, {1, 0, 0, 0}, {0, 1, 0, 0}}))

Method II: Tensor product

(Underscript[(Subscript[(OverHat[X]), A]), (4×4)])=(Underscript[(OverHat[X]), (2×2)])⊗(Underscript[𝟙, (2×2)])
≏(({{0, 1}, {1, 0}}))⊗(({{1, 0}, {0, 1}}))
=(({{0(({{1, 0}, {0, 1}})), 1(({{1, 0}, {0, 1}}))}, {1(({{1, 0}, {0, 1}})), 0(({{1, 0}, {0, 1}}))}}))
=(({{0, 0, 1, 0}, {0, 0, 0, 1}, {1, 0, 0, 0}, {0, 1, 0, 0}})).

Rules for (Subscript[(OverHat[Z]), B]):

(Subscript[(OverHat[Z]), B])(Ket[?0])=(Ket[?0]), (Subscript[(OverHat[Z]), B])(Ket[?1])=-(Ket[?1]).

Method I: Filling the table

({{ , 00, 01, 10, 11}, {00, 1,  ,  ,  }, {01,  , -1,  ,  }, {10,  ,  , 1,  }, {11,  ,  ,  , -1}})=>(Subscript[(OverHat[Z]), B])≏(({{1, 0, 0, 0}, {0, -1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, -1}}))

Method II: Tensor product

(Underscript[(Subscript[(OverHat[Z]), B]), (4×4)])=(Underscript[𝟙, (2×2)])⊗(Underscript[(OverHat[Z]), (2×2)])
≏(({{1, 0}, {0, 1}}))⊗(({{1, 0}, {0, -1}}))
=(({{1(({{1, 0}, {0, -1}})), 0(({{1, 0}, {0, -1}}))}, {0(({{1, 0}, {0, -1}})), 1(({{1, 0}, {0, -1}}))}}))
=(({{1, 0, 0, 0}, {0, -1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, -1}})).

Rules for (Subscript[(OverHat[X]), A])(Subscript[(OverHat[Z]), B]):

(Subscript[(OverHat[X]), A])(Subscript[(OverHat[Z]), B])(Ket[00])=(Ket[10]),
(Subscript[(OverHat[X]), A])(Subscript[(OverHat[Z]), B])(Ket[01])=-(Ket[11]),
(Subscript[(OverHat[X]), A])(Subscript[(OverHat[Z]), B])(Ket[10])=(Ket[00]),
(Subscript[(OverHat[X]), A])(Subscript[(OverHat[Z]), B])(Ket[11])=-(Ket[01]).

Method I: Filling the table

({{ , 00, 01, 10, 11}, {00,  ,  , 1,  }, {01,  ,  ,  , -1}, {10, 1,  ,  ,  }, {11,  , -1,  ,  }})=>(Subscript[(OverHat[X]), A])(Subscript[(OverHat[Z]), B])≏(({{0, 0, 1, 0}, {0, 0, 0, -1}, {1, 0, 0, 0}, {0, -1, 0, 0}})).

Method II: Tensor product

(Underscript[(Subscript[(OverHat[X]), A])(Subscript[(OverHat[Z]), B]), (4×4)])=(Underscript[(OverHat[X]), (2×2)])⊗(Underscript[(OverHat[Z]), (2×2)])
≏(({{0, 1}, {1, 0}}))⊗(({{1, 0}, {0, -1}}))
=(({{0(({{1, 0}, {0, -1}})), 1(({{1, 0}, {0, -1}}))}, {1(({{1, 0}, {0, -1}})), 0(({{1, 0}, {0, -1}}))}}))
=(({{0, 0, 1, 0}, {0, 0, 0, -1}, {1, 0, 0, 0}, {0, -1, 0, 0}})).

Method III: Matrix multiplication

(Subscript[(OverHat[X]), A])≏(({{0, 0, 1, 0}, {0, 0, 0, 1}, {1, 0, 0, 0}, {0, 1, 0, 0}})), (Subscript[(OverHat[Z]), B])≏(({{1, 0, 0, 0}, {0, -1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, -1}})),

therefore,

(Subscript[(OverHat[X]), A])(Subscript[(OverHat[Z]), B])≏(({{0, 0, 1, 0}, {0, 0, 0, 1}, {1, 0, 0, 0}, {0, 1, 0, 0}}))(({{1, 0, 0, 0}, {0, -1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, -1}}))
=(({{0, 0, 1, 0}, {0, 0, 0, -1}, {1, 0, 0, 0}, {0, -1, 0, 0}})).

Time Evolution

(OverHat[H])=(∑_n)(Ket[n])(Subscript[E, n])(Bra[n]),

(OverHat[U])=(e^(-i (OverHat[H])t))=(∑_n)(Ket[n])(e^(-i (Subscript[E, n])t))(Bra[n]).

State evolution (Schrödinger picture)

({{(Ket[ψ]), →, (OverHat[U])(Ket[ψ])}, {∥,  , ∥}, {(∑_n)(Subscript[ψ, n])(Ket[n]), →, (∑_n)(Subscript[ψ, n])(e^(-i (Subscript[E, n])t))(Ket[n])}})

Operator evolution (Heisenberg picture)

({{(OverHat[O]), →, (SuperDagger[(OverHat[U])])(OverHat[O])(OverHat[U])}, {∥,  , ∥}, {(∑_(m n))(Subscript[O, m n])(Ket[m])(Bra[n]), →, (∑_(m n))(Subscript[O, m n])(e^(i ((Subscript[E, m])-(Subscript[E, n]))t))(Ket[m])(Bra[n])}})

Expectation value evolution (either pictures)

({{(Subscript[⟨O⟩, 0]), →, (Subscript[⟨O⟩, t])}, {∥,  , ∥}, {(Bra[ψ])(OverHat[O])(Ket[ψ]), →, (Bra[ψ])(SuperDagger[(OverHat[U])])(OverHat[O])(OverHat[U])(Ket[ψ])}, {∥,  , ∥}, {(∑_(m n))(Subscript[ψ, m]^( * ))(Subscript[O, m n])(Subscript[ψ, n]), →, (∑_(m n))(Subscript[ψ, m]^( * ))(Subscript[O, m n])(Subscript[ψ, n])(e^(i ((Subscript[E, m])-(Subscript[E, n]))t))}})

Show that the time average of expectation value 
(OverBar[⟨O⟩])=(lim_(T→∞))(1/T)(∫_(-T/2)^(T/2))dt(Subscript[⟨O⟩, t])
only depends on the diagonal matrix elements of (OverHat[O]) in the eigenbasis of (OverHat[H]).

(OverBar[⟨O⟩])=(lim_(T→∞))(1/T)(∫_(-T/2)^(T/2))dt(Subscript[⟨O⟩, t])
=(lim_(T→∞))(1/T)(∫_(-T/2)^(T/2))dt (∑_(m n))(Subscript[ψ, m]^( * ))(Subscript[O, m n])(Subscript[ψ, n])(e^(i ((Subscript[E, m])-(Subscript[E, n]))t))
=(∑_(m n))(Subscript[ψ, m]^( * ))(Subscript[O, m n])(Subscript[ψ, n])(lim_(T→∞))(1/T)(∫_(-T/2)^(T/2))dt (e^(i ((Subscript[E, m])-(Subscript[E, n]))t))
=(∑_(m n))(Subscript[ψ, m]^( * ))(Subscript[O, m n])(Subscript[ψ, n])(lim_(T→∞))(2/(((Subscript[E, m])-(Subscript[E, n]))T))sin(((((Subscript[E, m])-(Subscript[E, n]))T)/2)),

Plot[2/x Sin[x/2],{x,-20π,20π},FrameLabel->{"\!\( x\)","\!\(2\/x sin(x\/2)\)"},PlotStyle->Black,PlotRange->All,ImageSize->220]

(OverBar[⟨O⟩])=(∑_(m n))(Subscript[ψ, m]^( * ))(Subscript[O, m n])(Subscript[ψ, n])(Subscript[δ, m n])
=(∑_n)(Subscript[ψ, n]^( * ))(Subscript[O, n n])(Subscript[ψ, n])
=(∑_n)(Subscript[O, n n])(Subscript[p, n]),

Measurement

(OverHat[O])=(∑_k)(Ket[(Subscript[O, k])])(Subscript[O, k])(Bra[(Subscript[O, k])]).

Possible measurement outcomes: (Subscript[O, k]) (eigenvalues)

Probability to observe a particular outcome (Subscript[O, k]):

p((Subscript[O, k])|ψ)=((|(BraKet[(Subscript[O, k]), ψ])|)^2).

After observing (Subscript[O, k]), the state collapses to:

If there is no degeneracy

(Ket[ψ])→(Ket[(Subscript[O, k])]) .

If there is degeneracy

(Ket[ψ])→(Subscript[α, m])(Ket[(Subscript[O, k]),m]),

where (Subscript[α, m])∝(BraKet[(Subscript[O, k]),m, ψ]) followed by normalization.

Consider a two-qubit system, initially in arbitrary state. Measure (Subscript[(OverHat[X]), A])(Subscript[(OverHat[X]), B]) and (Subscript[(OverHat[Y]), A])(Subscript[(OverHat[Y]), B]) simultaneously. Observe (Subscript[X, A])(Subscript[X, B])=-1 and (Subscript[Y, A])(Subscript[Y, B])=+1. What is the post-measurement final state?

(Subscript[(OverHat[X]), A])(Subscript[(OverHat[X]), B])(Ket[ψ])=-(Ket[ψ]),
(Subscript[(OverHat[Y]), A])(Subscript[(OverHat[Y]), B])(Ket[ψ])=+(Ket[ψ]).

(Subscript[(OverHat[X]), A])(Subscript[(OverHat[X]), B])≏(({{0, 1}, {1, 0}}))⊗(({{0, 1}, {1, 0}}))=(({{0, 0, 0, 1}, {0, 0, 1, 0}, {0, 1, 0, 0}, {1, 0, 0, 0}})),
(Subscript[(OverHat[Y]), A])(Subscript[(OverHat[Y]), B])≏(({{0, -i}, {i, 0}}))⊗(({{0, -i}, {i, 0}}))=(({{0, 0, 0, -1}, {0, 0, 1, 0}, {0, 1, 0, 0}, {-1, 0, 0, 0}})).

(Ket[ψ])≏(({{(Subscript[ψ, 00])}, {(Subscript[ψ, 01])}, {(Subscript[ψ, 10])}, {(Subscript[ψ, 11])}})),

(({{0, 0, 0, 1}, {0, 0, 1, 0}, {0, 1, 0, 0}, {1, 0, 0, 0}}))(({{(Subscript[ψ, 00])}, {(Subscript[ψ, 01])}, {(Subscript[ψ, 10])}, {(Subscript[ψ, 11])}}))=-(({{(Subscript[ψ, 00])}, {(Subscript[ψ, 01])}, {(Subscript[ψ, 10])}, {(Subscript[ψ, 11])}}))
=>(({{(Subscript[ψ, 11])}, {(Subscript[ψ, 10])}, {(Subscript[ψ, 01])}, {(Subscript[ψ, 00])}}))=-(({{(Subscript[ψ, 00])}, {(Subscript[ψ, 01])}, {(Subscript[ψ, 10])}, {(Subscript[ψ, 11])}})),
(({{0, 0, 0, -1}, {0, 0, 1, 0}, {0, 1, 0, 0}, {-1, 0, 0, 0}}))(({{(Subscript[ψ, 00])}, {(Subscript[ψ, 01])}, {(Subscript[ψ, 10])}, {(Subscript[ψ, 11])}}))=(({{(Subscript[ψ, 00])}, {(Subscript[ψ, 01])}, {(Subscript[ψ, 10])}, {(Subscript[ψ, 11])}}))
=>(({{-(Subscript[ψ, 11])}, {(Subscript[ψ, 10])}, {(Subscript[ψ, 01])}, {-(Subscript[ψ, 00])}}))=(({{(Subscript[ψ, 00])}, {(Subscript[ψ, 01])}, {(Subscript[ψ, 10])}, {(Subscript[ψ, 11])}})).

(Subscript[ψ, 00])=-(Subscript[ψ, 11]), (Subscript[ψ, 01])=0, (Subscript[ψ, 10])=0.

(Ket[ψ])≏(({{(Subscript[ψ, 00])}, {(Subscript[ψ, 01])}, {(Subscript[ψ, 10])}, {(Subscript[ψ, 11])}}))=(1/(Sqrt[2]))(({{1}, {0}, {0}, {-1}}))

(Ket[ψ])=(1/(Sqrt[2]))((Ket[00])-(Ket[11])),

Par II: Algebraic Methods

Harmonic Oscillator

Annihilation and creation operators

({{{, ({{(OverHat[a])=(1/(Sqrt[2]))((OverHat[x])+i (OverHat[p]))}, {(SuperDagger[(OverHat[a])])=(1/(Sqrt[2]))((OverHat[x])-i (OverHat[p]))}})}}), ({{{, ({{(OverHat[x])=(1/(Sqrt[2]))((OverHat[a])+(SuperDagger[(OverHat[a])]))}, {(OverHat[p])=(1/((Sqrt[2])i))((OverHat[a])-(SuperDagger[(OverHat[a])]))}})}}).

They satisfies the commutation relation

[(OverHat[x]),(OverHat[p])]=i 𝟙⇔[(OverHat[a]),(SuperDagger[(OverHat[a])])]=𝟙.

Number operator

(OverHat[n])=(SuperDagger[(OverHat[a])])(OverHat[a]).

It defines a discrete spectrum (OverHat[n])(Ket[n])=n(Ket[n]) for n∈ℕ. Such that

(OverHat[a])(Ket[n])=(Sqrt[n])(Ket[n-1]),
(SuperDagger[(OverHat[a])])(Ket[n])=(Sqrt[n+1])(Ket[n+1]).

Hamiltonian

(OverHat[H])=(1/2)ℏ ω (((OverHat[p])^2)+((OverHat[x])^2))=ℏ ω ((OverHat[n])+(𝟙/2)).

Eigen energies

(Subscript[E, n])=ℏ ω(n+(1/2)).

Every eigenstate (Ket[n]) can be raised from the ground state by

(Ket[n])=(1/(Sqrt[n!]))((((SuperDagger[(OverHat[a])])))^n)(Ket[0]).

Calculate (Bra[n])(OverHat[x])(OverHat[p])(Ket[n]).

(Bra[n])(OverHat[x])(OverHat[p])(Ket[n])=(Bra[n])(1/(Sqrt[2]))((OverHat[a])+(SuperDagger[(OverHat[a])]))(1/((Sqrt[2])i))((OverHat[a])-(SuperDagger[(OverHat[a])]))(Ket[n])
=(1/(2i))(Bra[n])((OverHat[a])(OverHat[a])-(OverHat[a])(SuperDagger[(OverHat[a])])+(SuperDagger[(OverHat[a])])(OverHat[a])-(SuperDagger[(OverHat[a])])(SuperDagger[(OverHat[a])]))(Ket[n])
=(1/(2i))(Bra[n])(-(OverHat[a])(SuperDagger[(OverHat[a])])+(SuperDagger[(OverHat[a])])(OverHat[a]))(Ket[n])
=(1/(2i))(Bra[n])(-[(OverHat[a]),(SuperDagger[(OverHat[a])])])(Ket[n])
=(1/(2i))(Bra[n])(-𝟙)(Ket[n])
=(1/(2i))(-1)
=(i/2).

Consider 2D harmonic oscillator, described by 
(OverHat[H])=(1/2)((OverHat[p])^2)+(1/2)((OverHat[x])^2),
where (OverHat[p])=((Subscript[(OverHat[p]), 1]),(Subscript[(OverHat[p]), 2])) and (OverHat[x])=((Subscript[(OverHat[x]), 1]),(Subscript[(OverHat[x]), 2])) with [(Subscript[(OverHat[x]), i]),(Subscript[(OverHat[x]), j])]=[(Subscript[(OverHat[p]), i]),(Subscript[(OverHat[p]), j])]=0 and [(Subscript[(OverHat[x]), i]),(Subscript[(OverHat[p]), j])]=i (Subscript[δ, i j])𝟙. Find the eigen energies of (OverHat[H]) and the corresponding degeneracies.

({{{, ({{(Subscript[(OverHat[a]), i])=(1/(Sqrt[2]))((Subscript[(OverHat[x]), i])+i (OverHat[(Subscript[p, i])]))}, {(Subscript[(OverHat[a]), i]^†)=(1/(Sqrt[2]))((Subscript[(OverHat[x]), i])-i (Subscript[(OverHat[p]), i]))}})}}).

Commutation relations

[(Subscript[(OverHat[a]), i]),(Subscript[(OverHat[a]), j])]=[(Subscript[(OverHat[a]), i]^†),(Subscript[(OverHat[a]), j]^†)]=0, [(Subscript[(OverHat[a]), i]),(Subscript[(OverHat[a]), j]^†)]=(Subscript[δ, i j])𝟙

indicates that they are independent boson modes.

(OverHat[H])=(1/2)((OverHat[p])^2)+(1/2)((OverHat[x])^2)
=(1/2)((Subscript[(OverHat[p]), 1]^2)+(Subscript[(OverHat[x]), 1]^2))+(1/2)((Subscript[(OverHat[p]), 2]^2)+(Subscript[(OverHat[x]), 2]^2))
=((Subscript[(OverHat[n]), 1])+(𝟙/2))+((Subscript[(OverHat[n]), 2])+(𝟙/2))
=(Subscript[(OverHat[n]), 1])+(Subscript[(OverHat[n]), 2])+𝟙

(Subscript[(OverHat[n]), 1])(Ket[(Subscript[n, 1]),(Subscript[n, 2])])=(Subscript[n, 1])(Ket[(Subscript[n, 1]),(Subscript[n, 2])]),
(Subscript[(OverHat[n]), 2])(Ket[(Subscript[n, 1]),(Subscript[n, 2])])=(Subscript[n, 2])(Ket[(Subscript[n, 1]),(Subscript[n, 2])]).

E=(Subscript[n, 1])+(Subscript[n, 2])+1.

Block[{n=5,a=0.2},Graphics[{{Gray,Table[{Line[{{m+1,-1},{-a,m+a}}],Text[StringTemplate["\!\(E=`1`\)"][m+1],{m+1,-1},{-1,0},{1,-1}]},{m,0,n}]},{LightGray,AbsoluteThickness[1],{#,GeometricTransformation[#,ReflectionTransform[{1,-1},{0,0}]]}&@(Translate[Line[{#,0}&/@{0,n+1}],{0,#}]&/@Range[n])},{Arrowheads[0.08],Rotate[Arrow[{#,0}&/@{0,n+1}],π #/2,{0,0}]&/@{0,1}},{AbsolutePointSize[5],Table[Point[{n1,n2}],{n1,0,n},{n2,0,n}]},{Table[Text[n1,{n1,0},{0,1.2}],{n1,n}],Table[Text[n2,{0,n2},{2,0}],{n2,n}],Text[0,{0,0},{2,0.8}]},{Text["\!\(n\_1\)",{n+1,0},{0,1}],Text["\!\(n\_2\)",{0,n+1},{1.5,0}]}},ImageSize->180]]

({{E, 1, 2, 3, ⋯}, {deg., 1, 2, 3, ⋯}})

Following (Exc ). Define (Subscript[(OverHat[S]), 1])=(1/2)((Subscript[(OverHat[x]), 1])(Subscript[(OverHat[x]), 2])+(Subscript[(OverHat[p]), 1])(Subscript[(OverHat[p]), 2])), find the matrix representation of (Subscript[(OverHat[S]), 1]) in the E=2 subspace

{(Ket[2,0]), (Ket[1,1]), (Ket[0,2])}.

Rewrite it in terms of creation/annihilation operators

(Subscript[(OverHat[S]), 1])=(1/2)((Subscript[(OverHat[x]), 1])(Subscript[(OverHat[x]), 2])+(Subscript[(OverHat[p]), 1])(Subscript[(OverHat[p]), 2]))
=(1/2)((1/(Sqrt[2]))((Subscript[(OverHat[a]), 1])+(Subscript[(OverHat[a]), 1]^†))(1/(Sqrt[2]))((Subscript[(OverHat[a]), 2])+(Subscript[(OverHat[a]), 2]^†))+(1/((Sqrt[2])i))((Subscript[(OverHat[a]), 1])-(Subscript[(OverHat[a]), 1]^†))(1/((Sqrt[2])i))((Subscript[(OverHat[a]), 2])-(Subscript[(OverHat[a]), 2]^†)))
=(1/4)(((Subscript[(OverHat[a]), 1])+(Subscript[(OverHat[a]), 1]^†))((Subscript[(OverHat[a]), 2])+(Subscript[(OverHat[a]), 2]^†))-((Subscript[(OverHat[a]), 1])-(Subscript[(OverHat[a]), 1]^†))((Subscript[(OverHat[a]), 2])-(Subscript[(OverHat[a]), 2]^†)))
=(1/4)(((Subscript[(OverHat[a]), 1])(Subscript[(OverHat[a]), 2])+(Subscript[(OverHat[a]), 1]^†)(Subscript[(OverHat[a]), 2])+(Subscript[(OverHat[a]), 1])(Subscript[(OverHat[a]), 2]^†)+(Subscript[(OverHat[a]), 1]^†)(Subscript[(OverHat[a]), 2]^†))-((Subscript[(OverHat[a]), 1])(Subscript[(OverHat[a]), 2])-(Subscript[(OverHat[a]), 1]^†)(Subscript[(OverHat[a]), 2])-(Subscript[(OverHat[a]), 1])(Subscript[(OverHat[a]), 2]^†)+(Subscript[(OverHat[a]), 1]^†)(Subscript[(OverHat[a]), 2]^†)))
=(1/2)((Subscript[(OverHat[a]), 1]^†)(Subscript[(OverHat[a]), 2])+(Subscript[(OverHat[a]), 2]^†)(Subscript[(OverHat[a]), 1])).

Enumerate the action of (Subscript[(OverHat[S]), 1]) on the basis states,

(Subscript[(OverHat[S]), 1])(Ket[2,0])=(1/2)((Subscript[(OverHat[a]), 1]^†)(Subscript[(OverHat[a]), 2])+(Subscript[(OverHat[a]), 2]^†)(Subscript[(OverHat[a]), 1]))(Ket[2,0])
=(1/2)((Subscript[(OverHat[a]), 1]^†)(Subscript[(OverHat[a]), 2])(Ket[2,0])+(Subscript[(OverHat[a]), 2]^†)(Subscript[(OverHat[a]), 1])(Ket[2,0]))
=(1/2)(Subscript[(OverHat[a]), 2]^†)(Subscript[(OverHat[a]), 1])(Ket[2,0])
=((Sqrt[2])/2)(Subscript[(OverHat[a]), 2]^†)(Ket[1,0])
=(1/(Sqrt[2]))(Ket[1,1]),

(Subscript[(OverHat[S]), 1])(Ket[1,1])=(1/2)((Subscript[(OverHat[a]), 1]^†)(Subscript[(OverHat[a]), 2])+(Subscript[(OverHat[a]), 2]^†)(Subscript[(OverHat[a]), 1]))(Ket[1,1])
=(1/2)((Subscript[(OverHat[a]), 1]^†)(Subscript[(OverHat[a]), 2])(Ket[1,1])+(Subscript[(OverHat[a]), 2]^†)(Subscript[(OverHat[a]), 1])(Ket[1,1]))
=(1/2)((Subscript[(OverHat[a]), 1]^†)(Ket[1,0])+(Subscript[(OverHat[a]), 2]^†)(Ket[0,1]))
=((Sqrt[2])/2)((Ket[2,0])+(Ket[0,2]))
=(1/(Sqrt[2]))(Ket[2,0])+(1/(Sqrt[2]))(Ket[0,2])

(Subscript[(OverHat[S]), 1])(Ket[0,2])=(1/2)((Subscript[(OverHat[a]), 1]^†)(Subscript[(OverHat[a]), 2])+(Subscript[(OverHat[a]), 2]^†)(Subscript[(OverHat[a]), 1]))(Ket[0,2])
=(1/2)((Subscript[(OverHat[a]), 1]^†)(Subscript[(OverHat[a]), 2])(Ket[0,2])+(Subscript[(OverHat[a]), 2]^†)(Subscript[(OverHat[a]), 1])(Ket[0,2]))
=(1/2)(Subscript[(OverHat[a]), 1]^†)(Subscript[(OverHat[a]), 2])(Ket[0,2])
=((Sqrt[2])/2)(Subscript[(OverHat[a]), 1]^†)(Ket[0,1])
=(1/(Sqrt[2]))(Ket[1,1]).

Fill the table to construct matrix representation

({{ , (Ket[2,0]), (Ket[1,1]), (Ket[0,2])}, {(Ket[2,0]),  ,  ,  }, {(Ket[1,1]),  ,  ,  }, {(Ket[0,2]),  ,  ,  }})
(Overscript[=>, (Subscript[(OverHat[S]), 1])(Ket[2,0])=(1/(Sqrt[2]))(Ket[1,1])])({{ , (Ket[2,0]), (Ket[1,1]), (Ket[0,2])}, {(Ket[2,0]),  ,  ,  }, {(Ket[1,1]), (1/(Sqrt[2])),  ,  }, {(Ket[0,2]),  ,  ,  }})
(Overscript[=>, (Subscript[(OverHat[S]), 1])(Ket[1,1])=(1/(Sqrt[2]))(Ket[2,0])+(1/(Sqrt[2]))(Ket[0,2])])({{ , (Ket[2,0]), (Ket[1,1]), (Ket[0,2])}, {(Ket[2,0]),  , (1/(Sqrt[2])),  }, {(Ket[1,1]), (1/(Sqrt[2])),  ,  }, {(Ket[0,2]),  , (1/(Sqrt[2])),  }})
(Overscript[=>, (Subscript[(OverHat[S]), 1])(Ket[0,2])=(1/(Sqrt[2]))(Ket[1,1])])({{ , (Ket[2,0]), (Ket[1,1]), (Ket[0,2])}, {(Ket[2,0]),  , (1/(Sqrt[2])),  }, {(Ket[1,1]), (1/(Sqrt[2])),  , (1/(Sqrt[2]))}, {(Ket[0,2]),  , (1/(Sqrt[2])),  }}).

(Subscript[(OverHat[S]), 1])≏(1/(Sqrt[2]))(({{0, 1, 0}, {1, 0, 1}, {0, 1, 0}})).

Angular Momentum

[(Subscript[(OverHat[J]), a]),(Subscript[(OverHat[J]), b])]=i (Subscript[ϵ, a b c])(Subscript[(OverHat[J]), c]).

The total angular momentum operator

((OverHat[J])^2)=(Subscript[(OverHat[J]), 1]^2)+(Subscript[(OverHat[J]), 2]^2)+(Subscript[(OverHat[J]), 3]^2).

The raising and lowering operators

(Subscript[(OverHat[J]), ±])=(Subscript[(OverHat[J]), 1])±i (Subscript[(OverHat[J]), 2]).

((OverHat[J])^2)(Ket[j,m])=j(j+1)(Ket[j,m]),
(Subscript[(OverHat[J]), 3])(Ket[j,m])=m(Ket[j,m]),
(Subscript[(OverHat[J]), ±])(Ket[j,m])=(Sqrt[j(j+1)-m(m±1)])(Ket[j,m±1]),

j=0,(1/2),1,(3/2),…,
m=-j,-j+1,…,j-1,j.

Construct matrix representations of angular momentum operators (Subscript[(OverHat[J]), 1]), (Subscript[(OverHat[J]), 2]), (Subscript[(OverHat[J]), 3]) in the spin-1 subspace.

Use (Subscript[(OverHat[J]), 3])(Ket[j,m])=m(Ket[j,m]), follow the table method

({{ , (Ket[1,+1]), (Ket[1,0]), (Ket[1,-1])}, {(Ket[1,+1]), +1,  ,  }, {(Ket[1,0]),  , 0 ,  }, {(Ket[1,-1]),  ,  , -1 }})

therefore,

(Subscript[(OverHat[J]), 3])≏(({{1, 0, 0}, {0, 0, 0}, {0, 0, -1}})).

Use (SubPlus[(OverHat[J])])(Ket[j,m])=(Sqrt[j(j+1)-m(m+1)])(Ket[j,m+1]), follow the table method

({{ , (Ket[1,+1]), (Ket[1,0]), (Ket[1,-1])}, {(Ket[1,+1]),  , (Sqrt[2]),  }, {(Ket[1,0]),  ,   , (Sqrt[2])}, {(Ket[1,-1]),  ,  ,   }})

therefore

(SubPlus[(OverHat[J])])≏(({{0, (Sqrt[2]), 0}, {0, 0, (Sqrt[2])}, {0, 0, 0}}))
=>(SubMinus[(OverHat[J])])=(Subscript[(OverHat[J]), +]^†)≏(({{0, 0, 0}, {(Sqrt[2]), 0, 0}, {0, (Sqrt[2]), 0}})).

The raising/lowering operators (Subscript[(OverHat[J]), ±]) are the keys to construct (Subscript[(OverHat[J]), 1]) and (Subscript[(OverHat[J]), 2])

(Subscript[(OverHat[J]), 1])=(1/2)((SubPlus[(OverHat[J])])+(SubMinus[(OverHat[J])]))
≏(1/2)((({{0, (Sqrt[2]), 0}, {0, 0, (Sqrt[2])}, {0, 0, 0}}))+(({{0, 0, 0}, {(Sqrt[2]), 0, 0}, {0, (Sqrt[2]), 0}})))
=(1/(Sqrt[2]))(({{0, 1, 0}, {1, 0, 1}, {0, 1, 0}})).

(Subscript[(OverHat[J]), 2])=(1/(2i))((SubPlus[(OverHat[J])])-(SubMinus[(OverHat[J])]))
≏(1/(2i))((({{0, (Sqrt[2]), 0}, {0, 0, (Sqrt[2])}, {0, 0, 0}}))-(({{0, 0, 0}, {(Sqrt[2]), 0, 0}, {0, (Sqrt[2]), 0}})))
=(1/(Sqrt[2]))(({{0, -i, 0}, {i, 0, -i}, {0, i, 0}})).

(Subscript[(OverHat[J]), 1])≏(1/(Sqrt[2]))(({{0, 1, 0}, {1, 0, 1}, {0, 1, 0}})),
(Subscript[(OverHat[J]), 2])=(1/(Sqrt[2]))(({{0, -i, 0}, {i, 0, -i}, {0, i, 0}})),
(Subscript[(OverHat[J]), 3])≏(({{1, 0, 0}, {0, 0, 0}, {0, 0, -1}})).