### An Exercise in Making Things Easier for Yourself

The problem: you have a point, and a line, and want to find the distance from the point to the line, specifically the shortest distance that meets that requirement.

Given: the point $(a_x,a_y)$ and the line $y=mx+b$ as in the picture, we want to find the point of intersection $(p_x,p_y)$ so we can then find the distance from $a$ to $p$.

### Don’t reinvent the wheel (use what you already know)

Things we remember1 (hopefully) that could be useful but we won’t prove or explain here:

- The shortest distance from a point to a line is along the line that is perpendicular to the given line, and passes through the given point. This is a pretty good guess based on the picture, and conveniently enough happens to be true.
- Perpendicular lines have negative reciprocal slopes. This one isn’t so obvious, and maybe I’ll have an entry for it someday, but not today.

If we do nothing to make the problem easier, then things will get ugly. Therefore, that’s exactly what we will do! After all, whoever learned something by watching someone else do it the easiest way first?

### The plan

A little planning first: we’ll find the equation of the red line, then use that to find the point of intersection, then use the Pythagorean Theorem to find the distance, and last of all try to clean things up a little bit. Also, relax! This is a first draft, so with a little luck we will be able to clean it up a bit.

### The Red Line

Let’s find the equation of the red line. We know that it has slope $-\frac{1}{m}$ (the negative reciprocal of $m$) and goes through the point $(a_x,a_y)$, so let’s do a little math and find an equation that fits. Find $\color{purple}b$, which is the $y$-intercept of the red line:

We start with the equation of some line having slope $-\frac{1}{m}$, then put in the point $(a_x,a_y)$ because we know that has values of $a_x$ and $a_y$ that make the equation true. The key here is to recognize that when we know what everything is except for $b$, that tells us we should probably solve for $b$. Now we can write the equation of our line with slope $-\frac{1}{m}$ and passing through point $(a_x,a_y)$ as:

### Point of Intersection

Great! Now all we have to do is find the point of intersection and then use the Pythagorean Theorem to find the distance between the two points. There are lots of ways to find the intersection of two lines, we’ll just use one of them. According to $\eqref{a1}$, another way to write $y$ is as $-\frac{1}{m}x + \frac{a_x}{m}+a_y$, so let’s do a little substitution:

Then all we need to do is to solve for $\color{red}x$:

Now we know what $x$ must be…brilliant! Since we know what $\color{red}x$ is now, let’s just substitute that into $\eqref{a2}$ and see what we get for $y$:

The point of intersection is a little messy:

### Last step: Pythagorean Theorem

Well, no one ever said this was going to be easy, but we’re a little crazy so let’s just keep going. One Pythagorean Theorem coming right up! (To be fair, I have a bad feeling about this…)

…and there’s our answer. Wow, that was really ugly. The answer isn’t too bad, but getting from the third line through about the sixth really took being careful.

### Reflection: What went well and what didn’t

End of first draft. Looking back, what could we have done better? To be fair, up on line three, I considered multiplying everything out to make it even tougher, but I’m too lazy for that. Leaving it as it was probably helped, considering that the $m^2+1$ ended up factoring out and then canceling out, but the bigger prize was the other factor: $ma_x – a_y + b$. If I had multiplied out the squares at $\eqref{d1}$, I’m not sure I would have found the factors in $\eqref{d2}$ and $\eqref{d3}$.

What could we have done differently? The math was mostly straightforward: we used a few well-known formulas, did some substitution, and solved for a variable. The biggest obstacle was that it was a little more involved than solving $2x+7 = 5x-2$ for $x$. If I could find a way to reduce the number of variables involved, that would really help.

### Using Zero!

The best way I know of to make something disappear is to define it as being ZERO. Since the origin of a graph is defined as being $(0,0)$, why not take advantage of that? Moving the origin won’t change much, and it may reduce what we need to do.

Whoops! I don’t think that line has the same equation now. It still has the same slope, but the $y$-intercept has changed. When we moved the origin from $(0,0)$ to $(1,4)$, we effectively subtracted 4 from every $y$ value and 1 from every $x$ value. Let’s do a little colorful line graphing to figure out how to fix our equation. We know we want the blue line to pass through (on this graph) $(2,-3)$ and we want to use the 1 and 4 to get there.

To get the purple line, subtract 1 from the $x$-intercept (it sounds a little odd, but bear with me). How much did the $y$-intercept change? It moved up from -1 to $-\frac{1}{3}$, a change of $+\frac{2}{3}$. Coincidence? As one of my students once said, “Nah…there are no coincidences in math.” That looks suspiciously like we added $ma_x$ to $b$. Then to get the green line, we subtract 4 from the $y$-intercept. That change is pretty straightforward.

So to fix the equation of our line, we do the same:

Referring to my student above, is it really coincidence that our new $b$ value is $ma_x – a_y + b$, the same expression that shows up in $\eqref{d4}$?

### Shorter math is easier

Now that we have a new equation, and some convenient zeroes, let’s do this again, with $p$ being a point that just happens to be on both lines:

…and we are back to $\eqref{d3}$. That was much easier!

(moral of the story: zero is your friend!)