Is there an easier command to compute vector projection? I am instead using the following: Answer Maybe this is what you really want: This should give the projection of vector x onto vector y – see https://en.wikipedia.org/wiki/Vector_projection. Alternatively, if you want to compute the projection of y onto x, then replace y with x in the denominator (norm) of the above equation. EDIT: As @VaidAbhishek commented, the above formula is for the scalar projection. To obtain vector projection multiply scalar projection by a unit vector in the direction of the vector onto which the first vector is projected. The formula