---
title: Affine Independence and Barycentric Coordinates
module: Geometry of Vector Spaces
moduleNumber: 9
lessonNumber: 2
order: 902
summary: >
  Affine independence is linear independence for the translated or lifted points,
  and it guarantees each point of an affine hull a unique weight vector. Those
  weights are barycentric coordinates: centers of mass, ratios of triangle areas,
  and the interpolation rule behind smooth shading in computer graphics.
topics: [Geometry of Vector Spaces]
sources:
  - book: Lay
    ref: "Ch. 8 — The Geometry of Vector Spaces; §8.2 Affine Independence"
draft: false
---

Linear dependence asks whether some nontrivial combination of vectors is zero.
Affine dependence adds one requirement: the weights must also sum to zero. That
extra equation is what separates the geometry of triangles and simplices from
the algebra of subspaces.[^lay-affind]

An indexed set $\{\mathbf{v}_1, \dots, \mathbf{v}_p\}$ in $\mathbb{R}^n$ is
**affinely dependent** if there exist scalars $c_1, \dots, c_p$, not all zero,
with

$$
c_1 + c_2 + \cdots + c_p = 0
\qquad\text{and}\qquad
c_1\mathbf{v}_1 + c_2\mathbf{v}_2 + \cdots + c_p\mathbf{v}_p = \mathbf{0}.
$$

Otherwise the set is **affinely independent**. The prototype is three points on a
line. If $\mathbf{v}_3 = (1-t)\mathbf{v}_1 + t\mathbf{v}_2$, then
$(1-t)\mathbf{v}_1 + t\mathbf{v}_2 - \mathbf{v}_3 = \mathbf{0}$, a linear
dependence whose weights $(1-t) + t - 1 = 0$ also sum to zero: an affine
dependence.

Because the weights carry an extra constraint, affine dependence is stricter than
linear dependence. Every affinely dependent set is linearly dependent, but not
conversely.

> **Theorem (Tests for affine dependence).** For $S = \{\mathbf{v}_1, \dots, \mathbf{v}_p\}$ in
> $\mathbb{R}^n$ with $p \ge 2$, the following are equivalent.
>
> - $S$ is affinely dependent.
> - One point of $S$ is an affine combination of the others.
> - The translated set $\{\mathbf{v}_2 - \mathbf{v}_1, \dots, \mathbf{v}_p -
>   \mathbf{v}_1\}$ is linearly dependent.
> - The homogeneous forms $\{\tilde{\mathbf{v}}_1, \dots, \tilde{\mathbf{v}}_p\}$
>   are linearly dependent in $\mathbb{R}^{n+1}$.

The third condition is the test in practice: subtract one point from all the
others and check the resulting $p-1$ vectors for linear dependence by row
reduction. The fourth condition tests the lifted points directly, without
choosing a base point.

$$
% caption: A third point on the line through $\mathbf{p}$ and $\mathbf{q}$ makes
% the set affinely dependent; a point off the line keeps it independent.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=1.0]
\definecolor{acc}{HTML}{2F6DB5}
\definecolor{red}{HTML}{B23A48}
\draw[thick] (-0.3,0.15) -- (4.6,1.6);
\node[black, anchor=west, font=\scriptsize] at (4.7,1.45) {line through both};
\fill[black] (0.6,0.42) circle (1.7pt) node[anchor=north] {$\mathbf{p}$};
\fill[black] (3.4,1.26) circle (1.7pt) node[anchor=north] {$\mathbf{q}$};
\fill[acc] (2.0,0.84) circle (1.7pt) node[anchor=south] {$\mathbf{r}$};
\fill[acc] (2.7,2.5) circle (1.8pt) node[anchor=south] {$\mathbf{s}$};
\draw[black, dashed] (0.6,0.42) -- (2.7,2.5) -- (3.4,1.26);
\node[black, anchor=west, font=\scriptsize] at (2.9,2.0) {outside the line};
\node[black, anchor=north, font=\scriptsize] at (2.0,0.55) {on the line};
\end{tikzpicture}
$$

