Gram Schmidt


Consider the matrix

\begin{align} A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 10 \end{pmatrix} \end{align}

The rows of A form a basis for $\mathbb{R}^3$, but not an orthogonal basis. We can use the rows of $A$ to generate an orthogonal basis using the gram_schmidt() method. The method returns a tuple containing two matrices $G$ and $M$: G is a matrix where each row is an element in the orthogonal set generated by the process, and M is a matrix where each row is the coefficients of the linear combination of the rows of the first matrix to generate the corresponding row in $A$. In other words, $MG = A$

Sage Cell


A = matrix(QQ, [[1, 2, 3], [4, 5, 6], [7, 8, 10]])


Creating an Orthonormal Basis

The method has an option for creating an orthonormal basis instead of a simply orthogonal one. To accomplish this, we simply set the orthonormal argument to True when calling the method. Since this procedure usually involves irrational square roots, we'll define the matrix $A$ to be over RDF, Sage's double precision real number field.


A = matrix(RDF, [[1, 2, 3], [4, 5, 6], [7, 8, 10]])


Primary Tags:

Secondary Tags:

A list of possible tags can be found at The WeBWorK Open Problem Library. For linear algebra tags see the Curated Courses Project.

Related Cells

Any related cells go here. Provide a link to the page containing the information about the cell.




Date: 12 Jun 2020 17:16

Submitted by: Zane Corbiere

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License