# How to mathematically express square to not “lose” sign of a vector

I need to express force exerted on a body due to aerodynamic drag mathematically as vector in matrix form. Let $F_f$ be the exerted force, $k_{lf}$ the aerodynamic constant and $\vec{V} = [u, v, w]^T$ the velocity vector. $[u, v, w]^T$ can either be positive or negative and $F_f$ is proportional to $\vec{V}^2$ but directed opposite. Writing:

$F_f = -k_{lf} \begin{bmatrix} u^2 \\ v^2 \\ w^2 \end{bmatrix}$

is wrong, as $u^2$ is always positive. What's the correct form of the above equation in matrix form, to preserve $u, v, w$ sign? Is using $sgn(x)$ the right choice?

PS. Does wrinting $\vec{V}^2$ preserve sign, i.e. is the below true?

$\vec{V}^2 = \begin{bmatrix} sgn(u) u^2 \\ sgn(v) v^2 \\ sgn(w) w^2\end{bmatrix}$

-

If I understand your question right, could you write: $$F_f = \left| -k_{lf} \begin{bmatrix} u^2 \\ v^2 \\ w^2 \end{bmatrix}\right| \frac{-\vec{V}}{\lvert \vec{V}\lvert}\quad ?$$ So the $\lvert \cdot\lvert$ are the magnitude of the vectors. And $\frac{-\vec{V}}{\lvert \vec{V}\lvert}$ is a unit vector in the direction of $F_f$.

Now, of course you can rewrite this by actually writing what the magnitudes are: $$F_f = \lvert k_{lf}\lvert \sqrt{u^4 + v^4 + w^4} \frac{1}{\sqrt{u^2 + v^2 + w^2}}\begin{bmatrix} -u \\ -v \\ -w \end{bmatrix}$$

The idea here is that any vector $\vec{v}$ can be written as the magnitude times a unit vector giving the direction: $$\vec{v} = \lvert\vec{v}\lvert\frac{\vec{v}}{\lvert\vec{v}\lvert.}$$

-
Upvote for how I have seen it written in aerodynamics models. (though need to fix the tex) – Lucas Dec 10 '12 at 17:16
@Lucas: Thanks for the fix. – Thomas Dec 10 '12 at 17:20
So you're actually suggesting using $sgn(x)$. I'd like to use only the matrix form, no vectors, so it'd rather be: $F_f = k_{lf} [-sgn(u) u^2, -sgn(v) v^2, -sgn(w) w^2]^T$, correct? So is it the best way to put this? – mmm Dec 10 '12 at 17:20
@mmm: What do you mean by sgn$(x)$ (the sign of a vector)? – Thomas Dec 10 '12 at 17:21
@Thomas: $sgn(x)$ is the sign function. In my case the sign of a vector's component, i.e. en.wikipedia.org/wiki/Sign_function, note no vector sign used. – mmm Dec 10 '12 at 17:23

Something like this does what you want, $F = \left|\vec{v}\right|\vec{v}$

-