> **Worked example.** Let $\mathbf{v}_1 = (1,3,7)$, $\mathbf{v}_2 = (2,7,6.5)$,
> $\mathbf{v}_3 = (0,4,7)$. Is $\{\mathbf{v}_1, \mathbf{v}_2, \mathbf{v}_3\}$
> affinely independent?
>
> Translate by $\mathbf{v}_1$:
> $$
> \mathbf{v}_2 - \mathbf{v}_1 = (1,4,-0.5), \qquad \mathbf{v}_3 - \mathbf{v}_1 =
> (-1,1,0).
> $$
> These two vectors are not scalar multiples of each other, so they are linearly
> independent. By the third of the affine-dependence tests, all statements are false, and
> the set is affinely independent. Its affine hull is a plane through the three
> points, parallel to $\operatorname{Span}\{\mathbf{v}_2 - \mathbf{v}_1,
> \mathbf{v}_3 - \mathbf{v}_1\}$.

$$
% caption: An affinely independent triple. The span of the translated points is a
% plane through the origin; the affine hull is the parallel plane through
% $\mathbf{v}_1$, $\mathbf{v}_2$, $\mathbf{v}_3$.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=1.0]
\definecolor{acc}{HTML}{2F6DB5}
\definecolor{red}{HTML}{B23A48}
% affine plane (upper)
\fill[acc!10] (0.6,1.7) -- (4.6,2.3) -- (5.6,3.7) -- (1.6,3.1) -- cycle;
\draw[acc, thick] (0.6,1.7) -- (4.6,2.3) -- (5.6,3.7) -- (1.6,3.1) -- cycle;
\fill[black] (1.8,2.3) circle (1.5pt) node[anchor=north east] {$\mathbf{v}_1$};
\fill[black] (3.8,2.6) circle (1.5pt) node[anchor=north] {$\mathbf{v}_2$};
\fill[black] (3.1,3.2) circle (1.5pt) node[anchor=south] {$\mathbf{v}_3$};
\node[acc, anchor=west, font=\scriptsize] at (4.7,2.7) {plane};
% span plane (lower, through origin)
\fill[red!8] (0,0) -- (4.0,0.6) -- (5.0,2.0) -- (1.0,1.4) -- cycle;
\draw[red!70, thick] (0,0) -- (4.0,0.6) -- (5.0,2.0) -- (1.0,1.4) -- cycle;
\fill[black] (1.2,0.7) circle (1.5pt) node[anchor=north east] {$O$};
\node[red!80, anchor=west, font=\scriptsize] at (4.1,1.0) {span (translated)};
\end{tikzpicture}
$$

When a fourth point lands on the plane, the set becomes affinely dependent, and
the extra point acquires weights that record its position relative to the first
three.

> **Worked example.** With $\mathbf{v}_1, \mathbf{v}_2, \mathbf{v}_3$ as above,
> add $\mathbf{v}_4 = (0,14,6)$. Row reducing $[\,\mathbf{v}_2 - \mathbf{v}_1\;\;
> \mathbf{v}_3 - \mathbf{v}_1\;\; \mathbf{v}_4 - \mathbf{v}_1\,]$ shows the third
> column is not a pivot column, so the translated set is dependent and
> $\{\mathbf{v}_1, \dots, \mathbf{v}_4\}$ is affinely dependent. Full reduction
> gives
> $$
> \mathbf{v}_4 - \mathbf{v}_1 = 2(\mathbf{v}_2 - \mathbf{v}_1) + 3(\mathbf{v}_3 -
> \mathbf{v}_1),
> $$
> which rearranges to $\mathbf{v}_4 = -4\mathbf{v}_1 + 2\mathbf{v}_2 +
> 3\mathbf{v}_3$. The weights $(-4, 2, 3)$ sum to $1$, so $\mathbf{v}_4$ is an
> affine combination of the first three points and lies in their plane, though
> the negative weight places it outside the triangle they span.

## Barycentric coordinates

Affine independence gives each point of an affine hull a unique weight vector,
the exact analogue of coordinates relative to a basis.

