I'm trying to rewrite a projection $P_\vec{v}(\vec{w})$ expressed with dot products $\frac{\vec{v} \cdot \vec{w}}{\vec{v} \cdot \vec{v}}\vec{v}$ to something expressed with a projection matrix $\frac{\vec{v}\vec{v}^T}{\vec{v}^T\vec{v}}\vec{w}$ without using the constituent elements as an intermediate step, reasoning only in abstract (an exercise thrown in a YouTube video about linear algebra).
It's clear to me that since the denominator part is just the definition of dot product in terms of a matrix multiplication $\vec{v} \cdot \vec{v} = \vec{v}^T\vec{v}$, we can extract the denominators as a scalar $\lambda = \frac{1}{\vec{v} \cdot \vec{v}} = \frac{1}{\vec{v}^T\vec{v}}$, yielding $\lambda(\vec{v} \cdot \vec{w})\vec{v}$ and $\lambda(\vec{v}\vec{v}^T)\vec{w}$.
Next, I'm tempted of rewriting as $\lambda\vec{v}(\vec{v}^T\vec{w})$ by associativity of matrix multiplication. However, by definition of dot product, that results to $\lambda\vec{v}(\vec{v} \cdot \vec{w})$, a scalar times vector times a scalar. That seems awkward to me, as scaling a vector is usually defined only from left, like in $\lambda\vec{v}$. On the other hand, matrix multiplication is not commutative, so it's not like I can just change the order willy-nilly. I'd like to just call it a day and rewrite as $\lambda(\vec{v} \cdot \vec{w})\vec{v}$, but is this, formally speaking, nonsense? Is there some trick I'm missing that allows me to rewrite this while abiding by the rules?