Linear Algebra

Orthogonality

↩ Back
01

Dot Product and Norm

Concept
Dot product

For $u, v \in \mathbb{R}^n$, the dot product (also called inner product or scalar product) multiplies matching entries and adds the results.

$u \cdot v = u_1v_1 + \cdots + u_nv_n$

Symmetric$u\cdot v = v\cdot u$
Distributive$(u+v)\cdot w = u\cdot w + v\cdot w$
Homogeneous$(\lambda u)\cdot v = \lambda(u\cdot v) = u\cdot(\lambda v)$
Positive definite$u\cdot u \ge 0$, and $u\cdot u = 0$ only when $u=0$
Concept
Norm (length) of a vector

Since $u\cdot u = u_1^2+\cdots+u_n^2$, the Pythagorean theorem tells us this is the square of the length of $u$. That motivates the definition of norm in any dimension.

$|u| = \sqrt{u\cdot u}$

Normalizeda vector is normalized when it has norm 1
Scaling$|\lambda u| = |\lambda|\,|u|$
Normalizingfor $u\neq 0$, the vector $u/|u|$ is normalized and points in the same direction as $u$
Interactive
Dot product and the angle between vectors

$u=(4,0)$ stays fixed along the x-axis, with $|u|=4$. Rotate $v$ and change its length to see how the dot product responds, and watch for the angle where it hits zero.

Controls
Angle and length of v
π/3
3.0

u · v = 0
02

Orthogonal Vectors and Orthogonal Sets

Concept
Orthogonal vectors

$u$ and $v$ are orthogonal when their dot product is zero. We write $u\perp v$. Being orthogonal is a property of a pair; it does not make sense to call a single vector orthogonal on its own.

$u\perp v \;\Longleftrightarrow\; u\cdot v = 0$

Orthogonality is stronger than linear independence: if two nonzero vectors are orthogonal, they are automatically independent, but the converse fails.

Orthogonal ⇒ independentnonzero $u\perp v$ are always linearly independent
Independent ⇏ orthogonale.g. $(1,0)^\top$ and $(1,1)^\top$ are independent but not orthogonal
Concept
Orthogonal sets and orthonormal bases

A set $\{u_1,\dots,u_r\}$ is orthogonal when every pair of distinct vectors in it is orthogonal. If the set is also a basis of a subspace $U$, we call it an orthogonal basis of $U$; if every vector is additionally normalized, it is an orthonormal basis.

Orthogonal set$u_i\cdot u_j = 0$ for all $i\neq j$
Orthogonal basisan orthogonal set that is also a basis of $U$
Orthonormal basisan orthogonal basis where every vector has norm 1
Example
Checking every pair
Let $u=(1,0,1)^\top$, $v=(1,1,0)^\top$, $w=(1,-1,2)^\top$. Then $u\cdot v=1$ and $u\cdot w=3$, so neither pair is orthogonal.
$v\cdot w=0$, so $\{v,w\}$ is an orthogonal set.
The full set $\{u,v,w\}$ is not orthogonal, since $u$ fails to be orthogonal to either of the other two.
03

Orthogonal Subspaces and Orthogonal Complement

Concept
Orthogonal subspaces

Subspaces $U$ and $V$ are orthogonal to each other, written $U\perp V$, when every vector of one is orthogonal to every vector of the other. It is enough to check this on the basis vectors.

$U\perp V \;\Longleftrightarrow\; u_i\cdot v_j = 0 \text{ for all basis vectors } u_i\in U,\ v_j\in V$
Concept
Orthogonal complement

Given a subspace $U\subset\mathbb{R}^n$, the orthogonal complement $U^\perp$ collects every vector orthogonal to all of $U$.

$U^\perp = \{v\in\mathbb{R}^n : v\cdot u = 0 \text{ for every } u\in U\}$