> **Theorem (Unique barycentric coordinates).** Let $S = \{\mathbf{v}_1, \dots, \mathbf{v}_k\}$ be affinely
> independent. Then each $\mathbf{p}$ in $\operatorname{aff} S$ has a unique
> representation
> $$
> \mathbf{p} = c_1\mathbf{v}_1 + \cdots + c_k\mathbf{v}_k, \qquad c_1 + \cdots +
> c_k = 1.
> $$

The weights $c_1, \dots, c_k$ are the **barycentric coordinates** of
$\mathbf{p}$. Uniqueness follows from affine independence: two representations
would subtract to an affine dependence with weights summing to zero. The
computation uses homogeneous forms, since the two conditions of the
unique-representation theorem combine into

$$
\begin{bmatrix} \mathbf{p} \\ 1 \end{bmatrix} = c_1 \begin{bmatrix} \mathbf{v}_1
\\ 1 \end{bmatrix} + \cdots + c_k \begin{bmatrix} \mathbf{v}_k \\ 1 \end{bmatrix}.
$$

Row reduction of $[\,\tilde{\mathbf{v}}_1 \;\cdots\; \tilde{\mathbf{v}}_k \mid
\tilde{\mathbf{p}}\,]$ produces the coordinates.

> **Worked example.** Let $\mathbf{a} = (1,7)$, $\mathbf{b} = (3,0)$, $\mathbf{c}
> = (9,3)$, and $\mathbf{p} = (5,3)$. Find the barycentric coordinates of
> $\mathbf{p}$ with respect to the affinely independent set $\{\mathbf{a},
> \mathbf{b}, \mathbf{c}\}$.
>
> Row reduce the augmented matrix of homogeneous forms, moving the row of ones to
> the top:
> $$
> \left[\begin{array}{ccc|c} 1 & 1 & 1 & 1 \\ 1 & 3 & 9 & 5 \\ 7 & 0 & 3 & 3
> \end{array}\right]
> \sim
> \left[\begin{array}{ccc|c} 1 & 0 & 0 & \tfrac{1}{4} \\ 0 & 1 & 0 & \tfrac{1}{3}
> \\ 0 & 0 & 1 & \tfrac{5}{12} \end{array}\right].
> $$
> The coordinates are $\big(\tfrac{1}{4}, \tfrac{1}{3}, \tfrac{5}{12}\big)$, and
> they sum to $1$:
> $$
> \mathbf{p} = \tfrac{1}{4}\mathbf{a} + \tfrac{1}{3}\mathbf{b} +
> \tfrac{5}{12}\mathbf{c}.
> $$

### Physical and geometric meaning

Barycentric coordinates were introduced by Möbius in 1827 for a point inside a
triangle. Place masses $m_a, m_b, m_c$ at the vertices $\mathbf{a}, \mathbf{b},
\mathbf{c}$; the center of mass sits at $\mathbf{p} = m_a\mathbf{a} +
m_b\mathbf{b} + m_c\mathbf{c}$ once the masses are scaled to sum to $1$. The
coordinates are the normalized masses themselves, which is the origin of the term.

The geometric reading is a ratio of areas. Joining $\mathbf{p}$ to each vertex
splits triangle $\mathbf{abc}$ into three smaller triangles, and

$$
\operatorname{area}(\mathbf{pbc}) = c_1 \cdot \operatorname{area}(\mathbf{abc}),
\quad
\operatorname{area}(\mathbf{apc}) = c_2 \cdot \operatorname{area}(\mathbf{abc}),
\quad
\operatorname{area}(\mathbf{abp}) = c_3 \cdot \operatorname{area}(\mathbf{abc}).
$$

Each coordinate is the fraction of the total area cut off by the sub-triangle
opposite that vertex.

