Why Vector, Matrix and Tensor are called 1D, 2D and 3D

1. Vector (1D):

A list of numbers in a single line. [1,2,3,4,5]

Think of it as a single column or Single Row in Excel. It either goes Horizontal or Vertical or any direction, but Single Line.

That is why it is called Only one dimension.

Example: [5, 10, 15] → 3 numbers in one row or 3 numbers in one column.

Python Code:

import numpy as np
vector = np.array([1,2,3,4,5])
print(vector)



2. Matrix (2D):

A table of numbers with both rows and columns.
Think of it as one Excel sheet where Column A has 1,2,3,4,5 and Column B has 6,7,8,9,10

Now it has Two dimensions: rows × columns.

Python Code:

import numpy as np


matrix = np.array([[1,2,3],[4,5,6],[7,8,9]])
print(matrix)


3. Tensor (3D or more):

A collection of matrices stacked together like a .
Think of it as multiple Excel sheets stacked in a workbook. One above another.
Tensor Can have 3, 4, or more dimensions.
Row is one dimension, Column is second dimension, second table or second sheet is third dimension, third table is fourth dimension etc.

Python code:

import numpy as np
tensor = np.array([[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]],[[13,14,15],[16,17,18]]])
print(tensor)

Comments

Popular posts from this blog

What is Artificial Intelligence? What is Machine Learning? What is Data Science? how they are related to each other?

Linear Algebra - What is it?

What is a Python Library?