Linear Algebra To Know For Machine Learning

Ojash Shrestha
5 min readMay 14, 2021

In this article, we’ll learn about Linear Algebra. Linear Algebra is the backbone of Artificial Intelligence. Complex models in Machine Learning are represented and solved with the processes of Linear Algebra and thus it is critical. Each and every Machine Learning Engineer must have a strong foundation of it.

Read the Previous Article — Why Do AI Engineers Need Calculus to dive deeper into Calculus in order to become a better AI Engineer

Linear Algebra

Linear Algebra deals with linear equations like linear maps (which is a mapping of two different vector spaces which preserve the vector operation of addition and scalar multiplication) and its representations in vector spaces and through matrices. Linear algebra is key in almost all areas of mathematics since it is widely used in science and many fields of engineering as it helps model different natural phenomena and compute them efficiently. Linear Algebra is highly similar to the Algebra we talked about back in our previous article, except that instead of ordinary single numbers, it deals with vectors. Many of the same algebraic operations we’ve used to perform on ordinary numbers (i.e., scalars), like addition, subtraction and multiplication, can be generalized to be operated on vectors.

What we’ll be learning in this article is overall about what happens when we have multiple variables,

  • Introduction to vectors
  • Solving sets of linear equations
  • Introduction to matrices
  • Solving sets of linear equations of matrices
  • Linear transformations
  • Identity matrix
  • Determinant

Vectors

A vector is a list of numbers. There are (at least) two ways to interpret what this list of numbers means: One way to think of the vector as being a point in space. If so, this list of different numbers would in fact be a way of identifying that very point in space such that each number represents the vector’s component of that dimension. Another approach to understanding vector is as a magnitude and a direction, e.g., a quantity like a velocity (“the car’s velocity is 120 mph north-by-northeast”).

Vector Addition

Vectors can be added and subtracted.

Graphically, we can imagine adding two different vectors together as placing two-line segments end-to-end, maintaining distance and direction. An example of it is illustrated below, showing the addition of two vectors that create the third vector. A vector is denoted by its name with an arrow over it.

Let,

,

Adding the vectors, we get,

This resultant vector would be the third vector.

Vector Multiplication

There are two different distinguishable ways of multiplying vectors, which are called dot products (i.e. scalar products) and cross products. The dot product generates a scalar value from the product of two vectors and will be discussed in greater detail below. Do not confuse the dot product with the cross product which is entirely different.

Here,

And the calculations are the same in multiple dimensions.

Solving a set of equations,

One of the ways to solve the two equations is to draw them graphically and how they intersect each other.

In Linear Algebra, we take the matrixes and solve them.

Let us take, two equations,

X = Y + 5

3X + 2Y = 5

Taking both X and Y is same sides, we get,

X — Y = 5

3X + 2 Y = 5

Taking the above equation, I and II in matrix form, we get,

Matrix

A matrix just like a vector can also be understood as a collection of numbers. The major difference between vector and matrix is that matrix is a table of numbers instead of a list.

Matrix Row & Matrix Column

Entries or Elements are different numbers, symbols, and expressions in a matrix. Rows and Columns are the horizontal and vertical lines in a matrix respectively.

Matrix Multiplication

Matrix multiplication is complicated, as multiple elements in the first matrix interact with multiple elements in the second to produce each element in the product matrix. This explains how matrix multiplication can be a mundane task to carry out by hand, and thus would be time-consuming on a computer for very large matrices.

Taking matrix multiplication for two different equations,

X — Y = 5

3X + 2 Y = 5 can be written as,

Here, the vertical values 1, 3 and –1,2 are columns and the horizontals are taken as rows.

To Read the full article with detailed examples, https://www.c-sharpcorner.com/article/linear-algebra-to-know-for-machine-learning/

--

--