Vector Projection Calculator

Enter two vectors a and b (in 2D or 3D) and the Vector Projection Calculator computes the orthogonal projection of a onto b. Provide each vector's components — x, y, and optionally z — and get back the projection vector components, the scalar projection, and the orthogonal component.

Used only in 3D mode

Used only in 3D mode

Results

Scalar Projection (comp)

--

Projection Vector — x

--

Projection Vector — y

--

Projection Vector — z

--

Orthogonal Component — x

--

Orthogonal Component — y

--

Orthogonal Component — z

--

Projection Vector Magnitude |proj|

--

Angle Between Vectors (°)

--

Vector Components Comparison

Frequently Asked Questions

What is the vector projection formula?

The orthogonal projection of vector a onto vector b is given by: proj = (a·b / b·b) × b, where a·b is the dot product of a and b, and b·b is the dot product of b with itself (equal to the square of b's magnitude). The result is a vector pointing in the direction of b.

What is the difference between scalar projection and vector projection?

The scalar projection (also called the component of a along b) is a single number: comp = a·b / |b|. The vector projection is the full vector result: proj = (a·b / |b|²) × b. The scalar projection gives the signed length of the shadow, while the vector projection gives the actual shadow vector.

How do I calculate the projection of vector a on b?

First compute the dot product a·b by multiplying corresponding components and summing them. Then divide by the squared magnitude of b (|b|²). Finally, multiply this scalar by each component of vector b. The result is the projection vector.

What is the orthogonal component of the projection?

The orthogonal component (also written as ort) is the part of vector a that is perpendicular to b. It is calculated as ort = a − proj, where proj is the vector projection of a onto b. Together, proj and ort decompose a completely: a = proj + ort.

What is the length (magnitude) of the vector projection?

The magnitude of the projection vector equals the absolute value of the scalar projection: |proj| = |a·b| / |b|. This is always a non-negative number representing the length of the shadow vector cast by a onto the direction of b.

What is the projection of [3, 4] onto [1, 1]?

The dot product is 3×1 + 4×1 = 7. The squared magnitude of [1,1] is 1+1 = 2. So the scalar coefficient is 7/2 = 3.5. The projection vector is 3.5 × [1, 1] = [3.5, 3.5]. The orthogonal component is [3−3.5, 4−3.5] = [−0.5, 0.5].

What are the applications of vector projections in data science?

Vector projections underpin many data science techniques. Principal Component Analysis (PCA) uses projections to reduce dimensionality by projecting data onto principal axes. Orthogonal projections also appear in linear regression (projecting the target vector onto the column space of the feature matrix), recommendation systems, and natural language processing with word embeddings.

Does the vector projection work in 2D and 3D?

Yes. The same formula proj = (a·b / b·b) × b works in both 2D and 3D (and higher dimensions). In 2D you supply x and y components; in 3D you add a z component. This calculator supports both modes — select your desired dimension before entering the values.

More Math Tools