Computation Lab: Linear Combinations and Span Geometry
An interactive lab for seeing how coefficients, generator directions, and dependence determine what vectors you can build.
Keywords
computation, simulation, visualization, span, vectors
1 Lab Goal
This lab helps you see one specific fact:
changing coefficients moves you inside the span you already have, but changing the generator directions changes the span itself.
2 Math Question
How do the coefficients and the angle between two generator vectors affect:
- the constructed vector
- whether the generators are independent
- whether the span is a line or the whole plane
3 Model or Setup
We use two vectors in \(\mathbb{R}^2\):
\[ v_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \qquad v_2 = \begin{bmatrix} \cos \theta \\ \sin \theta \end{bmatrix}. \]
The constructed vector is
\[ x = a v_1 + b v_2. \]
4 Parameters and Controls
Angle: controls whether \(v_2\) is nearly parallel to \(v_1\) or clearly independentCoefficient a: weight on \(v_1\)Coefficient b: weight on \(v_2\)
Default values are 50 degrees, 1.2, and 0.8.
5 Code and Simulation
6 What To Observe
- As long as the angle is not
0or180degrees, the two directions are independent. - When the angle approaches
0or180, the determinant approaches zero and the span collapses toward a single line. - The sliders for \(a\) and \(b\) move the red vector inside the span you already have; they do not create a new span.
- Dependence is not about one coefficient choice. It is about the geometry of the generators themselves.
7 Interpretation
This is the geometry behind the phrase
span is the set of all linear combinations.
When the generators are independent in \(\mathbb{R}^2\), their span is the whole plane. When they are dependent, all combinations stay on one line. The determinant here is a quick 2D witness of that change.
8 Failure Modes and Numerical Cautions
- Near-zero determinants can look nonzero numerically because of floating-point rounding.
- This is only a 2D picture. In higher dimensions, span and dependence still behave the same way, but the geometry is harder to draw.
- A visually small angle does not by itself prove exact dependence; exact dependence is an algebraic statement.
9 Reproducibility Notes
- execution engine: Observable JS
- randomness: none
- libraries: Quarto OJS with Plot and Inputs
- render mode: interactive client-side
10 Extensions
- replace \(v_1\) by a non-axis-aligned vector
- add a third vector and test when it changes the span and when it is redundant
11 Sources and Further Reading
- MIT 18.06SC: Basis and Dimension -
First pass- good official anchor for span and dependence. Checked2026-04-24. - Introduction to Applied Linear Algebra – Vectors, Matrices, and Least Squares -
Second pass- useful for computational and geometric phrasing. Checked2026-04-24. - Attention is All you Need -
Paper bridge- later reminder that weighted vector mixtures remain central in modern ML systems. Checked2026-04-24.