Addition and Scalar Multiplication

 

Matrix addition

Addition and subtraction are element-wise, so you simply add or subtract each corresponding element:

[abcd]+[wxyz]=[a+wb+xc+yd+z]\begin{bmatrix} a & b \\ c & d \end{bmatrix} +\begin{bmatrix} w & x \\ y & z \end{bmatrix} =\begin{bmatrix} a+w & b+x \\ c+y & d+z \end{bmatrix}

To add or subtract two matrices, their dimensions must be the same.

Matrix scalar multiplication

In scalar multiplication, we simply multiply every element by the scalar value:

[abcd]x=[axbxcxdx]\begin{bmatrix} a & b \\ c & d \end{bmatrix} * x =\begin{bmatrix} a*x & b*x \\ c*x & d*x \end{bmatrix}

Add Scalar to a Matrix

What happens if we have a Matrix + scalar? The scalar value is added to each entry of A.

A = [0 1; 1 0]
C = A + 2
C =
     2     3
     3     2