Matrices - RPIQuantumComputing/QuantumCircuits GitHub Wiki

Matrix notation: In any quantum circuit, we apply quantum gates to the initial quantum state to find the final quantum state. The transformation of the input state to the output is achieved using a matrix.

For single-qubit gates, a matrix consists of two columns of numbers. SingleQubit

Using matrices: We can use the matrix for a quantum gate to calculate the result of applying that gate to a quantum state. To find this result, we multiply the matrix for the quantum gate with the vector for the quantum state.

Rules for Multiplying Matrices: The first matrix must have the same number of columns as the second matrix has rows. The number of rows of the resulting matrix equals the number of rows of the first matrix, and the number of columns of the resulting matrix equals the number of columns of the second matrix.

Applying multiple gates to quantum states: Most quantum circuits will have more than one gate. We can find the result of applying multiple gates to an initial quantum state by applying one gate at a time. So, in a circuit with two gates, we first find the result of applying the first gate using matrix-vector multiplication. Then, we find the result of applying the second gate, again using matrix vector multiplication.

Generating superposition: Superposition is an important quantum resource used by all quantum algorithms. To generate superposition in the circuit, we use the H gate. Using the matrix of the H gate, we can prove how applying the H gate to the |0> states results in the |+> state, which is an equal superposition of |0> and |1>.