# NumPy Kronecker Delta | What is NumPy.kron()?

Hello geeks and welcome in this article, we will cover the NumPy Kronecker delta function. Along with that, for an overall better understanding, we will also look at its syntax and parameter. Then we will see the application of all the theory part through a couple of examples. While writing our program, we represent our function as NumPy.kron(). But at first, let us try to understand what does the Kronecker means in general. We can understand the Kronecker function as the operation on the 2 matrices of arbitrary sizes resulting in a block matrix in mathematical terms. To denote this operation, the symbol “⊗” is used. So we can conclude that NumPy Kronecker delta or NumPy.kron() helps us by finding the Kronecker product of 2 Input arrays. Next, we will look at the syntax associated with the function.

Contents

## SYNTAX OF NUMPY KRONECKER DELTA

``numpy.kron`(a, b)`

Here we can see that the function has a straightforward syntax and has only 2 parameters. In the next section, we will cover its parameter as well as the return type.

## PARAMETER OF NUMPY KRONECKER DELTA

a,b: array_like

This parameter represents the 2 input arrays of which the Kronecker product needs to be calculated.

## RETURN

out: ndarray

The function returns a ndarray representing the Kronecker Product of our input.

## EXAMPLES

We have covered all the necessary theory associated with our function. Also, we have understood what Kronecker product means in general. In this section, we will look at various examples and understand how the function works. We will start with an elementary level example and gradually move our way to more complicated examples.

```#input
import numpy as ppool
a=[1,23,4]
b=[2,45,5]
print(ppool.kron(a,b))
```

Output:

``[   2   45    5   46 1035  115    8  180   20]``

Before moving ahead with the explanation of the above example, I would like to make a few things clear. Kronecker multiplication is totally different from when compared to matrix multiplication in general. Now, let’s get back to the example. Here we have at first imported the NumPy module. Then we have defined 2 arrays of which we wish to get the Kronecker product. In the next step, we have used the print statement along with our syntax. Here our output justifies the input properly. We can understand it in this way, the general Kronecker product representation is [a11 b11, a11 b12,……… so on] and we compare it to our input the answer is justified.

From the above example, it is quite evident how it is different from the original matrix product. As for matrix multiplication, the number of columns in the first matrix must be equal to the number of rows in the second matrix. But as in the above example, we can see that we performed operation for two 1*3 matrix. One difference that we can spot is the general matrix multiplication representation is [a11b11+a12b21 + a13b31 + ……… so on].

Now as we are done with this let us look at one more example.

```#input
import numpy as ppool
a=[[1,23,4],
[20,45,9],
[34,8,6]]
b=[[2,45,5],
[5,8,7]]
print(ppool.kron(a,b))
```

Output:

``````[[   2   45    5   46 1035  115    8  180   20]
[   5    8    7  115  184  161   20   32   28]
[  40  900  100   90 2025  225   18  405   45]
[ 100  160  140  225  360  315   45   72   63]
[  68 1530  170   16  360   40   12  270   30]
[ 170  272  238   40   64   56   30   48   42]]``````

Here we can look at another example. In this particular case, we have followed all the steps similar to that of the first example. But instead of having a 1-d array as that of the 1st example, we went for two different 2-d arrays. The output here justifies our input. Just Imagine doing such humungous calculations by hand. 