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?
 A: 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}}|$.
A: 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. 
A: For this derivation, we won’t be needing any trigonometric equation nor you have to prior study trigonometry.
For this derivation we just need the following things:

*

*Pythagoras Theorem

*Algebra

*Area of triangle $$\frac{1}{2} \times \text{height} \times \text{base}$$
Let us take the line equation $Ax+By+C = 0$.
So by putting first $y = 0$ solving for $x$ and then putting $x = 0$ and solving for $y$.

*

*By putting $y = 0$ and solve for $x$:
\begin{align}
Ax+By+C &= 0, \quad y = 0 \\
Ax+B(0)+C &= 0 \\
Ax+C &= 0 \\
Ax &= -C \\
x &= -\frac C A
\end{align}


*By putting $x = 0$ and solve for $y$:
\begin{align}
Ax+By+C &= 0, \quad x = 0 \\
A(0)+By+C &= 0 \\
By+C &= 0 \\
By &= -C \\
y &= -\frac C B
\end{align}
By doing the above we get the base distance and perpendicular distance of the triangle formed by the line equation $Ax+By+C = 0$.
Since the triangle formed is a right-angled triangle, we can get its area and hypotenuse with no problem.

*

*So first, deriving the hypotenuse:
$$\text{Rise} = \left|\frac{-C}{A}\right|,\ \text{Run} = \left|\frac{-C}{B}\right|$$
Pythagoras Thm.:  Hyp.${}^2$ = Rise${}^2$ + Run${}^2$:
\begin{align}
\text{Hyp.}^2 &= \left|\frac{-C}{A}\right|^2 + \left|\frac{-C}{B}\right|^2 \\
&= \frac{C^2}{A^2} + \frac{C^2}{B^2} \\
&= \frac{C^2(A^2+B^2)}{(AB)^2}; \\
\text{Hyp.} &= \sqrt\frac{C^2(A^2+B^2)}{(AB)^2} \\
&= \frac{|C|\sqrt{A^2+B^2}}{|AB|}.
\end{align}


*Deriving the Area:
\begin{align}
\text{Base} &= \left|\frac{-C}{A}\right|, \\
\text{Height} &= \left|\frac{-C}{B}\right|; \\
\text{Area} &= \frac 1 2 \times \left|\frac{-C}{A}\right| \times \left|\frac{-C}{B}\right| \\
&= \frac{C^2}{2|AB|}.
\end{align}
We can also write the area as half the hypotenuse times the height that is perpendicular to the hypotenuse (Note: the height perpendicular to the hypotenuse is the shortest distance to the origin, so let us call this height $w$).
\begin{align}
\text{Area} &= \frac 1 2 \times \text{hypotenuse} \times \text{perp. height} \\
\frac{C^2}{2|AB|} &= \frac 1 2 \times \frac{|C| \sqrt{A^2+B^2}}{|AB|} \times w \\
\frac{C^2}{|AB|} &= \frac{|C|\sqrt{A^2+B^2}}{|AB|} \times w \\
|C| &= \sqrt{A^2+B^2} \times w \\
\frac{|C|}{\sqrt{A^2+B^2}} &= w.
\end{align}
This is the answer.
A: 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$.
