Basics of Vectors and Matrices
Lesson Introduction
Welcome to this exciting course path! This path focuses on teaching math concepts that are important for machine learning. Note that this path assumes that you have basic knowledge of the python programming language. You can use our Introduction Programming in Python course path to gain or solidify this knowledge.
Welcome to our lesson on the basics of vectors and matrices!
In this lesson, we'll explore what vectors and matrices are, why they're important in machine learning, and how to create and work with them in Python. By the end of this lesson, you'll understand how to define, display, and interpret vectors and matrices. Let's get started!
Concept: Vector
Imagine you have a list of your favorite ice cream flavors: ["vanilla", "chocolate", "strawberry"]. A vector is such a list, but with numbers. For example, a vector could be [1, 2, 3].
A vector is a list (or array) of numbers arranged in a specific order. It's one-dimensional, meaning it has only one row or one column. If a vector is a row, it is called a row vector. Here is an example of it:
If a vector is a column, it is called a column vector:
They look the same, but some mathematical operations treat row vectors and column vectors differently, so it is vital to differentiate them.
Creating and Displaying a Row Vector in Python
Let's see how we can create a row vector in Python using np.array() from the NumPy library. NumPy provides advanced linear algebra features that will be useful in the upcoming units of our course.
This shows a simple row vector with three numbers.
Creating and Displaying a Column Vector in Python
And this is how we represent the column vector using np.array():
Using np.array(), we specify a 2-dimensional structure for the column vector, but with one item in each row.
