[Math] Component-Wise 3D Vector Projection

3dgeometrypolar coordinatesprojectionvectors

I want to define the projection of a vector $\mathbf{v} \in \mathbb{R}^3$ onto the line $\mathbf{r} \in \mathbb{R}^3$ in terms of the components of $\mathbf{v} = (v_x, v_y, v_z)$. In 2D, this looks like the following:

enter image description here

2D component-wise vector projection

The magnitude of the component-wise projection of the velocity vector $\mathbf{v}$ onto $\mathbf{r}$ is the radial velocity $v_r$, and (in 2D) can be expressed as the following:

$$
v_r = \text{comp}_{\mathbf{r}} \mathbf{v}_x + \text{comp}_{\mathbf{r}} \mathbf{v}_y = v_x \cos \theta + v_y \sin \theta
$$

or in vector form,

$$
v_r = \begin{bmatrix} \cos \theta & \sin \theta \end{bmatrix} \begin{bmatrix} v_x \\ v_y \end{bmatrix}
$$

The 3D case becomes a bit more complicated, and this is where I haven't been able to understand the geometry of the component-wise projection. In the 3D case, we have the vector $\mathbf{r}$ expressed in a form of polar coordinates where the azimuth angle $\theta$ is defined in the x-y plane relative to the positive y-axis, and the elevation angle $\phi$ is defined in the w-z plane relative to the positive w-axis, where the direction of the w-axis is defined by the direction of the projection of $\mathbf{r}$ onto the x-y plane.

enter image description here

3D geometry

The 3D vector $\mathbf{v}$ is defined with its origin at the point $(x,y,x)$ and has components $(v_x, v_y, v_z)$. The magnitude of the component-wise projection of $\mathbf{v}$ onto $\mathbf{r}$ will be a function of both the azimuth ($\theta$) and elevation ($\phi$) angles of the form:

$$
v_r = \begin{bmatrix} f_1(\theta, \phi) & f_2(\theta, \phi) & f_3(\theta, \phi) \end{bmatrix} \begin{bmatrix} v_x \\ v_y \\v_z \end{bmatrix}
$$

Best Answer

In $\mathbb R^n$ in any number of dimensions, with the usual distance function, if you have a line through the origin in the direction of a vector $\mathbf r,$ as you have in your first figure, and any other vector $\mathbf v,$ the length of the projected vector you get by projecting $\mathbf v$ onto the line of $\mathbf r$ is just the inner product (aka dot product) $$ v_r = \left(\frac1{\lVert\mathbf r\rVert}\mathbf r\right) \cdot v. $$

In general, the vector $\frac1{\lVert\mathbf r\rVert}\mathbf r$ is simply a unit vector in the same direction as $\mathbf r.$ In two dimensions, with a vector $\mathbf r$ at an angle $\theta$ from the $x$ axis, it happens that the vector on the left side of that inner product is $$ \frac1{\lVert\mathbf r\rVert} \mathbf r= \begin{bmatrix} \cos\theta \\ \sin\theta \end{bmatrix},$$ and therefore the inner product is given by the matrix multiplication you showed.

In your three-dimensional case, you can set $$\frac1{\lVert\mathbf r\rVert} \mathbf r= \begin{bmatrix} f_1(\theta, \phi) \\ f_2(\theta, \phi) \\ f_3(\theta, \phi) \end{bmatrix},$$ that is, simply set $f_1(\theta, \phi),$ $f_2(\theta, \phi),$ and $f_3(\theta, \phi)$ to the three coordinates of the unit vector in the direction $\theta,\phi.$ You can read these coordinates off your diagram. (They are combinations of trigonometric functions of $\theta$ and $\phi$ which you've already written; just don't multiply by $R$.)

Related Question