Evanalysis
9.1Estimated reading time: 20 min

9.1 Vectors, norm, dot product, and projection

Connect coordinate arithmetic to length, angle, signed area, orthogonal projection, and the fundamental vector inequalities.

Course contents

Motivation

A displacement contains more information than a distance: moving four units right and one unit up is different from moving one unit right and four units up. Coordinates retain these separate contributions. Vectors allow us to add displacements, compare directions, and separate a movement into parts parallel and perpendicular to a chosen direction.

The same calculations make sense in any positive integer dimension nn. Geometry in two or three dimensions helps explain the formulas, but proofs using coordinates work throughout Rn\mathbb R^n. We will distinguish a vector from a scalar throughout: a sum of vectors is a vector, whereas a dot product is a real number. Zero inputs require particular care whenever a formula involves division by a length.

Coordinates and vector operations

Definition

Vectors, standard basis, and operations

For nZ+n\in\mathbb Z^+, a vector in Rn\mathbb R^n is an ordered tuple v=(v1,,vn)v=(v_1,\ldots,v_n) of real numbers. Let eie_i have entry 11 in position ii and 00 elsewhere. Then

v=i=1nviei,0=(0,,0).v=\sum_{i=1}^n v_i e_i,\qquad \mathbf0=(0,\ldots,0).

The vectors e1,,ene_1,\ldots,e_n form the standard basis. In R2\mathbb R^2 we also write e1=i,e2=je_1=\mathbf i,e_2=\mathbf j; in R3\mathbb R^3, e3=ke_3=\mathbf k. For u,vRnu,v\in\mathbb R^n and scalar tRt\in\mathbb R, define

u+v=(u1+v1,,un+vn),tv=(tv1,,tvn).u+v=(u_1+v_1,\ldots,u_n+v_n),\qquad tv=(tv_1,\ldots,tv_n).

Set v=(1)v-v=(-1)v and uv=u+(v)u-v=u+(-v). Two vectors are parallel when one is a scalar multiple of the other. This convention includes the zero vector, since 0=0v\mathbf0=0v for every vv.

The coordinate representation is unique: the iith coordinate of the displayed sum is exactly viv_i. Tuples must have the same dimension before addition. A negative scalar reverses the direction of a nonzero vector, a positive scalar preserves it, and scalar zero erases direction altogether.

Concept lensGeometric

Coordinates describe a displacement, not a fixed arrow

Represent uu and vv by arrows OU\overrightarrow{OU} and OV\overrightarrow{OV}. Translating the second arrow so its tail is at UU does not change its components. Its new endpoint WW satisfies OW=u+v\overrightarrow{OW}=u+v. This is the head-to-tail rule and also the diagonal of the parallelogram built from u,vu,v.

Subtraction answers a different question: the displacement from VV to UU is VU=uv\overrightarrow{VU}=u-v. Thus exchanging the endpoints changes the sign. Coordinate addition and the arrow construction describe the same operation; a vector records a displacement without requiring its arrow to start at the origin.

Theorem

Vector arithmetic laws

For u,v,wRnu,v,w\in\mathbb R^n and s,tRs,t\in\mathbb R,

u+v=v+u,(u+v)+w=u+(v+w),v+0=v,v+(v)=0,1v=v,s(tv)=(st)v,s(u+v)=su+sv,(s+t)v=sv+tv.\begin{gathered} u+v=v+u,\qquad (u+v)+w=u+(v+w),\\ v+\mathbf0=v,\qquad v+(-v)=\mathbf0,\qquad 1v=v,\\ s(tv)=(st)v,\qquad s(u+v)=su+sv,\qquad(s+t)v=sv+tv. \end{gathered}

Every identity follows coordinate by coordinate from the corresponding real number law. For example, the iith coordinates of s(u+v)s(u+v) and su+svsu+sv are s(ui+vi)s(u_i+v_i) and sui+svisu_i+sv_i, which are equal by real distributivity. Real commutativity, associativity, identity and inverse laws likewise establish the other displayed statements for each ii, hence for the whole tuples.

Norm and unit direction

