Index gymnastics and representing bra-kets as covariant and contravariant tensors I am trying to figure out how to write, in Einstein notation as well as pick out elements of $$\langle A|[\mu]|B\rangle \langle X|[\nu]|Y\rangle$$
where $[\mu] = \begin{bmatrix} \mu_{11} & \mu_{12} \\ \mu_{21} & \mu_{22} \end{bmatrix}$, $[\nu] = \begin{bmatrix} \nu_{11} & \nu_{12} \\ \nu_{21} & \nu_{22} \end{bmatrix}$, $\langle A| = \begin{bmatrix} a_{1} \,   a_{2}\\ \end{bmatrix}$, $|B\rangle  = \begin{bmatrix} b_{1}  \\  b_{2} \end{bmatrix}$, $\langle X| = \begin{bmatrix} x_{1}\,    x_{2}\\ \end{bmatrix}$ ,   $|Y\rangle  = \begin{bmatrix} y_{1}  \\  y_{2} \end{bmatrix}$ 
Now by associativity of matrix multiplication I should get the same answer no matter in which order I multiply; so I break it up as follows: $(\langle A|[\mu])(|B\rangle \langle X|)([\nu]|Y\rangle)$ Where $|B\rangle \langle X|$ is the tensor product $|B\rangle \otimes \langle X|$
After some multiplication, In Einstein notation I get 
$\langle A|[\mu] = \begin{bmatrix} a_{1}\mu_{11}+ a_{2}\mu_{21} & a_{1}\mu_{12}+ a_{2}\mu_{22}   \end{bmatrix} = \begin{bmatrix} a_{i}\mu_{i1} & a_{j}\mu_{j2}  \end{bmatrix}$ in Einstein notation. 
Likewise:
$[\nu] |Y\rangle  = \begin{bmatrix} \nu_{11} & \nu_{12} \\ \nu_{21} & \nu_{22} \end{bmatrix} \begin{bmatrix} b_{1}  \\  b_{2} \end{bmatrix} =\begin{bmatrix} \nu_{11}b_{1} + \nu_{12}b_{2} \\ \nu_{21}b_{1} + \nu_{22}b_{2} \end{bmatrix} = \begin{bmatrix} \nu_{1r}b_{r} \\ \nu_{2s}b_{s}    \end{bmatrix} $
$ \begin{bmatrix} a_{i}\mu_{i1} & a_{j}\mu_{j2}  \end{bmatrix} \begin{bmatrix} b_{1}x_{1} & b_{1}x_{2}  \\ b_{2}x_{1}  & b_{2}x_{2}  \end{bmatrix}  \begin{bmatrix} \nu_{1r}b_{r} \\ \nu_{2s}b_{s}    \end{bmatrix} =  $ 
$$(a_{i}\mu_{i1}b_{1}x_{1}+a_{j}\mu_{j2}b_{2}x_{1})\nu_{1k}b_{k}+ (a_{i}\mu_{i1}b_{1}x_{2}+a_{j}\mu_{j2}b_{2}x_{2})\nu_{2r}b_{r}$$
??
It is getting crazy with the indices - can I contract this tensor more?
Furthermore would it be useful to try and denote $\langle X|$ is a covariant (row) vector and $|Z\rangle$ is the contravariant (column) vector? We might say $X_{\mu}$ and $Z^{\nu}$ respectively where $X_{1} = x_1, X_{2}=x_2$ and $Z^{1} = z^1, Z^{2} = z^2$. 
 A: What you have done is correct, but it isn't yet in the smallest possible form. In fact it will eventually become $a_i\mu_{ij}b_jx_k\nu_{kl}y_l$. Do you see how this works? At least try expanding what I wrote to see that it agrees with what you have.
