Matrices are important in scientific and engineering work. Using Python programming language for matrix computation is made easy using the numpy package. array() object or function in numpy can be used to create matrix in Python. Once you have created matrices(see How to create matrix in Python) the addition of two or more matrices is easy.

Suppose we have two matrices a and b, then to add matrices we just add them up like so,

Now consider the addition of two different sizes x and z,

Suppose we have two matrices a and b, then to add matrices we just add them up like so,

The only thing to remember is to use same size matrices.

To illustrate the error in adding matrices of different size consider the following example where we have used the builtin functions for creating zeros and ones matrices. See Useful builtin matrices in Python Numpy.

First consider addition of same size matrices x and y,

Now consider the addition of two different sizes x and z,

## No Comment to " How to add matrices in Python? "