Subspace$U^\perp$ is itself a subspace of $\mathbb{R}^n$
Testingenough to check $v\cdot u_i=0$ against a basis $u_1,\dots,u_r$ of $U$
Dimensions$\dim U + \dim U^\perp = n$
Decompositionevery $u\in\mathbb{R}^n$ splits uniquely as $u=z+y$ with $z\in U$, $y\in U^\perp$
Example
Finding an orthogonal complement
1
Let $U\subset\mathbb{R}^3$ have basis $u_1=(1,1,1)^\top$, $u_2=(1,-1,0)^\top$.
2
Since $\dim U=2$, we know $\dim U^\perp = 3-2=1$, so we just need one generator.
3
Write $u'=(x,y,z)^\top$ and impose $u'\cdot u_1=0$, $u'\cdot u_2=0$: this gives $x+y+z=0$ and $x-y=0$.
4
Solving: $x=y=\lambda$ and $z=-2\lambda$, so every solution is a multiple of $(1,1,-2)^\top$.
5
Hence $U^\perp = \operatorname{Span}\{(1,1,-2)^\top\}$.
Theorem
Fundamental subspaces of a matrix

Orthogonal complements connect the four fundamental subspaces of any matrix $A$.

$(\operatorname{Row}A)^\perp = \operatorname{Nul}A, \qquad (\operatorname{Col}A)^\perp = \operatorname{Nul}(A^\top)$

SpaceOrthogonal complement
Row ANul A
Col ANul(A)
04

Orthogonal Projections

Concept
Projection of one vector onto another

The projection of $u$ over $v$ is the vector along $v$ obtained by "crushing" $u$ onto the line spanned by $v$. This is not symmetric: $\operatorname{proj}_v u$ and $\operatorname{proj}_u v$ are generally different. If $u\perp v$, the projection is 0 either way.

$\operatorname{proj}_v u = \dfrac{u\cdot v}{v\cdot v}\,v$

Projecting over $v$ is the same as projecting over any nonzero multiple $\lambda v$, so really we are projecting onto the line $\operatorname{Span}\{v\}$.

Example
A projection in R²
1
Let $u=(1,-2)^\top$, $v=(-2,0)^\top$.
2
$u\cdot v = 1(-2)+(-2)(0) = -2$, and $v\cdot v = 4$.
3
$\operatorname{proj}_v u = \dfrac{-2}{4}v = -\dfrac{1}{2}(-2,0)^\top = (1,0)^\top$.
Interactive
Projection playground

Move u (blue) and v (red) with the sliders. The black vector is the projection of u onto v.

projv u
Controls
Components of u and v
3.0
2.0
4.0
-1.0

proj_v u = (0, 0)
05

Orthogonal Bases and Projection onto a Subspace

Theorem
Coordinates as a sum of projections

When $U$ has an orthogonal basis $\{u_1,\dots,u_r\}$, the coordinates of any $u\in U$ are just its projections onto each basis vector, no linear system needed.

$u = \operatorname{proj}_{u_1}u+\cdots+\operatorname{proj}_{u_r}u = \dfrac{u\cdot u_1}{u_1\cdot u_1}u_1+\cdots+\dfrac{u\cdot u_r}{u_r\cdot u_r}u_r$

If the basis is orthonormal every denominator is 1, so the coefficients are simply $u\cdot u_i$.

Concept
Projection onto a subspace

The same idea extends to projecting any vector $v\in\mathbb{R}^n$ (not necessarily in $U$) onto $U$, using an orthogonal basis of $U$.

$\operatorname{proj}_U v = \operatorname{proj}_{u_1}v+\cdots+\operatorname{proj}_{u_r}v$

Every vector splits into its part inside $U$ and its part inside $U^\perp$.

$v = \operatorname{proj}_U v + \operatorname{proj}_{U^\perp} v$
06

Gram-Schmidt Process

Concept
Turning any basis into an orthogonal one