Definition

Euclidean norm and normalization

The norm of vRnv\in\mathbb R^n is

v=v12++vn2.\|v\|=\sqrt{v_1^2+\cdots+v_n^2}.

It is nonnegative, and it is zero exactly when v=0v=\mathbf0. A vector of norm 11 is a unit vector. For v0v\ne\mathbf0, its unit vector in the same direction is v^=v/v\widehat v=v/\|v\|.

The zero-norm assertion holds because a sum of nonnegative squares is zero exactly when every square is zero. For every real scalar tt,

tv2=t2v2,tv=tv.\|tv\|^2=t^2\|v\|^2,\qquad \|tv\|=|t|\|v\|.

Taking the nonnegative square root introduces t|t|, not tt. Consequently v^=1\|\widehat v\|=1 and v=vv^v=\|v\|\widehat v when v0v\ne\mathbf0. There is no unit direction obtained by normalizing the zero vector.

Worked example

Coordinate arithmetic and a unit vector

For u=(4,1)u=(4,1) and v=(2,3)v=(2,3), addition gives u+v=(6,4)u+v=(6,4). For the different pair a=(4,2)a=(4,2) and b=(1,3)b=(1,3), subtraction gives ab=(3,1)a-b=(3,-1), the displacement from endpoint bb to endpoint aa. Scaling aa gives 3a=(12,6)3a=(12,6), a/2=(2,1)a/2=(2,1), and a=(4,2)-a=(-4,-2).

For z=(4,3)z=(4,3), Pythagoras gives z=5\|z\|=5, so z^=(4/5,3/5)\widehat z=(4/5,3/5). Its squared norm is 16/25+9/25=116/25+9/25=1. Also z=5\|-z\|=5; reversing direction does not produce a negative length.

Dot product and Cauchy–Schwarz

Definition

Dot product and orthogonality

For u,vRnu,v\in\mathbb R^n,

uv=i=1nuiviR.u\cdot v=\sum_{i=1}^n u_iv_i\in\mathbb R.

In particular vv=v2v\cdot v=\|v\|^2 and 0v=0\mathbf0\cdot v=0, a scalar zero. Vectors are orthogonal when uv=0u\cdot v=0. Algebraically the zero vector is orthogonal to every vector, although it has no direction or angle.

Theorem

Dot-product laws

For u,v,wRnu,v,w\in\mathbb R^n and tRt\in\mathbb R,

uv=vu,u(v+w)=uv+uw,(tu)v=u(tv)=t(uv).u\cdot v=v\cdot u,\quad u\cdot(v+w)=u\cdot v+u\cdot w,\quad (tu)\cdot v=u\cdot(tv)=t(u\cdot v).

Moreover eiej=1e_i\cdot e_j=1 if i=ji=j, and 00 otherwise.

For distributivity, expand iui(vi+wi)\sum_i u_i(v_i+w_i) and separate the two finite sums. Symmetry follows from uivi=viuiu_iv_i=v_iu_i, and the scalar law follows by pulling tt outside the sum. The basis statement follows by checking whether the two nonzero entries occupy the same coordinate. Thus algebraic expansion of squared norms is justified by these laws, rather than by a picture.

Theorem

Cauchy–Schwarz inequality with all equality cases

For u,vRnu,v\in\mathbb R^n,

uvuv.|u\cdot v|\le\|u\|\|v\|.

Equality holds exactly when the two vectors are linearly dependent: one is a scalar multiple of the other, including every pair with a zero vector.

Proof: A nonnegative squared residual controls the dot product

Boundary first. If v=0v=\mathbf0, both sides are zero and equality holds; the pair is dependent. We may therefore assume v0v\ne\mathbf0.

Legal choice. Set t=(uv)/v2t=(u\cdot v)/\|v\|^2. The denominator is strictly positive. Dot-product expansion gives

0utv2=u22t(uv)+t2v2=u2(uv)2v2.0\le\|u-tv\|^2 =\|u\|^2-2t(u\cdot v)+t^2\|v\|^2 =\|u\|^2-\frac{(u\cdot v)^2}{\|v\|^2}.

