Linear Algebra - Vector


tuple in Linear algebra are called vector.

A vector is a list of scalar (real number) used to represent a function

When the letters are in bold in a formula, it signifies that they're vectors,

To represent the below function:

<math> \begin{array}{rrr} 0 & \mapsto & 8 \\ 1 & \mapsto & 7 \\ 2 & \mapsto & −1 \\ 3 & \mapsto & 2 \\ \end{array} </math>


we use the following dictionary 4-vector:

<math>\{0:8, 1:7,2:−1, 3:2\}</math>

that can be simplified as this list of number:

<math>[8, 7,−1,2]</math>

Technically, a vector is:

  • a function from some domain D to a field
  • a function <math>v : D \mapsto C</math> , where D and C are the domain and co-domain, and C is a field.

Data Structure


Python’s dictionaries can represent such vectors, e.g.

{0:8, 1:7, 2:-1, 3:2}

The following convention is often adopted: entries with value zero may be omitted from the dictionary.


A class Vec with two instance variables (fields):

  • f, the function, represented by a dictionary, and
  • D, the domain of the function, represented by a set.


A list L must be viewed as a function where the domain is the index of the value ie {0, 1, 2, . . . , len(L)}.

Example: <math>[8,7,-1,2]</math>

Example of n-vectors

  • A 4-vector over <math>\mathbb{R}</math> :

<math>[8, 7,−1,2]</math>

  • A 3-vector over <math>\mathbb{R}</math> :

<math>[8, 7,−1]</math>



Used to represent


In natural language processing, a document is represented by a bag of words model by a function <math>f : WORDS \mapsto \mathbb{R}</math> specifying, for each word, how many times it appears in the document.

For any single document, most words in the word dictionary are of course not represented. They should be mapped to zero but a convenient convention for representing vectors by dictionaries allow to omit pairs when the value is zero.

Example representing a WORDS-vector over bbR: “The rain in Spain falls mainly on the plain” would be represented by the dictionary

{’on’: 1, ’Spain’: 1, ’in’: 1, ’plain’: 1, ’the’: 2, ’mainly’: 1, ’rain’: 1, ’falls’: 1}

Binary string

(for cryptography/information theory)

Collection of attributes

  • Senate voting record
  • demographic record of a consumer
  • characteristics of cancer cells

State of a system

  • Population distribution in the world
  • number of copies of a virus in a computer network
  • state of a pseudo-random generator
  • state of Lights Out

Probability distribution

Mathematics - Probability distribution function e.g. {1:1/6, 2:1/6, 3:1/6, 4:1/6, 5:1/6, 6:1/6}


{(0,0): 0, (0,1): 0, (0,2): 0, (0,3): 0,
(1,0): 32, (1,1): 32, (1,2): 32, (1,3): 32,
(2,0): 64, (2,1): 64, (2,2): 64, (2,3): 64,
(3,0): 96, (3,1): 96, (3,2): 96, (3,3): 96,
(4,0): 128, (4,1): 128, (4,2): 128, (4,3): 128,
(5,0): 160, (5,1): 160, (5,2): 160, (5,3): 160,
(6,0): 192, (6,1): 192, (6,2): 192, (6,3): 192,
(7,0): 224, (7,1): 224, (7,2): 224, (7,3): 224 }


  • Can interpret the 2-vector [x, y] as a point in the plane.
  • Can interpret 3-vectors as points in space, and so on.



The D-vector whose entries are all zero is the zero vector, written 0_D or just 0.

To test if a vector v should be considered a zero vector, you can see if the square of its norm is very small, e.g. less than <math>10^{-20}</math>


A vector most of whose values are zero is called a sparse vector.

If no more than k of the entries are non-zero, we say the vector is k-sparse. A k-sparse vector can be represented using space proportional to k. For instance, when we represent a corpus of documents by WORD-vectors, the storage required is proportional to the total number of words in all documents.

Most signals acquired via physical sensors (images, sound, …) are not exactly sparse.


Vectors that are mutually orthogonal and have norm 1 are orthonormal

Set of vector

Set of all 4-vectors over bbR is written bbR^4. See Linear Algebra - Function (Set)

Example of gf2 Set: GF(2)^5 is the set of 5-element bit sequences, e.g. [0,0,0,0,0], [0,0,0,0,1], …


n-vectors over bbR can be visualized as arrows in bbR^n

The 2-vector [3, 1.5] can be represented by an arrow
with its tail at the origin and its head at (3, 1.5)
or, equivalently, by an arrow whose tail is at (-2,-1)
and whose head is at (1,0.5)


William Rowan Hamilton
William Rowan Hamilton, the inventor of the theory of quaternions.
The quaternions are a number system that extends the complex numbers.
i^2 = j^2 = k^2 = ijk = -1
Josiah Willard Gibbs
Developed vector analysis as an alternative to quaternions.

Documentation / Reference

Powered by ComboStrap