# How to represent the state vector form of a qubit in density matrix representation? [duplicate]

While I'm studying state vector and density matrix. I wonder how to write qubit state as density matrix. qubit state can be represented with state vector form. But how about density matrix?

A qubit state $$|\psi\rangle \in \mathbb{C}^{2^n} \ \ \textrm{for} \ \ n\in\mathbb{N}$$ can be represented as a density operator/matrix as $$\rho = | \psi \rangle \langle \psi |$$.

For example: If $$|\psi \rangle = |1\rangle$$ then $$\rho = |\psi \rangle \langle \psi | = \begin{pmatrix} 0 \\ 1 \end{pmatrix} \begin{pmatrix} 0 & 1 \end{pmatrix} = \begin{pmatrix} 0 & 0\\ 0 & 1 \end{pmatrix}$$ is the density matrix representation of $$|\psi \rangle$$.

Thus, density matrix representation offers a general way of expressing a quantum state. As you can see, a pure state $$|\psi \rangle$$ can always be converted into a density matrix representation where the matrix is of rank 1. That is density matrix generalize the idea of state vector. In fact, the pure states (state vectors) are just the extreme points of the state space. In term of 1 qubit, you can think that the 1 qubit state vector $$|\psi \rangle = \alpha | 0 \rangle + \beta |1 \rangle$$ are just the states on the surface of the Blochsphere. The states inside the Blochsphere are known as mixed states.

To go even deeper, states are positive linear functional of unit norm.

If we have a pure state:

$$|\psi\rangle = \alpha |0 \rangle + \beta |1\rangle$$

The corresponding density matrix:

$$\rho = |\psi \rangle \langle \psi| = (\alpha |0 \rangle + \beta |1\rangle)(\alpha^* \langle 0 | + \beta^* \langle 1|) = \\= |\alpha|^2|0 \rangle \langle 0| + \alpha \beta^*|0 \rangle \langle 1| + \alpha^* \beta|1 \rangle \langle 0|+ |\beta|^2 |1 \rangle \langle 1| = \begin{pmatrix} |\alpha|^2 & \alpha \beta^* \\ \alpha^* \beta & |\beta|^2 \end{pmatrix}$$

If the state is not pure and we have $$p_1$$ probability of haveing $$\psi_1$$ state and with $$p_2$$ probability of having $$\psi_2$$ state (and this can be extended to $$n$$ cases: $$p_n$$ probability of $$\psi_n$$ state):

$$\rho = p_1 |\psi_1 \rangle \langle \psi_1| + p_2 |\psi_2 \rangle \langle \psi_2| = p_1 \begin{pmatrix} |\alpha_1|^2 & \alpha_1 \beta_1^* \\ \alpha_1^* \beta_1 & |\beta_1|^2 \end{pmatrix} + p_2 \begin{pmatrix} |\alpha_2|^2 & \alpha_2 \beta_2^* \\ \alpha_2^* \beta_2 & |\beta_2|^2 \end{pmatrix} = \\ =\begin{pmatrix} p_1|\alpha_1|^2 + p_2|\alpha_2|^2 & p_1 \alpha_1 \beta_1^* + p_2 \alpha_2 \beta_2^* \\ p_1 \alpha_1^* \beta_1 + p_2 \alpha_2^* \beta_2 & p_1|\beta_1|^2 + p_2 |\beta_2|^2 \end{pmatrix}$$