On the two-dimensional plane, we can define a product that measures oriented area. For two vectors \(\mathbf{a},\mathbf{b}\in\mathbb{R}^2\), the perp product is the signed area of the parallelogram spanned by \(\mathbf{a}\) and \(\mathbf{b}\).
It is closely related to the 2D exterior product, the determinant of two vectors, and the z-component of the 3D cross product.
Geometric interpretation: \(\mathbf{a}\perp\mathbf{b}\) equals the signed area of the parallelogram spanned by \(\mathbf{a}\) and \(\mathbf{b}\).
Definition
Let
\[ \mathbf{a}= \begin{pmatrix} a_x\\ a_y \end{pmatrix}, \qquad \mathbf{b}= \begin{pmatrix} b_x\\ b_y \end{pmatrix}. \]
Recall that the perp vector of \(\mathbf{a}\) is obtained by rotating \(\mathbf{a}\) by \(90^\circ\) counterclockwise:
\[ \mathbf{a}^{\perp} := \begin{pmatrix} -a_y\\ a_x \end{pmatrix}. \]
The 2D perp product of \(\mathbf{a}\) and \(\mathbf{b}\) is defined as
\[ \mathbf{a}\perp\mathbf{b} := \mathbf{a}^{\perp}\cdot\mathbf{b}. \]
Expanding the dot product gives
\[ \mathbf{a}\perp\mathbf{b} = (-a_y,a_x)\cdot(b_x,b_y) = a_xb_y-a_yb_x. \]
Hence the perp product is exactly the determinant of the two vectors:
\[ \mathbf{a}\perp\mathbf{b} = \det \begin{pmatrix} a_x & a_y\\ b_x & b_y \end{pmatrix}. \]
Geometric Meaning
If \(\theta\) is the angle between \(\mathbf{a}\) and \(\mathbf{b}\), then
\[ \mathbf{a}\perp\mathbf{b} = \|\mathbf{a}\|\,\|\mathbf{b}\|\sin\theta. \]
Therefore:
- \(|\mathbf{a}\perp\mathbf{b}|\) is the area of the parallelogram spanned by \(\mathbf{a}\) and \(\mathbf{b}\),
- the sign encodes the orientation of the ordered pair \((\mathbf{a},\mathbf{b})\),
- \(\mathbf{a}\perp\mathbf{b}=0\) exactly when the vectors are collinear.
In particular,
\[ \mathbf{a}\perp\mathbf{b}>0 \quad\Longleftrightarrow\quad \mathbf{b}\text{ lies counterclockwise from }\mathbf{a}, \]
while
\[ \mathbf{a}\perp\mathbf{b}<0 \quad\Longleftrightarrow\quad \mathbf{b}\text{ lies clockwise from }\mathbf{a}. \]
Properties
For all \(\mathbf{a},\mathbf{b},\mathbf{c}\in\mathbb{R}^2\) and \(\alpha,\beta\in\mathbb{R}\), the perp product satisfies the following properties.
Alternating
A vector spans no area with itself:
\[ \mathbf{a}\perp\mathbf{a}=0. \]
Antisymmetric
Swapping the two vectors changes the sign:
\[ \mathbf{a}\perp\mathbf{b} = -(\mathbf{b}\perp\mathbf{a}). \]
Bilinear
The perp product is linear in each argument. In particular,
\[ (\alpha\mathbf{a})\perp(\beta\mathbf{b}) = \alpha\beta(\mathbf{a}\perp\mathbf{b}), \]
and
\[ \mathbf{a}\perp(\mathbf{b}+\mathbf{c}) = \mathbf{a}\perp\mathbf{b} + \mathbf{a}\perp\mathbf{c}. \]
Similarly,
\[ (\mathbf{a}+\mathbf{b})\perp\mathbf{c} = \mathbf{a}\perp\mathbf{c} + \mathbf{b}\perp\mathbf{c}. \]
Zero iff Linearly Dependent
The perp product becomes zero exactly when the two vectors are linearly dependent:
\[ \mathbf{a}\perp\mathbf{b}=0 \quad\Longleftrightarrow\quad \mathbf{a}\text{ and }\mathbf{b}\text{ are linearly dependent.} \]
Geometrically, this means that the two vectors span no area.
Useful Perp Identities
Because the perp product is defined using the perp operator, it also gives useful identities together with the dot product:
\[ \mathbf{a}^{\perp}\cdot\mathbf{b} = \mathbf{a}\perp\mathbf{b}, \]
\[ \mathbf{a}\cdot\mathbf{b}^{\perp} = -(\mathbf{a}\perp\mathbf{b}), \]
and
\[ \mathbf{a}^{\perp}\cdot\mathbf{b}^{\perp} = \mathbf{a}\cdot\mathbf{b}. \]
Rotating both vectors by \(90^\circ\) preserves their dot product.
Area Scaling under Linear Maps
If \(M\) is a \(2\times2\) matrix, then
\[ (M\mathbf{a})\perp(M\mathbf{b}) = \det(M)(\mathbf{a}\perp\mathbf{b}). \]
This gives one of the most important geometric interpretations of the determinant as the signed factor by which a linear map scales areas.
To see why, put \(\mathbf{a}\) and \(\mathbf{b}\) into a matrix as columns:
\[ A=(\mathbf{a}\ \mathbf{b}). \]
Then the perpendicular product is just the determinant of this matrix:
\[ \mathbf{a}\perp\mathbf{b} = \det(A). \]
After applying \(M\), the new column matrix is
\[ (M\mathbf{a}\ M\mathbf{b}) = M(\mathbf{a}\ \mathbf{b}) = MA. \]
Therefore
\[ (M\mathbf{a})\perp(M\mathbf{b}) = \det(MA) = \det(M)\det(A) = \det(M)(\mathbf{a}\perp\mathbf{b}). \]
Lagrange Identity
Together with the dot product, the perp product satisfies the two-dimensional Lagrange identity:
\[ (\mathbf{a}\perp\mathbf{b})^2 + (\mathbf{a}\cdot\mathbf{b})^2 = \|\mathbf{a}\|^2\|\mathbf{b}\|^2. \]
This identity says that the squared area component and the squared projection component together reconstruct the product of the squared lengths.
Since
\[ \mathbf{a}\cdot\mathbf{b} = \|\mathbf{a}\|\|\mathbf{b}\|\cos\theta \]
and
\[ \mathbf{a}\perp\mathbf{b} = \|\mathbf{a}\|\|\mathbf{b}\|\sin\theta, \]
the identity is also the vector form of
\[ \sin^2\theta+\cos^2\theta=1. \]
Relation to the 3D Cross Product
The perp product is often called the 2D analogue of the cross product. The connection becomes clear if we embed two-dimensional vectors into three-dimensional space with zero z-components:
\[ \tilde{\mathbf{a}}=(a_x,a_y,0), \qquad \tilde{\mathbf{b}}=(b_x,b_y,0). \]
Calculating the cross product yields
\[ \tilde{\mathbf{a}}\times\tilde{\mathbf{b}} = \begin{pmatrix} 0\\ 0\\ a_xb_y-a_yb_x \end{pmatrix} = (\mathbf{a}\perp\mathbf{b})\hat{\mathbf{z}}. \]
Thus, the 2D perp product is exactly the z-component of the 3D cross product of two vectors in the xy-plane.
In both cases, the area magnitude comes from the same Lagrange identity. In two dimensions,
\[ (\mathbf{a}\perp\mathbf{b})^2 = \|\mathbf{a}\|^2\|\mathbf{b}\|^2 - (\mathbf{a}\cdot\mathbf{b})^2, \]
while in three dimensions,
\[ \|\mathbf{a}\times\mathbf{b}\|^2 = \|\mathbf{a}\|^2\|\mathbf{b}\|^2 - (\mathbf{a}\cdot\mathbf{b})^2. \]
Hence both the perp product and the cross product measure the same geometric quantity: the area component that remains after removing the projection component measured by the dot product.
\[ \begin{array}{rll} \mathbf{a}\perp\mathbf{b} &= \|\mathbf{a}\|\|\mathbf{b}\|\sin\theta &\text{2D signed scalar area,}\\[4pt] \|\mathbf{a}\times\mathbf{b}\| &= \|\mathbf{a}\|\|\mathbf{b}\|\sin\theta &\text{3D area magnitude.} \end{array} \]
The corresponding Lagrange identities are:
\[ \begin{array}{rll} (\mathbf{a}\perp\mathbf{b})^2 + (\mathbf{a}\cdot\mathbf{b})^2 &= \|\mathbf{a}\|^2\|\mathbf{b}\|^2 &\text{2D case,}\\[4pt] \|\mathbf{a}\times\mathbf{b}\|^2 + (\mathbf{a}\cdot\mathbf{b})^2 &= \|\mathbf{a}\|^2\|\mathbf{b}\|^2 &\text{3D case.} \end{array} \]
The main difference is how orientation is represented. In two dimensions, the normal direction is already fixed: it can only point along the positive or negative z-axis. Therefore the direction information is compressed into the sign of the scalar \(\mathbf{a}\perp\mathbf{b}\).
In three dimensions, the normal direction is not fixed. The cross product therefore returns a vector. Its length gives the area, while its direction gives the orientation according to the right-hand rule.
Applications
Area of a Parallelogram
The signed area of the parallelogram spanned by \(\mathbf{a}\) and \(\mathbf{b}\) is
\[ A_{\text{▱}}^{\pm} = \mathbf{a}\perp\mathbf{b}. \]
This sign is useful when orientation matters. If only the geometric area is needed, we take the absolute value:
\[ A_{\text{▱}} = |\mathbf{a}\perp\mathbf{b}|. \]
Using the angle formula, this is equivalently
\[ A_{\text{▱}} = \|\mathbf{a}\|\,\|\mathbf{b}\|\,|\sin\theta|. \]
Area of a Triangle
Given three points \(\mathbf{P}_1,\mathbf{P}_2,\mathbf{P}_3\), define the two edge vectors
\[ \mathbf{u}:=\mathbf{P}_2-\mathbf{P}_1, \qquad \mathbf{v}:=\mathbf{P}_3-\mathbf{P}_1. \]
The triangle \(\triangle \mathbf{P}_1\mathbf{P}_2\mathbf{P}_3\) has base length
\[ b=\|\mathbf{u}\|. \]
If \(\theta\) is the angle from \(\mathbf{u}\) to \(\mathbf{v}\), then the height of the triangle relative to this base is
\[ h=\|\mathbf{v}\|\,|\sin\theta|. \]
Therefore the ordinary triangle area is
\[ A_{\triangle} = \frac{1}{2}bh = \frac{1}{2}\|\mathbf{u}\|\,\|\mathbf{v}\|\,|\sin\theta| = \frac{1}{2}|\mathbf{u}\perp\mathbf{v}|. \]
If we keep the orientation instead of taking the absolute value, we get the signed triangle area
\[ A_{\triangle}^{\pm} = \frac{1}{2}(\mathbf{u}\perp\mathbf{v}). \]
Counterclockwise ordering of the points gives positive area, while clockwise ordering gives negative area.
In coordinates, this is
\[ A_{\triangle}^{\pm} = \frac{1}{2} \det \begin{pmatrix} P_2^x-P_1^x & P_2^y-P_1^y\\ P_3^x-P_1^x & P_3^y-P_1^y \end{pmatrix}. \]
The same formula can also be written in the classical 3-by-3 determinant form:
\[ A_{\triangle}^{\pm} = \frac{1}{2} \det \begin{pmatrix} P_1^x & P_1^y & 1\\ P_2^x & P_2^y & 1\\ P_3^x & P_3^y & 1 \end{pmatrix}. \]
This is the same expression in a translation-invariant coordinate form. It is also the local building block behind the shoelace formula for polygon area.
Shoelace Formula
The perp product also gives a direct way to derive the shoelace formula for the area of a polygon. First consider a triangle with vertices \(\mathbf{P}_1\), \(\mathbf{P}_2\), and \(\mathbf{P}_3\). Define
\[ \mathbf{a}:=\mathbf{P}_2-\mathbf{P}_1, \qquad \mathbf{b}:=\mathbf{P}_3-\mathbf{P}_1. \]
Its signed area is
\[ A_{\triangle}^{\pm} = \frac12(\mathbf{a}\perp\mathbf{b}) = \frac12\big((\mathbf{P}_2-\mathbf{P}_1)\perp(\mathbf{P}_3-\mathbf{P}_1)\big). \]
Expanding this expression using bilinearity and antisymmetry gives
\[ \begin{aligned} (\mathbf{P}_2-\mathbf{P}_1)\perp(\mathbf{P}_3-\mathbf{P}_1) &= \mathbf{P}_2\perp\mathbf{P}_3 - \mathbf{P}_2\perp\mathbf{P}_1 - \mathbf{P}_1\perp\mathbf{P}_3 + \mathbf{P}_1\perp\mathbf{P}_1\\ &= \mathbf{P}_2\perp\mathbf{P}_3 + \mathbf{P}_1\perp\mathbf{P}_2 + \mathbf{P}_3\perp\mathbf{P}_1\\ &= \mathbf{P}_1\perp\mathbf{P}_2 + \mathbf{P}_2\perp\mathbf{P}_3 + \mathbf{P}_3\perp\mathbf{P}_1. \end{aligned} \]
Therefore the signed area of the triangle can be written in cyclic form:
\[ A_{\triangle}^{\pm} = \frac12 \left( \mathbf{P}_1\perp\mathbf{P}_2 + \mathbf{P}_2\perp\mathbf{P}_3 + \mathbf{P}_3\perp\mathbf{P}_1 \right). \]
This formula looks like it depends on the origin, because it uses the position vectors of the vertices. But it does not. The equivalent edge-vector formula
\[ \frac12\big((\mathbf{P}_2-\mathbf{P}_1)\perp(\mathbf{P}_3-\mathbf{P}_1)\big) \]
shows that translating all three points by the same vector leaves the signed area unchanged.
Now let \(\mathbf{P}_1,\mathbf{P}_2,\ldots,\mathbf{P}_n\) be the ordered vertices of a polygon. We can decompose the polygon into oriented triangles by fixing \(\mathbf{P}_1\):
\[ (\mathbf{P}_1,\mathbf{P}_2,\mathbf{P}_3), \quad (\mathbf{P}_1,\mathbf{P}_3,\mathbf{P}_4), \quad \ldots, \quad (\mathbf{P}_1,\mathbf{P}_{n-1},\mathbf{P}_n). \]
Summing their cyclic area formulas gives
\[ A^{\pm} = \frac12 \sum_{i=2}^{n-1} \left( \mathbf{P}_1\perp\mathbf{P}_i + \mathbf{P}_i\perp\mathbf{P}_{i+1} + \mathbf{P}_{i+1}\perp\mathbf{P}_1 \right). \]
When this sum is written out, the terms belonging to the internal diagonals cancel in pairs. For example,
\[ \mathbf{P}_3\perp\mathbf{P}_1 + \mathbf{P}_1\perp\mathbf{P}_3 = 0. \]
The same cancellation happens for every internal diagonal. What remains is only the cyclic boundary sum:
\[ A^{\pm} = \frac12 \left( \mathbf{P}_1\perp\mathbf{P}_2 + \mathbf{P}_2\perp\mathbf{P}_3 + \cdots + \mathbf{P}_n\perp\mathbf{P}_1 \right). \]
Equivalently, if we set \(\mathbf{P}_{n+1}:=\mathbf{P}_1\), then
\[ A^{\pm} = \frac12 \sum_{i=1}^{n} \mathbf{P}_i\perp\mathbf{P}_{i+1}. \]
If \(\mathbf{P}_i=(x_i,y_i)\), then
\[ \mathbf{P}_i\perp\mathbf{P}_{i+1} = x_i y_{i+1}-y_i x_{i+1}. \]
Hence
\[ A^{\pm} = \frac12 \sum_{i=1}^{n} (x_i y_{i+1}-y_i x_{i+1}), \qquad \mathbf{P}_{n+1}:=\mathbf{P}_1. \]
This is the shoelace formula. Written without orientation, the ordinary polygon area is
\[ A = \frac12 \left| \sum_{i=1}^{n} (\mathbf{P}_i\perp\mathbf{P}_{i+1}) \right| = \frac12 \left| \sum_{i=1}^{n} (x_i y_{i+1}-y_i x_{i+1}) \right|. \]
Point on Left or Right Side of a Line
The perp product can be used to determine on which side of a directed line a point lies. Let the directed line be given by \(\mathbf{P}_1\) and \(\mathbf{P}_2\), and let \(\mathbf{P}_3\) be the test point.
Define
\[ \mathbf{u}=\mathbf{P}_2-\mathbf{P}_1, \qquad \mathbf{v}=\mathbf{P}_3-\mathbf{P}_1. \]
Then
\[ \begin{aligned} \mathbf{u}\perp\mathbf{v} &> 0 &&\Longleftrightarrow \mathbf{P}_3\text{ lies left of the directed line }\mathbf{P}_1\mathbf{P}_2,\\ \mathbf{u}\perp\mathbf{v} &< 0 &&\Longleftrightarrow \mathbf{P}_3\text{ lies right of the directed line }\mathbf{P}_1\mathbf{P}_2,\\ \mathbf{u}\perp\mathbf{v} &= 0 &&\Longleftrightarrow \mathbf{P}_1,\mathbf{P}_2,\mathbf{P}_3\text{ are collinear.} \end{aligned} \]
This is one of the most common uses of the perp product in computational geometry.
Orientation Predicate
The previous test is often written as the orientation predicate
\[ \operatorname{orient2d}(\mathbf{P}_1,\mathbf{P}_2,\mathbf{P}_3) := (\mathbf{P}_2-\mathbf{P}_1)\perp(\mathbf{P}_3-\mathbf{P}_1). \]
It gives twice the signed area of the triangle \(\triangle \mathbf{P}_1\mathbf{P}_2\mathbf{P}_3\):
\[ \operatorname{orient2d}(\mathbf{P}_1,\mathbf{P}_2,\mathbf{P}_3) = 2A_{\triangle}^{\pm}. \]
It is used in line segment intersection tests, convex hull algorithms, polygon winding checks, point-in-polygon tests, and many other planar geometry algorithms.
Collinearity and Segment Membership Tests
For points \(A,B,C\in\mathbb{R}^2\), define \( \overrightarrow{AB}=B-A \) and \( \overrightarrow{AC}=C-A \). Then collinearity is equivalent to \[ \overrightarrow{AB}\perp\overrightarrow{AC}=0. \]
In component form this is often written as a 2D cross scalar \[ \operatorname{cross}_{2D}(\mathbf{u},\mathbf{v}) := u_x v_y-u_y v_x, \] so for points \[ \operatorname{cross}_{2D}(\overrightarrow{AB},\overrightarrow{AC}) = (B_x-A_x)(C_y-A_y)-(B_y-A_y)(C_x-A_x). \]
With floating-point arithmetic, use a tolerance instead of exact zero: \[ \left|\operatorname{cross}_{2D}(\overrightarrow{AB},\overrightarrow{AC})\right|<\varepsilon. \]
To test whether \(C\) lies on the segment \(\overline{AB}\), combine collinearity with the dot-product interval test: \[ 0\le \overrightarrow{AB}\cdot\overrightarrow{AC} \le \overrightarrow{AB}\cdot\overrightarrow{AB}. \]
Altogether (with endpoint inclusion): \[ \boxed{ C\in\overline{AB} \iff \begin{cases} \overrightarrow{AB}\perp\overrightarrow{AC}=0,\\[2mm] 0\le \overrightarrow{AB}\cdot\overrightarrow{AC} \le \|\overrightarrow{AB}\|^2. \end{cases}} \] In numerical code, replace the first equality by a tolerance test.
Shortest Direction from One Vector to Another
The sign of the perp product also tells the shortest rotational direction from one vector to another, as long as neither vector is zero and the vectors are not exactly opposite.
For two nonzero vectors \(\mathbf{a}\) and \(\mathbf{b}\):
\[ \mathbf{a}\perp\mathbf{b}>0 \quad\Longleftrightarrow\quad \text{the shorter rotation from }\mathbf{a}\text{ to }\mathbf{b} \text{ is counterclockwise,} \]
and
\[ \mathbf{a}\perp\mathbf{b}<0 \quad\Longleftrightarrow\quad \text{the shorter rotation from }\mathbf{a}\text{ to }\mathbf{b} \text{ is clockwise.} \]
If \(\mathbf{a}\perp\mathbf{b}=0\), then the vectors are collinear. In that case they either point in the same direction, in opposite directions, or one of them is the zero vector. If they point in exactly opposite directions, the shortest rotation is not unique.
A particularly useful formula is
\[ \theta = \operatorname{atan2}(\mathbf{a}\perp\mathbf{b},\mathbf{a}\cdot\mathbf{b}), \]
which returns the signed angle from \(\mathbf{a}\) to \(\mathbf{b}\) in the interval \((-\pi,\pi]\). The perp product gives the sine component, while the dot product gives the cosine component.
Exterior Algebra View
In exterior algebra, the exterior product \(\mathbf{a}\wedge\mathbf{b}\) represents an oriented area element. In two dimensions there is only one independent oriented area direction, so this bivector can be identified with a scalar:
\[ \mathbf{a}\wedge\mathbf{b} \quad\longleftrightarrow\quad a_xb_y-a_yb_x. \]
The perp product is this scalar area component written in elementary vector notation.