$$
% caption: Joining $\mathbf{p}$ to the vertices splits the triangle into three
% pieces whose areas are $c_1$, $c_2$, $c_3$ times the whole; the barycentric
% coordinates read the area ratios directly.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=1.0]
\definecolor{acc}{HTML}{2F6DB5}
\coordinate (A) at (1.2,3.4);
\coordinate (B) at (0,0);
\coordinate (C) at (4.4,0.6);
\coordinate (P) at (1.9,1.4);
\draw[thick] (A) -- (B) -- (C) -- cycle;
\draw (P) -- (A);
\draw (P) -- (B);
\draw (P) -- (C);
\fill[black] (A) circle (1.7pt) node[anchor=south] {$\mathbf{a}$};
\fill[black] (B) circle (1.7pt) node[anchor=north east] {$\mathbf{b}$};
\fill[black] (C) circle (1.7pt) node[anchor=north west] {$\mathbf{c}$};
\fill[black] (P) circle (1.7pt) node[anchor=south west] {$\mathbf{p}$};
\node[black, font=\scriptsize] at (0.85,1.35) {$c_1$};
\node[black, font=\scriptsize] at (2.35,2.3) {$c_3$};
\node[black, font=\scriptsize] at (2.5,0.7) {$c_2$};
\end{tikzpicture}
$$

When $\mathbf{p}$ leaves the triangle, some coordinates turn negative. The lines
where a coordinate equals a fixed value are parallel to the opposite side: the
line through $\mathbf{b}$ and $\mathbf{c}$ has $c_1 = 0$ (its points are affine
combinations of $\mathbf{b}$ and $\mathbf{c}$ alone), and the parallel line
through $\mathbf{a}$ has $c_1 = 1$. Crossing the side $\mathbf{bc}$ flips the sign
of $c_1$.

$$
% caption: Level lines of the first barycentric coordinate. The side through
% $\mathbf{b}$ and $\mathbf{c}$ is the zero line; the parallel through $\mathbf{a}$
% is the one line; beyond the side the coordinate is negative.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=1.0]
\definecolor{acc}{HTML}{2F6DB5}
\definecolor{red}{HTML}{B23A48}
\coordinate (A) at (1.6,3.2);
\coordinate (B) at (0,0);
\coordinate (C) at (4.4,0.4);
\draw[thick] (A) -- (B) -- (C) -- cycle;
% zero line (bc extended)
\draw[acc, thick] (-0.7,-0.06) -- (5.3,0.48);
\node[acc, anchor=north] at (1.4,0.06) {$c_1=0$};
% one line through a, parallel to bc
\draw[acc, dashed] (0.6,3.14) -- (4.2,3.46);
\node[acc, anchor=south] at (3.6,3.4) {$c_1=1$};
\fill[black] (A) circle (1.6pt) node[anchor=east] {$\mathbf{a}$};
\fill[black] (B) circle (1.6pt) node[anchor=north east] {$\mathbf{b}$};
\fill[black] (C) circle (1.6pt) node[anchor=north west] {$\mathbf{c}$};
\node[black, anchor=north, font=\scriptsize] at (3.6,0.04) {$c_1<0$};
\end{tikzpicture}
$$

## Interpolation in computer graphics

A surface approximated by flat triangular patches carries data only at the
vertices: a color, a normal direction, a depth. Barycentric coordinates spread
that data across the interior. The value at an interior point $\mathbf{p}$ is the
combination of the vertex values with the barycentric coordinates as weights —
the interpolation that produces smooth shading from a coarse
mesh.

Colors are stored as RGB triples $(r,g,b)$ with each component between $0$ and
$1$. Interpolating a color across a triangle means applying the barycentric
weights to the three vertex colors.

> **Worked example.** Let $\mathbf{v}_1 = (3,1,5)$, $\mathbf{v}_2 = (4,3,4)$,
> $\mathbf{v}_3 = (1,5,1)$, and $\mathbf{p} = (3,3,3.5)$. The vertex colors are
> magenta $(1,0,1)$, light magenta $(1, 0.4, 1)$, and purple $(0.6, 0, 1)$. Find
> the interpolated color at $\mathbf{p}$.
>
> First the barycentric coordinates, from the homogeneous-form reduction:
> $$
> \left[\begin{array}{ccc|c} 1 & 1 & 1 & 1 \\ 3 & 4 & 1 & 3 \\ 1 & 3 & 5 & 3 \\ 5
> & 4 & 1 & 3.5 \end{array}\right]
> \sim
> \begin{bmatrix} 1 & 0 & 0 & 0.25 \\ 0 & 1 & 0 & 0.5 \\ 0 & 0 & 1 & 0.25 \\ 0 & 0
> & 0 & 0 \end{bmatrix},
> $$
> so $\mathbf{p} = 0.25\mathbf{v}_1 + 0.5\mathbf{v}_2 + 0.25\mathbf{v}_3$. Apply
> the same weights to the colors:
> $$
> 0.25\begin{bmatrix} 1 \\ 0 \\ 1 \end{bmatrix} + 0.5\begin{bmatrix} 1 \\ 0.4 \\ 1
> \end{bmatrix} + 0.25\begin{bmatrix} 0.6 \\ 0 \\ 1 \end{bmatrix} =
> \begin{bmatrix} 0.9 \\ 0.2 \\ 1 \end{bmatrix}.
> $$
> The interpolated color at $\mathbf{p}$ is $(0.9, 0.2, 1)$.

