How can I prove $x \cos\alpha + y \sin\alpha =p$ using vectors? A straight line satisfies the following condition.


$p&gt;0$ is the length of the perpendicular on the line from the origin
$\alpha$ is the angle made by this perpendicular with the positive $x$-axis.


Vectorically derive that the equation of this straight line is $$x \cos\alpha + y \sin\alpha =p$$



With some ideas I have made a figure. But not sure that the figure is correct. Please help me with this and the further derivation.
Let $P$ denote the point on the line that is closest to the origin. 

Then $\vec{OP}=\begin{pmatrix} p\cos \alpha \\ p \sin \alpha\end{pmatrix}$

Let $R$ be an arbitrary point on the line, let $\vec{OR}=\begin{pmatrix} x \\ y\end{pmatrix}$

$\vec{PR}$ and $\vec{OP}$ are perpendicular, hence their inner product (or dot product) should give us $0$.

$$\vec{PR}.\vec{OP}=0$$
$$(\vec{OR}-\vec{OP}).\vec{OP}=0$$
$$\vec{OR}.\vec{OP}=\vec{OP}.\vec{OP}$$

$$xp\cos (\alpha)+yp\sin(\alpha)=p^2$$
$$x\cos(\alpha)+y\sin(\alpha)=p$$
Firstly, you haven't marked the angle $\alpha$ in your diagram though it is implicit from your question.

Once you mark $\alpha$ express $\cos(\alpha)$ and $\sin(\alpha)$ in terms of the distances in the figure.

Hint: $$\cos(\alpha) = \frac{PO}{OA}$$

You should get your proof.