Vector Projection Calculator
Compute the vector projection of u onto v in 2D or 3D space, returning each component of the projected vector. Useful in physics, computer graphics, and linear algebra when decomposing forces or vectors along a given direction.
About this calculator
The vector projection of u onto v is the component of u that lies along the direction of v. The formula is proj_v(u) = ((u·v) / |v|²) · v, where u·v = u_x·v_x + u_y·v_y + u_z·v_z is the dot product and |v|² = v_x² + v_y² + v_z². The scalar factor (u·v)/|v|² is sometimes called the scalar projection coefficient. Each component of the projected vector is this scalar multiplied by the corresponding component of v: x-component = scalar · v_x, y-component = scalar · v_y, z-component = scalar · v_z. The orthogonal complement (the part of u perpendicular to v) is u − proj_v(u). These decompositions are central to resolving forces along inclined planes, projecting data in machine learning, and computing reflections in ray tracing.
How to use
Let u = (2, 3, 1) and v = (1, 0, 2). Enter u_x = 2, u_y = 3, u_z = 1, v_x = 1, v_y = 0, v_z = 2. Step 1: dot product u·v = 2·1 + 3·0 + 1·2 = 2 + 0 + 2 = 4. Step 2: |v|² = 1² + 0² + 2² = 1 + 0 + 4 = 5. Step 3: scalar = 4/5 = 0.8. Step 4: projected vector = (0.8·1, 0.8·0, 0.8·2) = (0.8, 0, 1.6). The projection of u onto v is (0.8, 0, 1.6), which lies entirely along the direction of v.
Frequently asked questions
What is the difference between scalar projection and vector projection?
The scalar projection of u onto v is the signed length of u's shadow along v, computed as (u·v)/|v|. It is a single number that can be positive or negative depending on whether u points with or against v. The vector projection is the full vector result: it scales v by this factor divided by |v| once more, giving proj_v(u) = ((u·v)/|v|²)·v. The vector projection points in the direction of v (or opposite if the scalar is negative) and has a magnitude equal to the absolute scalar projection.
How is vector projection used in physics to resolve forces?
In physics, vector projection is used to decompose a force into components parallel and perpendicular to a surface or direction of motion. For example, on an inclined plane, gravity is projected onto the surface direction to find the force causing acceleration and onto the normal direction to find the normal force. The parallel component (projection) and perpendicular component (rejection) together reconstruct the original force vector. This decomposition is also used in work calculations, where only the force component along displacement does work: W = F·d = |proj_d(F)| · |d|.
Why must the vector v be non-zero when calculating a vector projection?
The formula for vector projection involves dividing by |v|², the squared magnitude of v. If v is the zero vector, its magnitude is zero and the division is undefined. Geometrically, projecting onto a zero vector makes no sense because the zero vector has no direction. Most calculators return an error or zero in this case. Always ensure v has at least one non-zero component before computing the projection to avoid division-by-zero errors.