# Orthogonalize

Orthogonalize[{v1,v2,}]

gives an orthonormal basis found by orthogonalizing the vectors vi.

Orthogonalize[{e1,e2,},f]

gives an orthonormal basis found by orthogonalizing the elements ei with respect to the inner product function f.

# Details and Options • Orthogonalize[{v1,v2,}] uses the ordinary scalar product as an inner product.
• The output from Orthogonalize always contains the same number of vectors as the input. If some of the input vectors are not linearly independent, the output will contain zero vectors.
• All nonzero vectors in the output are normalized to unit length.
• The inner product function f is applied to pairs of linear combinations of the ei.
• The ei can be any expressions for which f always yields real results. »
• Orthogonalize[{v1,v2,},Dot] effectively assumes that all elements of the vi are real. »
• Orthogonalize by default generates a GramSchmidt basis.
• Other bases can be obtained by giving alternative settings for the Method option. Possible settings include: "GramSchmidt", "ModifiedGramSchmidt", "Reorthogonalization", and "Householder".
• Orthogonalize[list,Tolerance->t] sets to zero elements whose relative norm falls below t.

# Examples

open allclose all

## Basic Examples(1)

Find an orthonormal basis for two 3D vectors:

Find the coefficients of a general vector with respect to this basis:

## Scope(13)

### Basic Uses(6)

Orthogonalize a set of machine-precision vectors:

Orthogonalize complex vectors:

Orthogonalize exact vectors:

Orthogonalize arbitrary-precision vectors:

Orthogonalize symbolic vectors:

Simplify the result assuming a and b are real-valued:

Large numerical matrices are handled efficiently:

### Special Matrices(4)

Orthogonalize the rows of a sparse matrix:

Orthogonalize the rows of structured matrices:

Orthogonalizing a diagonal matrix produces another diagonal matrix:

Orthogonalize HilbertMatrix:

### ּGeneral Inner Products(3)

Find a symbolic basis, assuming all variables are real:

Orthogonalize vectors that are not lists using an explicit inner product:

Specify the inner product using a pure function:

## Options(3)

### Tolerance(1)

Below the tolerance, two vectors are not recognized as linearly independent:

### Method(2)

m forms a set of vectors that are nearly linearly dependent:

Deviation from orthonormality for the default method:

Deviation for all of the methods:

For a large numerical matrix, the Householder method is usually fastest:

## Applications(1)

Derive normalized Legendre polynomials by orthogonalizing powers of :

Derive normalized Hermite polynomials:

## Properties & Relations(6)

In dimensions, there can be at most elements in the orthonormal basis:

Most sets of random -dimensional vectors are spanned by exactly basis vectors:

With the default method, the first element of the basis is always a multiple of the first vector:

For linearly independent vectors, the result is an orthonormal set:

Verify using matrix multiplication:

For linearly independent vectors, the result is a set orthonormal with the given inner product:

Verify orthonormality:

is related to :

They are the same up to sign: