# Introduction

As a forewarning, there is so much I could comment on about this post already that I can't because I haven't shown off the fundamental appraoches and techniques to all of these Piecewise relations and equations. This means if it seems like there's a gap somewhere, please please please let me know. I've done so much work on this and can assume so much that it may seem slightly confusing to anyone who hasn't got the same intuition for this.

Diamonds are squares. Well, sometimes. But when they have equal internal angles of 90 degrees, for a sum of 360 degrees, and equal side lengths they are most definitely squares. Squares are cool, and this is where our journey to square-land begins: diamonds.

Diamonds are easy. You can construct them with equations that have $$y$$ in terms of $$x$$. This means their gradient isn't 'infinite' (not a vertical line) - it means we can graph them incredibly easily.

There are so many ways to construct a diamond it's not even funny. Geometrically speaking and algebraically speaking, of course. I'm going to cover 2 of them. The rudimentary and the 'radical' (there are no radicals except for side lengths, go home!). The radical being an approach built off of my 3 post series about an equation that can graph multiple functions. Spoilers! We have:

• Building our diamond by quadrant. (Rudimentary)
• Building our diamond by a set of 4 intersecting restricted lines via our One Relation.
• Why are these approaches really the same thing?

# Getting Started

## Setup

Let us consider a diamond with vertices $$(-1, 0)$$, $$(0, 1)$$, $$(1, 0)$$, $$(0, -1)$$, on the cartesian plane. We consider the construction of the diamond as a set of 4 lines interesecting these coordinates. We have the following linear equations:

1. $$y=-x+1$$ which intersects both $$(0, 1)$$ and $$(1, 0)$$
2. $$y=x-1$$ which intersects both $$(0, -1)$$ and $$(1, 0)$$
3. $$y=x+1$$ which intersects both $$(0, 1)$$ and $$(-1, 0)$$
4. $$y=-x-1$$ which intersects both $$(0, -1)$$ and $$(-1, 0)$$

Consider the our linear equations described above. For each of our equations, we want to bound them between their intersections with the coordinates described. One method of doing this is by considering the quadrants of the plane - that is, the regions in which the signs of $$x$$ and $$y$$ are unique. For example, there is only one region for which $$x \geq 0$$ and $$y \geq 0$$. Notice for our diamond, each of our lines that we wish to graph lie exactly within the quadrants and don't cross over. This means that we can use the quadrants as our restriction building-blocks.

Note: There is a far more rudimentary method of considering the values of y and x for each line with respect to each coordinate and their existence. This derivation skips that step, because honestly, it's not even worth writing down the sheer number of steps it would take to simplify it. Email me for more information if you wish to learn more

We can construct, therefore, the following Piecewise relation (not function!) - writing the right hand side as 0:

$\begin{cases} y+x-1 & x \geq 0 & y \geq 0 \\ y-x+1 & x \geq 0 & y \leq 0 \\ y-x-1 & x \leq 0 & y \geq 0 \\ y+x+1 & x \leq 0 & y \leq 0 \end{cases} = 0$

Given that the only constant in the piecewise relation is the hardest to simplify, we can multiply the cases whose sign of $$1$$ is positive by $$-1$$ to give us:

$\begin{cases} y+x-1 & x \geq 0 & y \geq 0 \\ -y+x-1 & x \geq 0 & y \leq 0 \\ y-x-1 & x \leq 0 & y \geq 0 \\ -y-x-1 & x \leq 0 & y \leq 0 \end{cases} = 0$

Next, we can extract the $$-1$$ from each case and move it to the other side. While we're at it, we'll also nest piecewise for $$x \geq 0$$ and $$x \leq 0$$ in terms of $$y$$.

$\begin{cases} \begin{cases} y+x & y \geq 0 \\ -y+x & y \leq 0 \end{cases} & x \geq 0 \\ \begin{cases} y-x & y \geq 0 \\ -y-x & y \leq 0 \end{cases} & x \leq 0 \\ \end{cases} = 1$

