Chapter 2. Vectors, Part 1

Vectors provide the foundations upon which all of linear algebra (and therefore, the rest of this book) is built.

By the end of this chapter, you will know all about vectors: what they are, what they do, how to interpret them, and how to create and work with them in Python. You will understand the most important operations acting on vectors, including vector algebra and the dot product. Finally, you will learn about vector decompositions, which is one of the main goals of linear algebra.

Creating and Visualizing Vectors in NumPy

In linear algebra, a vector is an ordered list of numbers. (In abstract linear algebra, vectors may contain other mathematical objects including functions; however, because this book is focused on applications, we will only consider vectors comprising numbers.)

Vectors have several important characteristics. The first two we will start with are:

Dimensionality

The number of numbers in the vector

Orientation

Whether the vector is in column orientation (standing up tall) or row orientation (laying flat and wide)

Dimensionality is often indicated using a fancy-looking N , where the indicates real-valued numbers (cf. for complex-valued numbers) and the N indicates the dimensionality. For example, a vector with two elements is said to be a member of 2 . That special character is made using latex code, but you can also write R2, R2, or R^2.

Equation 2-1 shows a few examples of vectors; please determine ...

Get Practical Linear Algebra for Data Science now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.