Pencil of cubics
Click and drag to move the points
Math: cubics through 8 points
This visualizes the pencil of cubics defined through 8 points, where you can place the 8 points! A cubic curve is the zero locus of a polynomial of degree less than or equal to 3. The space of cubic polynomials in 2 variables is 10 dimensional. Here is a basis
\[\begin{gather} 1,\\ x,\quad y \\ x^2, \quad xy, \quad y^2, \\ x^3, \quad x^2 y, \quad x y^2, \quad y^3 \end{gather}\]For a degree three polynomial $f$, A cubic curve $f^{-1}(0)$ passes through a point $p\in \RR^2$ if and only if $f(p)=0$. To find the space of cubics passing through $p$, we recast the problem slightly. Let $\mathcal{H}$ denote the 10 dimensional vector space of cubic functions, and consider the evaluation map
\[ev_{p} : \mathcal{H} \to \RR \qquad ev_{p} (f) = f(p)\]The cubics passing through $p$ satisfy $ev_{p}(f) = 0$, so the space of cubics through $\vec{x}$ is the kernel of $ev_{p}$. Since $ev_{p}$ is linear, this defines a 9 dimensional subspace of $\mathcal{H}$.
Restricting the cubic to pass through a point reduces the dimensional by 1. Fixing the cubic to pass through 8 points leaves $10-8=2$ dimensions of cubic functions. More formally, let $P = {p_1,\dots,p_8}$ be the 8 points of interest. Define the evaluation \(ev_P:\mathcal{H} \to \RR^8 \quad ev_P(f) = (f(p_1),\dots,f(p_8))\) The space of cubic functions passing through all the points in $P$ is the kernel of $ev_P$. By the rank-nullity theorem, \(\dim \ker(ev_P) = \dim \mathcal{H} - \dim \text{im}(ev_P)\)If $ev_P$ is maximal rank, then the kernel has dimensional $10-8=2$. This can be higher if $ev_P$ does not have maximal rank, for example if two points coincide. It turns out, $ev_P$ is fails to be full rank whenever 4 points in $P$ are colinear, or 7 points lie on the same conic. Try to arrange this, and see what happens to the pencil of cubics.
When we scale $f$ by some $\lambda \in \RR-{0}$, the cubic curves $(\lambda f)\inv(0)$ and $f\inv(0)$ are equal. Therefore, the space of cubic curves is the projectivization $\mathbb{P} \ker(ev_P)$. When the kernel is 2 dimensional, the space of cubic curves is a circle $\mathbb{RP}^1$.
The visualization above is plotting about 20 cubics sampled evenly from the circle and slowly rotating. The color of each cubic is determined by the starting phase of the cubic. When the cubics are very closely spaced, I draw white. This helps with aliasing artifacts, and illustrates how pencils of cubics like to concentrate onto lower degree curves.
Arrange the points in a 3 by 3 grid. Notice how a ninth point appears? This is due to the Caylay-Bacharach theorem. If cubic curves $A,B$ passes through 8 points $P$ and intersect at $p_0$, then any cubic passing through $P$ also passes through $p_0$. We get a ninth point for free. This can be used for a slick proof of Pascal’s and pappus’s hexagon theorem.
This shader was made during the winter school, inspired by Steve Trettel’s shader course. Check out his notes, they’re awesome.