## Straight Lines on Rectangular Planes

#### 2.1  Vectors

The equation of a line can also be specified as a combination of vectors.

In regular coordinate geometry, a vector is a linear distance and direction specified by axis-parallel displacements. This can be used to specify the location of a point relative to another point (the other point could be a coordinate system origin). This type of vector is called a position vector. The following graph shows a position vector p that specifies the position of the point (3, 2) relative to the coordinate system origin:

A vector can also be “free floating” to specify the direction of flow in a field, referred to as a free vector.

Some vectors may have a predefined fixed length, in order to only specify direction, referred to as a direction vector. If the fixed length of the direction vector is equal to one (1), it is a unit vector.

A direction vector may be a position vector or a free vector. If the direction vector is a position vector, it is collinear with the line that has the same direction and passes through that position vector. If the direction vector is a free vector, it is collinear with all parallel lines that have that direction.

Consider a position vector p as described above to specify a point on a line, and a vector q that points in the same direction as the line. We can position the base of q at the end (tip) of p to specify a line that passes through p and has direction of q.

This vector equation of a line is:

L = p + tq

where L is the position vector to any point on the line, p is the position vector to a predefined point on the line, q is the direction vector that has the same direction as the line, and t is a scalar that is applied to q (performing scalar multiplication of q) to find a point on the line.

If the parameter t is zero, the point on the line is at the predefined point on the line (at the end of p). If t is positive, the point on the line is in the q direction from the predefined point. If t is negative, the point is in the opposite direction.

$(x_{0}, y_{0}) + (x_{1}, y_{1}) = (x_{0} + x_{1}, y_{0} + y_{1})$

Only the corresponding components are added together. Components are not mixed — that would be like adding “apples and oranges” so to speak.

For p = (3, 2) and q = (−2, 1), L = p + q = (3−2, 2+1) = (1, 3):

#### 2.3  Scalar Multiplication

A scalar is a single number. Scalar multiplication of a vector multiplies each vector component with the scalar (which scales the vector). For a scalar t:

$t(x, y) = (tx, ty)$

For t = 2:

For t = −1:

#### 2.4  Scalar Product

Unlike scalar multiplication, which operates on a single vector (multiplying the vector with a scalar), vector algebra also has products. The “products” of vector algebra operate on two vectors at a time, producing a scalar or a vector.

The type of product that produces a scalar is called a scalar product. That is defined in this section. The type of product that produces a vector is called a vector product, and is defined in the next section.

A scalar is a single number (not a vector). A scalar product (also called inner product or dot product) operates on two vectors to produce a scalar, using the following formula for the rectangular coordinates we are using:

$(x_{0}, y_{0}) \cdot (x_{1}, y_{1}) = x_{0}x_{1} + y_{0}y_{1}$

with a dot ( · ) as the operator symbol for producing a scalar product.

A useful feature of the scalar product is to calculate the length of a projection of a vector on another vector (explained below).

#### 2.5  Vector Product

A vector product (also called cross product) operates on two vectors to produce a vector, using this formula for two vectors on the xy plane:

$( x_{0}, y_{0}, 0 ) \times ( x_{1}, y_{1}, 0 ) = ( 0, 0, x_{0}y_{1} - x_{1}y_{0} )$

with a crossing symbol ( × ) as the operator symbol for producing a vector product.

Vector products actually operate in three dimensional space (x, y, z), producing a vector that is perpendicular to the two vectors being crossed. In our case, we are setting the third coordinate (z) of the crossed vectors to zero, making them lie on the xy plane, producing a vector that is entirely in the z direction (not on the xy plane).

The length of the vector that is produced (in this case its z value) provides the area of the parallelogram enclosed by the crossed vectors on the xy plane, allowing us to use that value as a scalar (since this cross product does not have x or y values). The sign of that number is positive above the xy plane, or negative below the xy plane. Which side is above or below depends on the rotation direction from the first crossed vector to the second crossed vector, and for some applications is not important other than to compare to other vectors.

#### 2.6  Vector Length

Vector length is a scalar, that is the distance, from the base of the vector to its tip (from the the tail to the head of the vector). Vector length is denoted with vertical bars (absolute value). It is calculated with the Pythagorean Theorem. For a two-dimensional vector u = (ux, uy):

$\vert \mathbf{u} \vert = \sqrt{u_{x}u_{x} + u_{y}u_{y}}$

and in three dimensions, for u = (ux, uy, uz):

$\vert \mathbf{u} \vert = \sqrt{u_{x}u_{x} + u_{y}u_{y} + u_{z}u_{z}}$

Note that if a vector has only one nonzero component, the absolute value of that component is the vector length:

\begin{align} \vert (0, 4) \vert & = \sqrt{(0)(0) + (4)(4)} = 4 \\ \vert (-4, 0) \vert & = \sqrt{(-4)(-4) + (0)(0)} = 4 \\ \vert (0, 0, 5) \vert & = \sqrt{(0)(0) + (0)(0) + (5)(5)} = 5 \\ \vert (0, 0, -5) \vert & = \sqrt{(0)(0) + (0)(0) + (-5)(-5)} = 5 \end{align}

That is why we can use the z component of a cross product of two xy vectors as the length of the cross product. Since the cross product is perpendicular to both crossed vectors, none of the cross product components are on the plane of the crossed vectors.

#### 2.7  Unit Vector

A unit vector is a vector with length equal to one (1), sometimes denoted with a “hat” (^). To convert a vector to a unit vector with the same direction, scale the vector by the reciprocal of its length. For a vector u = (ux, uy):

$\text{unit vector of } \mathbf{u} = \mathbf{\hat{u}} = \frac{\mathbf{u}}{\vert \mathbf{u} \vert} = \left( \frac{u_{x}}{\vert \mathbf{u} \vert}, \frac{u_{y}}{\vert \mathbf{u} \vert} \right)$