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 (3405)\text{Gram-Schmidt on the rows of } \begin{pmatrix} 3 & 4 \\ 0 & 5 \end{pmatrix}

(35,45), (−45,35)\displaystyle \left(\frac{3}{5}, \frac{4}{5}\right),\ \left(-\frac{4}{5}, \frac{3}{5}\right)

Orthogonal (not normalised)

(3,4), (−125,95)\displaystyle \left(3, 4\right),\ \left(-\frac{12}{5}, \frac{9}{5}\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=(3,4)\mathbf{e}_{1} = \left(3, 4\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=(0,5)−(45)(3,4)=(−125,95)\begin{aligned} \mathbf{e}_{2} &= \left(0, 5\right) - \left(\frac{4}{5}\right)\left(3, 4\right) \\ &= \left(-\frac{12}{5}, \frac{9}{5}\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=125(3,4)=(35,45),  q2=19(−125,95)=(−45,35)\mathbf{q}_{1} = \frac{1}{\sqrt{25}}\left(3, 4\right) = \left(\frac{3}{5}, \frac{4}{5}\right),\ \ \mathbf{q}_{2} = \frac{1}{\sqrt{9}}\left(-\frac{12}{5}, \frac{9}{5}\right) = \left(-\frac{4}{5}, \frac{3}{5}\right)
  4. Result

    So the orthonormal vectors are (35,45), (−45,35)\left(\frac{3}{5}, \frac{4}{5}\right),\ \left(-\frac{4}{5}, \frac{3}{5}\right).

Worked examples