Proving the perpendicular distance from a point to a line using vectors (the harder algebraic way) I want to prove that the distance from a point $P\left(x_{0},y_{0}\right)$ to line $l$: $ax+by+c=0$ is given by $\frac{\left|ax_{0}+by_{0}+c\right|}{\sqrt{a^{2}+b^{2}}}$.
So I am stuck on $$\left|\text{perp}_lAP\right|=\left|\binom{x_0}{y_0+\frac{c}{b}}-\frac{-bx_0+ay_0+\frac{ac}{b}}{\sqrt{a^2+b^2}}\:\binom{-b}{a}\right|$$
Where $l$ is the vector parallel to the line,and $AP$ is a vector. See diagram/graph for context.
So I took the projection of $AP$ onto $l$, then found the perpendicular by proj+perp=l
And this should work right? I see no error, but just a very messy simplification.
I know the better way is to do instead, the projection from $PA$ onto $l$, which we know is perpendicular anyway.
But me doing |perp| = |$l$-proj| SHOULD also work right?How do I simplify it (especially turning $bx_0$ into $ax_0$)
Diagram:
https://imgur.com/a/JXfSxko
 A: There is nothing wrong with your method and calculations are not too complicated. But it is rather a small mistake that caused you grief.

If $M$ is the foot of the perpendicular on line $l$, you have not defined $\vec {AM}$ correctly.
$\displaystyle \frac{-bx_0+ay_0+\frac{ac}{b}}{\sqrt{a^2+b^2}}$ is the magnitude of the projection of $\vec {AP}$ on line $l$ as you have taken dot product of $\vec {AP}$ with unit vector in direction of line $l$. Now if you are multiplying it by $(-b, a)$, that is wrong. It gives you a vector with different magnitude. To get to $\vec{AM}$, it should be multiplied by unit vector in direction of line $l$. So,
$\begin {aligned}
|\vec{MP}|&=\left|\binom{x_0}{y_0+\frac{c}{b}}-\frac{-bx_0+ay_0+\frac{ac}{b}}{a^2+b^2}\:\binom{-b}{a}\right| \\
& = \dfrac{1}{(a^2+b^2)} \left| (a^2+b^2)\binom{x_0}{y_0+\frac{c}{b}} + \left(-bx_0+ay_0+\frac{ac}{b}\right)\:\binom{b}{-a}\right| \\
&= \dfrac{1}{(a^2+b^2)} \left|\binom{a^2x_0 + ab y_0 + ac}{abx_0 + b^2y_0+bc}\right| \\
& = \dfrac{1}{(a^2+b^2)} \left| (ax_0 + by_0 + c) \binom{a}{b}\right| \\ 
&= \dfrac{\left|ax_0+by_0+c\right|}{\sqrt{a^2+b^2}} 
\end{aligned}$
That's all.
A: Don't think there is a way to work it out completely "nicely" this way, but it can be made somewhat easier by making a couple of adjustments in the setup of the problem.

*

*A line proper cannot have $a$ and $b$ both $0$, so it can be assumed WLOG that $a^2+b^2=1$ by dividing the equation by $\sqrt{a^2+b^2}$. Once the distance is proven to be $\mid ax_0+by_0+c\mid$ under this assumption, the substitutions can be reversed $a \to \frac{a}{\sqrt{a^2+b^2}}$, $b \to \frac{b}{\sqrt{a^2+b^2}}$, $c \to \frac{c}{\sqrt{a^2+b^2}}$ to recover the general result.


*With $a^2+b^2=1$, the reference point $\left(0,-\frac{c}{b}\right)$ can be chosen as $(-ca,-cb)$, instead, to preserve some of the symmetry and simplify the calculations.
With the above, the orthogonal component in the case $a^2+b^2=1$ becomes:
$$
T \;=\;\binom{x_0+ca}{y_0+cb}-\left(bx_0-ay_0\right)\binom{b}{-a}
$$
Then:
$$
\require{cancel}
\begin{align}
|T|^2 &= \left(x_0+ca-b(bx_0-ay_0)\right)^2 + \left(y_0+cb+a(bx_0-ay_0)\right)^2
\\ &= x_0^2+2cax_0 + c^2a^2 - 2b(x_0+ca)(bx_0-ay_0)+b^2(bx_0-ay_0)^2
\\ &\;\;\;\; + y_0^2+2cby_0+c^2b^2 + 2a(y_0+cb)(bx_0-ay_0)+a^2(bx_0-ay_0)^2
\\ &= x_0^2+y_0^2+2c(ax_0+by_0)+c^2-2(bx_0+\cancel{bca}-ay_0-\cancel{acb})(bx_0-ay_0)+(bx_0-ay_0)^2
\\ &=x_0^2+y_0^2+2acx_0+2bcy_0+c^2-b^2x_0^2-a^2y_0^2+2abx_0y_0
\\ &= a^2x_0^2+b^2y_0^2+c^2 +2abx_0y_0+2acx_0+2bcy_0
\\ &= \left(ax_0+by_0+c\right)^2
\end{align}
$$
A: The points where $ax+by+c=0$ can be parametrized as
$$
\left(\frac{-bt-ac}{a^2+b^2},\frac{at-bc}{a^2+b^2}\right)\tag1
$$
The square of the distance from $(x_0,y_0)$ is then
$$
\begin{align}
&\left(x_0+\frac{bt+ac}{a^2+b^2}\right)^2+\left(y_0+\frac{-at+bc}{a^2+b^2}\right)^2\\[6pt]
&=\left(x_0^2+y_0^2\right)+\frac{2x_0(bt+ac)+2y_0(-at+bc)}{a^2+b^2}+\overbrace{\frac{(bt+ac)^2+(-at+bc)^2}{\left(a^2+b^2\right)^2}}^{\large\frac{t^2+c^2}{a^2+b^2}}\tag{2a}\\
&=\frac{\left(a^2+b^2\right)\left(x_0^2+y_0^2\right)+2c(ax_0+by_0)+2(bx_0-ay_0)t+c^2+t^2}{a^2+b^2}\tag{2b}\\[3pt]
&=\frac{\left(a^2+b^2\right)\left(x_0^2+y_0^2\right)+2c(ax_0+by_0)+c^2-(bx_0-ay_0)^2+(t+bx_0-ay_0)^2}{a^2+b^2}\tag{2c}\\[3pt]
&=\frac{a^2x_0^2+b^2y_0^2+2abx_0y_0+2c(ax_0+by_0)+c^2+(t+bx_0-ay_0)^2}{a^2+b^2}\tag{2d}\\[3pt]
&=\frac{(ax_0+by_0+c)^2+(t+bx_0-ay_0)^2}{a^2+b^2}\tag{2e}
\end{align}
$$
Explanation:
$\text{(2a)}$: expand the squares collecting the first, middle, and last parts
$\text{(2b)}$: put over a common denominator and collect powers of $t$
$\text{(2c)}$: complete the square in $t$
$\text{(2d)}$: expand $\left(a^2+b^2\right)\left(x_0^2+y_0^2\right)-(bx_0-ay_0)^2$
$\text{(2e)}$: collect $(ax_0+by_0+c)^2$
$\text{(2e)}$ is minimized when $(t+bx_0-ay_0)^2=0$ which gives the minimum distance to be
$$
\frac{|ax_0+by_0+c|}{\sqrt{a^2+b^2}}\tag3
$$
