21

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 qubit, we use a kronecker product on it (this confused me so much when I was starting out - I had no idea how to scale gates; as you can imagine, it's rather ...


14

$$ 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 mean? The above matrix means: on a two qubit system (such as $\left|00\right>$, $\left|10\right>$, $\left|11\right>$, etc.) if the first qubit is a one,...


14

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\sigma_j\otimes\sigma_k\otimes\sigma_l)^\dagger \cdot A\big) = \frac{1}{4}\text{Tr}\big((\sigma_i\otimes\sigma_j\otimes\sigma_k\otimes\sigma_l) \cdot A\big) $$ ...


13

$\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 (of dimensions that are powers of $2$). More specifically, fix an integer $n$ and let $N\equiv 2^n$, define $\bssigma\equiv(\sigma_x,\sigma_y,\sigma_y)$, and $\...


11

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 that such matrix cannot be expressed as the tensor product of two other matrices is to take matrices $A =\begin{pmatrix}a & b \\ c & d\end{pmatrix}$ $...


10

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 unlikely that $X_1X_2I_3$ is given a new name, because there's nothing going on other than just two $X$ gates. CNOT has a name because the "C" part in CNOT ...


10

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 valid quantum gate! The interesting implication is that in contrast to the classical case, where only one non-trivial single bit gate exists - the NOT gate - ...


9

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} \sin\left(\frac{\theta}{2}\right) \\ e^{i\phi} \sin\left(\frac{\theta}{2}\right) & e^{i(\lambda + \phi)} \cos\left(\frac{\theta}{2}\right) \end{pmatrix} $$ ...


9

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) & 0 \\ 0 & -i \sin(\phi) & \cos(\phi) & 0 \\ -i \sin(\phi) & 0 & 0 & \cos(\phi) \\ \end{bmatrix}.$$ The second option doesn't make a ...


8

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{array}} \right) &= \frac{1}{2}\left( {\begin{array}{*{20}{c}} \sqrt 2 e^{i\pi / 4}&\sqrt 2 e^{-i\pi / 4}\\ \sqrt 2 e^{-i\pi / 4}&\sqrt 2 e^{i\pi / 4} \...


7

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 $9$ dimensional space, and one $d=6$ qudit has a six dimensional space. As such, we cannot regard them as equivalent. I guess you meant to compare situations ...


7

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\times 2$ block of the iSWAP gate. See page 95 here[$\dagger$]. [$\dagger$]: Explorations in Computer Science (Quantum Gates) - Colin P. Williams


7

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 diagonalisation straightforward), $$ H=\sum_{i=1}^mH_i. $$ If the matrix is sparse, then you shouldn't need too many distinct $H_i$. Then you can simulate the ...


7

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 qubit for the sake of simplicity. We have that $$ |\psi\rangle=|0\rangle\sum_{y\in\{0,1\}^{n-1}}a_{0y}|y\rangle+|1\rangle\sum_{y\in\{0,1\}^{n-1}}a_{1y}|y\rangle $$ ...


7

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 is a unique decomposition as a linear combination of tensor products of Pauli unitaries. Same is true if we fix some other unitary basis. If we not fix the ...


7

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 gates such as $\mathsf{CCNOT}$ (Toffoli) or $\mathsf{CSWAP}$ (Fredkin) have such a name is because they have been found to be useful and are a shorthand for the ...


7

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 known as a universal set. Surprisingly (or not), it is quite small. One example of a universal set is: $G = \{H, S, T, CNOT \}$ where $$H = \dfrac{1}{\sqrt{2}}\...


6

You can use Python with Qiskit. Say your string representation is written using OpenQASM syntax. qasm = """ OPENQASM 2.0; include "qelib1.inc"; qreg q[2]; h q[0]; t q[1]; cx q[0], q[1]; """ You can build a circuit out of this and simulate it on a unitary simulator: import qiskit as qk import numpy as np circuit = qk.load_qasm_string(qasm) result = qk....


6

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 the matrices and vectors with zeros to make it the right size. This is because the vector $|b\rangle$ in the HHL algorithm, is a quantum state, which means if ...


6

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 footing, you can consider that iSWAP is the gate obtained by time-evolving with an XX interaction ($H=-\sigma_x\otimes\sigma_x - \sigma_y\otimes\sigma_y$), in ...


6

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\sigma^B_i, $$ where $\sum_ip_i=1$ and the $\sigma^A_i$ and $\sigma^B_i$ are valid states on single sites. The difficulty actually comes from the freedom that ...


6

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 you do write them down right to left, but it's just a consequence of writing the operator that we want to apply on the left of the vector, while our natural way ...


6

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}} \vert k \rangle.$$ For $N=2$ this is simply $$\vert j \rangle = \frac{1}{\sqrt{2}}\begin{bmatrix}1 & 1 \\ 1 & -1 \end{bmatrix} \, \vert k \rangle = H \...


6

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 will not be flipped until qubit 1 is set to zero. I am going to use computational basis for this $CNOT_1\left|00\right> = \left|00\right>$, $CNOT_1\left|01\...


6

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 obtain the matrix representation of a Toffoli gate acting between three qubits, a good way to start is by first writing down its bra-ket representation. This ...


6

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, \dots, i_n,j_1, \dots, j_n$ are all binary and the $c$ with the awful index are the elements of the matrix. Now we know the transformation rules so it's not ...


6

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 gate" $X$. Recall that because $X^2=I$ that you can express the exponential of $X$ using something very similar to Euler's formula: \begin{align} \exp\left(-i\...


5

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$ on the third qubit is not going to work as you might as well forget about the third qubit completely if that were the case. By the way, the two matrices you ...


5

All quantum operators must be unitary. Unitary means the conjugate-transpose of the operator is its inverse. In your case: $UU^{\dagger} = \begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 1 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & ...


5

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 \end{pmatrix} $$ $$ P_1 = \begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix} $$ Then we have the Z gate : $$ Z= \begin{pmatrix} 1 & 0 \\ 0 &...


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