(* Some matrix functions *)
Commutator[A_, B_] := A.B-B.A
AntiCommutator[A_,B_] := A.B+B.A

(* The algebra of certain matrices *)

(* Definitions *)
cps={{0,1,0},{0,0,1},{1,0,0}}
p12={{0,1,0},{1,0,0},{0,0,1}}
cpd = cps.cps
p23=cpd.p12.cps
p31=cps.p12.cpd

(* The algebra of certain matrices *)

(* The commutators *)
Commutator[p12,p23]
Commutator[p23,p31]
Commutator[p31,p12]
Commutator[cps,cpd]
Commutator[p12,cps]
Commutator[p23,cps]
Commutator[p31,cps]
Commutator[p12,cpd]
Commutator[p23,cpd]
Commutator[p31,cpd]

(* The algebra of certain matrices *)

(* The anti-commutators *)
AntiCommutator[p12,p23]
AntiCommutator[p23,p31]
AntiCommutator[p31,p12]
AntiCommutator[cps,cpd]
AntiCommutator[p12,cps]
AntiCommutator[p23,cps]
AntiCommutator[p31,cps]
AntiCommutator[p12,cpd]
AntiCommutator[p23,cpd]
AntiCommutator[p31,cpd]