Skip to main content
24 votes
Accepted

How to interpret a quantum circuit as a matrix?

Specific Circuit The first gate is a Hadamard gate which is normally represented by $$\frac{1}{\sqrt{2}}\begin{bmatrix}1&1\\1&-1\end{bmatrix}$$ Now, since we're only applying it to the first ...
auden's user avatar
  • 3,459
23 votes
Accepted

Can arbitrary matrices be decomposed using the Pauli basis?

For any matrix $A$ we can write $$ A =\sum_{i,j,k,l}h_{ijkl}\cdot \frac{1}{4}\sigma_i\otimes\sigma_j\otimes\sigma_k\otimes\sigma_l, $$ where $$ h_{ijkl} = \frac{1}{4}\text{Tr}\big((\sigma_i\otimes\...
Danylo Y's user avatar
  • 7,452
17 votes

How to construct matrix of regular and "flipped" 2-qubit CNOT?

$$ CNOT = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{bmatrix} $$But what does this matrix ...
Perry Sakkaris's user avatar
14 votes

Can arbitrary matrices be decomposed using the Pauli basis?

$\newcommand{\bs}[1]{{\boldsymbol #1}} \newcommand{\tildebssigma}{\tilde{\bs\sigma}} \newcommand{\bssigma}{{\bs\sigma}}$Yes, products of Pauli matrices form a basis for the set of Hermitian matrices (...
glS's user avatar
  • 25.6k
13 votes
Accepted

How to construct matrix of regular and "flipped" 2-qubit CNOT?

The CNOT gate is a 2-qubit gate, and consequently, its operation cannot be expressed by the tensor product of two one-qubit gates as the example you gave with the Hadamard gates. An easy way to check ...
Josu Etxezarreta Martinez's user avatar
13 votes
Accepted

How to check if a quantum circuit can be constructed for a given matrix representation?

Correct, unitarity is a sufficient and necessary condition. From Nielson and Chuang page 18: Amazingly, this unitary constraint is the only constraint on quantum gates. Any unitary matrix specifies a ...
ryanhill1's user avatar
  • 2,503
11 votes
Accepted

Is there a name for the 3-qubit gate that does NOT NOT NOTHING?

The gate in which you're interested: would more often be called $X_1X_2I_3$ rather than $¬_a ¬_b I_c$, because we use $X$ to denote the NOT gate more often than we use $¬$. However it is very ...
user1271772 No more free time's user avatar
11 votes
Accepted

What is the square root of the NOT gate?

They are the same up to a global phase. Note that $1 + i = \sqrt 2 e^{i\pi / 4}$. That means \begin{align*} \frac{1}{2}\left( {\begin{array}{*{20}{c}} {1 + i}&{1 - i}\\ {1 - i}&{1 + i} \end{...
Egretta.Thula's user avatar
10 votes
Accepted

Advantage of simulating sparse Hamiltonians

The insight that suggests that sparse matrices are useful goes along the lines of: for any $H$, we can decompose it in terms of a set of $H_i$ whose individual components all commute (making ...
DaftWullie's user avatar
  • 59.4k
10 votes
Accepted

What are theta, phi and lambda in cu1(theta, ctl, tgt) and cu3(theta, phi, lam, ctl, tgt)? What are the rotation matrices being used?

From IBM Q Documentation (the link is hard to find) here is the definition of the generic gate: $$ U(\theta, \phi, \lambda) = \begin{pmatrix} \cos\left(\frac{\theta}{2}\right) & -e^{i\lambda} \...
Adrien Suau's user avatar
  • 4,987
10 votes
Accepted

Matrix definition of the Ising XX gate

Your first option is the correct one, being related to $e^{-i\phi X\otimes X}$, which is $$ XX(\phi) = \begin{bmatrix}\cos(\phi)&0&0& -i \sin(\phi)\\ 0&\cos(\phi)&-i \sin(\phi) &...
DaftWullie's user avatar
  • 59.4k
9 votes
Accepted

How can we be sure that for every $A$, $A^\dagger A$ has a positive square root?

A matrix is positive if and only if it is Hermitian (and thus unitarily diagonalizable) and all its eigenvalues are positive (that they are real follows automatically from it being Hermitian). If this ...
glS's user avatar
  • 25.6k
9 votes

How to check if a quantum circuit can be constructed for a given matrix representation?

Right. But when you build a quantum computer, you want to have a certain set of gates that you want to implement, and all other gates (unitary matrices) can be built from that set of gates. This is ...
KAJ226's user avatar
  • 13.9k
9 votes

What is the square root of the NOT gate?

As mentioned already, both of those unitaries are the same up to a global phase. It might be useful to think about how you can actually arrive at one of these definitions in terms of the "Not ...
forky40's user avatar
  • 7,183
8 votes
Accepted

Could the Hadamard gate have been constructed differently with similar characteristics?

The Hadamard gate has close ties to the discrete Fourier transform. Consider the DFT for an $N$-level system: $$\vert j \rangle = \frac{1}{\sqrt{N}} \sum\limits_{k=0}^{N-1} e^{\frac{i2 \pi j k}{N}} \...
Jonathan Trousdale's user avatar
8 votes
Accepted

Non-unitary matrix decomposition as a sum of unitary matrices

All tensor products of $n$ Pauli operators $\{I,X,Y,Z\}$ (that is $4^n$ combinations) form an orthogonal basis for the vector space of $2^n \times 2^n$ complex matrices. Hence, for every matrix there ...
Danylo Y's user avatar
  • 7,452
7 votes
Accepted

Difference between 3 qubits, 2 qutrits & 1 six level qunit

The Hilbert space dimension of $n$ qudits is $d^n$, where $d$ is the dimension of the qudit ($d=2$ for qubit, $d=3$ for qutrit, etc). So three qubits have an $8$ dimensional space, two qutrits have a $...
James Wootton's user avatar
7 votes
Accepted

What is the matrix of the iSwap gate?

Mostly I'm confused over whether the common convention is to use +i or -i along the anti-diagonal of the middle 2x2 block. The former. There are two $+i$'s along the anti-diagonal of the middle $2\...
Sanchayan Dutta's user avatar
7 votes
Accepted

Differentiate between local and global unitaries

This is actually a much easier problem. In the case of states, you're trying to use the PPT criterion, or others, to distinguish if $\rho$ can be written in the form $$ \rho=\sum_ip_i\sigma^A_i\otimes\...
DaftWullie's user avatar
  • 59.4k
7 votes
Accepted

How to efficiently calculate the inverse of a Kronecker product?

You specifically ask about qubits, so I'll keep it to that. Imagine you have a state $$ |\psi\rangle=\sum_{x\in\{0,1\}^n}a_x|x\rangle. $$ You can choose to look at each qubit. I'll take the first ...
DaftWullie's user avatar
  • 59.4k
7 votes

How do I write the matrix for a CZ gate operating on nonadjacent qubits?

Consider that a control qubit is $q_k$ and a target qubit is $q_{k+n}$ and you want to apply operator $U$ on the target qubit. Denote $N=2^{n+1}$. Then matrix representation of this controlled $U$ is \...
Martin Vesely's user avatar
7 votes
Accepted

What is the matrix for a SWAP operation on two qubits?

In the general case I think it's easier to consider the matrix in the form $$ M = \sum_{i_1,\dots,i_n, j_1, \dots j_n} c_{i_1,\dots,j_n} |i_1 \dots i_n\rangle \langle j_1 \dots j_n|, $$ where the $i_1,...
Rammus's user avatar
  • 5,968
7 votes

Is there a name for the 3-qubit gate that does NOT NOT NOTHING?

Welcome to QCSE. You seem to have gotten some of the gist of quantum gates but don't be surprised if not every such gate is promoted to having a specific, universally recognized name. A reason some ...
Mark Spinelli's user avatar
7 votes
Accepted

What is the set of generators for the qutrit Clifford group?

From the paper Normal form for single-qutrit Clifford+T operators and synthesis of single-qutrit gates, the Clifford group in $p>2$ dimensions acting on a sigle qudit is generated by $S$ and $H$ ...
epelaez's user avatar
  • 2,905
7 votes
Accepted

Random quantum states and Schur-Weyl duality

Note that the quoted relation $$ \bar M_i = \sum_\lambda a_\lambda P_\lambda, $$ only holds if the $M_i$ also commute with the representation of the symmetric group! Otherwise this can obviously not ...
Markus Heinrich's user avatar
7 votes

In Schur-Weyl's duality, why is the commutant of $\pi_k(S_k)$ spanned by $U(d)^{\otimes k}$ matrices?

While I agree with Markus Heinrich that the argument is non-trivial, actually it can be presented in familiar quantum computing terms. The matrix algebra $M(d)^{\otimes n} \cong M(d^k)$ has a self-...
Greg Kuperberg's user avatar
6 votes
Accepted

Is there a tool that can give you the unitary representing a quantum circuit from just a string?

You can use Python with Qiskit. Say your string representation is written using OpenQASM syntax. ...
Ali Javadi's user avatar
  • 1,632
6 votes
Accepted

Solving linear systems represented by NxN matrices with N not power of 2

This is indeed a correct way to solve linear systems with dimension not equal to a power of 2. Solve the smallest possible system of dimension 2$^n$ that contains the system you want to solve, and pad ...
user1271772 No more free time's user avatar
6 votes

What is the matrix of the iSwap gate?

Whether you use $+i$ or $-i$ is entirely up to you. After all, your definition of $\pm i$ is merely a convention. On the other hand, I think I've only ever seen it with $+i$. On a more general ...
Norbert Schuch's user avatar
6 votes
Accepted

What's the matrix representation of this 3-qubit CZ circuit?

One way to do it is to build a sort of quantum IF statement. You have in quantum computing projector operators telling you whether a qubit is 0 or 1: $$ P_0 = \begin{pmatrix} 1 & 0 \\ 0 & 0 ...
cnada's user avatar
  • 4,754

Only top scored, non community-wiki answers of a minimum length are eligible