# Can a transformation matrix be expressed in terms of the vector to be transformed?

I'm currently learning linear algebra with my friend via an online course, and we have a disagreement that we would like settled.

Upon learning that vectors can be projected onto lines by a simple function, and that this function is a linear transformation, I recommended that we find a way to calculate the transformation matrix for the function.

This function was characterized by a vector $\vec{v}$ pointing along the line to be projected onto. The non-matrix form of the function we were given was this:

$$proj_{\vec{v}}(\vec{x}) = (\vec{x} \cdot \hat{u})\hat{u}$$

where $\hat{u}$ is the normalized form of $\vec{v}$ calculated by ($\frac{1}{||\vec{v}||}\vec{v}$).

When trying to construct this as a matrix, my friend came up with this (this is just for $\mathbb{R}^{3}$, but you get the idea):

$$proj_{\vec{v}}(\vec{x}) = \left[\begin{array}{ccc} \vec{x} \cdot \hat{u} & 0 & 0 \\ 0 & \vec{x} \cdot \hat{u} & 0 \\ 0 & 0 & \vec{x} \cdot \hat{u} \end{array}\right] \cdot \hat{u}$$

I see multiple problems with this. First of all, transformation matrices cannot be expressed in terms of the vector to be transformed, can they? To my understanding, they are supposed to contain constant values that are the same no matter what vector is being transformed. Second of all, linear transformations multiply $\vec{x}$ by the transformation matrix, not any other vector, right?

I'm not particularly interested in the actual transformation matrix for this problem - I plan to get some practice with what i've learned by calculating that :) - I'd just like confirmation as to whether or not the things my friend has done are valid. Thank you!

-

The short answer is: You are right. The representing matrix has to be independent of $x$. Moreover a matrix $A$ represents a linear function $f$ if and only if $Ax=f(x)$ for all $x$, so $A$ has indeed to be multiplied with the vector in question.
$$(x\cdot u)u=u(x\cdot u)=u(u\cdot x)=u(u^tx)=(uu^t)x.$$
So $uu^t$ is the representing matrix. (I write the representing matrix, since the basis is understood to be fixed. In genereal there is more than one representing matrix.)