$$
% caption: A color assigned at each vertex spreads across the triangle by
% barycentric weighting; the interior point inherits a blend of the three.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=1.0]
\definecolor{acc}{HTML}{2F6DB5}
\definecolor{mag}{HTML}{C13A8E}
\definecolor{pur}{HTML}{7A4FB0}
\coordinate (A) at (1.0,3.2);
\coordinate (B) at (0,0);
\coordinate (C) at (4.2,0.8);
\fill[acc!8] (A) -- (B) -- (C) -- cycle;
\draw[acc, thick] (A) -- (B) -- (C) -- cycle;
\fill[mag] (A) circle (2.4pt) node[anchor=south, black] {$\mathbf{v}_1$};
\fill[mag!70] (B) circle (2.4pt) node[anchor=north east, black] {$\mathbf{v}_2$};
\fill[pur] (C) circle (2.4pt) node[anchor=north west, black] {$\mathbf{v}_3$};
\fill[black] (1.55,1.4) circle (1.7pt) node[anchor=west] {$\mathbf{p}$};
\node[black, anchor=north, font=\scriptsize] at (2.0,0.1) {blend of the vertex colors};
\end{tikzpicture}
$$

The same weights answer the point-in-triangle question. A point of the plane
lies inside triangle $\mathbf{abc}$ precisely when all three barycentric
coordinates are nonnegative; a zero coordinate puts it on an edge, and a negative
one puts it outside. Ray tracing uses this: a ray $\mathbf{x}(t) = \mathbf{a} +
t\mathbf{d}$ meets the plane of a triangle at one parameter $t$, and the sign
pattern of the barycentric coordinates of that intersection decides whether the
ray actually strikes the patch.

$$
% caption: The sign pattern of the barycentric coordinates classifies a point:
% all positive inside, one zero on an edge, one negative outside.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=1.0]
\definecolor{acc}{HTML}{2F6DB5}
\definecolor{red}{HTML}{B23A48}
\coordinate (A) at (1.4,3.0);
\coordinate (B) at (0,0);
\coordinate (C) at (4.0,0.4);
\fill[acc!10] (A) -- (B) -- (C) -- cycle;
\draw[acc, thick] (A) -- (B) -- (C) -- cycle;
\fill[black] (1.5,1.1) circle (1.7pt) node[anchor=north, font=\scriptsize] {inside};
\fill[black] (2.7,0.7) circle (1.7pt);
\node[black, anchor=west, font=\scriptsize] at (2.75,0.62) {on edge};
\fill[red] (4.4,1.9) circle (1.8pt) node[anchor=west, font=\scriptsize] {outside};
\node[acc, anchor=east, font=\scriptsize] at (1.35,1.55) {$c_i>0$};
\end{tikzpicture}
$$

Nonnegative barycentric coordinates single out the points of the triangle from
the points of its full plane. That restriction, applied to any set of points, is
the definition of a
[convex combination](/linear-algebra/geometry-of-vector-spaces/convex-combinations-and-convex-sets).

[^lay-affind]: **Lay**, _Linear Algebra and Its Applications_, §8.2 — Affine
Independence: Theorem 5 (four equivalent tests), Theorem 6 (unique affine
representation), the definition of barycentric coordinates, and the area-ratio
and computer-graphics interpretations. Worked examples adapt §8.2 Examples 2–5.
