# Lines and squares

*This puzzle presumably came to me by way of @ajk44, some time ago. Thanks, Alison!*

The problem, given here, is to find the equations of two lines that complete a square, given:

- Two of the lines are $y=ax+b$ and $y=ax+c$
- One of the vertices is at $(0,b)$.

The example given has $a=2$, $b=1$ and $c=4$, so that the given lines are $y=2x+1$ and $y=2x+4$.

A perpendicular line to either, passing through $(0,1)$, would be $y= -\frac{1}{2}x + 1$, using the negative reciprocal property. Another possible line, given to us in the question, is $y= -\frac{1}{2}x + \frac{5}{2}$. ((An alternative is $y = -\frac{1}{2}x - \frac{1}{2}$.))

### But why does that make a square?

It’s easy enough to see that it works if you plot it on Desmos, but ‘proof by Desmos’ is not generally accepted by the community. It took me a while to see it - and save myself from some horrible simultaneous equations.

It’s to do with spacing. On the $y$-axis, the upward-and-to-the-right lines cross at points a distance of 3 units apart. For their crossing lines to make a square, they need to be a *horizontal* distance of 3 units apart.

For the fourth line to make a square, it must pass through $(-3,1)$ or $(3,1)$. Using everyone’s favourite formula, we get $(y-1) = -\frac{1}{2}\left(x \pm 3\right)$, which gives $y = -\frac{1}{2}x - \frac{1}{2}$ or $y=-\frac{1}{2}x + \frac{5}{2}$.

### More generally

The general solution to the problem has the third line as $y = - \frac{1}{a}x + b$, and the second derived from $y-b = -\frac{1}{a}\left(x \pm (b-c)\right)$.

Personally, I’d rearrange that as $x + ay - ab \pm (b-c) = 0$, but I’m not in charge of the question.

* Many thanks to NRICH for allowing me to share the question.