# Introduction to Matrices (Pt. 2)

## Types of entities

|           Example          | Math/Physics | <p>Computer <br>Science</p> |
| :------------------------: | :----------: | :-------------------------: |
|            \[1]            | Scalar (1-D) |         Number (0-D)        |
|           \[1, 2]          | Vector (2-D) |         Array (1-D)         |
| <p>[1, 2]</p><p>[3, 4]</p> | Matrix (3-D) |         Matrix (2-D)        |
|     \[\[1, 2], \[3,4]]     | Tensor (N-D) |         Tensor (N-D)        |

#### Dimensions

Poh-**tay**-toh, poh-**tah**-toh 🥔... ...&#x20;

Toh-**may**-toh, toh-**mah**-toh 🍅... ...

With all confusing jargons aside, dimensions can be a difficult concept to wrap around. Despite having 7D dried mangoes and even 9D cinemas, it is difficult (actually impossible 🤪) to visualize even 4 dimensions.

You might have also noticed the difference in the _amount of dimensions_ referred to by either via the **Math/Physics vs Computer Science** view.

This is because **Math/Physics** often work with what they refer to as the **Vector Space** (don't really claim to know this very well). Thus, the _dimensions_ being referred to are the tools for the plotting of 2-D to 3-D vectors, to better understand topics such as forces of either push, pull, shear or rotation.

However, for **Computer Science**, the _dimensions_ referred to here are often just a description about the arrays. Hence, instead of the former key purpose of plotting and visualization, this simply describes the level of complexity of a given array.

{% hint style="info" %}
E.g., it may be helpful to describe the position of an element of a **2-D array (matrix)** via both its _row and column number_, whereas it is not that necessary for a scalar (unnecessarily wrong)
{% endhint %}

Following this GitBook will be focusing on **matrices**, but however, the following entities are also a good mentioning/starting points.

{% tabs %}
{% tab title="Scalar" %}
### Scalar

A scalar is a **single-value** number. This entity is often applied to a vector, and its action is called **scaling**.&#x20;

* For example, the value **3** is a scalar
* It should also not be represented with brackets
* It has 0 dimensions, as it is not meaningful to express it in terms of either rows or columns&#x20;
* There are also no other possible variations to express a scalar
{% endtab %}

{% tab title="Vector" %}
### Vector

In Physics, a vector has both the characteristic of a _magnitude_ and a _direction_. A vector of **\[2, 7]** is able to tell the _direction_ from the way it points, from the origin \[0, 0] to \[2, 7], and the _magnitude_ through computing its _Euclidean Distance_ (or alternatively the hypotenuse using _Pythagoras Theorem_).

In contrast to a scalar, a vector consist of

* **More than one element**, and&#x20;
* There are **two possible variation** of expression

#### Row Vector

$$
\mathbf{v_r } = \left[\begin{array}
{rrr}
x_1 & x_2  & x_3 
\end{array}\right]
$$

A _row_ vector has the size of **1 x n**.

#### Column Vector

$$
\mathbf{v_c} = \left[\begin{array}
{rrr}
x_1\\
x_2\\
x_3
\end{array}\right]
$$

A _column_ vector has the size of **m x 1**.
{% endtab %}
{% endtabs %}

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