We can extract the common terms $$x$$ and $$-x$$ respectively from each sub-piecewise function, then apply the definition of $$\left|y\right|$$:

$\begin{cases} \left|y\right| + x & x \geq 0 \\ \left|y\right| - x & x \leq 0 \end{cases} = 1$

Doing so again this time, except extracting $$|y|$$ from the piecewise relation and applying the definition of $$|x|$$:

$\left|y\right| + \left|x\right| = 1$

And we have reached the end of this method of derivation.

## Building by our 'One Relation'

Consider the pair of lines $$y=1-x$$ and $$y=x-1$$. Consider the former is greater than the latter in the interval $$x \in \left[0,1\right]$$, and share an intersection at $$(1,0)$$. We can therefore 'combine' these, getting the relation $$|y|=1-x$$. Notice that this was our second trivial example in the final post; if you haven't read it, you can find a link to the series of the posts at the top of this page.

Consider the second pair of lines $$y=x+1$$ and $$y=-x-1$$. Likewise, the former is greater than the latter in the interval $$x \in \left[-1,0\right]$$, and share an intersection at $$(-1, 0)$$. We can do the same thing as before, getting us $$|y|=1+x$$.

We have now a final pair of equations $$|y|=1-x$$ and $$|y|=1+x$$. Solving for $$x$$ in both, we get $$x = 1-|y|$$ and $$x = |y|-1$$. Considering the interval $$y \in \left[-1,1\right]$$, the former equation is greater on the x-axis. We can therefore apply the same technique again, this time on $$x$$, and obtain $$|x| = 1-|y|$$ or $$|x|+|y|=1$$.

## Why are these the same?

If you've read the small post series on graphing multiple functions in one equation, you'll immediately notice that there is a lot less background effort into working the first derivation than there is in the second, yet the second derivation is far more succinct on its own; assuming that our tool actually works. Where the first derivation is purely algebraic, the second relies on an algebraic derivation of a tool we used heavily.

But this doesn't answer the question: Why are these essentially the same?

Well, while we relied on our tool in the second approach, realistically we still indirectly split our equation up into quadrants. e.g $$x \geq 0$$. But what about when we got to our final step, on $$x$$? Well also notice we had it in terms of $$|y|$$ - so really, the regions ($$y \geq 0$$ and $$y \leq 0$$) are implied. It's just something we skip over when we perform our first two combinations of functions.

Our original post series also covered all the cases our first derivation did - intersections and restrictions both. It's more just here we focused on where one line, or relation, was greater than another, under an interval, rather than focusing on where the lines was greater or less than the axes that separated them.

# Moving Forward

## There's no unit diamond here

For the purposes of the forthcoming series I may write, we consider the unit square to have side lengths one, with a centre on the $$x$$ and $$y$$ axes at $$(0, 0)$$. Normally, it could be the lower-left corner at $$(0, 0)$$. You'll notice, as we move on, however, that it is much easier to derive if the centre lies at $$(0,0)$$ rather than $$(\frac{1}{2}, \frac{1}{2})$$. The same is no different for this diamond.

This means, by our definition, however, that our diamond is not a unit square. And similar reasons apply. It is so much simpler to have the vertices at integral coordinates (in this case!) and a centre at $$(0,0)$$. You can apply a transformation on $$x$$ and $$y$$ to obtain the unit diamond.

Suppose we want a unit diamond. We therefore want coordinates involving $$\frac{1}{\sqrt{2}}$$ rather than $$1$$ (use the pythagorean theorem to derive this). We can replace all of our $$1$$s in our original equation with this and voila, we have $$\left|\sqrt{2}x\right| + \left|\sqrt{2}y\right| = 1$$. Magic.

## But wait, there's more!

If you rotate our unit diamond by 45 degrees clockwise or counterclockwise, via the rotation matrix or similar means, you can obtain a unit square.

Funnily enough, this square is something we'll be delving deep into in the future. One form is $$\left|x-y\right| + \left|x+y\right| = 1$$, and can derived through many other means.