# 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.

In fact, I figured out by myself. When I was reading this website, it posts a density matrix that I want(that is a long website, to find the corresponding part, just search the keyword 'identity').

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.

• Although I did so, there might be space for us to improve the algorithm. In my answer, to produce an identity matrix(up to a normalization constant) of n qubits, another n ancilla qubits are required, but is this necessary? Nov 17, 2020 at 11:43
• 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, 2020 at 0:22
• Why the identity matrix useful for me comes from the nature communication 2020 article, Training Deep Neural Network. Nov 18, 2020 at 1:05
• I suspect there's something different going on than preparing a maximally mixed state. Once you have a maximally mixed state in your circuit, you cannot do anything else with it - Any unitary will leave it maximally mixed, and so will any any valid CPTP map on one of its subspaces (this is easiest to see with Kraus form operators) Nov 18, 2020 at 1:30
• Your concern makes sense, but an identity density matrix is not all I need. Another quantum register is also required and there is additional unitaries act between the two quantum registers. The final output is the density matrices of the two registers. Nov 18, 2020 at 6:52