# Mathematical notation for orthogonal projection of a set of points on a line

How could i mathematically denote the following: Assume a matrix P which represents the coordinates of a set of points (each row = a single point). Each point in the matrix P is projected on a line which coincides with a unit vector $$\vec{z}$$.

I've denoted P and Q as followed:

$$\bf{P}= \begin{bmatrix}P_{1} \\ P_{2} \\ \vdots\\ P_{m} \end{bmatrix} \quad$$ and $$\bf{Q}= \begin{bmatrix}Q_{1} \\ Q_{2} \\ \vdots\\ Q_{m} \end{bmatrix} \quad$$with $$P_{i}, Q_{i} \in \mathbb{R}^{3}$$

but I do not know how I could denote the operation that projects the points in P on the line defined by $$\vec{z}$$ resulting in the matrix Q.

• Traditionally, one treats columns as vectors, not rows. While there is nothing wrong a priori with using row vectors, it means that when you communicate with other people, it introduces cognitive dissonance as they have to reverse their customary formulas. This makes it more taxing, and leads to more errors as needed modifications are overlooked. This is why it is better to stick with column vectors unless there is specific need for row vectors. – Paul Sinclair Aug 17 at 14:07
• @PaulSinclair Thank you for your comment. Just to be clear, you are saying that it would be better if P and Q are 1 x m matrices, whereas $P_i$ and $Q_i$ should be column vectors? – KrisH Aug 17 at 14:16
• $\bf P$ and $\bf Q$ are $m \times m$ matrices whether you are using row or column vectors. The $P_i$ and $Q_i$ would be column vectors, and you would have $$\mathbf P = \begin{bmatrix}P_1 & P_2 & \dots & P_m\end{bmatrix}$$ etc.The reason this notation is conventional is that it is also conventional to put coefficients and functions on the left of what they modify: $y = mx + b$ and $y = f(x)$, not $y = xm + b$ or $y =(x)f$. With column vectors $u, v$ and matrix $A$, we can write $u = Av$, whereas with row vectors we have to write $u = vA$. – Paul Sinclair Aug 17 at 14:34
• Forgive me but I don't understand why P and Q would be $m \times m$ matrices? They both consist of $m$ elements on a single axis, whether that be horizontal or vertical, i.e. rows or columns. And each of the elements in P and Q are $1\times3$ row vectors in my original question or $3\times1$ column vectors as you suggest. – KrisH Aug 17 at 14:47
• If each $P_i = \begin{bmatrix} p_{i1} & p_{i2} & \dots & p_{im}\end{bmatrix}$, then $$\mathbf P = \begin{bmatrix} P_1\\P_2\\\vdots\\P_m\end{bmatrix} = \begin{bmatrix}p_{11} & p_{12} & \dots & p_{1m}\\p_{21} & p_{22} & \dots & p_{2m}\\\vdots&\vdots&\ddots&\vdots\\p_{m1} & p_{m2} & \dots & p_{mm}\end{bmatrix}$$an $m \times m$ matrix. (You should note that in my answer, I didn't pull the $z$ and $z^T$ out of the matrix notations until I had verified that matrix multiplication would indeed act that way when everything was fully expanded like this.) – Paul Sinclair Aug 17 at 14:56

The projection of a vector $$\vec v$$ onto a unit vector $$\vec z$$ is given by

$$Pr_{\vec z}(\vec v) = (\vec v \cdot \vec z)\vec z$$ For row vectors, $$\vec v \cdot \vec z = v\,z^T$$, so one way of denoting it would be $$\begin{bmatrix}Q_1 \\ Q_2 \\ \vdots\\ Q_m\end{bmatrix} = \begin{bmatrix}(P_1z^T)z \\ (P_2z^T)z \\ \vdots\\ (P_mz^T)z\end{bmatrix}=\begin{bmatrix}P_1z^T\\P_2z^T\\\vdots\\P_mz^T\end{bmatrix}z =\left(\begin{bmatrix}P_1\\P_2\\\vdots\\P_m\end{bmatrix}z^T\right)z$$

That is, $$\mathbf Q = \mathbf Pz^Tz$$ In the more traditional column vector notation, this would be: $$\mathbf Q = zz^T\mathbf P$$