70. Projection

The projection of a vector 𝑥, onto a line 𝐿, denoted as Proj𝐿(𝑥), is a vector that lies on the line 𝐿, such that the difference between 𝑥 and its projection, Proj𝐿(𝑥)𝑥, is orthogonal to 𝐿

Proj𝐿(𝑥) can be seen as the “shadow”cast by 𝑥 onto 𝐿 when light shines perpendicularly to 𝐿.

Proj𝐿(𝑥)=𝑐𝑣=(𝑥𝑣𝑣𝑣)𝑣

Equivalently

Proj𝐿(𝑥)=𝑐𝑣=(𝑥𝑣𝑣2)𝑣

Where:

Example
𝑥=[23],𝑣=[21]
  1. Define the line 𝐿 as all vectors of the form 𝑐𝑣, where 𝑐 is a scalar:
𝐿={𝑐𝑣|𝑐}={𝑐[21]|𝑐}
  1. Compute the projection using
Proj𝐿(𝑥)=𝑥𝑣𝑣𝑣𝑣=[23][21][21][21][21]=75[21]=[2.81.4]

Projection as a Transformation

As a matrix vector product

𝐿={𝑐𝑣|𝑐}Proj𝐿:𝑛𝑛𝑣𝑣=𝑣2

If 𝑣 is a unit vector:

𝑣=1

Then

Proj𝐿(𝑥)=(𝑥𝑣𝑣𝑣)𝑣=(𝑥𝑣𝑣2)𝑣

If we redefine our line 𝐿 as all the scalar multiples of out unit vector 𝑢̂:

𝐿={𝑐𝑢̂|𝑐}

Simplifies to:

(𝑥𝑢̂)𝑢̂

Projection as a Linear Transformation

Let 𝑢̂𝑛 be a unit vector:

𝑢̂=[𝑢1𝑢2𝑢𝑛],where𝑢̂=1

The projection matrix 𝐴 is:

𝐴=𝑢̂𝑢̂𝑇=[𝑢1𝑢2𝑢𝑛][𝑢1𝑢2𝑢𝑛]

Expands to:

𝐴=[𝑢1𝑢1𝑢1𝑢2𝑢1𝑢𝑛𝑢2𝑢1𝑢2𝑢2𝑢2𝑢𝑛𝑢𝑛𝑢1𝑢𝑛𝑢2𝑢𝑛𝑢𝑛]

For any 𝑥𝑛, the projection of 𝑥 onto the line spanned by 𝑢̂ is:

Proj𝐿(𝑥)=𝐴𝑥=(𝑢̂𝑥)𝑢̂
Example

Consider a vector 𝑣 in 2:

𝑣=[21]

1. Construct the Unit Vector

𝑣=22+12=5𝑢̂=𝑣𝑣=15[21]=[2515]

This unit vector 𝑢̂ defines the line 𝐿, which consists of all the scalar multiples og 𝑣:

𝐿={𝑐𝑣|𝑐}

2. Derive the Projection Matrix

The projection of any vector 𝑥 onto the line 𝐿 is given by:

Proj𝐿(𝑥)=𝐴𝑥

Where 𝐴 is the projection matrix. To construct 𝐴 we use the formula:

𝐴=𝑢̂𝑢̂𝑇=[𝑢1𝑢2][𝑢1𝑢2]=[𝑢1𝑢1𝑢1𝑢2𝑢2𝑢1𝑢2𝑢2]=[2515][2515]=[(25)215252515(15)2]=[45252515]

3. Applying the Projection

To project any vector 𝑥 onto 𝐿, we multiply 𝑥 by the matrix 𝐴:

Proj𝐿(𝑥)=𝐴𝑥=[45252515]𝑥
  1. Additivity of Projections (Linearity with respect to addition)
Proj𝐿(𝑎+𝑏)=((𝑎+𝑏)𝑢̂)=(𝑎𝑢̂+𝑏𝑢̂)𝑢̂=(𝑎𝑢̂)𝑢̂+(𝑏𝑢̂)𝑢̂=Proj𝐿(𝑎)+Proj𝐿(𝑏)
  1. Homogeneity of Projections (Linearity with respect to scalar multiplication)
Proj𝐿(𝑐𝑎)=(𝑐𝑎𝑢̂)𝑢̂=𝑐(𝑎𝑢̂)𝑢̂=𝑐Proj𝐿(𝑎)

General Properties of 𝐴

  1. Idempotence
𝐴2=𝐴
  1. Symmetry
𝐴𝑇=𝐴
  1. Rank
rank(𝐴)=1

Because 𝑢̂𝑢̂𝑇 projects onto a one-dimensional subspace spanned by 𝑢̂