411 REFERENCE · Wikibooks
Linear Algebra and the C Language/a0ow
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
__NOTOC__
Dot Product
In mathematics, the dot product is an algebraic operation that takes two equal-length sequences of numbers (usually coordinate vectors), and returns a single number.... Wikipedia: Dot product
Compute orthogonal vectors
You want to compute the orthogonal vectors to the vectors V. To calculate these vectors, I chose the algorithm that calculates free vectors. I create a system Ab with at least two rows and I solve this system using the free variables algorithm.
/* The algorithm of free variables (The free vectors: b_free) */
gj_PP_mR(Ab,NO);
put_zeroR_mR(Ab,Ab_free);
put_freeV_mR(Ab_free);
gj_PP_mR(Ab_free,YES);
c_Ab_b_mR(Ab_free,b_free);
I check if the dot product of two vectors is zero; this means that they are orthogonal to each other.
for(c=C0; c<VARRAY; c++)
for(r=C0; r<UARRAY; r++)
printf(" v^t[%d] u[%d] = %+.4f\n",c,r, dot_R(vt[c],u[r]));
If you want normalize the vectors, you can find an example Here
Application
Compute an orthogonal vector:
In ℝ2
In ℝ3
In ℝ4
Compute two orthogonal vectors:
In ℝ3
In ℝ4
Compute three orthogonal vectors:
In ℝ4
Compute four orthogonal vectors:
In ℝ6
Compute five orthogonal vector:
In ℝ6