Projection of A onto B Calculator
This Projection of A onto B Calculator finds the shadow one vector casts along another, and shows the working line by line. The dot product measures how much of the first vector lies along the second, and dividing by the second vector's squared length rescales that into a multiple of it. What is left points along the second vector only. Following the same pattern every time keeps the two vectors from being swapped.
Enter the components of \(\vec{A}\) and \(\vec{B}\).
Step-by-step method
- Set up the problem.
- Write the formula.
- Substitute the vectors into the formula.
- Work out the dot product and the squared magnitude of B.
- Work out the projection.
Formula: Vector Projection Formula
This formula gives the part of A that points along B. Divide the dot product by the squared length of B, then multiply B by that number.
Useful Tips to Remember
The projection always points along \(\vec{B}\), or exactly opposite to it when the dot product is negative. The denominator is \(|\vec{B}|^{2}\), so there is no square root to work out. Swapping A and B gives a different answer. If the dot product is 0, the projection is the zero vector, because the vectors are perpendicular.
Required knowledge
- How to find the dot product, covered in the Dot Product Calculator.
- How to scale a vector by a number, covered in the Scalar Multiplication Calculator.
- How to simplify fractions, covered in the Simplifying of Fractions Calculator.
Where Is Vector Projection Used?
Projecting one vector onto another splits it into the part along a direction and the part across it, which is one of the most useful ideas in applied maths. Physics uses it to find the part of gravity acting down a slope, or the part of a force that does work. Game engines project movement onto walls so characters slide instead of sticking. In statistics and machine learning, projections are the basis of least squares fitting and of reducing data to fewer dimensions.
- The component of gravity down a slope
- Sliding movement along walls in games
- Shadows and casting in computer graphics
- Least squares fitting in statistics
- Reducing data to fewer dimensions
Vector Projection Practice Problems
Example 1 projects \(\langle 1, 2, 3 \rangle\) onto \(\langle 4, 5, 6 \rangle\), which gives fraction components, and Example 2 projects \(\langle 2, 0, 0 \rangle\) onto \(\langle 1, 1, 0 \rangle\). Find the dot product and \(|\vec{B}|^{2}\), scale B and compare. For two more free worked examples, check out the Projection of A onto B Notes.
The worked examples below go through the same pattern from start to finish, so you can compare every step with your own working. For more practice, the notes page goes further with extra worked examples and fuller explanations of the ideas behind each step. Use them together to check your answers and to understand why each step works.
See Example 1 Hide Example 1
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Substitute the vectors into the formula.
- Work out the dot product and the squared magnitude of B.
- Work out the projection.
Formula
Formula: Vector Projection Formula
This formula gives the part of A that points along B. Divide the dot product by the squared length of B, then multiply B by that number.
Step 1
Step 1 - Set up the problem.
In this problem: We are projecting \(\vec{A} = \left\langle 1,\; 2,\; 3 \right\rangle\) onto \(\vec{B} = \left\langle 4,\; 5,\; 6 \right\rangle\).
Step 2
Step 2 - Write the formula.
In this problem: The projection is the part of A that points along B. The dot product divided by the squared length of B gives how many copies of B it takes.
Step 3
Step 3 - Substitute the vectors into the formula.
In this problem: Replacing \(\vec{A}\) and \(\vec{B}\) in \(\text{proj}_{\vec{B}}\vec{A} = \frac{\vec{A} \cdot \vec{B}}{|\vec{B}|^{2}}\,\vec{B}\) gives \(\text{proj}_{\vec{B}}\vec{A} = \frac{\left\langle 1,\; 2,\; 3 \right\rangle \cdot \left\langle 4,\; 5,\; 6 \right\rangle}{|\left\langle 4,\; 5,\; 6 \right\rangle|^{2}}\,\left\langle 4,\; 5,\; 6 \right\rangle\).
Step 4
Step 4 - Work out the dot product and the squared magnitude of B.
In this problem: The fraction needs the dot product and the squared magnitude of B, so each one is worked out in turn.
Step 4a
Step 4a - Work out the dot product.
In this problem: The dot product is worked out from the components, covered in the Dot Product Calculator. Multiplying the matching components gives \(1 \times 4 = 4\), \(2 \times 5 = 10\) and \(3 \times 6 = 18\). Adding the three products gives \(4 + 10 + 18 = 32\).
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Substitute the components into the formula.
- Work out the dot product.
Formula
Formula: Dot Product Formula
This formula multiplies two vectors into a single number. Multiply the matching components, then add the three products.
Step 1
Step 1 - Set up the problem.
In this problem: We are finding the dot product of \(\vec{A} = \left\langle 1,\; 2,\; 3 \right\rangle\) and \(\vec{B} = \left\langle 4,\; 5,\; 6 \right\rangle\).
Step 2
Step 2 - Write the formula.
In this problem: The dot product multiplies the matching components of the two vectors and adds the three products, giving a single number.
Step 3
Step 3 - Substitute the components into the formula.
In this problem: Replacing each component in \(\vec{A} \cdot \vec{B} = a_{1}b_{1} + a_{2}b_{2} + a_{3}b_{3}\) gives \(\vec{A} \cdot \vec{B} = 1 \times 4 + 2 \times 5 + 3 \times 6\).
Step 4
Step 4 - Work out the dot product.
In this problem: Multiplying the matching components gives \(1 \times 4 = 4\), \(2 \times 5 = 10\) and \(3 \times 6 = 18\). Adding the three products gives \(4 + 10 + 18 = 32\).
Final Answer
Step 4b
Step 4b - Work out the squared magnitude of B.
In this problem: Squaring the components of B gives \(4^{2} = 16\), \(5^{2} = 25\) and \(6^{2} = 36\), and adding them gives \(16 + 25 + 36 = 77\).
Step 5
Step 5 - Work out the projection.
In this problem: Putting the values back in gives \(\text{proj}_{\vec{B}}\vec{A} = \frac{32}{77}\,\left\langle 4,\; 5,\; 6 \right\rangle\). Multiplying each component of B by \(\frac{32}{77}\) gives \(\frac{32}{77} \times 4 = \frac{128}{77}\), \(\frac{32}{77} \times 5 = \frac{160}{77}\) and \(\frac{32}{77} \times 6 = \frac{192}{77}\).
Final Answer
See Example 2 Hide Example 2
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Substitute the vectors into the formula.
- Work out the dot product and the squared magnitude of B.
- Work out the projection.
Formula
Formula: Vector Projection Formula
This formula gives the part of A that points along B. Divide the dot product by the squared length of B, then multiply B by that number.
Step 1
Step 1 - Set up the problem.
In this problem: We are projecting \(\vec{A} = \left\langle 2,\; 0,\; 0 \right\rangle\) onto \(\vec{B} = \left\langle 1,\; 1,\; 0 \right\rangle\).
Step 2
Step 2 - Write the formula.
In this problem: The projection is the part of A that points along B. The dot product divided by the squared length of B gives how many copies of B it takes.
Step 3
Step 3 - Substitute the vectors into the formula.
In this problem: Replacing \(\vec{A}\) and \(\vec{B}\) in \(\text{proj}_{\vec{B}}\vec{A} = \frac{\vec{A} \cdot \vec{B}}{|\vec{B}|^{2}}\,\vec{B}\) gives \(\text{proj}_{\vec{B}}\vec{A} = \frac{\left\langle 2,\; 0,\; 0 \right\rangle \cdot \left\langle 1,\; 1,\; 0 \right\rangle}{|\left\langle 1,\; 1,\; 0 \right\rangle|^{2}}\,\left\langle 1,\; 1,\; 0 \right\rangle\).
Step 4
Step 4 - Work out the dot product and the squared magnitude of B.
In this problem: The fraction needs the dot product and the squared magnitude of B, so each one is worked out in turn.
Step 4a
Step 4a - Work out the dot product.
In this problem: The dot product is worked out from the components, covered in the Dot Product Calculator. Multiplying the matching components gives \(2 \times 1 = 2\), \(0 \times 1 = 0\) and \(0 \times 0 = 0\). Adding the three products gives \(2 + 0 + 0 = 2\).
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Substitute the components into the formula.
- Work out the dot product.
Formula
Formula: Dot Product Formula
This formula multiplies two vectors into a single number. Multiply the matching components, then add the three products.
Step 1
Step 1 - Set up the problem.
In this problem: We are finding the dot product of \(\vec{A} = \left\langle 2,\; 0,\; 0 \right\rangle\) and \(\vec{B} = \left\langle 1,\; 1,\; 0 \right\rangle\).
Step 2
Step 2 - Write the formula.
In this problem: The dot product multiplies the matching components of the two vectors and adds the three products, giving a single number.
Step 3
Step 3 - Substitute the components into the formula.
In this problem: Replacing each component in \(\vec{A} \cdot \vec{B} = a_{1}b_{1} + a_{2}b_{2} + a_{3}b_{3}\) gives \(\vec{A} \cdot \vec{B} = 2 \times 1 + 0 \times 1 + 0 \times 0\).
Step 4
Step 4 - Work out the dot product.
In this problem: Multiplying the matching components gives \(2 \times 1 = 2\), \(0 \times 1 = 0\) and \(0 \times 0 = 0\). Adding the three products gives \(2 + 0 + 0 = 2\).
Final Answer
Step 4b
Step 4b - Work out the squared magnitude of B.
In this problem: Squaring the components of B gives \(1^{2} = 1\), \(1^{2} = 1\) and \(0^{2} = 0\), and adding them gives \(1 + 1 + 0 = 2\).
Step 5
Step 5 - Work out the projection.
In this problem: Putting the values back in gives \(\text{proj}_{\vec{B}}\vec{A} = \frac{2}{2}\,\left\langle 1,\; 1,\; 0 \right\rangle\). Multiplying each component of B by \(1\) gives \(1 \times 1 = 1\), \(1 \times 1 = 1\) and \(1 \times 0 = 0\).
Final Answer
Notes and Practice Mode
Want to understand the method more deeply? The Projection of A onto B Notes go through the same pattern with extra worked examples and fuller explanations of the ideas behind each step, so you can see why every step works and not just what to do. When you are ready to test yourself, Projection of A onto B Practice gives you a new problem at Easy, Medium or Hard level, checks your answer and shows the full working whenever you get one wrong. Practice Mode for this calculator is available on the Pro plan.
Login and upgrade to Pro to unlock the full step solution.
Example Problems
Click one to load it into the box and solve it.