Conclusion. Multiply by the positive denominator and take nonnegative square roots. This yields Cauchy–Schwarz without assuming an angle formula.

Equality dependency. Equality holds precisely when utv=0\|u-tv\|=0, that is, u=tvu=tv. Conversely this relation gives equality by norm scaling. Together with the separate v=0v=\mathbf0 case, this covers every dependent pair. Writing only u=tvu=tv without the separate zero case would miss nonzero uu paired with v=0v=\mathbf0.

Checkpoint

Q1. Is the dot product of the zero vector with v a vector or a scalar? Can an angle be assigned?

Keep the output type separate from the zero-input condition.

Solution · Quick-check Q1

It is the scalar 00. An angle involving the zero vector is undefined, even though the algebraic dot product and orthogonality relation are defined.

Angle and signed area

For nonzero u,vu,v, Cauchy–Schwarz places (uv)/(uv)(u\cdot v)/(\|u\|\|v\|) in [1,1][-1,1]. The angle θ[0,π]\theta\in[0,\pi] is therefore determined by

cosθ=uvuv.\cos\theta=\frac{u\cdot v}{\|u\|\|v\|}.

In the plane this agrees with the geometric angle: expand uv2=u2+v22uv\|u-v\|^2=\|u\|^2+\|v\|^2-2u\cdot v and compare with the cosine law. For nonzero vectors, a positive dot product gives 0θ<π/20\le\theta\lt\pi/2; zero gives θ=π/2\theta=\pi/2; negative gives π/2<θπ\pi/2\lt\theta\le\pi. The endpoints 0,π0,\pi correspond to parallel directions. Orthogonality is equivalent to a right angle only when both vectors are nonzero.

Worked example

A dot product and an obtuse angle

For u=(4,2,3)u=(4,2,3) and v=(2,6,5)v=(-2,6,5), uv=8+12+15=19u\cdot v=-8+12+15=19. The output is one scalar, not a new vector. For a=(3,0)a=(3,0) and b=(2,2)b=(-2,2), we have ab=6a\cdot b=-6, a=3\|a\|=3, and b=22\|b\|=2\sqrt2. Thus cosθ=1/2\cos\theta=-1/\sqrt2 and θ=3π/4\theta=3\pi/4. Both norms are nonzero, and the negative dot product correctly predicts an obtuse angle.

For u=(u1,u2)u=(u_1,u_2) in the oriented plane, its counterclockwise quarter-turn is u=(u2,u1)u^\perp=(-u_2,u_1). The signed parallelogram area is

A(u,v)=uv=u1v2u2v1.A(u,v)=u^\perp\cdot v=u_1v_2-u_2v_1.

For nonzero vectors and the directed angle ϕ\phi from uu to vv, this equals uvsinϕ\|u\|\|v\|\sin\phi. Indeed the quarter-turn changes the cosine expression to cos(ϕπ/2)=sinϕ\cos(\phi-\pi/2)=\sin\phi. This directed angle records orientation, unlike the unsigned angle θ\theta. Ordinary area is A(u,v)|A(u,v)|; exchanging the two vectors reverses the sign. The coordinate formula also handles zero or parallel vectors, giving zero area without assigning an angle to zero.

Worked example

Orientation changes the sign of area

A(i,j)=1A(\mathbf i,\mathbf j)=1, whereas A(j,i)=1A(\mathbf j,\mathbf i)=-1. For u=(2,3)u=(2,3) and v=(4,1)v=(-4,1),

A(u,v)=213(4)=14.A(u,v)=2\cdot1-3(-4)=14.

The ordinary area is 1414. Reversing the order gives signed area 14-14 but the same ordinary area; the sign describes orientation, not negative size.

Projection and orthogonal decomposition

Length alone cannot tell us how much of one displacement points along another. For a nonzero direction ww, the signed scalar component of vv is (vw)/w(v\cdot w)/\|w\|. Dividing the dot product by w2\|w\|^2 instead gives the coefficient multiplying ww in the projection vector. This is why projection follows norm and angle.

Theorem

