Vector Linear Transformation

One of the most basic operation we can perform on a vector is a linear transformation. It is also referred to as a scalar transformation. A linear transformation of a vector simply means that we can scale up or down a whole vector by multiplying it to some scalar value.

Mathematically, linear transformation follows the representation below:

$$a \begin{bmatrix} x \\y \end{bmatrix} = \begin{bmatrix} ax \\ ay \end{bmatrix}$$

Let's define a simple vector with values $1,2,3$ and implement a linear transformation to double their values.

$$ 2 \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} = \begin{bmatrix} 2(1) \\ 2(2) \\ 2(3) \end{bmatrix} = \begin{bmatrix} 2 \\ 4 \\ 6 \end{bmatrix}$$

Implementation in Python Numpy

import numpy as np

sample_vect = np.array([1, 2, 3])
sample_vect
array([1, 2, 3])
2  * sample_vect
array([2, 4, 6])