We propose a formalization of C.G. Jung's theory of personality using a four-dimensional Hilbert-space for the representation of two qubits. The first qubit relates to Jung's four psychological functions Thinking, Feeling, Sensing and iNtuition, which are represented by two groups of projection operators {T, F} and {S, N}. The operators in each group are commuting but operators of different groups are not. The second qubit represents Jung's two perspectives of extraversion and introversion. It is shown that this system gives a natural explanation of the 16 psychological types that are defined in the Jungian tradition. Further, the system accounts for the restriction posed by Jung concerning the possible combination of psychological functions and perspectives. Interestingly, the unitary transformation called X-gate in the quantum computation community realizes the cognitive operation connected to Jung's idea of the shadow. The empirical consequences of the present m...