Last Halloween I found myself the lone math student at a party, wearing a Springer Yellow Book costume. While I do not claim to be good at making costume decisions, to my relief people enjoyed a good “textbook costume” pun. Most of all, I was happy that nobody found my costume scary1.
After a while I started a conversation with a couple of people about our jobs and what we enjoy about it. I told them about the research and teaching aspects of my graduate program. This semester I was a teaching assistant for a lower-division Linear Algebra and Differential Equations course. I find this course to be quite fun to teach, because I get to help students develop a geometric intuition for abstract mathematics and point to wonderful applications of that abstraction.
As it turned out, one of the people in our group was a graphics design student. He told me about a project involving linear algebra, and how he wished that he had taken more math courses. He also mentioned using the Bézier curves in his classes. I had never heard of that name, so I wrote a note to look into it later. This conversation reminded me of something I had read in Jordan Ellenberg pitch for Outward-Facing Mathematics:
“Those of us who teach spend a lot of hours talking about math in front of students who have been forced to be there. That makes it easy to forget that people out in the world generally admire math and are excited to learn about it, if we give them a way in!”
Back at home, I looked up Bézier curves, which lead me down a delightful rabbit hole of computer fonts and automobile design2, and in the process I learned new math. In this post (and hopefully others) I am going to write about the wonderful mathematics that I learn inspired by people in other professions.
What does graphic design have to do with math?
Geometry. Even the most basic illustrations involve lines and areas. To design the fancy $\LaTeX$ fonts used for mathematical symbols, for instance, each glyph is pieced together by many curves enclosing a shaded region.
This might sound like a trivial fact, like answering a toddler who asks “how are words written?” or at best something that typographers, not mathematicians, would find interesting. In that case, you might be surprised to hear that in the late 70’s and 80’s the AMS formed an advisory Standing Committee on Composition Technology3 and helped work on a then up-and-coming software by Donald Knuth called $\TeX$.
Stay with me and I will explain why I find this mathematically interesting.
How does interpolating curves work?
Euclid postulated that given any two points, we can draw a straight line passing through them.
Question: in how many different ways can the statement above be generalized?
Here are a few I can think of:
- given three points, when can we draw a straight line passing through them? How about a circle or a conic section?
- given three points, what is the lowest degree polynomial $y=P(x)$ passing through them?
- given two lines in the space, when can we find a unique plane passing through them?
Each of these are interesting problems, typically studied by algebraic geometers. There are also others, but for now let’s consider the following:
- given two points and two lines passing through them, is there a cubic polynomial tangent to the given lines at the respective points?
This is referred to as spline interpolation.
The idea here boils down to finding a special basis $H_0(x)$, $H_1(x)$, $H_2(x)$, and $H_3(x)$ for the space of cubic polynomials in one variable so that given $y_0$,$y_1$,$m_0$, and $m_1$, we can quickly find the cubic polynomial we wanted by computing $P(x) = y_0 H_0(x)$ $+ y_1 H_1(x)$ $+ m_0 H_2(x)$ $+ m_1 H_3(x)$. Here is the idea:
Consider $P(x) = ax^3+bx^2+cx+d$, so $\tfrac{dP}{dx}(x) = 3ax^2+2bx+c$. Plugging in our initial conditions gives:
$$
\begin{aligned}
y_0 = P(0) &= d \\\
y_1 = P(1) &= a + b + c + d \\\
m_0 = \tfrac{dP}{dx}(0) &= c \\\
m_1 = \tfrac{dP}{dx}(1) &= 3a + 2b + c
\end{aligned}
$$
This is a system of linear equations:
$$
\begin{pmatrix} y_0 \\\ y_1 \\\ m_0 \\\ m_1 \end{pmatrix} =
\begin{pmatrix} P(0) \\\ P(1) \\\ P'(0) \\\ P'(1) \end{pmatrix} =
\begin{pmatrix}
0 & 0 & 0 & 1 \\\
1 & 1 & 1 & 1 \\\
0 & 0 & 1 & 0 \\\
3 & 2 & 1 & 0 \\\
\end{pmatrix}
\begin{pmatrix} a \\\ b \\\ c \\\ d \end{pmatrix}
$$
Since this matrix is invertible, we can find:
$$
\begin{pmatrix} a \\\ b \\\ c \\\ d \end{pmatrix} =
\begin{pmatrix}
0 & 0 & 0 & 1 \\\
1 & 1 & 1 & 1 \\\
0 & 0 & 1 & 0 \\\
3 & 2 & 1 & 0 \\\
\end{pmatrix}^{-1}
\begin{pmatrix} y_0 \\\ y_1 \\\ m_0 \\\ m_1 \end{pmatrix}
$$
Now we can go back to $P(x)$:
$$
\begin{aligned}
P(x)
&= \begin{pmatrix} x^3 \\\ x^2 \\\ x \\\ 1 \end{pmatrix}^T
\begin{pmatrix} a \\\ b \\\ c \\\ d \end{pmatrix} \\\
&= \begin{pmatrix} x^3 \\\ x^2 \\\ x \\\ 1 \end{pmatrix}^T
\begin{pmatrix}
0 & 0 & 0 & 1 \\\
1 & 1 & 1 & 1 \\\
0 & 0 & 1 & 0 \\\
3 & 2 & 1 & 0 \\\
\end{pmatrix}^{-1}
\begin{pmatrix} y_0 \\\ y_1 \\\ m_0 \\\ m_1 \end{pmatrix} \\\
&= \begin{pmatrix} x^3 \\\ x^2 \\\ x \\\ 1 \end{pmatrix}^T
\begin{pmatrix}
2 & -2 & 1 & 1 \\\
-3 & 3 & -2 & -1 \\\
0 & 0 & 1 & 0 \\\
1 & 0 & 0 & 0 \\\
\end{pmatrix}
\begin{pmatrix} y_0 \\\ y_1 \\\ m_0 \\\ m_1 \end{pmatrix} \\\
&= \begin{pmatrix} 2x^3-3x^2+1 \\\ -2x^3+3x^2 \\\ x^3-2x^2+x \\\ x^3-x^2 \end{pmatrix}^T
\begin{pmatrix} y_0 \\\ y_1 \\\ m_0 \\\ m_1 \end{pmatrix} \\\
&= \begin{pmatrix} H_0(x) \\\ H_1(x) \\\ H_2(x) \\\ H_3(x) \end{pmatrix}^T
\begin{pmatrix} y_0 \\\ y_1 \\\ m_0 \\\ m_1 \end{pmatrix} \\\
&= y_0 H_0(x) + y_1 H_1(x) + m_0 H_2(x) + m_1 H_3(x)
\end{aligned}
$$
These polynomials are the cubic Hermite splines.
There is much more to learn here!
Interpolating piece-wise cubic curves certainly is not the end of the story. As studied by algebraic geometers, multivariate spline theory and geometric modeling of curves and especially algebraic surfaces of higher degree is an active area of research. Even more, we can consider complex analytic functions and arrive at periodic designs. All of that also for another time.
From here it is a short walk to define Bézier curves. To keep this post short I will point to two references instead5, but if you are interested to explore, there are many connections to numerical analysis and even a constructive proof of the Stone–Weierstrass approximation theorem.
If you are interested in the computations, you can experiment with cubic and quadratic Bézier curves or learn more about modern fonts and create one or make an animation instead.
To close, I want to give a nod to David Austin’s essay in which he suggests that “the singular value decomposition should be a central part of an undergraduate mathematics major’s linear algebra curriculum.” The book used in the course I am teaching stops at simple applications to physics, but perhaps introducing applications from other areas like computer science or the arts, even for students taking lower-division mathematics courses, would encourage people (including mathematicians) to view the subject in a more approachable light.
Notes and footnotes:
- The animations above are created by the Manim engine, as seen in 3Blue1Brown videos. I am confident that somewhere deep inside the Python libraries used in Manim, there are Bézier curves smoothing the transitions.
- In case anyone found my costume scary, I was ready to recite the quote by Gauss that “mathematics is the queen of sciences,” so technically I was wearing a princess costume! ↩︎
- If you haven’t heard yet, the new Tesla Cybertruck has decided to buck the trend of using smooth surfaces for vehicles in favor of low-poly designs. Oh well. ↩︎
- I couldn’t find much on this committee beyond an invitation by them to join the $\TeX$ user’s group in Knuth’s 1979 book “$\TeX$ and METAFONT,” published by the AMS. ↩︎
- These polynomials are not the same as Hermite polynomials a la the quantum harmonic oscillator, but they’re both named after the same Charles Hermite. ↩︎
- Bill Casselman’s feature column From Bézier to Bernstein and these slides from a Computer Graphics and Imaging course at UC Berkeley are good places to read more. ↩︎
Disclaimer: The opinions expressed on this blog are the views of the writer(s) and do not necessarily reflect the views and opinions of the American Mathematical Society.
Comments Guidelines: The AMS encourages your comments, and hopes you will join the discussions. We review comments before they are posted, and those that are offensive, abusive, off-topic or promoting a commercial product, person or website will not be posted. Expressing disagreement is fine, but mutual respect is required.