Projection onto a nonzero direction

Let v,wRnv,w\in\mathbb R^n with w0w\ne\mathbf0. Define

p=projw(v)=vww2w,r=vp.p=\operatorname{proj}_w(v)=\frac{v\cdot w}{\|w\|^2}w,\qquad r=v-p.

Then pp is a multiple of ww, rw=0r\cdot w=0, and v=p+rv=p+r. This decomposition into a multiple of ww and a vector orthogonal to ww is unique.

To derive the formula, write p=twp=tw. The required condition (vtw)w=0(v-tw)\cdot w=0 becomes vwtw2=0v\cdot w-t\|w\|^2=0, which has the unique solution t=(vw)/w2t=(v\cdot w)/\|w\|^2. Substitution verifies the orthogonality. This also proves uniqueness, since every admissible parallel component must have that coefficient. The residual is perpendicular to ww, not generally to vv.

Orthogonality also explains how projection affects length. Since pp is a multiple of ww and rw=0r\cdot w=0, we have pr=0p\cdot r=0. Expanding the squared norm of v=p+rv=p+r therefore gives

v2=p2+r2.\|v\|^2=\|p\|^2+\|r\|^2.

Thus pv\|p\|\le\|v\|: projection cannot increase length. Equality holds exactly when r=0r=\mathbf0, meaning that vv already lies along the chosen direction. This includes v=0v=\mathbf0 and also negative multiples of ww; projection onto the direction line does not discard the opposite direction. The residual accounts for precisely the squared length missing from the projected component, so the inequality follows from the decomposition itself.

When v0v\ne\mathbf0, the same formula is p=(vcosθ)w^p=(\|v\|\cos\theta)\widehat w. The scalar component along w^\widehat w is signed: it is negative for an obtuse angle. The norm of the projection is vcosθ|\|v\|\cos\theta|, so confusing scalar component with length loses a sign. If v=0v=\mathbf0, the algebraic projection is zero without requiring an angle.

Worked example

Projecting in either direction gives different vectors

For v=(3,2)v=(3,2) and w=(1,1)w=(1,1), vw=5v\cdot w=5 and w2=2\|w\|^2=2. Hence

p=(5/2,5/2),r=(1/2,1/2).p=(5/2,5/2),\qquad r=(1/2,-1/2).

Check p+r=vp+r=v and rw=1/21/2=0r\cdot w=1/2-1/2=0. But rv=3/21=1/2r\cdot v=3/2-1=1/2, so the residual is not perpendicular to vv. Reversing the projection gives projv(w)=513(3,2)\operatorname{proj}_v(w)=\frac5{13}(3,2), since v2=13\|v\|^2=13. The dot product is symmetric, but the projection operation is not.

Counterexample mode

The zero vector cannot supply a projection direction

The claim that the displayed projection formula works for every ww is false. Take v=(1,0)v=(1,0) and w=(0,0)w=(0,0). Its coefficient becomes 0/00/0, which is undefined; a zero numerator does not repair a zero denominator.

The correct hypothesis is w0w\ne\mathbf0. Projecting v=0v=\mathbf0 onto a nonzero ww is permitted, but projecting onto a zero direction is not defined by this formula. The same distinction applies to normalization: only a nonzero vector has the unit direction v/vv/\|v\|.

Checkpoint

Q2. Which vector is orthogonal to the projection residual, and which denominator must be nonzero?

Use the equation that determines the projection coefficient.

Solution · Quick-check Q2

The residual is orthogonal to the direction vector ww. The denominator is w2\|w\|^2, which is positive exactly when w0w\ne\mathbf0.

Triangle inequality and the parallelogram law

Theorem

Triangle inequality and equality

For u,vRnu,v\in\mathbb R^n,

u+vu+v.\|u+v\|\le\|u\|+\|v\|.

Equality holds if either vector is zero, or if both are nonzero and one is a positive scalar multiple of the other. Equivalently, one vector is a nonnegative scalar multiple of the other, with either ordering allowed.

By the dot-product laws and Cauchy–Schwarz,

