II.6 · Linear Algebra
What can two weighted moves reach?
Change two coefficients and watch the destination move through a parallelogram. Change the directions themselves and see the reachable set collapse from plane to line to point.
Two weights explore the reachable set
Unrestricted real coefficients reach the entire plane. The shaded parallelogram is only the coefficient window −2 ≤ a,b ≤ 2; its grid comes from these actual directions.
- first direction
- (2, 1)
- second vector
- (1, 2)
- first weight
- 1
- second weight
- −0.5
- linear combination
- (1.5, 0)
- number of independent directions
- 2
Exact expressions use =. Rounded computations use ≈. All arrows use these same quantities.
Unrestricted real coefficients reach the entire plane. The shaded parallelogram is only the coefficient window −2 ≤ a,b ≤ 2; its grid comes from these actual directions.
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −4 to 4, up to 2 decimal places
from −2 to 2, up to 2 decimal places
from −2 to 2, up to 2 decimal places
Move just , then just , and identify the two directions of travel. Choose Collinear directions: two controls still work, but their effects now lie on the same line. Choose Both directions zero: changing either weight cannot move the result. The geometry follows the actual vectors in every case.
Intuition: directions are resources
One nonzero vector supplies a line of possible moves, because its scalar multiples point along that line in either direction. Two vectors can supply two different directional resources. A weighted sum first scales each move, then adds them head-to-tail. Independent directions let the two weights navigate the plane.
Two arrows do not necessarily supply two directions. If one is twice the other, changing its coefficient only changes how far you move along a line already available. Zero contributes no directional resource at all. This is why the number of controls is not the dimension of the reachable set.
Definition
For real coefficients , a linear combination is
The span is the set of all such combinations with unrestricted real coefficients:
In the plane it can be all of , a line through the origin, or the singleton . It always contains zero, obtained with . It is also closed under addition and scalar multiplication. These properties make it a vector subspace; a translated line that misses the origin is not a span of ordinary vectors.
Mechanics: a coefficient square becomes a parallelogram
For fixed directions, varying while holding fixed traces a line parallel to . Varying traces a line parallel to . The stage’s coefficient grid uses several fixed values of each weight. Every line endpoint is computed as an actual combination of the current vectors.
The corners of the bounded region are , , , and . These are the images of the four corners of the control square. When the directions become collinear, the corners and grid collapse onto a segment. When both become zero, they collapse to the origin. Nothing remains shaded as a plane when the mathematics has only one or zero directions.
Derivation: plane, line, or point
Suppose with . Then
Every result lies on ‘s line, and every point on that line is reachable by choosing appropriately. If both vectors are zero, every combination is zero. If one is zero and the other is nonzero, the nonzero vector still spans a line.
When neither direction is a multiple of the other, every target in the plane can be written as a combination. To see the mechanism, begin by moving along . The second direction supplies a nonzero sideways component relative to that line; choose to match the target’s sideways displacement, then choose to correct the remaining parallel displacement. The next chapter turns this argument into exact coordinate formulas and proves uniqueness.
Closure under addition follows by grouping weights:
Scaling a combination likewise scales both weights. These identities explain why linear combinations remain inside the same span.
Worked examples
With , , , and , the weighted moves are and . Their sum is , despite neither original vector lying on the horizontal axis.
Inspect the worked calculation
With u = (2, 1), v = (1, 2), a = 1 and b = −0.5, the two moves are (2, 1) and (−0.5, −1).
- first direction
- (2, 1)
- second vector
- (1, 2)
- first weight
- 1
- second weight
- −0.5
- linear combination
- (1.5, 0)
- number of independent directions
- 2
For and , the combination reduces to . Both and produce . A target such as is impossible because every reachable point satisfies . This is a failed construction for a mathematical reason, independent of the control range.
Executable reference code
The pedagogical code spells out the weighted component sums and identifies zero, one, or two directions. NumPy shows the same combination directly, then maps a small table of coefficient pairs into sample points. Those samples illustrate a bounded region; a finite sample table is never the entire continuous span.
from fractions import Fraction
def combine(a, u, b, v):
if len(u) != 2 or len(v) != 2:
raise ValueError('Expected two components per vector')
a, b = Fraction(str(a)), Fraction(str(b))
return tuple(a*Fraction(str(x)) + b*Fraction(str(y)) for x, y in zip(u, v))
def span_dimension(u, v):
if len(u) != 2 or len(v) != 2:
raise ValueError('Expected two components per vector')
u, v = (tuple(Fraction(str(x)) for x in w) for w in (u, v))
cross = u[0]*v[1] - u[1]*v[0]
return 2 if cross else 1 if any(u) or any(v) else 0
if __name__ == '__main__':
assert combine(1, (2, 1), '-0.5', (1, 2)) == (Fraction('1.5'), 0)
assert span_dimension((1, 1), (2, 2)) == 1
assert span_dimension((0, 0), (0, 0)) == 0import numpy as np
u = np.array([2.0, 1.0])
v = np.array([1.0, 2.0])
a, b = 1.0, -0.5
w = a * u + b * v
assert np.array_equal(w, [1.5, 0])
# Sample the bounded coefficient square, not the entire mathematical span.
coefficients = np.array([[a, b] for a in [-2, 0, 2] for b in [-2, 0, 2]])
columns = np.column_stack((u, v))
reachable_samples = coefficients @ columns.T
assert reachable_samples.shape == (9, 2)Explore
Set and vary : only the second direction contributes. Set and vary . Use opposite signs to reach points beyond the wedge between the positive arrows. Then change until it lies on ‘s line; explain why the two families of grid lines no longer cross in distinct directions. Test a zero first vector and a nonzero second vector before setting both to zero.
In the almost-collinear preset, the region is very thin but remains two-dimensional. Exact entered decimals retain two distinct directions. Targets far from that thin strip may require large unrestricted weights; being a plane-spanning pair does not guarantee that the current control range can reach a chosen target.
Common mistakes
Restricting both weights to be nonnegative gives a cone, a different set from a span. Requiring describes an affine combination, another different set. Counting two vectors without checking their directions can mistake a redundant pair for a plane-spanning one. Finally, a span always passes through the origin: it is a set of moves, not a choice of where to place a diagram.
Numerical considerations
The stage forms combinations and tests collinearity exactly from the accepted decimals. With approximate measurements, nearly collinear inputs may be hard to distinguish from exact dependence. A numerical rank estimate needs a scale-aware criterion; a fixed determinant threshold confuses small lengths with small directional separation. Large weights of opposite signs can also nearly cancel, making a small output sensitive to coefficient error. The exact stage makes the intended algebra inspectable, while the NumPy code follows finite-precision array arithmetic.
Engineering and ML connections
Combining actuator directions determines which displacements a mechanism can produce. Mixing feature directions determines which outputs a linear model can express. Redundant directions can add parameters without adding reachable outputs. Before asking how to fit weights, it helps to ask whether the desired result lies in the available span at all.
Exercises
Summary and checkpoints
Linear combinations scale and add available directions; span includes every result with unrestricted real weights. Check that you can distinguish a control window from a span, explain each collapse, and prove closure under addition and scaling. II.7 Basis and coordinates asks when the weights are unique.