Questions tagged [matrix-representation]

For questions about matrix representations of quantum gates.

Filter by
Sorted by
Tagged with
1
vote
0answers
40 views

Matrix for $U^{2^j}$ from Shor's algorithm for any $a$ and $N$

I'm implementing Shor's algorithm from scratch and therefore want to implement a unitary gate $U$ such that $U^{2^j}|y\rangle = |a^{2^j}y \: \text{mod} \: N\rangle$. I know that an efficient way of ...
0
votes
1answer
57 views

How to represent a CNOT gate operating on three-qubit states as a matrix? [duplicate]

I am wondering how to represent these kinds of circuits as a matrix. Is there any formula for doing this?
0
votes
2answers
76 views

How do I apply a matrix to a ket state?

If we have the following matrix: $$\frac{1}{\sqrt{2}}\begin{pmatrix}1&1&0&0\\ 1&-1&0&0\\ 0&0&1&-1\\ 0&0&1&1\end{pmatrix}$$ How do we find the output for ...
6
votes
2answers
2k views

What is the square root of the NOT gate? [duplicate]

I have encountered different matrix of operator "the Square Root of NOT gate". For example, the matrix is specified here: $\sqrt {NOT} = \frac{1}{2}\left( {\begin{array}{*{20}{c}} {1 + i}&...
3
votes
2answers
43 views

Method to derive Matrix description of a circuit [duplicate]

This question is about finding a matrix description of a specific circuit. I am learning quantum computing through edX's Quantum Information Science lecture series. The question below is the one I am ...
2
votes
1answer
29 views

How would I apply rotations to both qubits in a 2 qubit system?

Say I have the two qubit system $\frac{1}{\sqrt{2}}\begin{bmatrix} 0 \\ 1 \\ 1 \\ 0 \end{bmatrix}$. I have two 2x2 unitary gates, one is a rotation ...
3
votes
1answer
82 views

How does a general rotation $R_\hat{n}(\theta)$ related to $U_3$ gate?

From eqn. $(4.8)$ in Nielsen and Chuang, a general rotation by $\theta$ about the $\hat n$ axis is given by $$ R_\hat{n}(\theta)\equiv \exp(-i\theta\hat n\cdot\vec\sigma/2) = \cos(\theta/2)I-i\sin(\...
2
votes
1answer
96 views

Is there a different way to represent Pauli gates in X basis?

It's easy to see that in computational basis, Pauli matrices could be represented in the outer product form: $$ X=|0\rangle\langle1|+|1\rangle\langle0|\\ Y=-i|0\rangle\langle1|+i|1\rangle\langle0|\\ Z=...
0
votes
0answers
17 views

Compiling Quantum Circuits using the Palindrome Transform

This paper shows a way to produce optimal circuits. I haver verified most of them and they are correct except this procedure: procedure ProduceArray(n) I cannot ...
9
votes
2answers
514 views

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

Let's say I have a matrix representation, e.g. $$ \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}. $$ How ...
2
votes
0answers
46 views

Representation of multiple qubit matrices in Dirac notation

Imagine one wants to represent the and function for any number of qubits in Dirac notation. The and gate flips the target qubit if all the control qubits are in state 1. This is its matrix ...
4
votes
2answers
66 views

Is the column vector of a uniformly sampled random unitary matrix a uniformly sampled random state vector?

I am wondering if a random unitary matrix taken from a Haar measure (as in, it is uniformly sampled at random) can yield a uniformly sampled random state vector. In section 3 of this paper it says &...
4
votes
1answer
101 views

Single-qubit rotations on a subspace within two-qubit unitary

I would like to implement the operation $$ U(a,b) = \exp\left(i \frac{a}{2} (XX + YY) + i \frac{b}{2} (XY - YX) \right) $$ ($a,b \in \mathbb{R}$) without using Baker-Campbell-Hausdorf expansion, ...
3
votes
1answer
112 views

Can we understand multi-qubit gates in terms of rotation groups?

I'm trying to reconcile (i) the statement that swapping two subsystems constitutes a rotation by $2\pi$ and (ii) the angle that is implied by the Hermitian generator of a SWAP gate. I haven't tracked ...
2
votes
1answer
36 views

Qiskit PauliWeightedOperator in the matrix representation?

Suppose we have a PauliWeightedOperator object from Qiskit. Is there any built-in method to convert it to the matrix representation in the computational basis? My search in the docs was not successful....
9
votes
2answers
2k views

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

It seems to me that the "disjunction gate" (aside: is that its proper name?) can be thought of as the combination of three gates, G1, G2, and G3, where G2 is the CCNOT gate, and $G1 = G3 = ¬...
3
votes
1answer
56 views

Mistake in using dirac notation when applying $X$ gate to vector

The X gate is given by $\big(\begin{smallmatrix} 0 & 1 \\ 1 & 0 \end{smallmatrix}\big)$ in the computational basis. In the Hadamard basis, the gate is $X_H = \big(\begin{smallmatrix} 1 &...
3
votes
2answers
103 views

How do you represent one-qubit rotations in two registers as a $4\times 4$ unitary matrix?

Let's say you have a circuit that performs a Z-rotation in the first register, and a Y-rotation in second register. How can we express this "moment" in terms of a 4x4 matrix, i.e. a two-...
3
votes
1answer
120 views

XY Hamiltonian in a 1D Heisenberg Chain

I've been trying to implement the 1D Heisenberg chain (i.e. the XXZ model) on Qiskit but have been having trouble. To recap, the Heisenberg hamiltonian is as follows: $$H_{XXZ} = \sum^{N}_{i = 1} [J(S^...
4
votes
1answer
172 views

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

Say we want to swap qubits $a$, $b$ in the same register, where $a,b \in \left \{ 0, 1,\cdots, n-1 \right \}$. What would be the corresponding matrix. For those interested, I'm curious about this ...
1
vote
1answer
74 views

Get a sparse matrix of quantum circuit

Is there a way that can obtain sparse matrix of quantum circuit? I used to check my quantum circuit with quantum_info.Operator, but for large number of qubits, it ...
3
votes
0answers
39 views

D-WAVE QUBO Matrix Form

I am trying to write down this problem (friend/enemy graph) in a polynomial matrix form in order to understand quantum annealing better, but it seems like the problem should actually be split into ...
6
votes
3answers
105 views

Decomposing gates resembling exponentiated members of desired gateset

Suppose I have access to a pretty typical gate set, for example $\{\text{CNOT}, \text{SWAP}, \text{R}_{x}, \text{R}_{y}, \text{R}_{z}, \text{CR}_x, \text{CR}_y, \text{CR}_z\}$ where $\text{CR}$ is a ...
2
votes
1answer
116 views

How to get subspace of quantum circuit?

How can I get a subspace of a quantum circuit? More precisely, I'm dealing with quantum circuit with data qubits ('q') and ancilla qubits ('anc'), such as $(q_0,q_1,...,q_n,anc_0,..anc_m)$. After some ...
0
votes
1answer
109 views

Quick question about Two-qubit SWAP gate from the Exchange interaction

I am reading the following paper: Optimal two-qubit quantum circuits using exchange interactions. I have a problem with the calculation of the unitary evolution operator $U$ (Maybe it is stupid): I ...
0
votes
2answers
78 views

What is the effect of the reset gate on the matrix form of a gate/circuit?

From what I understand, any circuit can be combined to make a gate, which has a square, unitary matrix form that acts on the $2^n$ row of the qubits state column vector. For example, the circuit ...
3
votes
2answers
64 views

How to find original matrix from eigenbasis and eigenvalues?

I'm not sure is it the right place to ask this but, I think it is better to ask here than Math Overflow. It is about how to find the matrix representation of an operator (for the CHSH test). What are ...
4
votes
1answer
140 views

Difference between change of basis in bra-ket notation and matrix notation

In matrix notation, say I have the vector $\begin{bmatrix} 1 \\ 0 \end{bmatrix}$. It is currently represented in the computational basis $\{\begin{bmatrix} 1 \\ 0\end{bmatrix}, \begin{bmatrix} 0 \\ 1\...
4
votes
2answers
139 views

Creating a custom gate (given by a matrix) more efficiently

I have the following gate (as represented by its matrix) on $4$ qubits which I hope to use in an error-detection code $$M=\left( \begin{array}{cccccccccccccccc} 1 & 0 & 0 & 0 & 0 &...
0
votes
1answer
61 views

How to force a matrix to be unitary given constraints on some of the elements? [duplicate]

I am working with a matrix of the following form: $$ A =\begin{pmatrix} a_{11} & Q & \ldots & Q\\ a_{21} & Q & \ldots & Q\\ \vdots & \vdots & \ddots & \vdots\\ ...
2
votes
2answers
53 views

How does a $d\times\ell$ matrix of rank $\ell$ and with singular values all equal to 1 imply it is maximally entangled

From this question, gls states that given $\Pi\equiv\sum_i |\eta_i\rangle\!\langle i|$ and $\Psi\equiv\sum_i|\psi_i\rangle\!\langle i|$, if $\Pi^\dagger\Psi=I_{d\times\ell}$, then $\Psi$ is "...
3
votes
1answer
640 views

How are the Pauli $X$ and $Z$ matrices expressed in bra-ket notation? [duplicate]

For example: $$\rm{X=\sigma_x=NOT=|0\rangle\langle 1|+|1\rangle\langle 0|=\begin{bmatrix}0 & 1 \\ 1 & 0\end{bmatrix}}$$ $$\rm{Z=\sigma_Z=signflip=|0\rangle\langle 0|-|1\rangle\langle 1|=\...
1
vote
3answers
104 views

How do I apply a Hadamard gate on a given qubit, in matrix formalism?

Hadamard gate matrix is: $$\frac{1}{\sqrt2}\begin{bmatrix}1 & 1 \\ 1 & -1\end{bmatrix}$$ The matrix for $|0\rangle$ is: $$\begin{bmatrix}1 \\ 0\end{bmatrix}$$ I am unable to understand, how ...
0
votes
1answer
46 views

Information about two algorithms of Matrix product state

In qiskit backends, there is Matrix_product_state. With this backend, I can simulate circuit for several qubits. And I found some mysterious problem about MPS. With 25,26,27 qubits, the simulating ...
1
vote
1answer
67 views

Hadamard gate for three qubits; inconsistency between IBM and Matlab

I am trying to build a large and quite complex three qubit quantum circuit on IBMs quantum computer. I have a specific unitary which I am trying to implement and I am building a circuit following the ...
0
votes
1answer
69 views

How to implement quantum gate from matrix in Q#

Is it possible to implement a quantum gate from a matrix in Q#, the equivalent of unitary function in Qiskit ? My final goal is to implement cirq CZPowGate in Q#. Thank you.
1
vote
1answer
39 views

What is the matrix for measuring a superposition of general number of qubits in standard basis?

Let's say I have the state of the system of 2 qubits: $\frac{1}{\sqrt{3}}|00\rangle+\frac{2}{\sqrt{3}}|10\rangle$, and I want to measure it in the standard basis. How would I write it mathematically? ...
1
vote
2answers
103 views

How to make Toffoli gate using matrix form in multi qubits system?

I wonder that there is generalized form to make Toffoli gate in multi-qubits system even if the two control qubits and one target qubit are not adjacent. In Wikipedia there is one way to make Toffoli ...
1
vote
1answer
101 views

How does the graphical notation used to denote doubly-controlled gates work?

$\qquad$ $\qquad$ What is the difference between solid and hollow? How to express the corresponding matrix of these figures? In addition, if they are not adjacent, what should be done in the middle of ...
-1
votes
2answers
117 views

Nielsen and Chuang: Demonstration of equation 2.12 [duplicate]

Reproduced from Nielsen & Chuang's Quantum Computation and Quantum Information (10th Anniversary Edition) in page 64: We've seen that matrices can be regarded as linear operators. [...] Suppose $...
1
vote
0answers
47 views

Step-by-step passages in calculation

I would like to better understand some passages in a paper (Appendix A): Properties of Tensor Product Bilinearity: $A\otimes(B+ C) = A \otimes B + A \otimes C $ Mixed-product property: $(A\otimes B)(...
0
votes
2answers
175 views

How to find the matrix representation of an operator from its action on a basis?

First, I apologize if something is poorly written but English is not my first language. I know that these exercises have been solved in this question. But I do not agree. Inner product and concrete ...
5
votes
2answers
218 views

Representation of rotation operators $e^{-i\theta(I-Z_1\otimes Z_2 \otimes Z_3)}$ about arbitrary axis for $3$ qubits

I was wondering in how to interpret and represent the operator $e^{-i\theta(I-Z_1\otimes Z_2 \otimes Z_3)}$ for a 3 qubit system in a circuit using qiskit. I was thinking I could just perform an ...
3
votes
3answers
196 views

How to spot the matrix representation of the quantum NOT operation

Applying the above construction to AND we get the map $(x1,x2,y) \rightarrow (x1,x2,y⊕(x1∧x2))$ for $x1,x2,y \in \{0,1\}$. The unitaryoperator which implements this is then simply the map $|x1〉|x2〉|y&...
3
votes
3answers
349 views

Show that a $CZ$ gate can be implemented using a $CNOT$ gate and Hadamard gates

Show that a $CZ$ gate can be implemented using a $CNOT$ gate and Hadamard gates and write down the corresponding circuit. Recall from Quantum Information Theory that $Z=HXH$. As $CNOT$ is a ...
1
vote
3answers
153 views

Deriving a controlled Kraus operator from an uncontrolled Kraus operator

I have a Kraus operator $M$. $M$ is composed of a list of matrices $M_k$ satisfying $$\sum_{k} M_k^\dagger M_k = I$$ I would like to control the application of $M$ using a control qubit. This ...
0
votes
1answer
383 views

Expressing a term of an $n$-qubit Hamiltonian in terms of Pauli operators

Consider a $2^n\times 2^n$ Hermitian matrix $M$ containing up to two non-zero elements, which are $1$ (so, either $M_{ii}=1$ for some $i$, or $M_{ij}=M_{ji} = 1$ for some $i$ and $j$). Each such ...
0
votes
1answer
187 views

Nielsen & Chuang Exercise 4.34 “Measuring an operator”

I need help with the exercise 4.34 from Nielsen & Chuang Book. I am supposed to get a matrix corresponding to the circuit. Thanks
2
votes
1answer
92 views

Generic matrix exponential in Q#

I am trying to find a way to implement a unitary transformation in Q# that implements e^(iA) where A is a square matrix. However, I only found ways to do this in Q# if A can be represented as a ...
0
votes
1answer
71 views

Find the decomposition of the following matrix into two level unitary matrices [duplicate]

Find the decomposition of the following matrix into two level unitary matrices: $$ \frac{1}{2} \begin{pmatrix} 1 & 1 & 1 & 1\\ 1 & i & -1 & -i\\ 1 & -1 & 1 & -1\\ ...