Scalars, Vectors, and Tensors: The Building Blocks of Mathematical Structures


1. Introduction

In fields like physics, engineering, and artificial intelligence, mathematical expressions are used to describe quantities in the real world. These quantities are often expressed using scalars, vectors, and tensors. These three concepts differ based on how they represent a quantity’s value, direction, or structure. Understanding the differences is crucial for building a solid foundation—especially in data science, physics, and machine learning.


2. What is a Scalar?

A scalar is a mathematical quantity that has only magnitude (value). It has no direction and is usually represented by a single number.

Examples:

  • Temperature: 36.5 °C
  • Mass: 70 kg
  • Time: 5 seconds
  • Energy: 100 Joules

Mathematical Representation:

Scalars are typically represented with lowercase letters:
a = 5
Here, “a” represents the number 5. It does not indicate any direction—just a value.

Properties:

  • Represented by a single number (0-dimensional)
  • Not dependent on any coordinate system
  • Supports basic operations like addition or multiplication

3. What is a Vector?

A vector is a quantity that has both magnitude and direction. Unlike scalars, vectors tell us not just “how much” but also “which way”.

Examples:

  • Velocity: 60 km/h north
  • Force: 20 Newtons to the right
  • Displacement: 5 meters upward

Mathematical Representation:

Vectors can be written as arrays or with arrows:
v = [3, 4] or

v =  
⎡3⎤  
⎣4⎦

This means the vector goes 3 units along the x-axis and 4 units along the y-axis.

Dimension:

  • 1D vector: along a single axis (e.g., only x)
  • 2D vector: (x, y)
  • 3D vector: (x, y, z)

Properties:

  • Has both magnitude and direction
  • Has a defined starting point
  • Can be added, subtracted, or scaled by a scalar

4. What is a Tensor?

A tensor is a more general structure that includes both scalars and vectors as special cases. It can be thought of as a multi-dimensional array.

Tensor Ranks (Degrees):

  • Rank 0 Tensor: Scalar (e.g., 5)
  • Rank 1 Tensor: Vector (e.g., [1, 2, 3])
  • Rank 2 Tensor: Matrix (e.g., a 2×2 or 3×3 table)
  • Rank 3+ Tensor: Higher-dimensional data

Example:

An image can be represented as a 3rd-rank tensor:

  • Height × Width × Color Channels (e.g., 256 × 256 × 3)

Mathematical Representation:

A 2×2 matrix (2nd-rank tensor) looks like this:

A = [[1, 2],
     [3, 4]]

Applications:

  • Deep learning: Images, audio, text → all handled as tensors
  • Physics: Stress, strain → described using 2nd or 3rd-order tensors
  • Computer Vision: RGB images are passed to models as 3D tensors

Properties:

  • Expresses data in multiple dimensions
  • Can have direction in several axes
  • Becomes more complex as dimensions increase

5. Comparison Table

FeatureScalarVectorTensor
Dimension0 (a number)1 (an array)2 or more
DirectionNoneSingle directionMultiple directions
Example25[3, 4][[[1, 2], [3, 4]]]
Usage AreaGeneral purposePhysics, EngineeringAI, Deep Learning, Physics