Search

Mathematical Introduction: Matrices and how they can be used in quantum computing

Quantum Computing Basic Concepts cover image

Overview

Secondary School

Mathematics, Computer Science

Quantum Computing

English

Overview

Keywords: matrices, unitary matrix, square matrix, Dirac notation, bra-ket notation, Kronecker (tensor) product
Age group: 16-18 years
Required knowledge/skills: basic algebra
Time frame: 45 minutes 

This section is part of Basic Concepts of Quantum Computing – Mathematical Basics written by Natalija Budinski (RS).

Content

Definition of a matrix
Addition and subtraction of matrices
Multiplication of matrices
The bra-ket notation
Kronecker product
Task for students: Quiz

Summary

In this lesson, students will be introduced to the basic concepts and operations of matrices, which are essential tools in mathematics, physics, computer science and quantum computing. They will explore how matrices can be used to organise and transform data, and how they are applied in real-world quantum systems.

quantencomputingt_teaser_ilustrationen_v01_basic_concepts_skaliert

By the end of the lesson, students will be able to

  • understand what matrices are and how to perform basic operations like addition and multiplication on them;
  • discover how matrices are used in quantum mechanics and quantum computing;
  • learn about the Kronecker (tensor) product, a special matrix operation used, for example, to describe multi-qubit systems;
  • become familiar with the Dirac (bra-ket) notation, a symbolic way of representing quantum states.

Required materials

  • paper and pencil

Matrices

A matrix is a powerful mathematical tool used to organise and manipulate numbers in a structured way. At its core, a matrix is a rectangular array of numbers arranged in rows and columns. This structure allows to store, process, and analyse large amounts of data efficiently, making matrices essential in mathematics, computer science, physics, engineering, and more.

A matrix is an m × n array of numbers, m being the number of rows and n the number of columns. The order of a matrix is the number of rows times the number of columns, i.e. m × n . Let's say if a matrix has 5 rows and 4 columns then the order of the matrix will be 20. 

M = [ a 11 a 12 a 13 a 14 a 21 a 22 a 23 a 24 a 31 a 32 a 33 a 34 a 41 a 42 a 43 a 44 a 51 a 52 a 53 a 54 ]

A square matrix is a matrix that has the same number of rows and columns.

M = [ 1 2 4 0 1 5 2 0 3 ]

An identity matrix is a square matrix with 1s in the main diagonal and 0s elsewhere.

M = [ 1 0 0 0 1 0 0 0 1 ]

In order to perform an addition or subtraction, matrices must have the same number of rows and the same number of columns. Matrix addition and subtraction are performed element by element. Each element of one matrix is added to or subtracted from the corresponding element of the other matrix.

Example

For two given matrices A and B , calculate A + B and  A B

A = [ 2 3 5 1 ]  and B = [ 1 2 3 0 ].

Solution

A + B = [ 2 3 5 1 ] + [ 1 2 3 0 ] = [ 2 + 1 3 + 2 5 + 3 1 + 0 ] = [ 3 5 8 1 ]

A B = [ 2 3 5 1 ] [ 1 2 3 0 ] = [ 2 1 3 2 5 3 1 0 ] = [ 1 1 2 1 ]

A matrix can be multiplied with another matrix if their dimensions align (i.e., for two matrices A and B, the number of columns in A must match the number of rows in B). The result yields a matrix that has as many rows as the first matrix and as many columns as the second matrix.

A = [ a 11 a 12 a 21 a 22 ] and B = [ b 11 b 12 b 21 b 22 ]

A B = [ a 11 a 12 a 21 a 22 ] [ b 11 b 12 b 21 b 22 ] = [ a 11 b 11 + a 12 b 21 a 11 b 12 + a 12 b 22 a 21 b 11 + a 22 b 21 a 21 b 12 + a 22 b 22 ]

B A = [ b 11 b 12 b 21 b 22 ] [ a 11 a 12 a 21 a 22 ] = [ b 11 a 11 + b 12 a 21 b 11 a 12 + b 12 a 22 b 21 a 11 + b 22 a 21 b 21 a 12 + b 22 a 22 ]

Example

Take the two matrices from the example in “Addition and subtraction”. The results of  A B and  B A are:

