Kuest AI

Study anything, free

Start free

Scalars, Vectors, and Dimensions in Linear Algebra

Learn the difference between scalars and vectors, how vector dimensions work, and why vectors represent feature data in machine learning.

1. Scalars and vectors

A scalar is a single number. Examples include 77, −1.5-1.5, and 00.

A vector is an ordered collection of numbers. It is often written as a column:

x=(32).\mathbf{x}=\begin{pmatrix}3\\2\end{pmatrix}.

The entries of a vector are called its components. The order matters:

(32)≠(23).\begin{pmatrix}3\\2\end{pmatrix}\ne\begin{pmatrix}2\\3\end{pmatrix}.

In geometry, a vector can represent an arrow. In data science, it can represent one item using several numerical features.

2. Dimension: how many components?

The dimension of a vector is the number of entries it contains.

  • (4)\begin{pmatrix}4\end{pmatrix} has dimension 11.
  • (4−1)\begin{pmatrix}4\\-1\end{pmatrix} has dimension 22.
  • (4−16)\begin{pmatrix}4\\-1\\6\end{pmatrix} has dimension 33.

A vector with nn real-number components belongs to Rn\mathbb{R}^n:

v∈Rn.\mathbf{v}\in\mathbb{R}^n.

For example,

v=(1.20−58)∈R4.\mathbf{v}=\begin{pmatrix}1.2\\0\\-5\\8\end{pmatrix}\in\mathbb{R}^4.

3. Vectors as feature lists

In machine learning, a vector commonly stores the features of one observation. For instance,

x=(1240.8)\mathbf{x}=\begin{pmatrix}12\\4\\0.8\end{pmatrix}

could represent three measurements, where each position has a fixed meaning:

ComponentMeaning
x1=12x_1=12first measurement
x2=4x_2=4second measurement
x3=0.8x_3=0.8third measurement

The vector has dimension 33 because there are three features. Every vector in a dataset must use the same feature order so that corresponding components can be compared correctly.

4. Worked example and flashcards

Worked example: Classify the object below:

a=(−251).\mathbf{a}=\begin{pmatrix}-2\\5\\1\end{pmatrix}.
  1. It has three entries: −2-2, 55, and 11.
  2. Therefore, it is a vector, not a scalar.
  3. Its dimension is 33.
  4. In notation, a∈R3\mathbf{a}\in\mathbb{R}^3.

Quick flashcards

FrontBack
What is a scalar?One number.
What is a vector?An ordered list of numbers.
What determines a vector's dimension?Its number of components.
What does x∈R5\mathbf{x}\in\mathbb{R}^5 mean?x\mathbf{x} is a vector with 5 real-number components.
Does component order matter?Yes; positions have different meanings.

Check yourself

  1. 1.

    Is −9-9 a scalar or a vector?

    Show the answer

    It is a scalar because it is one number.

  2. 2.

    Find the dimension of (60−32)\begin{pmatrix}6\\0\\-3\\2\end{pmatrix}.

    Show the answer

    There are four components, so its dimension is 44. It belongs to R4\mathbb{R}^4.

  3. 3.

    Are (14)\begin{pmatrix}1\\4\end{pmatrix} and (41)\begin{pmatrix}4\\1\end{pmatrix} the same vector?

    Show the answer

    No. Their components appear in different positions, so they are different vectors.

Written with Kuest's AI tutor from a study session and checked before publishing; no personal details are included. Spot a mistake? Tell us.