# perpendicular distance from $ax-by = 1$ to origin

I have a problem from a basic number theory book that asks for the perpendicular distance from the line $ax - by = 1$ to the origin.

My approach was to find the area of the triangle formed by the line and the axes, find the base of the triangle situated at the diagonal, then use those to find the height of the triangle, which would be the perpendicular distance.

I found that the $x$ intercept is $\frac1a$, and the y intercept is $-\frac1b$. So if you consider the base to be the diagonal, it is $\sqrt{\frac{1}{a^2} + \frac{1}{b^2}}$. Then the area of the triangle is $\frac{1}{2ab}$. Thus the height is $\frac{1}{2ab\sqrt{\frac{1}{a^2} + \frac{1}{b^2}}}$ = $\frac{1}{2\sqrt{(a^2 + b^2}}$, which I thought would be the answer.

However, the book states that the answer is $\frac{1}{\sqrt{a^2 + b^2}}$, so I'm off by $\frac12$. Did I make a mistake with the area of the triangle? If not, where did I go wrong?

Thank you!

You forgot to include the factor of $1/2$ in the expression of the area using the diagonal and altitude to the origin. That will cancel the $1/2$ in the other expression when you solve for $h$.

Note that the height is $2Area/Base$ and you have lost here a factor 2.

As an alternative by similarity of right triangles we obtain

$$\frac{d}{\frac1b}=\frac{\frac1a}{\sqrt{\frac1{a^2}+\frac1{b^2}}}\implies d=\frac{\frac1{ab}}{\sqrt{\frac{a^2+b^2}{a^2b^2}}}\implies d=\frac1{\sqrt{a^2+b^2}}$$ Minimum Distance

Since \begin{align} 1 &=\left|\,ax-by\,\right|\\ &=\left|\,(a,-b)\cdot(x,y)\,\right|\\ &\le\left|\,(a,-b)\,\right|\left|\,(x,y)\,\right| \end{align} we have \begin{align} \left|\,(x,y)\,\right| &\ge\frac1{\left|\,(a,-b)\,\right|}\\ &=\frac1{\sqrt{a^2+b^2}} \end{align} If $(x,y)=\frac{(a,-b)}{a^2+b^2}$, then $ax-by=1$ and $\left|\,(x,y)\,\right|=\frac1{\sqrt{a^2+b^2}}$

Thus, the minimum of $\left|\,(x,y)\,\right|$ is $\frac1{\sqrt{a^2+b^2}}$.

Perpendicular Distance

If $ax_1-by_1=1$ and $ax_2-by_2=1$, then $$(a,-b)\cdot(x_1-x_2,y_1-y_2)=1-1=0$$ Thus, $(a,-b)$ is perpendicular to the line containing $(x_1,y_1)$ and $(x_2,y_2)$; i.e. the line $ax-by=1$.

This means the vector from the origin to $\frac{(a,-b)}{a^2+b^2}$ is perpendicular to the line $ax-by=1$ and the point $\frac{(a,-b)}{a^2+b^2}$ is on the line $ax-by=1$.

Thus, the perpendicular distance from the origin to the line is $$\left|\frac{(a,-b)}{a^2+b^2}\right|=\frac1{\sqrt{a^2+b^2}}$$