Many graphs, one relation

April 04, 2021 | 8 minutes, 30 seconds

This post will be fairly brief because the processes involved will be fairly handwavey in this post. Admittedly, a lot of it requires experimentation, and thanks to graphing tools I've mentioned in the past, it's fairly easy to do so. I'll admit, "many graphs, one relation" is also a bit clickbait-y. But it's not entirely inaccurate - there's far more room here to combine more than just two equations, and potentially any number of them, but it's not nearly as clear as our previous method.

Conceptualisation

Consider two relations in \(x\) and \(y\). For example \(x = f(y)\) or \(y = g(x)\), or whatever combination of relations you want to play with. From the last post detailing piecewise maximum/minimum functions, we established properties of the maximum and minimum functions that apply to sets. Let's see if we can move it to functions. So rather than manipulating sets of real values, we'll manipulate sets of real-valued functions that combine to form relations themselves.

Let's consider \(\operatorname{max}\{a,b\} = 0\). Why this? Well, if \(a \geq b\) then \(a = 0\) but \(b\) can be any value below. Similarly, if \(a \leq b\), then \(b = 0\) but \(a\) can be less than or equal to 0. In a set of real values, this doesn't really matter much. But with relations? It can be pretty cool.

For our example here, we'll use \(y = f(x)\) and \(y = g(x)\) for our inputs to the maximum function. There are several ways to combine these, and you'll see why they matter:

  1. Pair 1: \(y - f(x) = 0\) and \(y - g(x) = 0\) gives us \(\operatorname{max}\{y-f(x),y-g(x)\}=0\).
  2. Pair 2: \(y - f(x) = 0\) and \(-y + g(x) = 0\) gives us \(\operatorname{max}\{y-f(x),-y+g(x)\}=0\).
  3. Pair 3: \(-y+f(x) = 0\) and \(y - g(x) = 0\) gives us \(\operatorname{max}\{-y+f(x),y-g(x)\}=0\).
  4. Pair 4: \(-y+f(x) = 0\) and \(-y+g(x) = 0\) gives us \(\operatorname{max}\{-y+f(x),-y+g(x)\}=0\).

Essentially - they all graph the same pairs of functions, but the places where the functions are graphed vary based on how you write them. These are the only ways to write them - given that when you divide or multiply a negative number in an inequality, you 'flip' the sign, we only have two possibilities that really matter for that variable: \(-1\) and \(1\). Any other value is simply cancelled out. Also notice that the maximum of Pair 4 is the minimum of Pair 1 and vice versa. Likewise the maximum of Pair 3 is the minimum of Pair 2.

