Linear Algebra - Vector

Card Puncher Data Processing


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}


Image Vector

{(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

Vector Arrow 1 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)
Vector Arrow 2 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
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
Josiah Willard Gibbs
Developed vector analysis as an alternative to quaternions.

Documentation / Reference

Recommended Pages
Card Puncher Data Processing
(Statistics|Machine Learning|Data Mining) - (Unit|Individual|Case|Subject|Observation|Instance|Input)

in Statistics. Each member of a sample is also known as: a unit an individual a case a subject an instance an observation input data Data contains values grouped into variables and observations....
Data System Architecture
Collection - (Tuple|Vector|Row)

A tuple is: a finite list of elements (fields) - It can only contain a specific number of elements. ordered by position that may have different types. and still be completely typesafe. You can...
Thomas Bayes
Data Mining - Cosine Similarity (Measure of Angle)

The cosine similarity is a measure of the angle between two vectors, normalized by magnitude. You just divide the dot product by the magnitude of the two vectors. By taking the and definition of...
Card Puncher Data Processing
Linear Algebra

“Linear” “algebra” is the branch of mathematics: concerning vector spaces, often finite or countably infinite dimensional, as well as linear mappings between such spaces. Such an investigation...
Card Puncher Data Processing
Linear Algebra - Linear combination

A linear combination of the vectors is the following expression: where: The scalars are the coefficients Every vector in is a linear combination: Every linear combination is a vector in...
Card Puncher Data Processing
Linear Algebra - (Direct Sum | Union) of vector spaces

Let U and V be two vector spaces consisting of D-vectors over a field F. Definition: If U and V share only the zero vector then we define the direct sum of U and V to be the set: written: That is, ...
Card Puncher Data Processing
Linear Algebra - (Dot|Scalar|Inner) Product of two vectors

A dot Product is the multiplication of two two equal-length sequences of numbers (usually coordinate vectors) that produce a scalar (single number) Dot-product is also known as: scalar product or...
Card Puncher Data Processing
Linear Algebra - (Linear system|System of Linear equations)

In mathematics, a system of linear equations (or linear system) is a collection of linear equations involving the same set of variables. Each linear system corresponds to a linear system with zero...
Vector Addition Scalar Multiplication
Linear Algebra - (Line|Line Segment)

in linear algebra. Line and line segment definition in Linear Algebra that goes: A line has a dimension of one because only one coordinate is needed to specify a point on it Line_segmentline...
Card Puncher Data Processing
Linear Algebra - Basis of a Vector Space

A basis for vector space V is a linearly independent set of generators for V. Thus a set S of vectors of V is a basis for V if S satisfies two properties: Property B1 (Spanning) Span S = V, and Property...

Share this page:
Follow us:
Task Runner