# Vectors

A vector is an array of scalar numbers. We can identify each individual number by its index in that ordering. Typically, we give vectors lowercase names in bold typeface, such as $\mathbf{x}$.

Individual elements in the vector can be identified by the name in italics with a subscript indicating the element position. Vectors are conventionally $1$-indexed and are typically assumed to be column vectors.

$\mathbf{x} = \begin{bmatrix}x_1 \\ x_2 \\ \vdots \\ x_n \\ \end{bmatrix}$

For convenience, we commonly represent a vector as the transpose of a row vector.

$\mathbf{x} = [x_1, x_2, …, x_n]^T$

We can represent a vector as a list in Python.

x = [7, 4, 3, 2]

# Python is zero-indexed so x[2] will give the third element in the vector
print("Third element in vector x is {}".format(x[2]))
print("x is of type {}".format(type(x)))

Third element in vector x is 3
x is of type <class 'list'>


We can also represent a vector as a NumPy array. NumPy features a powerful $n$-dimensional array object and many useful tools and functions used in linear algebra.

x = np.array([7, 4, 3, 2])
print("Third element in vector x is {}. x is of type {}".format(x[2], type(x)))
print("x is of type {}".format(type(x)))


Third element in vector x is 3. x is of type <class 'numpy.ndarray'>