To see where each graph is plotted, you can apply the inequality to each pair (and I encourage anyone reading to derive this by hand using the piecewise notation for the maximum function - it's far more compact and quite fun to see for yourself!):

  • Pair 1:
    • \(y=f(x)\) is plotted when \(g(x)\geq f(x)\).
    • \(y = g(x)\) is plotted when \(f(x)\geq g(x)\).
  • Pair 2:
    • \(y=f(x)\) is plotted when \(f(x)\geq g(x)\).
    • \(y=g(x)\) is plotteed when \(f(x)\geq g(x)\) (Yes! This is entirely possible, having two graphs in the same domain!)
  • Pair 3:
    • \(y=f(x)\) is plotted when \(g(x)\geq f(x)\).
    • \(y=g(x)\) is plotted when \(g(x)\geq f(x)\).
  • Pair 4:
    • \(y=f(x)\) is plotted when \(f(x)\geq g(x)\).
    • \(y=g(x)\) is plotted when \(g(x)\geq f(x)\).

Try plotting \(\operatorname{max}\{\alpha \left(y-x\right),\beta \left(y-x^2\right)\} = 0\) where \(\alpha, \beta \in \{-1, 1\}\) in something like Desmos.

It becomes notably more complicated if we combine functions in \(x\) and \(y\). But as you can see, simply changing the way we represent our relations changes where we can mix our graphs, which is a really useful tool for creating our own relations.

Application

So why did I say this post was a bit handwavey? Well, I want to focus on the general application of it rather than how we can achieve what we do. For example, taking the maximum of 3 relations to achieve our own specific relation could be rigourously derived - but it is so much more effort than we probably want to go to (at least the way I know how, if you can find a technique please do share!! I would be super excited if you could!). Instead, we can tinker, with the help of graphing tools.

Let's start off with 3 equations. Let's create a simple triangle with little overhead calculations (as an additional challenge, construct a triangle that uses \(x^2+y^2 = 1\) to determine vertices, using the technique outlined here). Picking 3 vertices; \(\{(0,1), (-1,-1), (1,-1)\}\) we can construct the lines \(y=-1\), \(y=-2x+1\) and \(y=2x+1\).

From here, to combine, we have the following relation: \(\operatorname{max}\{\alpha(y+1),\beta(y+2x-1),\gamma(y-2x-1)\} = 0\). If you plot this with all positive values for \(\alpha, \beta, \gamma\), you'll notice the angled lines that we want aren't plotted where we want. In fact, both of them aren't. Given that the equation \(y=-1\) intersects both of them, we can reason that perhaps \(\alpha\) must be negative, and perhaps \(\beta, \gamma\) are positive. Turns out, yes, this is the case, and we're left with:

\[ \operatorname{max}\{-y-1,y+2x-1,y-2x-1\} = 0\]

Note: This line of reasoning is perhaps a decent way of determining whether certain equations should be represented in other ways, but I've yet to test it out yet further. Explicitly points out that if you want one equation changed, you change another that interacts with it in a certain way. Cool. If you want, you can apply this similar process say using Desmos, and try yourself!

We can simplify using the rules we established in our earlier post: \(\operatorname{max}\{-y,y+|2x|\}=1\), or, alternatively, in a more compact form, \(2\operatorname{max}\{y+\left|x\right|,0\}-y = 1\) (this form's coefficients also show you what you can do to transform the triangle we made, definitely worth trying out).

Another example I wanted before was to combine several lines: \(y=x\), \(y=-\frac{1}{2}x\) and \(y=-1-x\), at their intersection points to create a weird line that almost looks like the absolute value function. It was achievable, but the form of it was relatively ugly and also took a bit of experimentation. \(y = \operatorname{max}\left\{\left|x+\frac{1}{2}\right| -\frac{1}{2},-\frac{1}{2}x\right\}\) when simplified. Also shows that equations we can combine like this can also be simplified down to only be in terms of absolute value functions - but would look rather messy... cool, nonetheless, but messy.

Honestly, there are plenty of examples. The beautiful thing is you can try this one all by yourself with no complicated algebra, but a lot of experimentation. You can create closed shapes!

The diamond

In one of our posts, we derived the equation for a diamond through two methods. But actually, we can derive it using a third as well, using this outlined technique.

Take our lines \(y=1-x\), \(y=1+x\), \(y=x-1\) and \(y=-x-1\) and combine them using our new technique: \(\operatorname{max}\left\{\alpha(y+x-1), \beta(y-x-1), \gamma(y-x+1), \delta(y+x+1)\right\}=0\).

If we plot this, we see that our lines lie below where we want. Given the lines intersect \(y=x-1\) and \(y=-x-1\), let's suggest that, for our values, we have \(\alpha=1, \beta=1, \gamma=-1, \delta=-1\). We can additionally motivate this decision by the sign of the \(1\) in each of our elements in the input for the maximum function. Turns out this works, so we have (and simplifying):

\[ \begin{align} \operatorname{max}\left\{y+x-1,y-x-1,-y+x-1,-y-x-1\right\}&=0 \\ \operatorname{max}\left\{y+x,y-x,-y+x,-y-x\right\}&=1 \\ \operatorname{max}\left\{y+\operatorname{max}\left\{x,-x\right\},-y+\operatorname{max}\left\{x,-x\right\}\right\}&=1 \\ \operatorname{max}\left\{y+\left|x\right|,-y+\left|x\right|\right\}&=1 \\ \left|x\right|+\operatorname{max}\left\{y,-y\right\}&=1 \\ \left|x\right|+\left|y\right|&=1 \end{align}\]

An alternative form we might consider:

\[ \begin{align} \operatorname{max}\left\{y+x,y-x,-y+x,-y-x\right\}&=1 \\ \operatorname{max}\left\{\operatorname{max}\left\{y+x,-y-x\right\},\operatorname{max}\left\{y-x,-y+x\right\}\right\}&=1 \\ \operatorname{max}\left\{\left|x+y\right|,\left|x-y\right|\right\}&=1 \end{align}\]

And we're done!

The square

In fact, one of the things I'm building up to is a fun closed shape - the square. As a challenge, if we define a square by the lines on the \(x\) and \(y\) axes at \(\frac{1}{2}\) and \(-\frac{1}{2}\) each, see if you can combine them to form a single relation describing a square. Added bonus; simplify it. When I get around to writing my posts about squares, we can compare forms!