Linear Algebra › Section H · The geometry of vector spaces › Topic H.2

Affine independence

Three points that do not lie on one line pin down a plane, and every point of that plane can then be described by a unique set of weights. Affine independence makes that idea precise, and the weights it produces, barycentric coordinates, are how graphics hardware shades the triangles on a screen.

Independence without an origin

Linear independence asks whether some vector is a linear combination of the others, and it treats the origin as special: any set containing \(\mathbf{0}\) is dependent. For points, the origin should not matter. Three points in the plane carry real information exactly when they are not collinear, wherever the origin sits; two distinct points always define a line. The affine version of independence asks whether some point is an affine combination of the others, as in "Affine combinations". If none is, every point gets its own direction of freedom, and affine combinations of the set describe each point of its affine hull in exactly one way.

Definition

A set \(\{\mathbf{v}_1, \dots, \mathbf{v}_p\}\) in \(\mathbb{R}^n\) is affinely dependent if there are weights \(c_1, \dots, c_p\), not all zero, with

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

Otherwise it is affinely independent. Notice the weights add to 0, not 1. Such a relation is unaffected by moving the origin, since adding \(\mathbf{b}\) to each point adds \((\sum c_i)\mathbf{b} = \mathbf{0}\). A single point is always affinely independent, and so is any pair of distinct points. Three points are affinely dependent exactly when they are collinear, and four points in \(\mathbb{R}^3\) exactly when they lie in one plane.

Four equivalent tests

For a set \(S = \{\mathbf{v}_1, \dots, \mathbf{v}_p\}\) with \(p \ge 2\), these statements are equivalent: (a) \(S\) is affinely dependent; (b) one of the points is an affine combination of the others; (c) the differences \(\mathbf{v}_2 - \mathbf{v}_1, \dots, \mathbf{v}_p - \mathbf{v}_1\) are linearly dependent; (d) the homogeneous forms \(\tilde{\mathbf{v}}_1, \dots, \tilde{\mathbf{v}}_p\) in \(\mathbb{R}^{n+1}\) are linearly dependent. Test (c) is usually quickest by hand, and test (d) suits a single row reduction. A consequence of (c): in \(\mathbb{R}^n\) there can be at most \(n\) independent differences, so any set of more than \(n + 1\) points is affinely dependent. Four points in the plane always are.

Worked example: finding a dependence relation

Test \(\mathbf{v}_1 = (1, 0, 1)\), \(\mathbf{v}_2 = (2, 1, 3)\), \(\mathbf{v}_3 = (0, 2, 1)\), \(\mathbf{v}_4 = (1, 3, 3)\). 1. Differences: \(\mathbf{v}_2 - \mathbf{v}_1 = (1, 1, 2)\), \(\mathbf{v}_3 - \mathbf{v}_1 = (-1, 2, 0)\), \(\mathbf{v}_4 - \mathbf{v}_1 = (0, 3, 2)\). 2. The third is the sum of the first two, since \(1 + (-1) = 0\), \(1 + 2 = 3\) and \(2 + 0 = 2\). So the differences are linearly dependent, and the set is affinely dependent. 3. Rewrite:

(\mathbf{v}_4 - \mathbf{v}_1) - (\mathbf{v}_2 - \mathbf{v}_1) - (\mathbf{v}_3 - \mathbf{v}_1) = \mathbf{0}

which simplifies to \(\mathbf{v}_1 - \mathbf{v}_2 - \mathbf{v}_3 + \mathbf{v}_4 = \mathbf{0}\). 4. Check: weights \(1 - 1 - 1 + 1 = 0\), and the coordinates sum to \((0, 0, 0)\). The four points lie in one plane.

Barycentric coordinates

Let \(S = \{\mathbf{v}_1, \dots, \mathbf{v}_k\}\) be affinely independent. Then every point \(\mathbf{p}\) in \(\operatorname{aff} S\) can be written in exactly one way as

\mathbf{p} = c_1\mathbf{v}_1 + \cdots + c_k\mathbf{v}_k, \qquad c_1 + \cdots + c_k = 1

If there were two sets of weights, subtracting them would give a non-trivial relation whose weights add to 0, contradicting independence. The unique weights are the barycentric coordinates of \(\mathbf{p}\) relative to \(S\), sometimes called affine coordinates. The name, from the Greek word for heavy, comes from physics: when every \(c_i\) is positive, put masses \(c_i\) at the points and \(\mathbf{p}\) is their centre of mass. August Möbius introduced them in 1827. To compute them, row reduce the augmented matrix of the homogeneous forms.

Worked example: coordinates in a triangle

