22 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 ...
user avatar
  • 3,341
15 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\...
user avatar
  • 5,563
14 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 ...
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 (...
user avatar
  • 19.1k
12 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 ...
user avatar
11 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 ...
user avatar
  • 1,898
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) &...
user avatar
  • 47.5k
10 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 ...
user avatar
  • 12.1k
9 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} \...
user avatar
  • 4,542
9 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{...
user avatar
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 $...
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\...
user avatar
7 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 ...
user avatar
  • 47.5k
7 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}} \...
user avatar
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 ...
user avatar
  • 47.5k
7 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 ...
user avatar
  • 5,563
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 ...
user avatar
  • 7,454
7 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 ...
user avatar
  • 12.7k
7 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 ...
user avatar
  • 4,952
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. ...
user avatar
  • 1,562
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 ...
user avatar
  • 12.1k
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 ...
user avatar
6 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\...
user avatar
  • 47.5k
6 votes
Accepted

A basic question on circuits and matrix representation

Yes, in the circuit the qubit "enters" to the left, and exits to the right, but when applying the gates to a state you must apply the one on the far left first, then the next and so on, so concretely ...
user avatar
6 votes
Accepted

Representing qubit swap using linear algebra

Here, what you need to do is to understand writing CNOT gate based on the control qubit. Your first CNOT gate has qubit 1 as control and qubit 2 as target. So, what this means is the second qubit ...
user avatar
6 votes

How to represent an $n$-qubit circuit in matrix form?

The overall matrix can be built from the knowledge of the matrices representing each element of the circuit (in your example, the Toffoli and single-qubit gates) by simple matrix multiplication. To ...
user avatar
  • 19.1k
6 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,...
user avatar
  • 4,212
6 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$ ...
user avatar
  • 2,655
5 votes
Accepted

Can we process infinite matrices with a quantum computer?

If instead of manipulating the quantum information in qubits, your quantum computer were to do operations on qu$d$its with $d$ being infinity, then you'd essentially be processing infinite matrices on ...
user avatar
  • 12.1k
5 votes

What is the matrix for the operator that implements a function to tell the parity of its argument?

Since your desired operation is a non-injective function, you need a third qubit and a unitary acting on all three qubits. Using an operator on your two input qubits and tensoring this with ${\rm I}_2$...
user avatar

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