Help understanding the complex matrix representation of quaternions

Using the basis $$B = \{1, j\}$$, one can show that quaternions can be represented by 2x2 complex matrices as follows:

$$\begin{pmatrix} z & w\\ -\bar{w} & \bar{z}\\ \end{pmatrix}$$

I would like some help to understand this.

Lets say $$z = a + bi, w = c + di$$

Then we can represent the quaternion $$h = a + bi + cj + dk$$ as $$z + wj$$.

I would have thought that to find the matrix representation of complex numbers we would see what would happen if we multiply $$z + wj$$ by the basis elements. This would mean the first column of our matrix would be $$(z + wj)(1) = z + wj = \begin{bmatrix} z \\ w \\ \end{bmatrix}$$

And the second column would be $$(z + wj)(j) = zj + wj^{2} = zj - w = \begin{bmatrix} -w \\ z \\ \end{bmatrix}$$

So I would have thought the matrix representation would be $$\begin{pmatrix} z & -w\\ w & z\\ \end{pmatrix}$$

I have a feeling I have some large misunderstanding about what I'm doing, I'm just following the same approach I did to find matrix representations of complex numbers with real 2x2 matrices and matrix representations of quaternions with real 4x4 matrices.

e.g. with complex numbers, using a basis of $$B = \{1, i\}$$, and a complex number $$a + bi$$ where $$a$$ and $$b$$ are :

$$(a + bi)(1) = a+ bi = \begin{bmatrix} a \\ b \\ \end{bmatrix}$$ $$(a + bi)(i) = ai -b = \begin{bmatrix} -b \\ a \\ \end{bmatrix}$$

Which gives us the matrix $$\begin{pmatrix} a & -b\\ b & a\\ \end{pmatrix}$$

Which is correct. The same approach worked for me for quaternions and real 4x4 matrices.

Given a quaternion $$q$$ and a complex number $$\lambda$$, for scalar multiplication you can either apply $$\lambda$$ to $$q$$ from the left (i.e. $$\lambda q$$) or from the right (i.e. $$q\lambda$$). This means you can interpret $$\mathbb{H}$$ as a left complex vector space or as a right complex vector space. Now consider the left and right multiplication maps

$$L_p(x)=px, \qquad R_p(x)=xp. \tag{1}$$

Then $$L_p(x\lambda)=L_p(x)\lambda$$ for all complex numbers, so $$L_p$$ is a linear transformation of $$\mathbb{H}$$ as a right complex vector space. And $$R_p(\lambda x)=\lambda R_p(x)$$, so $$R_p$$ is a linear transformation of $$\mathbb{H}$$ as a left complex vector space.

However, $$L_p$$ is not linear if we treat $$\mathbb{H}$$ as a left complex vector space, and $$R_p$$ is not linear if we treat $$\mathbb{H}$$ as a right vector space. This is because $$\mathbb{H}$$ is not commutative. (Exercise.)

Using $$\{1,\mathbf{j}\}$$ as a basis for $$\mathbb{H}$$ as a complex vector space, you would write an arbitrary quaternion as $$z+w\mathbf{j}$$ if you're thinking left vector space, and write $$z+\mathbf{j}w$$ if you're thinking right vector space. (Also notice $$w$$ comes before $$z$$ in the alphabet, so we're backwards alphabetically.) You're thinking left vector space but you're examining the right-linear transformation $$L_p$$. That's problematic.

If you look at $$L_p$$ and think right vector space, you should get

$$\begin{bmatrix} z & -\overline{w} \\ w & \phantom{-}\overline{z} \end{bmatrix}. \tag{2}$$

(Exercise.)

Representing quaternions as matrices using $$R_p$$ is problematic since $$R_p\circ R_q\ne R_{pq}$$. Indeed, this would be a function $$\mathbb{H}\to M_2(\mathbb{C})$$ which is not a homomorphism but rather an anti-homomorphism, i.e. it satisfies $$R_p\circ R_q=R_{qp}$$ (the order of multiplication is reversed). In order to turn it into a homomorphism proper, one must either (pre)compose it with an anti-automorphism of $$\mathbb{H}$$ or (post)compose with an anti-automorphism of $$M_2(\mathbb{C})$$. Quaternion conjugation satisfies $$\overline{pq}=\overline{q}\,\overline{p}$$ and matrix transpose satisfies $$(AB)^T=B^TA^T$$, so we can use these as anti-automorphisms.

In the case of quaternion conjugation, we can take $$p=z+w\mathbf{j}$$, then its conjugate $$\overline{p}=\overline{z}-w\mathbf{j}$$, then the matrix of $$R_{\overline{p}}$$ you can calculate (exercise) to be

$$\begin{bmatrix} \overline{z} & \overline{w} \\ -w & z \end{bmatrix}, \tag{3}$$

and if instead you just calculated $$R_p$$'s matrix and took the transpose you'd get $$(2)$$ again.

Complex conjugation (applied entry-wise to a matrix) is an automorphism of $$M_2(\mathbb{C})$$, i.e. it satisfies $$\overline{AB}=\overline{A}\,\overline{B}$$, so we may compose it with any of the representations above to get another valid representation.