Find the barycentric coordinates of \(\mathbf{p} = (3, 3)\) relative to \(\mathbf{a} = (1, 1)\), \(\mathbf{b} = (5, 2)\), \(\mathbf{c} = (2, 6)\). 1. Solve \(r\tilde{\mathbf{a}} + s\tilde{\mathbf{b}} + t\tilde{\mathbf{c}} = \tilde{\mathbf{p}}\):

\begin{bmatrix} 1 & 5 & 2 & 3 \\ 1 & 2 & 6 & 3 \\ 1 & 1 & 1 & 1 \end{bmatrix}

2. Using \(r = 1 - s - t\), the first two rows become \(4s + t = 2\) and \(s + 5t = 2\). 3. So \(s = 8/19\), \(t = 6/19\) and \(r = 5/19\). 4. Check:

\tfrac{1}{19}\big[5(1, 1) + 8(5, 2) + 6(2, 6)\big] = \tfrac{1}{19}(57, 57) = (3, 3)

All three coordinates are positive, so \(\mathbf{p}\) lies inside the triangle.

What the coordinates mean

For a triangle \(\mathbf{abc}\), the barycentric coordinates \((r, s, t)\) of \(\mathbf{p}\) have a geometric meaning. The coordinate \(r\) is zero on the line through \(\mathbf{b}\) and \(\mathbf{c}\), equals 1 at \(\mathbf{a}\), is positive on \(\mathbf{a}\)'s side of that line and negative on the far side. So \(\mathbf{p}\) is inside the triangle exactly when all three are positive, on an edge when one is zero and the others positive, and outside when one is negative. Each coordinate is also a ratio of areas: \(r\) is the area of triangle \(\mathbf{pbc}\) divided by the area of \(\mathbf{abc}\), for points inside. In the example, \(\mathbf{abc}\) has area \(19/2\) and \(\mathbf{pbc}\) has area \(5/2\), so \(r = 5/19\).

Barycentric coordinates in computer graphics

3D models are built from thousands of triangles, and colours, brightness and texture positions are stored only at the vertices. To colour a pixel inside a triangle, the graphics processor finds its barycentric coordinates and blends the vertex values with the same weights. Suppose the brightness is 20% at \(\mathbf{a}\), 80% at \(\mathbf{b}\) and 50% at \(\mathbf{c}\) in the previous example. At \(\mathbf{p}\) it is

\tfrac{5}{19}(20) + \tfrac{8}{19}(80) + \tfrac{6}{19}(50) = \tfrac{1040}{19} \approx 54.7\%

Because the weights are positive and add to 1, the blend always lies between the smallest and largest vertex values. The same signs test decides which pixels are inside the triangle in the first place.

Common mistakes to avoid

First, requiring the weights in a dependence relation to add to 1; they must add to 0. Second, testing the points themselves for linear independence: \((1, 0)\), \((0, 1)\) and \((1, 1)\) are linearly dependent in \(\mathbb{R}^2\) but affinely independent, since they are not collinear. Third, forgetting that a set containing \(\mathbf{0}\) can still be affinely independent. Fourth, trusting barycentric coordinates relative to an affinely dependent set; they are not unique. Fifth, reading a negative coordinate as an arithmetic error, when it simply means the point is outside the triangle.

Key takeaways

A set of points is affinely dependent when some non-trivial weights adding to 0 combine the points to 0; otherwise it is affinely independent. Equivalent tests: one point is an affine combination of the others; the differences vᵢ − v₁ are linearly dependent; the homogeneous forms (vᵢ, 1) are linearly dependent. Three points are affinely independent exactly when not collinear, and more than n + 1 points in Rⁿ are always dependent. Relative to an affinely independent set, each point of its affine hull has unique barycentric coordinates, found by row reducing homogeneous forms. In a triangle they are positive inside, zero on an edge line, negative outside, and equal ratios of areas. Graphics uses them to blend vertex colours.

Flashcards

Flashcard

Affinely dependent

Σcᵢvᵢ = 0 for weights not all zero with Σcᵢ = 0

The weights add to 0, not 1.

Test your understanding

Question 1 of 5

Which set of points is affinely dependent?

Question 2 of 5

The points v₁, v₂, v₃, v₄ satisfy 2v₁ − v₂ + c v₃ − 3v₄ = 0, and this is an affine dependence relation. What is c?

Question 3 of 5

Relative to a = (0, 0), b = (4, 0), c = (0, 4), what are the barycentric coordinates of p = (1, 2)?

Question 4 of 5

A point has barycentric coordinates (0.6, −0.1, 0.5) relative to a triangle abc. Where is it?

Question 5 of 5

Brightness values are 10 at a, 40 at b and 70 at c. What is the interpolated value at the point with barycentric coordinates (0.5, 0.3, 0.2)?

← Previous topicNext topic →