Gram–Schmidt Calculator

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

Vectors as rows
Rows
2
Columns
3

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

Try

Result

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

(22,22,0), (66,−66,63)\displaystyle \left(\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2}, 0\right),\ \left(\frac{\sqrt{6}}{6}, -\frac{\sqrt{6}}{6}, \frac{\sqrt{6}}{3}\right)

Orthogonal (not normalised)

(1,1,0), (12,−12,1)\displaystyle \left(1, 1, 0\right),\ \left(\frac{1}{2}, -\frac{1}{2}, 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,1,0)\mathbf{e}_{1} = \left(1, 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,0,1)−(12)(1,1,0)=(12,−12,1)\begin{aligned} \mathbf{e}_{2} &= \left(1, 0, 1\right) - \left(\frac{1}{2}\right)\left(1, 1, 0\right) \\ &= \left(\frac{1}{2}, -\frac{1}{2}, 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=12(1,1,0)=(22,22,0),  q2=132(12,−12,1)=(66,−66,63)\mathbf{q}_{1} = \frac{1}{\sqrt{2}}\left(1, 1, 0\right) = \left(\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2}, 0\right),\ \ \mathbf{q}_{2} = \frac{1}{\sqrt{\frac{3}{2}}}\left(\frac{1}{2}, -\frac{1}{2}, 1\right) = \left(\frac{\sqrt{6}}{6}, -\frac{\sqrt{6}}{6}, \frac{\sqrt{6}}{3}\right)
  4. Result

    So the orthonormal vectors are (22,22,0), (66,−66,63)\left(\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2}, 0\right),\ \left(\frac{\sqrt{6}}{6}, -\frac{\sqrt{6}}{6}, \frac{\sqrt{6}}{3}\right).

Worked examples