AB= [ 23 51 ] [ 12 30 ] = [ 2·1 + 3·3 2·2 + 3·0 5·1 + 1·3 5·2 + 1·0 ] = [ 114 210 ]

BA= [ 12 30 ] [ 23 51 ] = [ 1·2 + 2·5 1·3 + 2·1 3·2 + 0·5 3·3 + 0·1 ] = [ 121 69 ]

The bra-ket notation

The bra-ket notation, also known as Dirac notation, is a way of writing quantum states. It is equiva-lent to the vector notation, but is shorter and “cleaner”.

It uses the symbols | (ket) and | (bra).
A ket represents a column vector, such as | 0 = [ 1 0 ] or | 1 = [ 0 1 ] , which are the basic qubit states. A bra represents a row vector, such as  0| = [ 1 0 ] or 1| = [ 0 1 ] . We won’t dwell further on the bra notation since the ket notation is the only one we use in this whole teaching material.

Kronecker product

In quantum computing, we often need to describe multiple quantum bits (qubits) together. A simple way to do this is through the Kronecker product (also called tensor product). The Kronecker product combines two matrices or two vectors.

Example 1

Consider two vectors u = [ a b ] and v = [ c d ] . The Kronecker product, denoted by a , of these two vectors is:
u v = [ a b ] [ c d ] = [ a c a d b c b d ]
Note that if one has two vectors u and v , their Kronecker product u v yields a larger vector. In this example, the initial vectors are 2-dimensional whereas the resulting vector is 2 × 2 = 4-dimensional.

Example 2

Consider the two vectors u = [ 1 2 5 ] and v = [ 3 4 ] . Their Kronecker product is:
u v = [ 1 2 5 ] [ 3 4 ] = [ 3 4 6 8 15 20 ] .
The Kronecker product of a 3-dimensional and a 2-dimensional vector is a 6-dimensional (3 x 2) vector.

Example 3

Consider again the two matrices A = [ 2 3 5 -1 ] and B = [ 1 2 3 0 ] . Their Kronecker product is:
A B = [ 2 3 5 1 ] [ 1 2 3 0 ] = [ 2 [ 1 2 3 0 ] 3 [ 1 2 3 0 ] 5 [ 1 2 3 0 ] 1 [ 1 2 3 0 ] ]  
= [ 2 4 3 6 6 0 9 0 5 10 1 2 15 0 3 0 ] .

Example 4

The Kronecker product is distributive: ( u + v ) w = u w + v w

a) Verify the distributivity relation for the following vectors:
u = [ 1 0 ] , u = [ 1 0 ]  and w = [ 1 0 ] .

b) In ket-notation, these three vectors may be written as:
u = | 0 , v = | 1 and w = | 0 .

u w + v w  can therefore also be written as:

| 0 | 0 + | 1 | 0 , or in an even shorter notation: | 00 + | 10 .

The Kronecker product is useful because it allows the manipulation of composite systems by treating them as combinations of single components.

Example 5

Consider the two qubit states:
| 0 = [ 1 0 ]  and | 1 = [ 0 1 ] .

A quantum state of a two-qubit system (composed of these two qubits) is given by the Kronecker product, for example,
| 0 | 0 = [ 1 0 ] [ 1 0 ] = [ 1 0 0 0 ] = | 00

Note: the Kronecker product is not commutative: | 0 | 1 | 1 | 0 .

Example 6

Quantum states cannot always be written as simple Kronecker products. Let us consider the two-qubit state:

| Φ + = 1 2 ( | 00 + | 11 ) ,

which corresponds to the following sum of Kronecker products:

| Φ + = 1 2 ( [ 1 0 ] [ 1 0 ] ) + 1 2 ( [ 0 1 ] [ 0 1 ] )

This is equal to:

| Φ + = 1 2 [ 1 0 0 0 ] + 1 2 [ 0 0 0 1 ] = 1 2 [ 1 0 0 1 ]

The resulting state cannot be represented by a Kronecker product of two basic qubit states.

Task for students: Quiz

You can download the quiz for students here:

Below you find the same questions in an interactive format.
Use this link to send the interactive H5P task to your students.

  1. B
  2. A
  3. B
  4. A
Close search