# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# `linalg`::`kroneckerProduct`

Kronecker product of matrices

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```linalg::kroneckerProduct(`A`, <`B, …`>)
```

## Description

`linalg::kroneckerProduct(A, B)` computes the Kronecker product of two matrices `A` and `B`.

The Kronecker product (direct matrix product) of an m×n matrix `A` and a p×q matrix `B` is the (mp) ×(nq) matrix given in block form as

.

Componentwise: with I = p (i - 1) + k, J = q (j - 1) + l.

If `A` and `B` are matrices of the same matrix domain with the same component ring, the result is a matrix of the same type as `A` and `B`. If the domains or the component rings of `A` and `B` differ, `linalg::kroneckerProduct` tries to convert `B` into the domain type of `A` by `A::dom::coerce`. If this fails, conversion of `A` to the domain type of `B` is attempted. If no conversion is possible, an error is raised.

### Note

Note that the Kronecker product is only implemented for matrices over the domains `Dom::Matrix`, `Dom::SquareMatrix` or `Dom::MatrixGroup`. In particular, this includes matrices created by `matrix`.

A call with more than two arguments produces ```linalg::kroneckerProduct(A, B, C) = linalg::kroneckerProduct(linalg::kroneckerProduct(A, B), C)``` etc.

A call with only one argument is possible. It returns the input matrix.

## Examples

### Example 1

We consider two matrices `A` and `B` with symbolic components:

```A:= matrix([[a11, a12], [a21, a22]]); B:= matrix([[b11, b12, b13], [b21, b22, b23]]);```

The Kronecker product of `A` and `B` is computed by multiplying the matrix `B` with each of the components of the matrix `A`. The resulting block matrix is returned as a matrix of larger dimension:

`linalg::kroneckerProduct(A, B);`

`delete A, B:`

### Example 2

An n×n matrix `H` with components in {- 1, 1} is called a Hadamard matrix if `H` multiplied with its transpose equals n times the n×n identity matrix. The matrix `H` defined below is a Hadamard matrix:

```H:= matrix([[1, 1], [1, -1]]); H * linalg::transpose(H) = 2 * matrix::identity(2);```

Hadamard matrices play a role in the field of error correcting codes. A basic property of this type of matrices is that the Kronecker product of two Hadamard matrices is again a Hadamard matrix. We verify this statement for the matrix `H`:

`H2:= linalg::kroneckerProduct(H, H);`

Indeed, the matrix `H2` is a again a Hadamard matrix:

`H2 * linalg::transpose(H2) = 4 * matrix::identity(4);`

`delete H, H2:`

## Parameters

 `A`, `B, …` Matrices of the domains `Dom::Matrix`, `Dom::SquareMatrix` or `Dom::MatrixGroup`

## Return Values

Matrix of the same type as `A` or `B`.