# Is there an equation for every graph?

Is it possible to write a formula for any line imaginable, for example a drawing?

I once saw this long, and complicated, formula made by a mathematician with loads of ceilings etc.

The explanation was something to do with something he was programming for computers using pixels - I'm really not sure - but basically, the entire graph had every single pixel drawing there was, and then limits were set to section off the image you wanted.

Is this possible with actual lines, not pixels.

-- I did a search and it's this: Tupper's self-referential formula

• Are you actually talking about something like the batman equation? Commented Dec 24, 2016 at 19:56
• yes $yes$ yes yes
– Tobi
Commented Dec 24, 2016 at 21:10
• @Tobi You forgot ***, as in yes! Commented Dec 24, 2016 at 21:12
• *** I'll add that to my pallet, yes! *** Nooooo!
– Tobi
Commented Dec 24, 2016 at 21:14
• Like John Hughes said, the answer is no. A more philiosophical question would be, is there an equation for every concievable graph? In that case, we'd have to be defining what an equation is. Commented Dec 25, 2016 at 3:35

@Ethan Bolker is right, and if you want to make his statement more precise, you could say something about the number of possible "curves" vs the number of possible "formulas", where a formula is something that's mathematically sensible, is written with some finite set of symbols (xs, ys, addition, powers, multiplication...whatever you can express using LaTeX's equation editing, for instance) in a finite string. The number of such formulas is countable, while the number of curves is uncountable (just think of the horizontal line at height $u$ for each possible real number $u$; as $u$ ranges over the reals, you have an uncountable number of 'curves').

But this question is also addressed, in a somewhat roundabout way, in Tom Stoppard's superb play Arcadia; in it there is the following interchange between Thomasina, a prodigy, and her tutor, Septimus:

Thomasina: ... Each week I plot your equations dot for dot, xs against ys in all manner of algebraical relation, and every week they draw themselves as commonplace geometry, as if the world of forms were nothing but arcs and angles. God's truth, Septimus, if there is an equation for a curve like a bell, there must be an equation for one like a bluebell, and if a bluebell, why not a rose? Do we believe nature is written in numbers?

Septimus: We do.

Thomasina: Then why do your equations only describe the shapes of manufacture?

Septimus: I do not know.

Thomasina: Armed thus, God could only make a cabinet.

Septimus: He has mastery of equations which lead into infinities where we cannot follow.

Thomasina: What a faint-heart! We must work outward from the middle of the maze. We will start with something simple. (She picks up the apple leaf.) I will plot this leaf and deduce its equation. You will be famous for being my tutor when Lord Byron is dead and forgotten.

While your question is mathematical, I strongly recommend reading the play, despite there being very little precise mathematics in it.

• +1, more than once if I could. I did think about the cardinality argument but completely forgot that passage from Arcadia! Commented Dec 24, 2016 at 19:26
• The argument reminds of the argument for uncomputable functions, due to the fact that there are only countable infinite many programs, but uncountable infinite many desireable machine functions.
– mvw
Commented Dec 24, 2016 at 19:40
• So can you communicate an arbitrary line at height $h\in\mathbb{R}$ to me?
– mvw
Commented Dec 24, 2016 at 19:49
• No, I absolutely can't (although I can't prove that). But if you believe thatm then that alone is enough to explain why there are more curves than formulas. Commented Dec 24, 2016 at 21:50
• How can the number of possible formulas be countable if there is indeed a formula for every horizontal line at height $u$ for every real number $u$? Commented Dec 25, 2016 at 6:35

The short answer is "no". A long answer would require careful definitions of "formula" and of "any line imaginable". Those definitions are hard to write.

If you have to draw a curve of pixels on a computer screen you will often be able to find a formula that gives you a good approximation of what you want.

There are fantastic formulas, like the Batman equation, but in general I believe it is not possible.

If we restrict us to the graphs of continuous functions of one variable, for our formulas we usually stick to a set of elementary functions which is exhausted rapidly for more exotic cases and must be extended by special functions or integral functions, solutions of differential equations etc.

