# How do quantum computers implement a random unitary gate?

If I from qiskit.quantum_info import random_unitary and then random_unitary(2**number_of_qubits) What returns is a unitary matrix with dimension $$(2^{number\_of\_qubits},2^{number\_of\_qubits})$$, and if I stimulating the unitary operation on a classical computer it is matrix computation.

Here comes my question: what quantum computers do to implement this random unitary?

From the universality of quantum gate set, we know that an arbitrary single-qubit operation can be decomposed into the set of $$\{H, S, T\}$$ or $$\hat U=\hat\Phi(\delta)\hat R_z(\alpha)\hat R_y(\theta)\hat R_z(\beta)$$ where $$\hat \Phi(\delta)=\begin{pmatrix}e^{i\delta}&0\\0&e^{i\delta}\end{pmatrix}$$, $$\hat R_z(\alpha)=\begin{pmatrix}e^{i\alpha/2}&0\\0&e^{-i\alpha/2}\end{pmatrix}$$ and $$\hat R_y(\theta)=\begin{pmatrix}cos\frac{\theta}{2}&sin\frac{\theta}{2}\\-sin\frac{\theta}{2}&cos\frac{\theta}{2}\end{pmatrix}$$.

But when considering physical realizations, we need to consider the problem of finite precision and so on. Then, which method will the quantum computers adopt? And more generally, what if we introduce CNOT here to form the universal quantum gate set for an arbitrary number of qubits?

Even a great reference paper or detailed qiskit documentation can be helpful (in fact to make my work rigorous this is essential). I appreciate you in advance.

• Actually, this might very well depend on what you intend to use the random unitary for. In most applications, it might be more practical to simply perform a random walk on a suitable universal gate set which converges (exponentially) fast to a random unitary with increasing depth. in many cases, an (approximate) unitary $t$-design might be enough, which is generally simpler to implement. Nov 26 '20 at 12:03
• I am learning the quantum walk now(kind of confusing). Although gates like CC...CC-U can be implemented by $\Theta(n^2)$ basic operations, the random_unitary(2**number_of_qubits) no ansatz is known to me that qiskit makes when writing the code, so this analysis is not rigorous enough for what I want to. So a most general analysis is my requirement(seems there are some exponential upper bounds). Nov 26 '20 at 13:53
• And you are right, I need the result in case of the approximated unitary operation. Nov 26 '20 at 13:54
• I'm still confused what you want to do. However, if I would run an experiment, and you want me to implement a ($n$-qubit) random unitary approximately, I would do a random walk on my gate set ... This is a braindead method and guaranteed to converge exponentially fast in diamond norm. And, there is no compiling needed. Nov 27 '20 at 8:59