Linear Algebra - Matrices: (lesson 2 of 3)

## Matrix Addition and Multiplication

### Addition of Matrices

Denote the sum of two matrices A and B
(of the same dimensions) by C = A + B.. The sum is defined by adding entries
with the same indices

over all i and j.

Example:

### Subtraction of Matrices

Subtraction is performed in analogous way.

Example:

### Scalar multiplication

To multiply a matrix with a real number, we multiply each element with this number.

Example:

### Multiplication of a row vector by a column vector

This multiplication is only possible if the row vector and the column vector have the same number of elements.
To multiply the row by the column, one multiplies corresponding elements, then adds the results.

Example:

If the row vector and the column vector are not of the same length, their product is **not defined**.

Example:

### The Product of a Row Vector and Matrix

When the number of elements in row vector is the same as the number of rows in the second matrix then this matrix
multiplication can be performed.

Example:

If the number of elements in row vector is **NOT** the same as the number of rows in the second matrix then their product is **not defined**.

Example:

### Matrix Multiplication - General Case

When the number of columns of the first matrix is the same as the number of rows in the second matrix then matrix
multiplication can be performed.

Examples

Multiplying a **2 x 3** matrix by a **3 x 2** matrix is possible and it gives a **2 x 2** matrix
as the result.

Multiplying a **2 x 3** matrix by a **2 x 3** matrix is **not defined.**

**Here is an example of matrix multiplication for two concrete matrices**

Example: Find the product AB where A and B are matrices given by:

Solution:

The product AB is defined since A is a 2 x 3 matrix and B is a 3 x 2 matrix. The answer is a 2 x 2 matrix.
The multiplication is divided into 4 steps.

**Step 1:**

We multiply the **1st** row of the first matrix and **1st** column of the second matrix, element by element. The answer goes in position **(1, 1)**

**Step 2:**

Now, we multiply the **1st** row of the first matrix and **2nd** column of the second matrix. The answer goes in position **(1, 2)**

**Step 3:**

Now we multiply **2nd** row of the first matrix and the **1st** column of the second matrix. The answer goes in position **(2, 1)**

**Step 4:**

Finally, we multiply **2nd** row of the first matrix and the **2st** column of the second matrix. The answer goes in position **(2, 2)**

**So, the result is:**

Example 2: Find the product AB where A and B are matrices given by:

Solution: