The curve as an equation

Every curve is a sum of cosines

Put the two angles of a two-link arm into any polynomial in x and y and what comes out is a constant plus a finite sum of cosines of whole-number combinations of them. Nine curves, three hundred random angle pairs each, and the two routes agree to 1.8 × 10⁻¹⁴.

Assumes A demand that is an equation.

The previous rung ended on a sentence and this one is the arithmetic behind it: a polynomial in the coordinates of a two-link arm’s tip is a finite sum of cosines of whole-number combinations of the arm’s two angles.

It is worth saying at once what that sentence is not. It is not a Fourier series. A Fourier series is an infinite sum that converges to something, and its coefficients are integrals. This sum is finite, its coefficients come out of multiplying two-term expressions together, and it does not converge to the polynomial — it is the polynomial, rearranged.

The arm, and the two expressions to be multiplied

The arm is two links of length \ell from a fixed pivot, at angles α\alpha and β\beta:

x=(cosα+cosβ),y=(sinα+sinβ).x = \ell(\cos\alpha + \cos\beta), \qquad y = \ell(\sin\alpha + \sin\beta).

Now write u=eiαu = e^{i\alpha} and v=eiβv = e^{i\beta}. Then cosα=(u+u1)/2\cos\alpha = (u + u^{-1})/2 and sinα=(uu1)/2i\sin\alpha = (u - u^{-1})/2i, and the two coordinates become

x=2(u+u1+v+v1),y=2i(uu1+vv1).x = \tfrac{\ell}{2}\left(u + u^{-1} + v + v^{-1}\right), \qquad y = \tfrac{\ell}{2i}\left(u - u^{-1} + v - v^{-1}\right).

Each is a Laurent polynomial in uu and vv — a sum of terms umvnu^m v^n with mm and nn any whole numbers, positive or negative — with four terms and complex coefficients. And that is the whole trick, because a product of Laurent polynomials is a Laurent polynomial. Multiply xx by itself, multiply the result by yy, add up the monomials with their coefficients, and p(x,y)p(x, y) arrives as

p=m,nCmnumvnp = \sum_{m,n} C_{mn}\, u^m v^n

with finitely many nonzero CC, because each multiplication can only spread the exponents by one in each direction.

The exponents are whole numbers because they are added, and nothing anywhere divides them. That is why the frequencies in the final sum are integers, and it is the reason the machinery of the next rungs exists at all: an integer multiple of an angle is something a chain of linkages can produce, and an arbitrary real multiple is not.

The expansion against the polynomial it came from. For each curve, three hundred random pairs of arm angles; at each, the polynomial evaluated directly at the arm's tip and the cosine sum evaluated from the expansion, and the worst disagreement between them. The bars are decades above 10⁻¹⁶. Every one of them is at the floor of double arithmetic, which is what an identity looks like when it is measured rather than asserted: nothing here is fitted, nothing is approximated, and the two routes share no code beyond the arithmetic of the machine they run on.
Fig. 1 The identity, measured on every curve in the catalogue: the cosine sum against a direct evaluation of the polynomial, at three hundred random angle pairs each.

Folding the pairs back into cosines

The Laurent form has complex coefficients and the polynomial is real, so the coefficients are not independent. Because u1=uˉu^{-1} = \bar u on the unit circle, reality forces

Cm,n=Cmn,C_{-m,-n} = \overline{C_{mn}},

and the two halves of each pair add up to a single real cosine. Writing Cmn=12AeiφC_{mn} = \tfrac{1}{2}A e^{i\varphi},

Cmnumvn+Cm,numvn=Acos(mα+nβ+φ).C_{mn} u^m v^n + C_{-m,-n} u^{-m} v^{-n} = A\cos(m\alpha + n\beta + \varphi).

So the whole sum collapses to a constant — the (0,0)(0,0) coefficient, which is real on its own — plus one cosine per conjugate pair:

p(x,y)=c0+kAkcos(mkα+nkβ+φk).p(x, y) = c_0 + \sum_k A_k \cos(m_k\alpha + n_k\beta + \varphi_k).

Three quantities per term, and each one is going to become a piece of a machine. mkm_k and nkn_k are how many times the two arm angles have to be multiplied up, φk\varphi_k is a fixed angle a rigid link can carry, and AkA_k is a length.

The frequencies a cubic asks for. One mark per term of x^3 − 0.2x − y, placed at the whole numbers (m, n) that say how many times the two arm angles enter it, and sized by the amplitude — which is the length of the link the machine builds for it. Only one of each conjugate pair is drawn, because (m, n) and (−m, −n) are the same cosine. The empty places are the content: a curve's cost is how many of these lattice points its coefficients fail to cancel, and every one that survives is a chain of reflectors long enough to multiply an angle by m and by n.
Fig. 2 One mark per term of a cubic, placed at the whole numbers that say how many times each arm angle enters it, and sized by the amplitude — which is the length of the link the machine builds for it. Only one of each conjugate pair is drawn.

Which representative of the pair is kept is arbitrary and it is fixed. The lexicographically positive one, so (1,1)(1, -1) is stored rather than (1,1)(-1, 1). That choice makes no difference to the sum and all the difference to reproducibility: two runs of the compiler produce the same machine, term for term and bar for bar, and a machine that changed between builds would make every count in this field meaningless.

How the term count grows with the degree. A dense polynomial of each degree — every monomial present, nothing cancelling — expanded, and its terms counted. The answer is exactly d² + d at every degree tried: two, six, twelve, twenty, thirty, forty-two. That is the honest worst case, and the catalogue's own curves all sit below it because each of them cancels a different amount. The number matters because the summing chain costs a translator for every pair of terms, so a machine's size goes as the square of this and therefore as the fourth power of the degree.
Fig. 3 The count the identity produces, at each degree, for a polynomial with nothing cancelling.

The check, and why it is a real one

An identity derived on paper is a claim about arithmetic, and this site’s habit is that a claim gets a test it could fail. The test here is unusually clean, because there are two evaluations that share nothing.

Route one. Take angles α\alpha and β\beta, compute the arm’s tip, put the coordinates into the polynomial, and add up the monomials.

Route two. Take the same angles, compute mα+nβ+φm\alpha + n\beta + \varphi for each term, take its cosine, scale by the amplitude, and add.

The first never forms a frequency and the second never forms a coordinate. They meet only in the value they produce.

Every bar in that chart is at the floor of double arithmetic. The worst disagreement over all nine curves and twenty-seven hundred angle pairs is 1.8×10141.8\times10^{-14}, and the curves with the larger figures are the ones with the higher powers, which is what rounding looks like: x5x^5 at a coordinate of size two is a number of order thirty, and thirty times the machine epsilon is about 101410^{-14}.

That the errors track the powers rather than the term counts is itself evidence. A truncated series would have an error governed by how much was thrown away, and would get worse for the curves whose expansions have more terms. The lemniscate has five terms and the cubic eight, and it is the quintic, with the biggest coordinates raised to the highest power, that reports the largest number. There is nothing being thrown away.

Two routes to the same number, along one sweep. The polynomial x^4 + 2x^2y^2 + y^4 − 1.2x^2 + 1.2y^2 evaluated at the tip of the arm as the second angle goes right round, by two routes that share nothing: once by putting the tip's coordinates into the polynomial, and once by adding up 5 cosines of whole-number combinations of the two angles. The two curves are drawn on top of each other and the worst gap between them is 8.9e-15. Where the line crosses zero is where the machine may stand: 2 crossings at this α, which is how many assemblies the compiled machine has at this driving angle.
Fig. 4 The same comparison along one sweep instead of at scattered points: the polynomial at the arm’s tip as the second angle goes right round, computed both ways and drawn on top of itself.

That figure carries a second thing worth noticing, which is what the zeros are. Where the line crosses the axis, the arm’s tip is on the curve — so the crossings are the configurations a compiled machine may occupy at that driving angle. Counting them is counting assemblies, and it is the same count the algebra field makes for a four-bar by eliminating variables, arrived at by looking rather than by resultants.

What each curve costs, in cosines. Every polynomial in the two arm angles is a constant plus a sum of terms A cos(mα + nβ + φ) with whole-number m and n, and the number of those terms is what a machine has to build. The count is not the degree and not the monomial count: a circle costs one term, a general line two, and a lemniscate — degree four — costs five, fewer than the cubic above it, because its symmetry cancels frequency pairs the cubic keeps. Each row's expansion was checked against a direct evaluation of its own polynomial at random angles, worst disagreement 1.8e-14.
Fig. 5 Every curve in the catalogue and how many cosine terms it expands to. A circle gives one, a line two, and a lemniscate five.

Worked, on the smallest case that is not trivial

The algebra above is short and it is still algebra, so it is worth watching it happen on one curve.

Take the circle x2+y2=r2x^2 + y^2 = r^2, with unit links. The sum of the two coordinates squared is the squared length of the arm’s tip from the pivot, and the arm is two unit links, so by the cosine rule that squared length is 2+2cos(αβ)2 + 2\cos(\alpha - \beta). The circle’s equation therefore becomes

2+2cos(αβ)r2=0,2 + 2\cos(\alpha - \beta) - r^2 = 0,

which is a constant of 2r22 - r^2 and one cosine term, at frequencies m=1m = 1, n=1n = -1, with no phase at all.

The machinery produced that without being told any geometry. It squared two four-term Laurent polynomials, added them, and found that fourteen of the sixteen products cancelled — the u2u^2, v2v^2, u2u^{-2}, v2v^{-2} terms and the cross terms uvuv and u1v1u^{-1}v^{-1} all vanish between x2x^2 and y2y^2, leaving only uv1uv^{-1}, its conjugate, and the constants. What is left is the cosine rule, arrived at by multiplication rather than by trigonometry.

It is worth pausing on what the single term means as a mechanism, because it is the smallest example of what this whole field does. One cosine term set equal to a constant says cos(αβ)\cos(\alpha - \beta) is fixed, which says αβ\alpha - \beta is fixed, which says the angle between the two links does not change. The arm is a rigid body turning about the pivot, and its tip goes round a circle. The compiler, handed a circle, has derived a crank.

That is a good result and it is also the first warning about the method. A crank is one bar and the next rung reports the compiled machine at eleven, because the compiler builds the whole apparatus of arm, angle transport and summing chain whether or not the sum has anything to sum.

The frequencies a lemniscate asks for. One mark per term of x^4 + 2x^2y^2 + y^4 − 1.2x^2 + 1.2y^2, placed at the whole numbers (m, n) that say how many times the two arm angles enter it, and sized by the amplitude — which is the length of the link the machine builds for it. Only one of each conjugate pair is drawn, because (m, n) and (−m, −n) are the same cosine. The empty places are the content: a curve's cost is how many of these lattice points its coefficients fail to cancel, and every one that survives is a chain of reflectors long enough to multiply an angle by m and by n.
Fig. 6 The lemniscate’s surviving frequency pairs on the lattice its degree allows. Every empty place is a coefficient that cancelled exactly.

The parity, and where the empty half of the lattice goes

The observation that m+nm + n has the parity of the monomial’s degree is easy to state and it does real work, so it deserves a line of its own.

Consider a curve with only even-degree monomials — a conic centred at the origin, say x2+2.2y2=1.6x^2 + 2.2y^2 = 1.6. Every monomial has even total degree, so every term has m+nm + n even, and half the lattice points are empty before any cancellation happens at all. The ellipse’s four terms sit at (2,0)(2,0), (1,1)(1,1), (1,1)(1,-1) and (0,2)(0,2), and the odd points (1,0)(1,0) and (0,1)(0,1) — which a line would use — are not merely small, they are structurally absent.

The same argument run the other way says something about curves through the origin. A polynomial with no constant monomial has c0=0c_0 = 0, so its summing chain has to end on the line through the pivot rather than beside it. That is a geometric statement about the machine derived from a purely algebraic feature of the input, and it has a consequence the compiler had to be taught about: the arm folded back on itself, with its tip exactly at the pivot, is on every such curve at every driving angle. It is a perfectly good solution of the equation and a completely useless configuration of the machine, because a folded arm is a flattened parallelogram and the machine built on it will not move at all.

Three of this field’s nine curves pass through the origin, so that is not an edge case, and the compiler now scores its candidate starting configurations rather than taking the first root a scan finds.

Bars against terms, over the whole catalogue. One mark per compiled machine. The bar count rises much faster than the term count, and the reason is the summing chain: term k has to have its direction carried to the k−1th vertex of the chain, one parallelogram per hop, so the carrying costs a translator for every pair of terms. Nine curves, from five bars to four hundred and thirteen, on a term count that goes from one to eighteen.
Fig. 7 What the bound on the frequencies buys: an arithmetic half that stays small however large the machine gets.

What the identity does and does not say

Three things follow immediately, and one thing does not follow and is worth guarding against.

It follows that the frequencies are bounded by the degree. A monomial xiyjx^i y^j can shift an exponent by at most i+ji + j in each of uu and vv, so every term of a degree-dd curve has md|m| \le d and nd|n| \le d. That bounds the angle multiplications the machine has to perform, and the bound is what makes the arithmetic half of a compiled machine cheap.

It follows that the parity is fixed. Each factor of xx or yy changes m+nm + n by an odd amount, so the terms coming from a monomial of total degree tt all have m+nt(mod2)m + n \equiv t \pmod 2. A polynomial with only even-degree monomials produces only even m+nm + n, which is half the lattice gone.

It follows that the constant is not free. The (0,0)(0,0) coefficient is whatever the multiplication produced, and it becomes the position of the line the machine’s summing chain has to end on. A curve through the origin has structure the compiler will meet again.

It does not follow that the sum has few terms. Nothing above says how many of the CmnC_{mn} are nonzero, and that is the whole subject of the next rung. The bound says a degree-five curve uses frequencies no larger than five in each variable, which is a lattice of a hundred and twenty-one points; how many of those survive depends on cancellation, and cancellation depends on the coefficients rather than on the degree.

Two routes to the same number, along one sweep. The polynomial x^3 − 0.2x − y evaluated at the tip of the arm as the second angle goes right round, by two routes that share nothing: once by putting the tip's coordinates into the polynomial, and once by adding up 8 cosines of whole-number combinations of the two angles. The two curves are drawn on top of each other and the worst gap between them is 2.7e-15. Where the line crosses zero is where the machine may stand: 2 crossings at this α, which is how many assemblies the compiled machine has at this driving angle.
Fig. 8 The same comparison on a cubic: eight cosines against the polynomial itself, along one sweep of the second arm angle.

The unglamorous half: it is a multiplication

It is worth being plain about what the compiler’s front end actually does, because the field’s later rungs are about machines with hundreds of bars and it would be easy to imagine something clever at the start.

There is nothing clever. Two four-term Laurent polynomials are formed once. Each monomial of the input is turned into a product of powers of them, by repeated multiplication. The results are added with the input’s coefficients. Terms smaller than 101310^{-13} in magnitude are dropped, and the survivors are folded into conjugate pairs. That is the whole of it, and on the largest curve in this field’s catalogue it takes under a millisecond.

The dropping threshold is the one judgement in the procedure and it is an absolute one rather than a relative one, deliberately. The coefficients are formed by multiplying numbers of order one, so a genuine coefficient is of order one and a cancelled one is of order 101610^{-16}; there is a dozen decades of daylight between them. The cancellations this rule has to get right are the ones that take a lemniscate from fifteen terms to five, and they are exact rather than nearly exact, because the lemniscate’s symmetry makes them exact.

Nothing above required the two links to be the same length, and it is fair to ask what the choice buys.

With unequal links aa and bb the coordinates become x=acosα+bcosβx = a\cos\alpha + b\cos\beta and the whole derivation goes through unchanged: the Laurent polynomials pick up different coefficients, the products still terminate, and the conjugate pairs still fold. Every term count in this field would be identical, because a term count is about which lattice points survive and the coefficients that cancel are the ones symmetry makes cancel.

What changes is the reachable set. Equal links reach the full disc of radius 22\ell including its centre; unequal links reach an annulus with a hole of radius ab|a - b| in the middle. A curve passing through that hole would be unreachable there for no reason but the choice, and the compiler would report a machine that works on part of the curve and fails on the rest, with nothing in its output saying why.

So equal links are the choice that removes an arbitrary obstruction, and the price is the one paid two sections above: with equal links the folded configuration exists, and it is exactly at the pivot, and every curve through the origin has it as a solution. Both halves of that trade are stated because neither is obvious from the algebra, and a reader who later finds the compiler scoring its starting angles will want to know that the scoring is repairing a consequence of a deliberate choice rather than patching a bug.

Why this is the field’s foundation and not a lemma

Every later rung is downstream of this one in a specific way.

The gadgets exist to produce mα+nβ+φm\alpha + n\beta + \varphi from α\alpha and β\beta, and they can only do it because mm and nn are whole numbers. The summing chain exists to add the terms up, and it can only be a chain of bars because each term is a fixed length at a produced angle. The cost is counted in terms and pairs of terms. The failures are failures of gadgets to produce the angles this identity asks for.

And the check above is the reason it is safe to build all of that. A machine four hundred bars long is not a thing that can be reasoned about position by position, and the only way to trust it is to trust each piece and to have an independent measurement of the whole. The identity is the first piece, it is checked against a route that shares no code with it, and the two agree to fourteen decimal places on every curve tried.

That is the same discipline this site applies to a Jacobian against a finite difference and to Grübler’s count against a rank: not one calculation done carefully, but two calculations done differently, and the distance between them published.

Every curve in the catalogue, compiled and counted. The bar count is not a formula: it is the number of bar constraints the compiled mechanism actually carries, asked of the object rather than predicted. A line costs five bars and a quintic four hundred and thirteen, which is the field's central number — exactness is paid for in size. The all-revolute column replaces the one prismatic pair that closes the chain with a Peaucellier cell, which costs seven bars whatever the curve, so it is more than half the machine on a line and a rounding error on a quintic. The last column is the polynomial evaluated at the traced point, worst over each machine's working arc.
Fig. 9 What is built on the identity, and what it costs. The algebra is exact; the machines have their own failure modes and they are not inherited from here.

One thing the identity is not evidence about

A caution, because the next several rungs will be quoting fourteen-decimal agreements and it would be easy to let them accumulate into a confidence they do not support.

The identity is about arithmetic. It says that a certain sum of cosines has the same value as a certain polynomial, for every pair of angles. It says nothing whatever about whether a mechanism built from those cosines works, whether it can be assembled, whether it moves, or whether the thing it draws is the curve.

Each of those is a separate question with a separate measurement, and at least two of them have answers that are worse than a reader arriving from this rung would guess. A compiled machine works over a fraction of a turn rather than a whole one — a general quintic’s machine over a tenth of a radian — and it has assemblies that satisfy every bar and draw a different curve entirely.

So the right way to hold this rung is as the first of several independent claims rather than as a foundation that carries the rest. The algebra is exact and it is checked. What is built on the algebra has its own failure modes, and they are not inherited from here; they arrive with the bars.

The identity being a multiplication rather than a discovery is the honest half of the rung, and it is worth saying what that buys, because unglamorous undersells it. An identity that is a multiplication is exact, terminating and checkable term by term: there is no approximation to bound, no series to truncate, and no convergence to argue about. Every coefficient the expansion produces is a finite sum of products of the polynomial’s own coefficients, and a wrong one shows up as a disagreement at a single sampled angle pair rather than as a drift. That is why three hundred random pairs at 101410^{-14} is a strong check rather than a weak one — the agreement is between two computations of the same finite quantity, so any error at all in either would show. The field is built on it for exactly that reason: the foundation of a construction should be the part with no approximation in it, and everything downstream — the bar counts, the arcs, the transport costs — is then the only place an error can hide.

What this makes readable

Essays that name this one as a prerequisite.

What links here

Essays that link to this one from their own argument.

The objects this essay names

Each one links to every other essay that touches it.

Algebraic curveConjugate pairExact arithmeticFrequency pairLaurent polynomialTrigonometric polynomialTwo-link arm