Orthogonal Vector Generator
Two vectors are perpendicular exactly when their dot product is zero — and with whole-number entries that is an exact integer zero, not a small floating-point number that might be rounding. Gram-Schmidt would introduce fractions, so these are found by drawing candidates and keeping only those already orthogonal to everything chosen, which keeps every entry an integer and every check exact.
What this generator does
Draws candidate vectors and keeps only those whose dot product with every vector already chosen is exactly zero. Every pairwise dot product is then listed, along with each vector's squared length as an integer.
How to use this tool
- Choose the number of dimensions and how many vectors you want.
- Compute the dot products yourself.
- Check every pair comes to exactly zero.
- Copy the vectors if you need an orthogonal set.
Understanding the controls
- How many dimensions
- Between 2 and 6. At most this many vectors can be mutually orthogonal, which is what dimension means.
- How many vectors
- Up to six, and never more than the dimension allows — the generator stops when no more can be found.
- Seed
- Reproduces exactly the same set of vectors.
Common use cases
- Test data where exact orthogonality matters
- Dot product practice with answers that are exactly zero
- Showing that at most n vectors can be mutually perpendicular in n dimensions
- Basis examples that avoid fractions
- Reproducing the same set from a seed
How this generator works
Rejection sampling rather than Gram-Schmidt, precisely because orthogonalising integer vectors introduces fractions. The check confirms every pair has a dot product of exactly zero, that no vector is the zero vector — which is trivially orthogonal to everything and proves nothing — and that the count never exceeds the dimension.
Randomness and fairness
The vectors are random within the orthogonality constraint. Seeded sets reproduce exactly and are therefore explicitly not cryptographically secure, and unseeded ones use the browser's cryptographically secure generator.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- Vectors are not normalised, so this is an orthogonal set rather than an orthonormal basis — normalising would introduce square roots.
- Rejection sampling means fewer vectors than asked for may be returned in low dimensions.
- Entries are small whole numbers between minus four and four.
- Only real vectors; the complex inner product is different.
- Sets are not stored between visits.
Privacy and your data
Vectors and dot products are computed in your browser. Nothing is transmitted or kept.
Related generators
- Vector GeneratorA random 2D vector with its magnitude shown.
- Symmetric Matrix GeneratorMatrices that equal their own transpose, with the trace, determinant and the count of entries that are actually free.
- Random 3D Coordinate GeneratorA random three-dimensional (x, y, z) coordinate point.
- Convex Hull GeneratorRandom points with the smallest convex boundary around them, every point checked to lie on or inside it.