# Vectors

**Scalar**: a single number

**Vector**: an ordered group of numbers / a $n \times 1$ matrix

## Vector properties #

**Length/magnitude**: $$ |\vec{v}| = \sqrt{v_1^2 + v_2^2 + \dots+v_n^2} $$

A **unit vector** has a length of 1, and can be obtained by dividing any vector by its magnitude.

**Distance between vectors** $\vec{a}$ and $\vec{b}$: $$ \text{dist}(\vec{a}, \vec{b}) = |a - b| $$

**Inner/dot product**: $$ \vec{a} \cdot \vec{b} = |\vec{a}| \times |\vec{b}| \times \cos{\theta} = a_1 b_1 + a_2 b_2 + \dots a_n b_n $$

Two vectors are **orthogonal** if the dot product is zero.

To calculate the angle between two vectors, you can rewrite the dot product: $$ \cos\theta = \frac{\vec{a} \cdot \vec{b}}{|\vec{a}| \times |\vec{b}|} $$

## Linear dependence #

**Linear combination**: let vectors $\vec{v}_1, \vec{v}_2, \dots, \vec{v}_p$ with weights $c_1, \dots, c_p$ then we have the linear combination $\vec{y}$: $$ \vec{y} = c_1 \vec{v}_1 + c_2 \vec{v}_2 + \dots + c_p \vec{v}_p $$

**Span**: the set of all possible linear combinations of a vector / a set of vectors

A set of two or more vectors is **linearly dependent** *if and only if* at least one of the vectors in S is a linear combination of the others.

Also, a set of two or more vectors is **linearly dependent** if:

- The set contains the zero vector
- The set contains more vectors than entries in each vector

Note: To check if a vector is a linear combination of other vectors you can solve it as a system of equations in a augmented matrix.