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:
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.
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} $$
$\endgroup$ 52 Answers
$\begingroup$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$.)
$\endgroup$ 7 $\begingroup$We want to create vectors along the vector $\vec r$ with components being that of the $x, y, z$ projections of the vector $\vec v = (v_x, v_y, v_z)$.
To create a vector in some direction with some magnitude, we multiply the unit vector along a direction with the magnitude we wish for. So, for example, to create the projection of the $x$ value along the direction by $\vec r$, we will:
- Create a unit vector $\hat r = \vec r / |r|$, which is the unit vector in the direction along $\vec r$
- Make the new vector $\vec r_x = v_x \hat r$, where $v_x$ is the x-component of the vector $v$.
Similarly, for $y$, we can create a vector $\vec r_y = v_y \hat r$. And for $z$, we can create $\vec z = v_z \hat r$.
Since we have the vector $\vec r$ in spherical coordinates, we can write the unit vector along the direction $\vec r$ in cartesian coordinates as:
$\hat r = (\cos \phi \sin \theta, \cos \phi \cos \theta, \sin \phi)$.
So the vectors will be:
- $\vec r_x = v_x \hat r = (v_x\cos \phi \sin \theta, v_x \cos \phi \cos \theta,v_x \sin \phi)$
- $\vec r_y = v_y \hat r = (v_y\cos \phi \sin \theta, v_y \cos \phi \cos \theta,v_y \sin \phi)$
- $\vec r_z = v_z \hat r = (v_z\cos \phi \sin \theta, v_z \cos \phi \cos \theta,v_z \sin \phi)$
If I completely misunderstood the question, please do tell me!
$\endgroup$ 3