# Equation for non-orthogonal projection of a point onto two vectors representing the isometric axis?

Suppose I have two vectors that are not orthogonal (let's say, an isometric grid) representing the new axis. Suppose I want to project a point onto these two vectors, how would I do it? Dot product only works for projecting a point orthogonally onto a vector, but now I want to project a point such that it is not along the orthogonal line, but respected to another vector.

For example, I found this picture in wikipedia: http://en.wikipedia.org/wiki/Projection_(linear_algebra)#Classification

Suppose I have two vectors that point in the same direction as line k and m. If I want to project a point onto axis m, I want to project it such that it follows along k onto m, not orthogonally. Then I can have my k and m as my new axis, and all the points will be projected respected to these two vectors.

-

Let's call your two "axis" vectors $U$ and $V$. The nice folks around here would probably call them "basis" vectors. And suppose you have some other vector $W$, lying in the plane of $U$ and $V$, that you want to decompose.

Essentially, you want to find two numbers $h$ and $k$ such that $$W = hU + kV$$ The vector $hU$ will be the projection of $W$ onto the $U$-axis in a direction parallel to $V$, and $kV$ will be the projection of $W$ onto the $V$-axis in a direction parallel to $U$. Draw a picture and you'll see why this is so.

Take dot products of the equation above with $U$ and $V$ in turn, getting $$h(U \cdot U) + k(U \cdot V) = W \cdot U$$ $$h(V \cdot U) + k(V \cdot V) = W \cdot V$$ Now you have two simultaneous equations for $h$ and $k$, which are easy to solve (using Cramer's rule, for example).

Of course, all of this is much easier if $U$ and $V$ are perpendicular, because then
$U \cdot V$ is zero. If $U$ and $V$ have unit length, it gets even easier, because then $U \cdot U$ and $V \cdot V$ are both equal to 1.

-

Just directly building upon bubba's answer, in Matrix form this can be computed by doing $$Y = \left(M^TM\right)^{-1}M^TW$$ where $M=\left\{\begin{matrix} |\\ U \;|\; V \\ | \end{matrix}\right\}$ is the matrix that contains the basis vectors and $Y=\left\{\begin{matrix} h\\ k \end{matrix}\right\}$ is the projection of W (your original vector) on said basis.

-