Given a basis $\{u_1,\dots,u_r\}$ of a subspace, not necessarily orthogonal, Gram-Schmidt builds an orthogonal basis $\{\bar u_1,\dots,\bar u_r\}$ of the same subspace. Keep the first vector, then from each later vector subtract its projections onto the vectors already built.

1
$\bar u_1 = u_1$.
2
$\bar u_2 = u_2 - \operatorname{proj}_{\bar u_1}u_2$.
3
$\bar u_3 = u_3 - \operatorname{proj}_{\bar u_1}u_3 - \operatorname{proj}_{\bar u_2}u_3$.
r
$\bar u_r = u_r - \sum_{i=1}^{r-1}\operatorname{proj}_{\bar u_i}u_r$.

Important: at each step we project onto the vectors already fixed, $\bar u_i$, never onto the original $u_i$. To get an orthonormal basis, add a final step dividing each $\bar u_i$ by its own norm.

Example
A 2-dimensional subspace of R³
1
Let $u_1=(1,2,3)^\top$, $u_2=(1,4,4)^\top$. Keep $\bar u_1 = u_1$.
2
$u_2\cdot u_1 = 1+8+12=21$, and $u_1\cdot u_1 = 1+4+9=14$.
3
$\bar u_2 = u_2 - \dfrac{21}{14}u_1 = (1,4,4)^\top - \dfrac{3}{2}(1,2,3)^\top = (-\tfrac12,1,-\tfrac12)^\top$.
4
Check: $\bar u_1\cdot\bar u_2 = 1(-\tfrac12)+2(1)+3(-\tfrac12) = 0$. Orthogonal basis found.
Example
A 3-dimensional subspace of R⁴
1
Let $u_1=(1,1,1,1)^\top$, $u_2=(1,1,0,0)^\top$, $u_3=(0,1,1,1)^\top$. Keep $\bar u_1=u_1$.
2
$\bar u_2 = u_2 - \dfrac{u_2\cdot u_1}{u_1\cdot u_1}u_1 = u_2 - \dfrac{2}{4}u_1 = \dfrac12(1,1,-1,-1)^\top$.
3
$\bar u_3 = u_3 - \dfrac{u_3\cdot u_1}{u_1\cdot u_1}u_1 - \dfrac{u_3\cdot \bar u_2}{\bar u_2\cdot \bar u_2}\bar u_2 = u_3 - \dfrac34 u_1 + \dfrac12\bar u_2$
$= \dfrac12(-1,1,0,0)^\top$
4
The vectors $\{\bar u_1,\bar u_2,\bar u_3\}$ are orthogonal to each other, as can be checked directly.
07

Orthogonal Matrices

Definition
Orthogonal matrix

A square matrix $A$ is orthogonal when its columns form an orthonormal set: each column has norm 1, and any two different columns are orthogonal to each other.

$a_i \cdot a_i = 1$ for every column $a_i$

$a_i \cdot a_j = 0$ for $i \neq j$

The name is a bit misleading: what is actually required is orthonormality (unit-length columns included), not just orthogonality between them.

Proposition and Corollary
The inverse is the transpose

Let $A$ be an orthogonal matrix of size $n\times n$.

$AA^\top = A^\top A = I_n$

A direct consequence is that computing the inverse becomes immediate for these matrices.

$A^{-1} = A^\top$
Summary
Key results by concept
ConceptWhat it gives you
Dot product$u\cdot v$, measures both length ($u\cdot u$) and angle between vectors
Orthogonal vectors$u\perp v \iff u\cdot v=0$
Orthogonal complement$U^\perp$, with $\dim U+\dim U^\perp=n$ and $(\operatorname{Row}A)^\perp=\operatorname{Nul}A$
Projection$\operatorname{proj}_v u = \dfrac{u\cdot v}{v\cdot v}v$, the shadow of $u$ over $v$
Orthogonal basiscoordinates become sums of projections, no linear system to solve
Gram-Schmidtturns any basis into an orthogonal one of the same subspace
Orthogonal matrixorthonormal columns, and $A^{-1}=A^\top$