Endograph and cograph of real functions

This post is covered by the Creative Commons Attribution – ShareAlike 3.0 License, which means you may use, adapt and distribute the work provided you follow the requirements of the license.


In the article Functions: Images and Metaphors in abstractmath I list a bunch of different images or metaphors for thinking about functions. Some of these metaphors have realizations in pictures, such as a graph or a surface shown by level curves. Others have typographical representations, as formulas, algorithms or flowcharts (which are also pictorial). There are kinetic metaphors — the graph of {y=x^2} swoops up to the right.

Many of these same metaphors have realizations in actual mathematical representations.

Two images (mentioned only briefly in the abstractmath article) are the cograph and the endograph of a real function of one variable. Both of these are visualizations that correspond to mathematical representations. These representations have been used occasionally in texts, but are not used as much as the usual graph of a continuous function. I think they would be useful in teaching and perhaps even sometimes in research.

A rough and unfinished Mathematica notebook is available that contains code that generate graphs and cographs of real-valued functions. I used it to generate most of the examples in this post, and it contains many other examples. (Note [1].)

The endograph of a function

In principle, the endograph (Note [2]) of a function {f} has a dot for each element of the domain and of the codomain, and an arrow from {x} to {f(x)} for each {x} in the domain. For example, this is the endograph of the function {n\mapsto n^2+1 \pmod 11} from the set {\{0,1,\ldots,10\}} to itself:

“In principle” means that the entire endograph can be shown only for small finite functions. This is analogous to the way calculus books refer to a graph as “the graph of the squaring function” when in fact the infinite tails are cut off.

Real endographs

I expect to discuss finite endographs in another post. Here I will concentrate on endographs of continuous functions with domain and codomain that are connected subsets of the real numbers. I believe that they could be used to good effect in teaching math at the college level.

Here is the endograph of the function {y=x^2} on the reals:

I have displayed this endograph with the real line drawn in the usual way, with tick marks showing the location of the points on the part shown.

The distance function on the reals gives us a way of interpreting the spacing and location of the arrowheads. This means that information can be gleaned from the graph even though only a finite number of arrows are shown. For example you see immediately that the function has only nonnegative values and that its increase grows with {x}.(See note [3]).

I think it would be useful to show students endographs such as this and ask them specific questions about why the arrows do what they do.

For the one shown, you could ask these questions, probably for class discussion rather that on homework.

  • Explain why most of the arrows go to the right. (They go left only between 0 and 1 — and this graph has such a coarse point selection that it shows only two arrows doing that!)
  • Why do the arrows cross over each other? (Tricky question — they wouldn’t cross over if you drew the arrows with negative input below the line instead of above.)
  • What does it say about the function that every arrowhead except two has two curves going into it?

Real Cographs

The cograph (Note [4] of a real function has an arrow from input to output just as the endograph does, but the graph represents the domain and codomain as their disjoint union. In this post the domain is a horizontal representation of the real line and the codomain is another such representation below the domain. You may also represent them in other configurations (Note [5]).

Here is the cograph representation of the function {y=x^2}. Compare it with the endograph representation above.

Besides the question of most arrows going to the right, you could also ask what is the envelope curve on the left.

More examples

Absolute value function

Arctangent function


[1] This website contains other notebooks you might find useful. They are in Mathematica .nb, .nbp, or .cdf formats, and can be read, evaluated and modified if you have Mathematica 8.0. They can also be made to appear in your browser with Wolfram CDF Player, downloadable free from Wolfram site. The CDF player allows you to operate any interactive demos contained in the file, but you can’t evaluate or modify the file without Mathematica.

The notebooks are mostly raw code with few comments. They are covered by the Creative Commons Attribution – ShareAlike 3.0 License, which means you may use, adapt and distribute the code following the requirements of the license. I am making the files available because I doubt that I will refine them into respectable CDF files any time soon.

[2] I call them “endographs” to avoid confusion with the usual graphs of functions — — drawings of (some of) the set of ordered pairs {x,f(x)} of the function.

[3] This is in contrast to a function defined on a discrete set, where the elements of the domain and codomain can be arranged in any old way. Then the significance of the resulting arrangement of the arrows lies entirely in which two dots they connect. Even then, some things can be seen immediately: Whether the function is a cycle, permutation, an involution, idempotent, and so on.

Of course, the placement of the arrows may tell you more if the finite sets are ordered in a natural way, as for example a function on the integers modulo some integer.

[4] The text [1] uses the cograph representation extensively. The word “cograph” is being used with its standard meaning in category theory. It is used by graph theorists with an entirely different meaning.

[5] It would also be possible to show the domain codomain in the usual {x-y} plane arrangement, with the domain the {x} axis and the codomain the {y} axis. I have not written the code for this yet.


[1] Sets for Mathematics, by F. William Lawvere and Robert Rosebrugh. Cambridge University Press, 2003.

[2] Martin Flashman’s website contains many exampls of cographs of functions, which he calls mapping diagrams.

Send to Kindle

6 thoughts on “Endograph and cograph of real functions”

Leave a Reply

Your email address will not be published. Required fields are marked *