Multivariate Statistical Techniques
Vector Operations


The Vector

Consider the vector v with three elements,

       

Or symbolically,

       

Or with numbers,

       

  • A vector with three elements is said to be three-dimensional.

  • A vector, as you can see, is displayed as a column of numbers.

  • We will usually use a lower case bold letter for a vector.

  • A vector is a directed quantity, as such, a two-dimensional vector can be represented as a line from the origin to a point in the xy-plane.

    Example:

    Consider the vector x' = [2 4]. It can be visualized as the point (2, 4) in two-dimensional space.

           

    Or, it can be visualized as an arrow from the origin to the point (2, 4).

           


    "Transpose" of a Vector

  • When writing a vector as a row, we will use a prime symbol to indicate "transpose."

  • v' = [3 2 2]
  • Note: Technically transpose is used for matrices but it is useful to be able to write vectors as rows, so we will use the transpose symbol to indicate that the column vector is being written as a row vector to save space.

    Adding Vectors

  • Vectors are added element by element. Let
    v' = [3 2 2] and w' = [4 1 2], then v' + w' = [7 3 4]

  • Note: Vector addition is commutative,
    v + w = w + v
  • Vectors must have the same number of elements to be added.

  • The sum of two two-dimensional vectors can be represented as the diagonal of a parallelogram.

    Example: Consider x' = [2 4] and y' = [1 -1]. Then x' + y' = [3 3].

           

  • The sum of two two-dimensional vectors can also be represented geometrically as two directed arrows placed tail to head on the xy-plane.

    Example: Consider x' = [2 4] and y' = [1 -1]. Then x' + y' = [3 3].

           

    Subtracting Vectors

  • Vectors are subracted element by element. Let
    v' = [3 2 2] and w' = [4 1 2], then v' - w' = [-1 1 0]
  • Vectors must have the same number of elements for subtraction.

  • The difference of two vectors can also be represented as the diagonal of a parallelogram.

    Multiplication by a Scalar

  • Multiply each element of the vector by the scalar.

  • Let c = 3 and v' = [3 2 2], the c*v' = [9 6 6]
           

    Vector Dot Product

  • Multiply elements and add the products.

  •  Let v' = [3 2 2] and w' = [4 1 2], then v·w = (3*4+2*1+2*2) = 18
  • In order to compute dot products, the vectors must have the same number of elements.

  • Note: v·w = w·v -- dot product is commutative.

  • The dot product of a vector with itself is the sum of squares of the elements.
    Thus, v·v = (3*3+2*2+2*2) = 17 and w·w = (4*4+1*1+2*2) = 21.


    Length of a Vector

  • The length of a vector is sqrt(v·v).

  • Length is just an application of the Pythagorian theorem.

  • The length of a vector is also known as the norm of a vector.

  • Length generalizes to more than two dimensions.

  • Let v' = [3 2 2], then length(v) = sqrt(17) = 4.1231056
  • Let w' = [4 1 2], then length(w) = sqrt(21) = 4.5825757

    Unit Length Vector

  • A vector that has unit length.

  • Let x' = [.5 .5 .5 .5], then length = norm(x) = sqrt(1) = 1

  • You can create unit length vectors by dividing each element by the length of the vector.
         
     Let v' = [3 2 2], then (1/norm)*v) = (1/4.12)*v'


    The Unit Vector

  • The unit vector is a vector in which all of the elements are ones. Commonly, unit vectors are denoted as u.

  • Thus, u' = [1 1 1 1]
  • A unit vector is, obviously, a different entity than a vector with unit length.

  • The dot product of a unit vector with itself is the number of elements in the vector.
    Let u' = [1 1 1 1], then u·u = (1*1+1*1+1*1+1*1) = 4
  • The dot product of a unit vector and a regular vector is the sum of the elements in the regular vector.
    Let v' = [3 2 2] and u' = [1 1 1], then u·v = (1*3+1*2+1*2) = 7
                                        and v·u = (3*1+2*1+2*1) = 7


    Multivariate Course Web Page

    Phil Ender, 4oct05, 22sep05, 23oct03