# Equation for Distance of the Straight line from the Origin.

By reduction of the equation $ax + by + c = 0$ of a straight line to the normal form , we get $$\left(\frac{-a}{\sqrt{a^2 + b^2}}\right)x + \left(\frac{-b}{\sqrt{a^2 + b^2}}\right)y = \frac{c}{\sqrt{a^2 + b^2}}$$ And, $$p= \frac{∣c∣}{\sqrt{a^2 + b^2}}$$ And my textbook says that $p$ is the distance of the straight line from the origin. I don't know why we are getting it as a distance from origin?

I know $p= x\cos\theta + y\sin\theta$ ( where $p$ is distance of line from origin).

Also I want to know how can we relate both equations?

• Have you tried to check what's written about this on Wikipedia or in other posts on this site like this or this? – Martin Sleziak Oct 8 '16 at 10:09
• @THE, you have made edits to about 30 questions in a matter of minutes, flooding the front page and driving other, newer questions off it. Please don't do that! Please edit three or four questions a day, not 30 in half an hour. – Gerry Myerson Jan 4 '17 at 3:47
• @GerryMyerson, I knew that soon something like that will come to me, and I appologise for what I did. But II did not took them from previous pages, they were already on the front page (Someone else had edited them), I just revised small mistakes. – I am Back Jan 4 '17 at 3:51
• @THE, yes, so I see. I have also left a comment for the other editor who is, if I'm not mistaken, a repeat offender. – Gerry Myerson Jan 4 '17 at 3:52
• Okay, @Garry, you do not need to worry shot it now. Nothing such will happen again from my side – I am Back Jan 4 '17 at 4:23

There is a simple derivation of what you want to know. Without going into details, let me introduce the result:

The perpendicular distance of a line $(Ax+By+c=0)$from a point is equal to $|\frac{Ax'+By'+c}{\sqrt{A^2+B^2}}|$. Where $(x',y')$ are coordinates of the point.

Since you want distance of line from origin, the coordinates become $(0,0)$ and hence the perpendicular distance of a line from origin is $|\frac{Ax'+By'+c}{\sqrt{A^2+B^2}}|=|\frac{0+0+c}{\sqrt{A^2+B^2}}|=|\frac{c}{\sqrt{A^2+B^2}}|$.

• I got that after few weeks I posted that. But I still don't know why $\cos\theta$ and $\sin\theta$ is getting when divided by $\sqrt{a^2 + b^2}$ – Fawad Jan 4 '17 at 11:22
• Wait, Have you got the book, SL Loney ?? – I am Back Jan 4 '17 at 11:23
• Of coordinate geometry?? – I am Back Jan 4 '17 at 11:23
• No :( I only follow my Textbook – Fawad Jan 4 '17 at 11:24
• Okay, then I m gonna send you pictures from that book of the section we are discussing here, I m sure it will help you, But where can I send you them ?? – I am Back Jan 4 '17 at 11:25

By simple identification, the two equations are identical when

$$-\frac a{\sqrt{a^2+b^2}}=\cos\theta,\\ -\frac b{\sqrt{a^2+b^2}}=\sin\theta,\\ \frac c{\sqrt{a^2+b^2}}=p.$$

This is coherent as you verify $\cos^2\theta+\sin^2\theta=1$. If $c$ is negative, change all signs.

As one can verify by substitution,

$$x=p\cos\theta-t\sin\theta,\\y=p\sin\theta+t\cos\theta.$$ describes any point along the line, by varying $t$.

The distance from the origin to this point is given by, after simplification,

$$d=\sqrt{x^2+y^2}=\sqrt{p^2+t^2}.$$

The minimum value is indeed $p$.

• How we get$x=p\cos\theta-t\sin\theta,\\y=p\sin\theta+t\cos\theta.$ – Fawad Oct 8 '16 at 10:19

Note that by Cauchy Schwarz, if $(x, y)$ satisfies $ax+by+c = 0$, then

$$c^2= (-c)^2 = (ax+by)^2 \le (a^2+b^2)(x^2+y^2).$$

(The last inequality can be checked directly). Thus every points $(x, y)$ on the line satisfies

$$\tag{1} \sqrt{x^2+y^2} \ge \frac{|c|}{\sqrt{a^2+ b^2}}.$$

On the other hand, the point

$$(x,y)= \left(\frac{-ac}{\sqrt{a^2+b^2}}, \frac{-bc}{\sqrt{a^2+b^2}}\right)$$

lies on the line and has distance

$$\frac{|c|}{\sqrt{a^2+b^2}}$$

from the origin. Thus we are done.

• I can't get any thing from your answer, can you explain in any simple way? – Fawad Oct 8 '16 at 10:25
• Which part do you not understand, @Ramanujan? – user99914 Oct 8 '16 at 10:53
• After $-c = ax+by =$ to last – Fawad Oct 8 '16 at 10:58
• Please see the edit @Ramanujan – user99914 Oct 8 '16 at 11:01
• @JohnMa I suppose you wanted to write $(ax+by)^2 \le (a^2+b^2)(x^2+y^2)$ rather than $(ax+by)^2 = (a^2+b^2)(x^2+y^2)$...? – Martin Sleziak Oct 8 '16 at 13:12