Matrices.org

Vector Projection Calculator

Calculate the projection of one vector onto another vector. Enter two vectors to find the vector projection, scalar projection, dot product, and magnitude of the projected vector. This calculator supports 2D, 3D, and higher-dimensional vectors with up to 8 components.

Calculate Vector Projection

Enter the components of Vector A and Vector B. Both vectors must have the same dimension.

Example: 3, 4 or 2, 3, 1
Example: 1, 2 or 1, 0, 2

What Is Vector Projection?

Vector projection is the process of finding the part of one vector that points in the direction of another vector. The projection of vector A onto vector B is a new vector that is parallel to B.

Geometrically, imagine dropping a perpendicular line from the tip of A onto the line containing B. The signed distance along B from the origin to the foot of that perpendicular represents the scalar projection. The vector from the origin to that point is the vector projection.

Projection is useful in geometry, physics, engineering, computer graphics, data science, and linear algebra.

Vector Projection Formula

The vector projection of A onto a nonzero vector B is calculated using the dot product:

projB(A) = ((A · B) / (B · B)) B

Since B · B is the squared magnitude of B, the formula can also be written as:

projB(A) = ((A · B) / |B|²) B

Scalar Projection Formula

The scalar projection measures the signed length of A in the direction of B:

compB(A) = (A · B) / |B|

A positive scalar projection means the vectors have an acute angle between them. A negative value means their angle is obtuse. A value of zero means the vectors are perpendicular.

Example: Projecting a 2D Vector

Suppose the vectors are:

A = (3, 4),   B = (1, 2)

Step 1: Calculate the dot product

A · B = (3 × 1) + (4 × 2) = 11

Step 2: Calculate the squared magnitude of B

B · B = 1² + 2² = 5

Step 3: Calculate the coefficient

k = 11 / 5 = 2.2

Step 4: Multiply B by the coefficient

projB(A) = 2.2(1, 2) = (2.2, 4.4)

Therefore, the projection of (3, 4) onto (1, 2) is (2.2, 4.4).

Vector Projection in 3D and Higher Dimensions

The same formula works in three dimensions and in higher-dimensional vector spaces. There is no need for a separate geometric formula for 3D vectors.

For example, if A = (2, 3, 1) and B = (1, 0, 2), then:

A · B = (2 × 1) + (3 × 0) + (1 × 2) = 4
B · B = 1² + 0² + 2² = 5
projB(A) = (4/5)(1, 0, 2) = (0.8, 0, 1.6)

The calculator supports vectors containing between 2 and 8 components. Both vectors must have the same number of components.

Vector Projection vs. Vector Rejection

Projection and rejection are complementary components of a vector. The projection is parallel to the target vector, while the rejection is perpendicular to it.

A = projB(A) + (A − projB(A))

The rejection is also called the perpendicular component of A relative to B. In an ordinary Euclidean vector space, the projection and rejection are orthogonal.

Important Properties of Vector Projection

Applications of Vector Projection

Physics

Projection separates a force into components parallel and perpendicular to a direction, such as the component of gravity along an inclined plane.

Computer Graphics

Projection is used to calculate directional components, lighting, shading, and geometric relationships between objects.

Engineering

Engineers use vector projection to resolve forces, velocities, displacements, and other vector quantities along selected axes.

Data Science and Linear Algebra

Projection is central to least-squares methods, orthogonal decomposition, regression, and projecting data onto subspaces.

Frequently Asked Questions

1. What is the projection of one vector onto another?

It is the component of the first vector that lies along the direction of the second vector. The result is parallel to the second vector.

2. What is the vector projection formula?

The formula is projB(A) = ((A · B) / (B · B))B, provided B is not the zero vector.

3. What is the difference between scalar and vector projection?

Scalar projection is a signed number representing a length. Vector projection is a vector pointing along the target vector.

4. Can the scalar projection be negative?

Yes. It is negative when the angle between the vectors is obtuse, meaning the vectors point partly in opposite directions.

5. Can I project onto a zero vector?

No. The denominator B · B would equal zero, so projection onto the zero vector is undefined.

6. Does this calculator support 3D vectors?

Yes. Enter three components for each vector. You can also calculate projections in dimensions 2 through 8.

7. What happens if the vectors are perpendicular?

Their dot product is zero, so the projection of A onto B is the zero vector.

8. Can I enter fractions?

Yes. Components can be entered as fractions such as 1/2 or -3/4, decimals, integers, and scientific notation.

Related Calculators

Explore more vector and matrix tools: