# How to write a matrix in a different basis by using Mathematica

I have these two 4x4 matrix

Subscript[S, 1] = KroneckerProduct[PauliMatrix, IdentityMatrix]
Subscript[S, 2] = KroneckerProduct[IdentityMatrix, PauliMatrix]


Which are written in the Canonical basis ({{{1}, {0}, {0}, {0}};{{{0}, {1}, {0}, {0}}; {{{0}, {0}, {1}, {0}}; {{{0}, {0}, {0}, {1}})

I would like to write down these two matrices in the following basis:

G := {{0}, {0}, {0}, {1}}

S := (1/Sqrt) {{0}, {1}, {1}, {0}}

A := (1/Sqrt) {{0}, {1}, {-1}, {0}}

EE := {{1}, {0}, {0}, {0}}


Is there any way to do it in Mathematica?

Should be

Subscript[S, 1] = KroneckerProduct[PauliMatrix, IdentityMatrix]
Subscript[S, 2] = KroneckerProduct[IdentityMatrix, PauliMatrix]
basis = {{0, 0, 0, 1}, (1/Sqrt) {0, 1, 1, 0}, (1/Sqrt) {0, 1, -1, 0}, {1, 0, 0, 0}};
Inverse[basis].Subscript[S, 1].Transpose[basis]
Inverse[basis].Subscript[S, 2].Transpose[basis]


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

{{0, I/Sqrt, -(I/Sqrt), 0}, {-(I/Sqrt), 0, 0, I/Sqrt}, {I/ Sqrt, 0, 0, I/Sqrt}, {0, -(I/Sqrt), -(I/Sqrt), 0}}

• I understood what you have done but when I reply it I do not get a matrix as the result. Instead, I get only the full expression of the products. – Soares Jul 21 at 23:31
• Of course, you have to define Subscript[S, 1]  and Subscript[S, 2], first. – Henrik Schumacher Jul 22 at 12:29