• Hahaha, that one. +1 for the memories. Commented Dec 24, 2016 at 19:28

Well, you can approximate with Taylor's theorem. You could also consider a fourier series (I am less familiar with that).

Indeed, many basic functions are calculated via their Taylor series. Mainly analytic functions:

$$\sin(x)=x-\frac16x^3+\frac1{120}x^5+\mathcal O(x^7)$$

as you keep taking the expansion out, you will get a polynomial that is really close to $\sin(x)$.

Some "lines" are representable using implicit formulas, like $x^y=y^x,y\ne x$. But it can also be represented by a parametric equation: $$(x,y)=(a^{1/(a-1)},a^{a/(a-1)})$$ or a polar form:

$$r=\left(\frac{(\sin\theta)^{\cos\theta}}{(\cos\theta)^{\sin\theta}}\right)^{1/(\sin\theta-\cos\theta)}$$

So there are many interesting ways to produce any numbers of lines.

I'm not really sure, however, if it could be possible to deduce any line's formula, but the above give some good ways to thinking about this.

• I've just realised how many questions of mine you've answered/contributed to - thanks!
– Tobi
Commented Dec 24, 2016 at 21:11
• @Tobi I just happen to be an extremely active user. High up there in ranking. Commented Dec 24, 2016 at 21:12
• "... thanks[ on behalf of everyone]!"
– Tobi
Commented Dec 24, 2016 at 21:13
• Parametric equations are pretty restrictive. A parametric equation defined using continuous functions on $[0,1]$ will always give you a connected curve. Many drawings are not connected curves, of course. Commented Dec 25, 2016 at 1:21
• @bubba Then we'd have piece-wise parametric equations. But I don't think the OP wanted discontinuous lines. Commented Dec 25, 2016 at 2:18

There's a big difference between drawing (either on a computer screen or with a pencil) and mathematics.

From the mathematical point of view, the answer from John Hughes explains that there are more curves than formulae, so there must be some curves that don't have a formula.

But drawing is an approximate process -- the pixels on a computer screen and the marks made by your pencil are not precise representations of mathematical formulae. The graphs of mathematical equations are infinitely thin curves, which are impossible to produce on a computer screen or on paper.

So, suppose you give me a drawing of a curve. I could scan it to get a black-and-white bitmap image (a two-dimensional array of pixels). Let $v_{ij}$ be the value of the $ij$-th pixel, where $v_{ij}=1$ means black and $v_{ij}=0$ means white for $1 \le i \le m$ and $1 \le j \le n$. For each $i,j$, define a function $\phi_{ij}: [1,m] \times [1,n] \to [0,1]$ by \begin{align} \phi_{ij}(x,y) &= v_{ij} \quad \text{ if } x = i \text{ and } y = j \\ \phi_{ij}(x,y) &= 0 \quad \text{ otherwise } \end{align} and define $$\phi(x,y) = \sum_{i=1}^m \sum_{j=1}^n \phi_{ij}(x,y)$$ Then the curve is the set $$S = \{ (x,y) \in \mathbb{R}^2: \phi(x,y) = 1 \}$$ or, less formally, the curve has equation $\phi(x,y) = 1$. If you were to plot this equation (in system like Mathematica, for example), then the result would be visually very close to the original drawing, perhaps even indistinguishable.

But this representation is essentially pixel-based, which you said you wanted to avoid. It could be turned into a vector/line based approach, though. The functions $\phi_{ij}$ are not continuous, but you can replace them with sharp spike-shaped continuous ones. Then the function $\phi$ is continuous. You can visualize it as a landscape that has sharp ridges (with height $z=1$) that follow the original curve. We want the contour plot at height $z=1$ on this landscape. There are well-known techniques for computing these sorts of contours, either as polylines or as spline curves. One of them is marching squares. Polylines and splines are somewhat cheating, arguably, since they are functions that are defined piecewise. But, I felt free to bend the rules, since you didn't state them precisely.