🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to AI Notes
Topic #47

Linear Algebra

Machine Learning experts cannot live without Linear Algebra:

  • ML make heavy use of Scalars
  • ML make heavy use of Vectors
  • ML make heavy use of Matrices
  • ML make heavy use of Tensors

The purpose of this chapter is to highlight the parts of linear algebra that is used in data science projects like machine learning and deep learning.

Col 1 Col 2 Col 3 Col 4 Col 5
Scalar Vector(s)
1 1 2 3 1 2 3
1 2 3 1 2 3
1
2
3
1 2 3
Matrix Tensor
1 2 3 4 5 6 Tensor 1 2 3 4 5 6 4 5 6 1 2 3 End Table
1 2 3
4 5 6
1 2 3 4 5 6 4 5 6 1 2 3
1 2 3
4 5 6
4 5 6
1 2 3

Vectors and Matrices

Vectors and Matrices are the languages of data.

With ML, most things are done with vectors and matrices.

With vectors and matrices, you can Discover Secrets.


Scalars

In linear algebra, a scalar is a single number.

In JavaScript it can be written like a constant or a variable:

const myScalar = 1;
let x = 1;
var y = 1;

Vectors

In linear algebra, a vector is an array of numbers.

In JavaScript, it can be written as an array:

const myArray = [50,60,70,80,90,100,110,120,130,140,150];
myArray.length;   // the length of myArray is 11

An array can have multiple dimensions, but a vector is a 1-dimensional array.

A vector can be written in many ways. The most common are:

Col 1 Col 2 Col 3
v = 1 2 3
1 2 3

or:

Col 1 Col 2
v = 1 2 3
1
2
3
Col 1 Col 2
The image to the left is a Vector. The Length shows the Magnitude. The Arrow shows the Direction.

Learn More ...


Matrices

In linear algebra, a matrix is a 2-dimensional array.

Col 1 Col 2 Col 3 Col 4
C = 3 0 0 0 0 3 0 0 0 0 3 0 0 0 0 3
3 0 0 0
0 3 0 0
0 0 3 0
0 0 0 3

In JavaScript, a matrix is typically represented as a two-dimensional (2D) array, meaning an array of arrays. Each inner array represents a row, and each element within those arrays represents a column.

Example

const myArray = [[1,2],[3,4],[5,6]];

Learn More ...


Tensors

A Tensor is an N-dimensional Matrix.

Col 1 Col 2 Col 3 Col 4 Col 5
T = 1 2 3 4 5 6 4 5 6 1 2 3
1 2 3 4 5 6 4 5 6 1 2 3
1 2 3
4 5 6
4 5 6
1 2 3

In JavaScript, a tensor is an array with multiple indices (indexes).

Learn More ...

Linear Algebra is the branch of mathematics that concerns linear equations (and linear maps) and their representations in vector spaces and through matrices.

Linear algebra is central to almost all areas of mathematics.

Wikipedia

Want to go beyond the notes?

Join CodingNow 2.0's AI course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Linear Algebra – FAQs

Quick answers about learning Linear Algebra in AI.

This free note from CodingNow 2.0 explains Linear Algebra in AI — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every AI topic on CodingNow 2.0, including Linear Algebra, is 100% free with no signup required.
With focused practice, most students grasp Linear Algebra in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now