## Weird dreams

I woke up today having a dream still in my head from the night, but it was a strange one. I was expanding out the Dirac notation representation of an operator in matrix form, but the symbols in the kets were elaborate pictures of Disney princesses that I was drawing with forestry scenery in the background, including little bears. At the point that I woke up from the dream, I noticed that I’d gotten the proportion of the bears wrong in one of the pictures, and they looked like they were ready to eat one of the princess characters.

## Guts

As a side effect of this weird dream I actually started thinking about matrix element representation of operators.

When forming the matrix element of an operator using Dirac notation the elements are of the form $$\bra{\textrm{row}} A \ket{\textrm{column}}$$. I’ve gotten that mixed up a couple of times, so I thought it would be helpful to write this out explicitly for a $$2 \times 2$$ operator representation for clarity.

To start, consider a change of basis for a single matrix element from basis $$\setlr{\ket{q}, \ket{r} }$$, to basis $$\setlr{\ket{a}, \ket{b} }$$

\label{eqn:operatorMatrixElement:20}
\begin{aligned}
\bra{q} A \ket{r}
&=
\braket{q}{a} \bra{a} A \ket{r}
+
\braket{q}{b} \bra{b} A \ket{r} \\
&=
\braket{q}{a} \bra{a} A \ket{a}\braket{a}{r}
+ \braket{q}{a} \bra{a} A \ket{b}\braket{b}{r} \\
&+ \braket{q}{b} \bra{b} A \ket{a}\braket{a}{r}
+ \braket{q}{b} \bra{b} A \ket{b}\braket{b}{r} \\
&=
\braket{q}{a}
\begin{bmatrix}
\bra{a} A \ket{a} & \bra{a} A \ket{b}
\end{bmatrix}
\begin{bmatrix}
\braket{a}{r} \\
\braket{b}{r}
\end{bmatrix}
+
\braket{q}{b}
\begin{bmatrix}
\bra{b} A \ket{a} & \bra{b} A \ket{b}
\end{bmatrix}
\begin{bmatrix}
\braket{a}{r} \\
\braket{b}{r}
\end{bmatrix} \\
&=
\begin{bmatrix}
\braket{q}{a} &
\braket{q}{b}
\end{bmatrix}
\begin{bmatrix}
\bra{a} A \ket{a} & \bra{a} A \ket{b} \\
\bra{b} A \ket{a} & \bra{b} A \ket{b}
\end{bmatrix}
\begin{bmatrix}
\braket{a}{r} \\
\braket{b}{r}
\end{bmatrix}.
\end{aligned}

Suppose the matrix representation of $$\ket{q}, \ket{r}$$ are respectively

\label{eqn:operatorMatrixElement:40}
\begin{aligned}
\ket{q} &\sim
\begin{bmatrix}
\braket{a}{q} \\
\braket{b}{q} \\
\end{bmatrix} \\
\ket{r} &\sim
\begin{bmatrix}
\braket{a}{r} \\
\braket{b}{r} \\
\end{bmatrix} \\
\end{aligned},

then

\label{eqn:operatorMatrixElement:60}
\bra{q} \sim
{\begin{bmatrix}
\braket{a}{q} \\
\braket{b}{q} \\
\end{bmatrix}}^\dagger
=
\begin{bmatrix}
\braket{q}{a} &
\braket{q}{b}
\end{bmatrix}.

The matrix element is then

\label{eqn:operatorMatrixElement:80}
\bra{q} A \ket{r}
\sim
\bra{q}
\begin{bmatrix}
\bra{a} A \ket{a} & \bra{a} A \ket{b} \\
\bra{b} A \ket{a} & \bra{b} A \ket{b}
\end{bmatrix}
\ket{r},

and the corresponding matrix representation of the operator is

\label{eqn:operatorMatrixElement:100}
A \sim
\begin{bmatrix}
\bra{a} A \ket{a} & \bra{a} A \ket{b} \\
\bra{b} A \ket{a} & \bra{b} A \ket{b}
\end{bmatrix}.