u+v2=u2+2uv+v2u2+2uv+v2(u+v)2.\begin{aligned} \|u+v\|^2 &=\|u\|^2+2u\cdot v+\|v\|^2\\ &\le\|u\|^2+2|u\cdot v|+\|v\|^2\\ &\le(\|u\|+\|v\|)^2. \end{aligned}

Both sides before taking square roots are nonnegative. Equality requires both inequalities to be equalities: dependence from Cauchy–Schwarz, together with uv0u\cdot v\ge0. For two nonzero dependent vectors this requires the same direction. If either vector is zero, direct substitution gives equality. Opposite nonzero directions give Cauchy–Schwarz equality but strict triangle inequality, so dependence alone is insufficient here.

Expanding both squared norms and adding cancels the mixed terms:

u+v2+uv2=2u2+2v2.\|u+v\|^2+\|u-v\|^2=2\|u\|^2+2\|v\|^2.

This is the parallelogram law. Its diagonals are represented by u+vu+v and uvu-v; the four side lengths contribute twice each of u2\|u\|^2 and v2\|v\|^2. It remains true when the parallelogram degenerates.

Summary

Coordinate laws support geometric reasoning in every Rn\mathbb R^n. The dot product gives squared length and orthogonality; Cauchy–Schwarz makes the angle formula valid and identifies dependent equality cases. Projection separates a vector along a nonzero direction, while the triangle inequality additionally distinguishes same from opposite directions. Signed planar area records orientation, and the parallelogram law compares sides with diagonals.

Exercises

  1. Compute the projection decomposition of v=(2,1,3)v=(2,1,3) along w=(1,2,2)w=(1,-2,2). Verify the sum and the required orthogonality directly.
  2. For u=(1,0)u=(1,0) and v=(2,0)v=(-2,0), decide whether equality holds in Cauchy–Schwarz and in the triangle inequality. Repeat with v=0v=\mathbf0.
  3. A circle has centre OO, positive radius RR, and diameter ABAB. If CC lies on the circle with CA,BC\ne A,B, prove ACB=π/2\angle ACB=\pi/2 using dot products. Explain the endpoint restriction.
  4. Derive the parallelogram law by writing out both squared norms, and check it for u=(4,1)u=(4,1) and v=(2,3)v=(2,3).

Guided solutions

Solution · Solution 1

vw=22+6=6v\cdot w=2-2+6=6 and w2=9\|w\|^2=9, so

p=23(1,2,2),r=vp=13(4,7,5).p=\frac23(1,-2,2),\qquad r=v-p=\frac13(4,7,5).

Their sum is (2,1,3)(2,1,3). Also rw=(414+10)/3=0r\cdot w=(4-14+10)/3=0, while pp is visibly a multiple of ww.

Solution · Solution 2

For v=(2,0)v=(-2,0), uv=2=uv|u\cdot v|=2=\|u\|\|v\|, but u+v=1<3=u+v\|u+v\|=1\lt3=\|u\|+\|v\|. The vectors have opposite directions. For v=0v=\mathbf0, both inequalities are equalities; no angle is needed.

Solution · Solution 3

Use OO as origin and write a=OAa=\overrightarrow{OA}, b=OB=ab=\overrightarrow{OB}=-a, c=OCc=\overrightarrow{OC}. Then a=c=R\|a\|=\|c\|=R and

CACB=(ac)(ac)=a2+c2=0.\overrightarrow{CA}\cdot\overrightarrow{CB} =(a-c)\cdot(-a-c)=-\|a\|^2+\|c\|^2=0.

The mixed terms cancel by symmetry. Since CA,BC\ne A,B, both vectors are nonzero, so orthogonality gives the stated right angle. At an endpoint one vector would be zero, and the angle would be undefined.

Solution · Solution 4

The two expansions are u2±2uv+v2\|u\|^2\pm2u\cdot v+\|v\|^2; adding gives the law. For the given vectors, u2=17\|u\|^2=17, v2=13\|v\|^2=13, u+v2=52\|u+v\|^2=52, and uv2=8\|u-v\|^2=8. Thus both sides are 6060.