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?

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.
