Matrices as Vectors

This week’s post will be a short little dive into some of the lesser-known back-waters of linear algebra. As discussed in other posts, a vector space is a rather generic thing with applications to a wide variety of situations that often look quite different than the traditional length-and-direction or column-array pictures that tend to dot the landscape.

One particularly interesting application, if for no other reason than it helps break the fixation that a vector must look like an arrow or a vertically stacked set of numbers is the application to the set of $$2\times2$$ matrices generically denoted as

\[ M = \left[ \begin{array}{cc} a & b \\ c & d \end{array} \right] \; ,\]

where the unspecified numbers $$\left\{a, b, c, d\right\}$$ can be complex.

There are two bases that are nice to use. One is the obvious ‘natural’ basis spanned by vectors

\[ \left| v_1 \right \rangle = \left[ \begin{array}{cc} 1 & 0 \\ 0 & 0 \end{array} \right] \; ,\]

\[ \left| v_2 \right \rangle = \left[ \begin{array}{cc} 0 & 1 \\ 0 & 0 \end{array} \right] \; ,\]

\[ \left| v_3 \right \rangle = \left[ \begin{array}{cc} 0 & 0 \\ 1 & 0 \end{array} \right] \; ,\]

and

\[ \left| v_4 \right \rangle = \left[ \begin{array}{cc} 0 & 0 \\ 0 & 1 \end{array} \right] \; .\]

The matrix $$M$$ is then decomposed, by inspection, to be

\[ \left| M \right \rangle = a \left| v_1 \right \rangle + b \left| v_2 \right \rangle + c \left| v_3 \right \rangle + d \left| v_4 \right \rangle \; .\]

Note the use of Dirac notation for both the basis vectors and the matrix $$M$$. The reason for this notational standard is that it will suggest how to get the components without using inspection, which will be the goal for computer-based decomposition for the second basis discussed below.

The usual way perform decomposition is to provide a natural inner product – bra with ket – so that, for example,

\[ a = \left \langle w_1 \right | \left . M \right \rangle \; .\]

So what is the rule for the bra $$\left \langle w_1 \right |$$? It can’t be the usual complex-conjugate, transpose since the right-hand side of the previous equation is a $$2\times2$$ matrix but the left-hand side is a scalar. Clearly, an added ingredient is needed. And, as will be shown below, that added ingredient is taking the trace.

How then to establish this? Start by assuming the usual definition of the bra; that is let’s ignore the trace piece for the moment and define

\[ \left \langle w_i \right | = \left| v_i \right \rangle^{\dagger} \; i = 1,2,3,4 \; .\]

The basic requirement to impose on the bra-ket relationship is

\[ \left \langle w_i \right | \left . v_j \right \rangle = \delta_{ij} \; . \]

There are 16 possible combinations, but one really only need look at a subset to infer the pattern. For convenience, take $$i=1$$ and let $$j=1,2,3,4$$. The four resulting products are:

\[ \left \langle w_1 \right | \left. v_1 \right \rangle = \left[ \begin{array}{cc} 1 & 0 \\ 0 & 0 \end{array} \right] \; ,\]

\[ \left \langle w_1 \right | \left. v_2 \right \rangle = \left[ \begin{array}{cc} 0 & 1 \\ 0 & 0 \end{array} \right] \; ,\]

\[ \left \langle w_1 \right | \left. v_3 \right \rangle = \left[ \begin{array}{cc} 0 & 0 \\ 0 & 0 \end{array} \right] \; ,\]

and

\[ \left \langle w_1 \right | \left. v_4 \right \rangle = \left[ \begin{array}{cc} 0 & 0 \\ 0 & 0 \end{array} \right] \; .\]

The other 12 products are similar. For each value of $$i$$, the matrix corresponding to $$j=i$$ has a single $$1$$ on the diagonal. Of the three matrices that result from $$j \neq i$$, two matrices are identically zero and the other one has a $$1$$ on the off-diagonal. So to get a single outcome, $$0$$ for $$j \neq i$$ and $$1$$ for $$j=i$$, simply take the trace of the resulting matrix.

This algorithm applies equally well to the second basis, which is one that is based a set of matrices commonly found in modern physics. This basis is spanned by the $$2\times2$$ identity matrix and the Pauli matrices:

\[ \left| I \right \rangle = \left[ \begin{array}{cc} 1 & 0 \\ 0 & 1 \end{array} \right] \; ,\]

\[ \left| \sigma_x \right \rangle = \left[ \begin{array}{cc} 0 & 1 \\ 1 & 0 \end{array} \right] \; ,\]

\[ \left| \sigma_y \right \rangle = \left[ \begin{array}{cc} 0 & -i \\ i & 0 \end{array} \right] \; ,\]

and

\[ \left| \sigma_z \right \rangle = \left[ \begin{array}{cc} 1 & 0 \\ 0 & -1 \end{array} \right] \; .\]

There are two important points to raise here. First, the bra-forms of this basis are identical to the basis itself. Second, each Pauli matrix is trace-free. Together these two properties simplify things. To see this, start with the observation (which is well established in quantum mechanics texts) that the Pauli matrices obey the equation

\[ \sigma_i \sigma_j = i \epsilon_{i j k} \sigma_k + \delta_{ij} I \; .\]

Thus the trace-enabled inner product (bra-ket) adaptation that we are discussing becomes

\[ \left \langle \sigma_i \right | \left . \sigma_j \right \rangle = 2 \delta_{i j} \; , \]

where the first term on the right-hand side is zero since the Pauli matrices are traceless.

There are two other types of combinations to consider. One an inner product where one member is the identity matrix and the other is a Pauli matrix. That inner product is zero again because the Pauli matrices are trace-free. The second one inner product of the identity matrix with itself, which is simply $$2$$.

Decomposition by inspection really isn’t possible for a generic form of $$M$$, but a simple algorithm to perform the decomposition based on the analysis above is easy to implement. The code to perform these computations in wxMaxima is:

compose_matrix_2d(list) := (
block([id2,sigma_x,sigma_y,sigma_z,M],
id2 : matrix([1,0],[0,1]),
sigma_x : matrix([0,1],[1,0]),
sigma_y : matrix([0,-%i],[%i,0]),
sigma_z : matrix([1,0],[0,-1]),

M : map(ratsimp,list[1]*id2 + list[2]*sigma_x + list[3]*sigma_y + list[4]*sigma_z)
)
)$

decompose_matrix_2d(M) := (
block([id2,sigma_x,sigma_y,sigma_z,spec],
id2 : matrix([1,0],[0,1]),
sigma_x : matrix([0,1],[1,0]),
sigma_y : matrix([0,-%i],[%i,0]),
sigma_z : matrix([1,0],[0,-1]),
spec : [0,0,0,0],
spec[1] : ratsimp(matrix_trace_2d( id2 . M )/2),
spec[2] : ratsimp(matrix_trace_2d( sigma_x . M )/2),
spec[3] : ratsimp(matrix_trace_2d( sigma_y . M )/2),
spec[4] : ratsimp(matrix_trace_2d( sigma_z . M )/2),
spec
)
)$
matrix_trace_2d(M) := (
block( result : M[1,1] + M[2,2] )
)$

For a general matrix

\[ M = \left[ \begin{array}{cc} i & -3 + 4 i \\ 19 & 6 + 5 i \end{array} \right] \; \]

the components are

\[ M \doteq \left[ \begin{array}{c} 3 + 3 i \\ 8 + 2 i \\ -2 – 11 i \\ -3 – 2 i \end{array} \right] \]

a result that the reader is invited to confirm by performing the linear combination and which the reader is challenged to arrive at more easily than the method given here.