Gram–Schmidt Calculator

Enter vectors as the rows of a matrix to orthonormalise them.

Vectors as rows
Rows
2
Columns
2

Write each vector as a row, rows separated by semicolons, like 3, 4; 0, 5.

Try

Result

You enteredGram-Schmidt on the rows of (1011)\text{Gram-Schmidt on the rows of } \begin{pmatrix} 1 & 0 \\ 1 & 1 \end{pmatrix}

(1,0), (0,1)\displaystyle \left(1, 0\right),\ \left(0, 1\right)

Orthogonal (not normalised)

(1,0), (0,1)\displaystyle \left(1, 0\right),\ \left(0, 1\right)
Show the work
  1. Start with the first vector

    The first vector needs no change: e1=a1\mathbf{e}_1 = \mathbf{a}_1. Every later one is made at right angles to it.

    e1=(1,0)\mathbf{e}_{1} = \left(1, 0\right)
  2. Remove the directions already used

    Subtract from a2\mathbf{a}_{2} its projection onto each earlier ei\mathbf{e}_i. What is left, e2\mathbf{e}_{2}, is at right angles to all of them.

    Using ek=ak−∑i<kak⋅eiei⋅eiei\mathbf{e}_k = \mathbf{a}_k - \sum_{i<k} \frac{\mathbf{a}_k \cdot \mathbf{e}_i}{\mathbf{e}_i \cdot \mathbf{e}_i}\mathbf{e}_i

    e2=(1,1)−1(1,0)=(0,1)\begin{aligned} \mathbf{e}_{2} &= \left(1, 1\right) - 1\left(1, 0\right) \\ &= \left(0, 1\right) \end{aligned}
  3. Normalise to length 1

    Divide each ek\mathbf{e}_k by its own length to get a vector of length 1 pointing the same way. The results qk\mathbf{q}_k are orthonormal: unit length and at right angles to each other.

    Using qk=ek∣ek∣\mathbf{q}_k = \frac{\mathbf{e}_k}{\left|\mathbf{e}_k\right|}

    q1=11(1,0)=(1,0),  q2=11(0,1)=(0,1)\mathbf{q}_{1} = \frac{1}{\sqrt{1}}\left(1, 0\right) = \left(1, 0\right),\ \ \mathbf{q}_{2} = \frac{1}{\sqrt{1}}\left(0, 1\right) = \left(0, 1\right)
  4. Result

    So the orthonormal vectors are (1,0), (0,1)\left(1, 0\right),\ \left(0, 1\right).

Worked examples