1001Ferramentas
➡️ Calculators

Vector Projection Calculator

Computes scalar and vector projection of vector u onto vector v in three dimensions using dot product and unit vector.

Projection of one vector onto another

The vector projection of u onto v is the vector pointing along v that sits closest to u: projv(u) = (u · v / |v|²) · v. That scalar out front, u · v / |v|², is what rescales v. Multiply it by |v| instead and you get the scalar projection, the signed length of the shadow, compv(u) = u · v / |v|. What's left over, u − projv(u), is the piece of u that runs orthogonal to v, and this orthogonal decomposition is exactly what the Gram–Schmidt process is built on. Take u = (3, 4, 5), v = (1, 0, 0): u · v = 3 and |v|² = 1, so projv(u) = 3·(1, 0, 0) = (3, 0, 0), leaving an orthogonal residual of (0, 4, 5).

Applications

It shows up all over the place. In physics you use it to split a force into parts parallel and perpendicular to an inclined plane, like gravity acting along a ramp. Machine learning leans on it for Gram–Schmidt orthogonalisation, QR decomposition and PCA whitening. Computer graphics needs it for reflection and shadow vectors (r = u − 2·projn(u)). In signal processing it's how you project onto a basis to get Fourier coefficients, and in robotics it pulls out the velocity component that lines up with the direction of motion.

FAQ

What if v is the zero vector? Then |v|² = 0 and the formula breaks down. There's simply no direction to project onto, so the input should be treated as invalid.

Vector projection vs scalar projection — what changes? The vector projection hands you back a vector pointing along v, while the scalar projection gives you only the signed magnitude. The two connect through projv(u) = compv(u) · (v/|v|).

Why does the result point opposite to v sometimes? Whenever u · v < 0, the angle between u and v is obtuse, and the projection ends up pointing the other way from v. It's the sign of the dot product that decides the orientation.

Related Tools