# Is it always possible to write the state corresponding to a set of stabilizer generators?

Given a set of stabilizer generators, is it always possible to write down the state corresponding to it? Is there a way to write down the quantum state corresponding to a stabilizer generator?

Given an $$n$$-qubit system and $$n$$ generators $$g_i$$ (which commute and square to identity), then the state that you are after satisfies $$g_i|\psi\rangle=|\psi\rangle.$$ (This defines it uniquely, up to a global phase and normalisation.) One straightforward way to construct this directly is just $$|\psi\rangle\langle\psi|=\frac{1}{2^n}\prod_i(I+g_i).$$ Thus, you can compute the matrix using the $$\{g_i\}$$ and find the vector $$|\psi\rangle$$ by determining the one eigenvector that does not have 0 eigenvalue. In practice, you can do this simply by reading off any non-trivial column of the matrix, and normalising.

For example, let $$n=2$$ and take $$g_1=X\otimes X,\qquad g_2=Z\otimes Z.$$ We have $$|\psi\rangle\langle\psi|=\frac14(I+XX)(I+ZZ)=\frac14(I+XX+ZZ-YY).$$ If I read off the first column, this is equivalent to computing $$|\psi\rangle\langle\psi|00\rangle=\frac14(I+XX+ZZ-YY)|00\rangle=\frac12(|00\rangle+|11\rangle).$$ Thus, $$|\psi\rangle=\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle).$$

You can do this easily using Qiskit as follows:

from qiskit.quantum_info import StabilizerState, Statevector

stabilizer_list = ["XX", "ZZ"]
stabilizer_state = StabilizerState.from_stabilizer_list(stabilizer_list)
sv = Statevector.from_label('0'*stabilizer_state.num_qubits).evolve(stabilizer_state)
sv.draw('latex')


The result: $$\frac{\sqrt{2}}{2} |00\rangle+\frac{\sqrt{2}}{2} |11\rangle$$