🐻
berkeley
  • #Despair
  • 16A/B
    • Thevenin and Norton Equivalence
    • Resistive Touchscreen
    • Trilateration and Correlation
    • RC Circuits & Transient Analysis
  • 61B
    • Testing
    • References in Java
    • Linked Lists in Java
    • Implementation Inheritance
    • Comparables and Iterators
    • Casting
    • Lists and Sets
    • Asymptotics
    • Trees
    • Hashing
    • PriorityQueue and Heap
    • Graphs, Tree Traversals
    • Tries
    • Sorting
  • Discrete Mathematics
    • Sets + Mathematical Notation
    • Logic and Proofs
    • Induction
    • Cryptography/RSA
    • Modular Arithmetic
    • Discrete Probability
  • Linear Algebra
    • Linear Equations
    • Matrix Algebra
    • Determinants
    • Vector Spaces
    • Eigenvectors and Eigenvalues
    • Projections and Orthogonality
    • SVD/PCA
  • Math 275 — Ordinary Differential Equations
    • Math 275 — Overview
    • Modeling via Differential Equations
    • Linear Systems
  • INTEGBI 35AC
    • Humans Came From Fish
    • Evolution's History
    • Typology
    • The Human Diaspora
  • 170
    • Basics
    • Divide and Conquer
    • Fast Fourier Transform
    • Graphs
    • Greedy
  • 61C
    • Pointers and Memory
    • Floating Point
    • Compliation, Assembly, Linking, Loading
    • RISC-V, Assembly
Powered by GitBook
On this page
  • Dot Products
  • Orthogonal Vectors
  • Orthogonal Sets
  • Decomposition and Projection
  • The Orthogonal Decomposition Theorem
  • The Best Approximation Theorem
  • Properties of Orthonormal Matrices
  • The Gram-Schmidt Process
  • QR Decomposition

Was this helpful?

  1. Linear Algebra

Projections and Orthogonality

Dot Products

Dot products are rather simple. Let's say you have a vector vvv with elements v1,v2,v3,vnv_1,v_2,v_3,v_nv1​,v2​,v3​,vn​ and so on, and a vector uuu with elements u1,u2,u3,un.u_1,u_2,u_3,u_n.u1​,u2​,u3​,un​. Then the dot product is as follows.

u⋅v=u1v1+u2v2+unvnu \cdot v=u_1v_1+u_2v_2+u_nv_nu⋅v=u1​v1​+u2​v2​+un​vn​

Here are some properties of dot products.

  • u⋅v=v⋅uu\cdot v=v\cdot uu⋅v=v⋅u

  • c(u⋅v)=(cu)⋅v=u⋅(cv)c(u\cdot v)=(cu)\cdot v=u\cdot(cv)c(u⋅v)=(cu)⋅v=u⋅(cv)

  • (u+v)⋅p=p⋅u+v⋅p(u+v)\cdot p=p\cdot u + v\cdot p(u+v)⋅p=p⋅u+v⋅p

It's a somewhat uncommon way of expressing it but you can also express the length (or norm) of a vector using dot products.

u⋅u\sqrt{u\cdot u}u⋅u​

Orthogonal Vectors

Two vectors are orthogonal if their dot product equals zero.

Let's talk about vector spaces WWW and W⊥.W^{\perp}.W⊥.

We're gonna assume that WWW is a subspace of RnR^nRn.

  • W⊥W^{\perp} W⊥ is vector space made of vectors where every vector vvv in W⊥W^{\perp}W⊥ is orthogonal to every vector in WWW

  • W⊥W^{\perp} W⊥ is a subspace of RnR^{n}Rn .

W⊥W^{\perp}W⊥ is referred to as the orthogonal complement of W.W.W.

There are a few important orthogonal complements to take note of based on the vectors that we have learned.

  • (RowA)⊥=NulA(Row A)^{\perp}=NulA(RowA)⊥=NulA

  • (ColA)⊥=NulA⊺(ColA)^{\perp}=NulA^{\intercal}(ColA)⊥=NulA⊺

In words, this means that all of the columns of Row A are orthogonal to every column in Nul A. The second statement is saying all of the columns of Col A are orthogonal to every row in Nul A.

The proof for this is simply that the definition of a null space of A is that Ax=0Ax=0Ax=0 , meaning that all the dot products of each row of A and x is 0, fitting the definitions of an orthogonal vector.

Orthogonal Sets

An orthogonal set is a set of vectors in which each vector in the set is orthogonal to every other vector in the set. Note that if the set contains all nonzero vectors, the vectors in the set are linearly independent.

An orthogonal basis for a subspace W in R^n is exactly what it sounds like it is.

Here is a theorem of orthogonal sets. Assuming {u1,u2,up}\{u_1, u_2, u_p\}{u1​,u2​,up​} is an orthogonal basis, the weights in the linear combination for each vector yyyin WWW (the orthogonal basis), y=c1u1+c2u2...etcy=c_1u_1+c_2u_2...etcy=c1​u1​+c2​u2​...etc the weights are cj=y⋅ujuj⋅ujc_j=\frac{y\cdot u_j}{u_j\cdot u_j}cj​=uj​⋅uj​y⋅uj​​.

