## How are the Pauli $X$ and $Z$ matrices expressed in bra-ket notation?

3

1

For example:

$$\rm{X=\sigma_x=NOT=|0\rangle\langle 1|+|1\rangle\langle 0|=\begin{bmatrix}0 & 1 \\ 1 & 0\end{bmatrix}}$$

$$\rm{Z=\sigma_Z=signflip=|0\rangle\langle 0|-|1\rangle\langle 1|=\begin{bmatrix}1 & 0 \\ 0 & -1\end{bmatrix}}$$

I do no understand how the matrix can be expressed in bra-ket and the way around. I could not find any good teachings on this.

Question was closed 2020-10-18T19:11:38.893

please try to use mathjax rather than images whenever possible

– glS – 2020-10-09T06:55:09.223

@glS no, my question is answered below as you can see checked it as an answer. – John T – 2020-10-09T09:07:34.023

Recall that kets $$|\cdot\rangle$$ represent column vectors; a bra $$\langle\cdot|$$ is a ket's row vector counterpart. For any ket $$|\psi\rangle$$, the corresponding bra is its adjoint (conjugate transpose): $$\langle\psi| = |\psi\rangle^\dagger$$. (For a refresher on this, see this question).
Kets and bras give us a neat way to express inner and outer products. The outer product of two vectors of the same size produces a square matrix. We can use a linear combination of several outer products of simple vectors (such as basis vectors) to express any square matrix. For example, the $$X$$ gate can be expressed as follows:
$$X = |0\rangle\langle1| + |1\rangle\langle0| = \begin{bmatrix} 1 \\ 0 \end{bmatrix}\begin{bmatrix} 0 & 1 \end{bmatrix} + \begin{bmatrix} 0 \\ 1 \end{bmatrix}\begin{bmatrix} 1 & 0 \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix} + \begin{bmatrix} 0 & 0 \\ 1 & 0 \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}$$