I'll show you what some  things become in index notation: Suppose $M$ and $N$ are matrices and $\left|X\right\rangle$ and $\left|Y\right\rangle$ are vectors. I'll even use up and down indices for columns and rows.
$$\begin{align}
M &\longmapsto M^i_{\,j}\\
\left|X\right\rangle &\longmapsto X^i\\
\left\langle X\right|&\longmapsto \overline{X}_i
\end{align}$$
The bar reminds us that a complex conjugation happens when we use hermitian conjugation to turn $\left|X\right\rangle$ into $\left\langle X\right|$. In other words $\left|X\right\rangle=\begin{bmatrix} X^1 \\ X^2\end{bmatrix}$ so $\left\langle X\right|=\begin{bmatrix} \overline {X^1} & \overline {X^2}\end{bmatrix}$, so we define $\overline X_i=\overline{X^i}$. Moving the index out from under the bar changes it from upper to lower. (Above you had a bra $\left\langle A\right|$ which you wrote in coordinates as $\begin{bmatrix} a_1 & a_2\end{bmatrix}$. This is fine, and it means that we would write $\left\langle A\right|$ in index notation as $a_i$, but if it had been me I would have said that $\left|A\right\rangle=\begin{bmatrix} a^1 \\ a^2\end{bmatrix}$ and then I would have had $\left\langle A\right|=\begin{bmatrix} \overline{a^1} & \overline{a^2}\end{bmatrix}$ and so I would have written it as $\bar a_i$ in index notation. Does this make sense?) Continuing with our list:
$$\begin{align}
MN &\longmapsto M^i_{\,j}N^j_{\,k}\\
M\left| X\right\rangle &\longmapsto M^i_{\,j}X^j\\
\left\langle X\mid Y\right\rangle &\longmapsto \overline{X}_i Y^i\\
\left| Y\right\rangle\left\langle X\right|&\longmapsto Y^i\overline{X}_j
\end{align}$$
Your expression:
$$\left\langle A\mid \mu\mid B\right\rangle\left\langle X\mid \nu\mid Y\right\rangle\longmapsto \overline A_i \:\mu^i_{\,j}\:B^j\:\overline X_k \:\nu^k_{\,l}\:Y^l$$
I would have thought of this as putting together
$$\begin{align}
\left\langle A\mid \mu\mid B\right\rangle&\longmapsto \overline A_i \:\mu^i_{\,j}\:B^j\\
\left\langle X\mid \nu\mid Y\right\rangle&\longmapsto \overline X_k \:\nu^k_{\,l}\:Y^l\\
\end{align}$$
But the way you did it in your post is equally valid:
$$\begin{align}
\left\langle A\right| \mu &\longmapsto \overline A_i \:\mu^i_{\,j}\\
\left| B\right\rangle\left\langle X\right| &\longmapsto B^j\:\overline X_k\\
\nu\left| Y\right\rangle &\longmapsto \nu^k_{\,l}\:Y^l
\end{align}$$
They come together to give the same thing.
A: You seem to be VERY confused about bra-ket notation.


*

*Matrix multiplication isn't commutative, so it's false that "I should get the same answer no matter in which order I multiply". 

*$|B\rangle \langle X|$ with standard notation does not denote a tensor product

*Covariance an contravariance are a lot different and involve geometry. Since quantum states in regular introductory nonrelativistic QM don't necessarily have geometry associated with them (ie your states could be "up" and "down", or "0" and "1", or "left polarized" or "right polarized") you don't expect covariance/contravariance.

*You can't write down things in matrix form without first choosing a basis.


I really suggest you read another introduction to Dirac notation and go through it carefully. There are also books like "Schaum's outline of Tensor Analysis" (I think that was it) whose first chapter has lots of practice with index gymnastics that should help you. The whole idea is to AVOID writing out the whole matrix, and only wind up with expressions like $a_{ij}=b_{ik}c_{km}d_{mj}$ do denote the product of three matrices. it should be succinct! If you find yourself writing out $k_{1,1}b_{1,2}$ etc with explicit numbers, you're almost certainly doing it a bad way.
