# Produce a quantum state with its density matrix an identity matrix up to an constant

For a n-qubit quantum state $$|\psi\rangle=\displaystyle\sum_{i=0}^{2^N-1}|i\rangle$$, by definition it's density matrix is $$|\psi\rangle\langle\psi|=\displaystyle\sum_{i,j=0}^{2^N-1}|j\rangle\langle i|$$.

Recently I am trying to implement a quantum neural network given by a paper, and one step of it is required so, maybe up to a normalization constant(at supplementary note 2, when calculating the derivative).

For a $$2^N$$ dimensional identity matrix, it does not violate the requirements of being a density matrix, but I just cannot figure out how to do so and I even think this is not possible, have anybody be at this place before?

An additional requirement of mine is that the density matrix must be produced by some qubits or this problem might be truly tedious.

Here comes the method. To produce a $$2^n$$ dimensional density matrix, you need n qubits as ancilla and n qubits as the target. In the case of $$n=1$$, implement the $$\hat H$$ on the ancilla, then use a $$cx$$ gate with ancilla as the target.
The density matrix of the whole system is $$\rho_{AB}=(\frac{|00\rangle+|11\rangle}{\sqrt2})(\frac{\langle 00|+ \langle 11|}{\sqrt2})$$, and the density matrix of the target(the reduced density matrix) is $$\rho_A=Tr_B(\rho_{AB})=\frac{1}{2}(|0\rangle\langle0|+|1\rangle\langle1|)=\frac{I_A}{2}$$, which satisfies my requirement.
• I'm unsure why you want an identity matrix in the first place since its not a useful quantum state. Whether you can use fewer than n ancillas depends on the situation. If you're confident you can measure/reset the ancilla system without learning about the measurement result then you could prepare bell states between each qubit and the ancilla and measure the ancilla between each step, since $\frac{1}{2^n} I_{2^n} = (\frac{1}{2} I_2) \otimes \dots \otimes (\frac{1}{2} I_2)$. Nov 18 '20 at 0:22