# How to make two vectors orthogonal?

From my question on CV, I need to find a way to make my two vectors orthogonal. They are:

$${\bf{v}} = \pmatrix{1 \\ 1 \\ 1 \\ 1 \\ 1 } \hspace{1.5cm} {\bf{w}} = \pmatrix{0.25 \\ 0.0625 \\ 0 \\ 0.0625 \\ 0.25}$$

What I (think) I need is the step that makes these two vectors orthogonal and I think that will give me my orthogonal regression model.

But how do I do this? It's not Gram-Schmidt is it?

EDIT:

1) Fixed spelling of Gram-Schmidt thanks to the comment.

2) Basically, for my regression model to be orthogonal, I need all the sum of all the linear terms to be 0 and the sum of all the quadratic terms to be 0. The vector ${\bf{w}}$ is all the $x_i^2$ terms in matrix form. What I need is effectively the dot product of ${\bf{v \cdot w' }} = 0$, where ${\bf{w'}}$ is basically ${\bf{w}}$ transformed in some way such that the sum of all these new terms equal $0$. Does that make sense?

-
One of these vectors is in $\mathbb{R}^6$ and another is in $\mathbb{R}^5$. Is this really what you meant? –  anorton Jan 11 '13 at 22:36
Do you want two orthogonal vectors which form a basis of the subspace generated by the two you have given? –  Mark Bennet Jan 11 '13 at 22:36
@anorton Whoops, no, they were both supposed to be in $\mathbb{R}^5$. –  Kaish Jan 11 '13 at 22:38
It's not Gramm-Schmidt. It's Gram-Schmidt (assuming you want to take a set of vectors that spans some space and create a new set of orthogonal vectors - typically also normalized - that spans the same space). –  dr jimbob Jan 11 '13 at 22:38
@Mark Bennet No, I want the step that makes these two vectors orthogonal, if that either a) makes sense, or b) is possible. –  Kaish Jan 11 '13 at 22:38

Let ${\bf v_1 } \equiv {\bf v }$ and ${\bf v_2 } \equiv {\bf w } - (\frac{{\bf v } \cdot {\bf w}}{\bf v \cdot v}) {\bf v}$ if you only want them to be orthogonal to each other.
Note evaluating ${\bf v_1} \cdot {\bf v_2} = {\bf v} \cdot {\bf w} - \frac{{\bf v} \cdot {\bf w}}{{\bf v} \cdot {\bf v}} ({\bf v} \cdot {\bf v}) = 0$. Any vector you could get with $a {\bf v} + b {\bf w}$ for some scalars $a$ and $b$, you can reach with $\alpha {\bf v_1} + \beta {\bf v_2}$ for some scalar $\alpha$ and $\beta$.
Oh wait, I don't think my question will work then will it? Because it will give me the vector that is orthogonal to ${\bf{v}}$ but not in the form that I need it to put it in my regression model. My model basically has to have some $\sum (x_i^2 + Ax_i + B) = 0$ and I want to work out this $A, B$. –  Kaish Jan 11 '13 at 22:46