A vector is a quantity that has a length and a direction. It can be visualized as an arrow. For example, speed and acceleration are vector quantities.

Scalar is a quantity that has not a direction.

A vector v that has its start at the origin and ends at some point P is called the radius vector of this point.

Algebraic projections (x, y, z) of a radius vector on the coordinate axes are called coordinates of vector or point.

You can translate any vector to the origin to get its coordinates. Or you can compute the subtraction of the radius vectors of the end point and start point of the vector.

There are source code in Java related with vectors: VectorFloat and LinearAlgebra classes.

collinear vectors

Two vectors are collinear, if they lie on the same line or parallel lines.

Two collinear vectors are called co-directed if they have the same direction. They are oppositely directed otherwise.

vectors a and b are collinear if:


If ax/bx > 0, then a and b are co-directed.

length of vector

The length of a vector is the square root of the sum of the squares of the coordinates. It is also called as norm of vector.

∥v∥ = ∥(x,y,z)∥ = sqrt(x*x+y*y+z*z)

The normalized vector of is a vector in the same direction but with norm 1.

equal vectors

Two vectors are equal, if they are parallel and of equal length.

Therefore, if we translate a vector it is still considered the same vector. In other words the location does not matter only direction and length.

zero vector

A vector whose initial and end point are the same is called a zero vector.

The norm of the zero vector is 0. The direction of the zero vector is not defined. Such a vector is collinear to any vector.

sum of vectors

The the parallelogram method:

  1. Place both vectors a and b at the same initial point.
  2. Complete the parallelogram.
  3. Diagonal of that parallelogram will be sum of a and b. The direction from the initial point to the other end.

Substraction can be presented as a + (-b). Change direction of b and you will get vector -b.

Coordinates of a+b can be computed as:

c = a + b = ( cx = ax + bx,
              cy = ay + by,
              cz = az + bz)

Coordinates of a-b can be computed as:

c = a - b = ( cx = ax - bx,
              cy = ay - by,
              cz = az - bz)

Properties of addition of vectors:

  1. Commutative law: a + b = b + a
  2. Associative law: a + (b + c) = (a + b) + c
  3. a + 0 = a
  4. Existence of the inverse: for every a exists a vector -a, so that a + (-a) = 0

You can compute the distance between any two points A and B with radius vectors a and b correspondingly as the norm of the vector a-b:

∥a - b∥ = sqrt( (ax - bx)2 + (ay - by)2 + (az - bz)2)

scalar multiplication

If v is a nonzero vector and n is real number, then the product n*v is defined to be the vector that has |n| times the length of v and the same direction as v, if n > 0 and the opposite direction if n < 0.

If n = 0 or v = 0, then define n*v is zero vector.

Two vectors are proportional if and only if they are collinear. This means one of the vector is a scalar multiple of the other.

Properties of scalar multiplication:

  1. 1*v = v
  2. Associative law for any number n and m: n*(m*v) = (n*m)*v
  3. Distributive law for any number n and m: (n+m)*v = k*v + l*v.
  4. Distributive law for any vectors v and w: n*(v+w) = n*v + n*w.

dot product

The dot product is the sum of the products of the corresponding coordinates of the two vectors. It is also known as scalar product.

a·b = ax*bx + ay*by + az*bz

The dot product has the alternative interpretation as:

a·b = ∥a∥*∥b∥*cos(α)

Here α is angle between vectors a and b. It is also means that two vectors are orthogonal if their dot pruduct is zero.

cross product

Result of the the cross product a×b is a vector c that is orthogonal to both a and b. Length of c equal to the area of the parallelogram defined by a and b. Direction is defined by right-hand rule.

∥a×b∥ = ∥a∥*∥b∥*sin(α),         
 where α is angle between a and b

Or in coordinate form:

a×b = 
(|ay az|  |az ax|  |ax ay|
  |by bz|, |bz bx|, |bx by|)
(ay*bz − az*by,
az*bx − ax*bz,
ax*by − ay*bx)
dot product of two vectors

You can read more about determinants of matrices that are used in coordinate form.

Properties of the cross product:

  1. a×a = 0
  2. a×b = -(b×a)
  3. Distributive law for addition of vectors: a×(b + c) = a×b + a×c
  4. Distributive law for number multiplication: (n*a)×b = a×(n*b)
  5. Two vectors a and b are collinear if a×b = 0

triple product

Triple product of three vectors is defined as

                        |ax ay az|
a·(b×c) = det(a,b,c) =  |bx by bz|
                        |cx cy cz|

Triple product equal to the value of the signed volume of the parallelepiped defined by three vectors.


  1. If vectors a, b and c lie on the same plane, then their triple product is equal to zero.
  2. If triple product is greater than 0, then vectors a, b and c form a right-handed coordinate system.

angles between vector and coordinate axes

cos(v,Ox) = x/∥v∥ = x/sqrt(x*x+y*y+z*z)
cos(v,Oy) = y/∥v∥ = y/sqrt(x*x+y*y+z*z)
cos(v,Oz) = z/∥v∥ = z/sqrt(x*x+y*y+z*z)