Decomposition and Projection

Let's say we had a vector yyy in Rn.R^n.Rn. We can decompose or break up into parts, that vector, into two vectors where one a multiple of some nonzero vector uuu and some other vector orthogonal to it. In other words, observe the diagram.

Here is the notation for the that bottom vector — it is written as βz=y^\beta z=\hat{y}βz=y^​. In accordance of our original goal of decomposing the vector yyy into the sum of two vectors, we find that y=y^+z.y=\hat{y}+z.y=y^​+z. However, this form useless insofar as we don't know the constant β.\beta.β. Let's look at a more useful form below that doesn't involve calculating the constant at all.

y^=y⋅uu⋅uu\hat{y}=\frac{y\cdot u}{u\cdot u}uy^​=u⋅uy⋅u​u

The Orthogonal Decomposition Theorem

Let WWWbe a subspace of Rn.R^n.Rn. Then each yyy inRnR^nRncan be expressed uniquely in the following form.

y=y^+zy=\hat{y}+zy=y^​+z

where y^\hat{y}y^​ is in WWW and zzz is in W⊥.W^{\perp}.W⊥. Keeping in mind that {u1,u2,up}\{u_1, u_2, u_p\}{u1​,u2​,up​} is an orthogonal basis for WWW, the following holds true.

y^=y⋅u1u1⋅u1u1+y⋅u2u2⋅u2u2+y⋅upup⋅upup\hat{y}=\frac{y\cdot u_1}{u_1\cdot u_1}u_1+\frac{y\cdot u_2}{u_2\cdot u_2}u_2+\frac{y\cdot u_p}{u_p\cdot u_p}u_py^​=u1​⋅u1​y⋅u1​​u1​+u2​⋅u2​y⋅u2​​u2​+up​⋅up​y⋅up​​up​

And of course, z=y−y^.z=y-\hat{y}.z=y−y^​.

The Best Approximation Theorem

Given that WWWis a subspace of Rn,R^n,Rn,and yyyis any vector in Rn,R^n,Rn,and y^\hat{y}y^​ being the orthogonal projection of yyy onto WWW, y^\hat{y}y^​is the closest point in WWWtoyyy.

Properties of Orthonormal Matrices

An orthonormal matrix is a matrix whose columns from an orthogonal basis in RnR^nRnand are all unit vectors (meaning that each vector's magnitude is one). Let's look at some theorems of orthonormal bases, given UUU is an orthonormal matrix.

U⊺U=IUU⊺=projwyU^{\intercal}U=I\\ UU^{\intercal}=proj_w^yU⊺U=IUU⊺=projwy​

The Gram-Schmidt Process

The Gram-Schmidt process is a painful method of finding an orthonormal basis for a subspace. Given any basis for a nonzero subspace WWWof Rn,R^n,Rn,the following holds true.

v1=x1v2=x2−(x2⋅v1v1⋅v1v1)v3=x3−(x3⋅v1v1⋅v1v1+x3⋅v2v2⋅v2v2)vp=xp−(xp⋅v1v1⋅v1v1+xp⋅v2v2⋅v2v2+xp⋅vpvp⋅vpvp)v_1=x_1\\ v_2=x_2-(\frac{x_2\cdot v_1}{v_1\cdot v_1}v_1)\\ v_3=x_3-(\frac{x_3\cdot v_1}{v_1\cdot v_1}v_1+\frac{x_3\cdot v_2}{v_2\cdot v_2}v_2)\\ v_p=x_p-(\frac{x_p\cdot v_1}{v_1\cdot v_1}v_1+\frac{x_p\cdot v_2}{v_2\cdot v_2}v_2+\frac{x_p\cdot v_p}{v_p\cdot v_p}v_p)v1​=x1​v2​=x2​−(v1​⋅v1​x2​⋅v1​​v1​)v3​=x3​−(v1​⋅v1​x3​⋅v1​​v1​+v2​⋅v2​x3​⋅v2​​v2​)vp​=xp​−(v1​⋅v1​xp​⋅v1​​v1​+v2​⋅v2​xp​⋅v2​​v2​+vp​⋅vp​xp​⋅vp​​vp​)

QR Decomposition

A matrix A can be decomposed into a product between orthonormal matrix Q and an upper triangular matrix R. The columns of Q can be found with the Gram-Schmidt process and can be turned into unit vectors.

A=QRA=QRA=QR

Well, we know Q is orthonormal, so we can rewrite this. Remember a property mentioned earlier, that U⊺U=IU^{\intercal}U=IU⊺U=I where UUU is orthonormal. Therefore, we can rewrite the above equation like so.

Q⊺A=Q⊺QRQ^{\intercal}A=Q^{\intercal}QRQ⊺A=Q⊺QR

Which simplifies to

Q⊺A=IR⟹Q⊺A=RQ^{\intercal}A=IR\Longrightarrow Q^{\intercal}A=R Q⊺A=IR⟹Q⊺A=R

PreviousEigenvectors and EigenvaluesNextSVD/PCA

Last updated 4 years ago

Was this helpful?

The above concept is an important one to understand. It can be proven with the law of cosines, which I can't be bothered to format in LaTeX, so if you really want to know the proof it is.

here
Credit: Me