# Matrices (Pt. 1): Intro

## Matrices

Matrix represents the bulk of our discussion as all possible discussed entities are arguably matrices with varying sizes.

### Size of Matrix

Matrices are expressed through *rows* by *cols*, with

> * m x n (read as m by n)
> * 3 x 2 (read as 3 by 2)

|      Type     |  Size |                        Example                        |
| :-----------: | :---: | :---------------------------------------------------: |
|     Matrix    | m x n |          <p>\[1, 2, 3] </p><p>\[4, 5, 6]</p>          |
| Square Matrix | n x n | <p>\[1, 2, 3] </p><p>\[4, 5, 6] </p><p>\[7, 8, 9]</p> |

It may though be superficial, but what distinguishes between a vector or a matrix is that both **m** and **n** variables has to be **greater than 1**.

### Notation of Elements

An **element** (or item) of a matrix is conventionally referred to by its location with

* **i** being its *row number*, while
* **j** being its *column number*

![An element of matrix a(i, j)](https://3978845189-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwfxeT-UMPxSGzkwagB%2F-Lx1gVS8C3H8Q1X5-B1S%2F-Lx1i9QOOq-T-lk6u3ye%2Fimage.png?alt=media\&token=d7fe947e-6b5d-47f1-98a1-02470151c678)

Hence, for Matrix "a" is particular, we could reference an element by calling for example **"a one-two"**.&#x20;

### Matrix Arithmetic

Matrices can undergo addition, subtraction, and mostly multiplication, but **never division** (lol) :skull:.

The following operations can be read at face-value. For example, Matrix-"*some-entity*" "*some-operation***"** .

#### Matrix-Scalar Add/Subtract/Multiply Operation

*Scalar-value* is applied to *all elements* of the matrix.

$$
\left\[\begin{array}{cc}
4 & 5\\
6 & 7
\end{array}\right]
+2 =
\left\[\begin{array}{cc}
(4+2) & (5+2)\\
(6+2) & (7+2)
\end{array}\right]
==================

\left\[\begin{array}{cc}
6 & 7\\
8 & 9
\end{array}\right]
$$

$$
\left\[\begin{array}{cc}
6 & 7\\
8 & 9
\end{array}\right]

* 3 =
  \left\[\begin{array}{cc}
  (6-3) & (7-3)\\
  (8-3) & (9-3)
  \end{array}\right]=
  \left\[\begin{array}{cc}
  3 & 4\\
  5 & 6
  \end{array}\right]
  $$

$$
\left\[\begin{array}{cc}
1 & 2\\
3 & 4
\end{array}\right]
\times 2 =
\left\[\begin{array}{cc}
(1\times 2) & (2\times 4)\\
(3 \times 2) & (4\times 2)
\end{array}\right]=
\left\[\begin{array}{cc}
2 & 4\\
6 & 8
\end{array}\right]
$$

#### Matrix-Matrix Add/Subtract Operation

*Scalar-value* of each elements are applied to *respective elements* of matrices.

* Matrices must be **of the same size**

$$
\left\[\begin{array}{cc}
1 & 2\\
3 & 4
\end{array}\right]
\+
\left\[\begin{array}{cc}
5 & 6\\
7 & 8
\end{array}\right]  =
\left\[\begin{array}{cc}
(1+5) & (2+6)\\
(3+7) & (4+8)
\end{array}\right]=
\left\[\begin{array}{cc}
6 & 8\\
10 & 12
\end{array}\right]
$$

$$
\left\[\begin{array}{cc}
7 & 8 & 9
\end{array}\right]
------------------

\left\[\begin{array}{cc}
3 & 2 & 1
\end{array}\right]
==================

\left\[\begin{array}{cc}
(7-3) & (8-2) & (9-1)
\end{array}\right]
==================

\left\[\begin{array}{cc}
4 & 6 & 8
\end{array}\right]
$$

#### **More on the next page ⏭**
