Parabolic Curve Stitching: Tangents

| math

What happened before: I introduced curve stitching as a way of constructing curves from straight lines. I focused on the intersection points between adjacent lines and showed that we can always find a quadratic function whose graph is a superset of these points (in other words, the intersection points are on a parabola).

In this post I will focus on the straight lines as an approximation of a parabola. This will yield insight into why this construction actually works. Instead of starting with straight lines, this time we start with the quadratic function. Again, we make our lives easier by looking only at parabolas with \(x=0\) as axis of symmetry. $$ f(x) = ax^2 + b $$

Tangent lines

From calculus we know that the derivative of this function is the following.

Consider only \((x^2)' = 2x\), since \(b\) is just a constant and \(a\) a constant factor. If you know the power rule, it's a special case of that. But we can also simply prove it from the definition of the derivative.

Let \(\Delta f = f(x + \Delta x) - f(x)\), then the derivative is defined as $$ f'(x) = \lim_{\Delta x \rightarrow 0} \frac{\Delta f}{\Delta x}. $$ For the square we can say that $$ f + \Delta f = (x + \Delta x)^2 = x^2 + 2x\Delta x + (\Delta x)^2. $$ Now we subtract \(f(x) = x^2\) from both sides, divide by \(\Delta x\) and let \(\Delta x\) approach zero $$ \lim_{\Delta x \rightarrow 0} \frac{\Delta f}{\Delta x} = 2x + \cancel{\lim_{\Delta x \rightarrow 0} \Delta x} $$ and that's it.

$$ f'(x) = 2a x $$

The derivative gives us the slope of the tangent line at any point of the graph of \(f(x)\). So we take a bunch of equally-spaced x-values \(x_i\) and plug them into \(f(x)\) to compute a few points from the parabola. Then we draw the tangent lines at these points as $$ t_i (x) = f'(x_i) \cdot (x - x_i) + f(x_i). $$

The result could look something like the following diagram.

Tangent lines at sampled points on a parabola.

Now this already looks uncannily similar to the construction from my previous post, but to know whether this could have been the result of our curve-stitching method, we need to prove that the ticks on the two outer line segments are spaced equally.

Tick points

Since the diagram is symmetric, we only need to look at one side. The tick points on the right are the intersections of the tangent at the point with maximal \(x_i\)-value and the tangents at all the other points. Let's say \(x_n\) is the maximum of our \(n\) sampled x-values (numbered from left to right) and \(x_{n-i}\) is another x-value at a distance \(-i \cdot d\), then we have the following two linear equations. (The value of \(d\) will be \(\frac{2 x_n}{(n - 1)} \).) $$ \begin{align*} t_n(x) &= f'(x_n) \cdot (x - x_n) + f(x_n)\\ t_{n - i}(x) &= f'(x_n - id) \cdot (x - (x_n - id)) + f(x_n - id) \end{align*} $$

The y-values need to match because we're looking for intersections, so we equate both right-hand sides and solve for x. $$ x = x_n - \frac{id}{2} $$ Clearly, the x-values of our tick points are spaced equally and so must be the y-values because they are generated by a linear function.


We know the tangent equations, so we can give precise instructions about how to draw the lines to approximate a parabola of the form \(f(x) = ax^2 + b \). $$ t_i(x) = 2ax_i x - ax_i^2 + b $$

The curve stitching construction starts with two line segments. The right line segment connects \(P_1 = (0, t_n(0))\) with the intersection point \(P_2\) of the lines \(t_{n-1}(x)\) and \(t_n(x)\). $$ \begin{align*} P_1 &= \left(0, -a x_n^2 + b \right)\\ P_2 &= \left(\frac{x_{n} \left(n - 2\right)}{n - 1}, \frac{ax_n^2 (n-3) + b(n-1)}{n - 1} \right) \\ \end{align*} $$

The left line segment is the right's mirror image over the y-axis. If you want to draw a part of the curve with predetermined width, choose the x-value of \(P_2\) (together with the number of lines \(n\)) and compute \(x_n = \frac{x (n-1)}{n - 2}\). Once you got the two outer line segments, mark the equally-spaced ticks and connect them. The more ticks and line segments you draw, the better the approximation of the parabolic curve.