# How to find a density matrix of a qubit?

If we are given a state of a qubit, how do we construct its density matrix?

If you're given $|\psi\rangle$, just calculate $\rho=|\psi\rangle\langle\psi|$.
For example, $|\psi\rangle=\cos\theta|0\rangle+\sin\theta e^{i\phi}|1\rangle$, then $\langle\psi|=\cos\theta\langle 0|+\sin\theta e^{-i\phi}\langle 1|$. This means that $$\rho=\left(\begin{array}{c} \cos\theta\\ \sin\theta e^{i\phi}\end{array}\right)\cdot \left(\begin{array}{cc} \cos\theta && \sin\theta e^{-i\phi}\end{array}\right)=\left(\begin{array}{cc} \cos^2\theta & \cos\theta\sin\theta e^{-i\phi} \\ \cos\theta\sin\theta e^{i\phi} & \sin^2\theta \end{array}\right).$$