Projection of A onto B Notes

Published on: September 29, 2026

These Projection of A onto B Notes explain how to find the shadow one vector casts along another, with the working shown 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.

x y z B ⟨b₁, b₂, b₃⟩ A ⟨a₁, a₂, a₃⟩ proj

Enter the components of \(\vec{A}\) and \(\vec{B}\).

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Substitute the vectors into the formula.
  4. Work out the dot product and the squared magnitude of B.
  5. 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.

\(\text{proj}_{\vec{B}}\vec{A} = \frac{\vec{A} \cdot \vec{B}}{|\vec{B}|^{2}}\,\vec{B}\)

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

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\). Examples 3 and 4 give you two more problems of the same kind to try. Find the dot product and \(|\vec{B}|^{2}\), scale B and compare.

The worked examples below go through the same pattern from start to finish, so you can compare every step with your own working. Try each problem on paper first, then open the example and check your working one step at a time, so you can see exactly which step went wrong if your answer does not match. Use them to check your answers and to understand why each step works.

See Example 1 Hide Example 1

Problem

\(\vec{A} = \left\langle 1,\; 2,\; 3 \right\rangle,\; \vec{B} = \left\langle 4,\; 5,\; 6 \right\rangle\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Substitute the vectors into the formula.
  4. Work out the dot product and the squared magnitude of B.
  5. 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.

\(\text{proj}_{\vec{B}}\vec{A} = \frac{\vec{A} \cdot \vec{B}}{|\vec{B}|^{2}}\,\vec{B}\)

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\).

\(\vec{A} = \left\langle 1,\; 2,\; 3 \right\rangle,\; \vec{B} = \left\langle 4,\; 5,\; 6 \right\rangle\)
x y z B ⟨4, 5, 6⟩ A ⟨1, 2, 3⟩ proj

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.

\(\text{proj}_{\vec{B}}\vec{A} = \frac{\vec{A} \cdot \vec{B}}{|\vec{B}|^{2}}\,\vec{B}\)

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\).

\(\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.

\(\vec{A} = \left\langle 1,\; 2,\; 3 \right\rangle,\; \vec{B} = \left\langle 4,\; 5,\; 6 \right\rangle\)

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\).

\(\vec{A} \cdot \vec{B} = 1 \times 4 + 2 \times 5 + 3 \times 6 = 32\)

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\).

\(|\vec{B}|^{2} = 4^{2} + 5^{2} + 6^{2} = 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}\).

\(\text{proj}_{\vec{B}}\vec{A} = \frac{32}{77}\,\left\langle 4,\; 5,\; 6 \right\rangle = \left\langle \frac{128}{77},\; \frac{160}{77},\; \frac{192}{77} \right\rangle\)

Final Answer

\(\text{proj}_{\vec{B}}\vec{A} = \left\langle \frac{128}{77},\; \frac{160}{77},\; \frac{192}{77} \right\rangle\)
See Example 2 Hide Example 2

Problem

\(\vec{A} = \left\langle 2,\; 0,\; 0 \right\rangle,\; \vec{B} = \left\langle 1,\; 1,\; 0 \right\rangle\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Substitute the vectors into the formula.
  4. Work out the dot product and the squared magnitude of B.
  5. 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.

\(\text{proj}_{\vec{B}}\vec{A} = \frac{\vec{A} \cdot \vec{B}}{|\vec{B}|^{2}}\,\vec{B}\)

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\).

\(\vec{A} = \left\langle 2,\; 0,\; 0 \right\rangle,\; \vec{B} = \left\langle 1,\; 1,\; 0 \right\rangle\)
x y z B ⟨1, 1, 0⟩ A ⟨2, 0, 0⟩ proj

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.

\(\text{proj}_{\vec{B}}\vec{A} = \frac{\vec{A} \cdot \vec{B}}{|\vec{B}|^{2}}\,\vec{B}\)

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\).

\(\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.

\(\vec{A} = \left\langle 2,\; 0,\; 0 \right\rangle,\; \vec{B} = \left\langle 1,\; 1,\; 0 \right\rangle\)

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\).

\(\vec{A} \cdot \vec{B} = 2 \times 1 + 0 \times 1 + 0 \times 0 = 2\)

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\).

\(|\vec{B}|^{2} = 1^{2} + 1^{2} + 0^{2} = 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\).

\(\text{proj}_{\vec{B}}\vec{A} = \frac{2}{2}\,\left\langle 1,\; 1,\; 0 \right\rangle = \left\langle 1,\; 1,\; 0 \right\rangle\)

Final Answer

\(\text{proj}_{\vec{B}}\vec{A} = \left\langle 1,\; 1,\; 0 \right\rangle\)
See Example 3 Hide Example 3

Problem

\(\vec{A} = \left\langle 3,\; 4,\; 0 \right\rangle,\; \vec{B} = \left\langle 1,\; 0,\; 0 \right\rangle\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Substitute the vectors into the formula.
  4. Work out the dot product and the squared magnitude of B.
  5. 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.

\(\text{proj}_{\vec{B}}\vec{A} = \frac{\vec{A} \cdot \vec{B}}{|\vec{B}|^{2}}\,\vec{B}\)

Step 1

Step 1 - Set up the problem.

In this problem: We are projecting \(\vec{A} = \left\langle 3,\; 4,\; 0 \right\rangle\) onto \(\vec{B} = \left\langle 1,\; 0,\; 0 \right\rangle\).

\(\vec{A} = \left\langle 3,\; 4,\; 0 \right\rangle,\; \vec{B} = \left\langle 1,\; 0,\; 0 \right\rangle\)
x y z B ⟨1, 0, 0⟩ A ⟨3, 4, 0⟩ proj

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.

\(\text{proj}_{\vec{B}}\vec{A} = \frac{\vec{A} \cdot \vec{B}}{|\vec{B}|^{2}}\,\vec{B}\)

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 3,\; 4,\; 0 \right\rangle \cdot \left\langle 1,\; 0,\; 0 \right\rangle}{|\left\langle 1,\; 0,\; 0 \right\rangle|^{2}}\,\left\langle 1,\; 0,\; 0 \right\rangle\).

\(\text{proj}_{\vec{B}}\vec{A} = \frac{\left\langle 3,\; 4,\; 0 \right\rangle \cdot \left\langle 1,\; 0,\; 0 \right\rangle}{|\left\langle 1,\; 0,\; 0 \right\rangle|^{2}}\,\left\langle 1,\; 0,\; 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.

\(\vec{A} = \left\langle 3,\; 4,\; 0 \right\rangle,\; \vec{B} = \left\langle 1,\; 0,\; 0 \right\rangle\)

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 \(3 \times 1 = 3\), \(4 \times 0 = 0\) and \(0 \times 0 = 0\). Adding the three products gives \(3 + 0 + 0 = 3\).

\(\vec{A} \cdot \vec{B} = 3 \times 1 + 4 \times 0 + 0 \times 0 = 3\)

Step 4b

Step 4b - Work out the squared magnitude of B.

In this problem: Squaring the components of B gives \(1^{2} = 1\), \(0^{2} = 0\) and \(0^{2} = 0\), and adding them gives \(1 + 0 + 0 = 1\).

\(|\vec{B}|^{2} = 1^{2} + 0^{2} + 0^{2} = 1\)

Step 5

Step 5 - Work out the projection.

In this problem: Putting the values back in gives \(\text{proj}_{\vec{B}}\vec{A} = \frac{3}{1}\,\left\langle 1,\; 0,\; 0 \right\rangle\). Multiplying each component of B by \(3\) gives \(3 \times 1 = 3\), \(3 \times 0 = 0\) and \(3 \times 0 = 0\).

\(\text{proj}_{\vec{B}}\vec{A} = \frac{3}{1}\,\left\langle 1,\; 0,\; 0 \right\rangle = \left\langle 3,\; 0,\; 0 \right\rangle\)

Final Answer

\(\text{proj}_{\vec{B}}\vec{A} = \left\langle 3,\; 0,\; 0 \right\rangle\)
See Example 4 Hide Example 4

Problem

\(\vec{A} = \left\langle 2,\; -1,\; 3 \right\rangle,\; \vec{B} = \left\langle 1,\; 2,\; 2 \right\rangle\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Substitute the vectors into the formula.
  4. Work out the dot product and the squared magnitude of B.
  5. 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.

\(\text{proj}_{\vec{B}}\vec{A} = \frac{\vec{A} \cdot \vec{B}}{|\vec{B}|^{2}}\,\vec{B}\)

Step 1

Step 1 - Set up the problem.

In this problem: We are projecting \(\vec{A} = \left\langle 2,\; -1,\; 3 \right\rangle\) onto \(\vec{B} = \left\langle 1,\; 2,\; 2 \right\rangle\).

\(\vec{A} = \left\langle 2,\; -1,\; 3 \right\rangle,\; \vec{B} = \left\langle 1,\; 2,\; 2 \right\rangle\)
x y z B ⟨1, 2, 2⟩ A ⟨2, −1, 3⟩ proj

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.

\(\text{proj}_{\vec{B}}\vec{A} = \frac{\vec{A} \cdot \vec{B}}{|\vec{B}|^{2}}\,\vec{B}\)

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,\; -1,\; 3 \right\rangle \cdot \left\langle 1,\; 2,\; 2 \right\rangle}{|\left\langle 1,\; 2,\; 2 \right\rangle|^{2}}\,\left\langle 1,\; 2,\; 2 \right\rangle\).

\(\text{proj}_{\vec{B}}\vec{A} = \frac{\left\langle 2,\; -1,\; 3 \right\rangle \cdot \left\langle 1,\; 2,\; 2 \right\rangle}{|\left\langle 1,\; 2,\; 2 \right\rangle|^{2}}\,\left\langle 1,\; 2,\; 2 \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.

\(\vec{A} = \left\langle 2,\; -1,\; 3 \right\rangle,\; \vec{B} = \left\langle 1,\; 2,\; 2 \right\rangle\)

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\), \(\left(-1\right) \times 2 = -2\) and \(3 \times 2 = 6\). Adding the three products gives \(2 - 2 + 6 = 6\).

\(\vec{A} \cdot \vec{B} = 2 \times 1 + \left(-1\right) \times 2 + 3 \times 2 = 6\)

Step 4b

Step 4b - Work out the squared magnitude of B.

In this problem: Squaring the components of B gives \(1^{2} = 1\), \(2^{2} = 4\) and \(2^{2} = 4\), and adding them gives \(1 + 4 + 4 = 9\).

\(|\vec{B}|^{2} = 1^{2} + 2^{2} + 2^{2} = 9\)

Step 5

Step 5 - Work out the projection.

In this problem: Putting the values back in gives \(\text{proj}_{\vec{B}}\vec{A} = \frac{6}{9}\,\left\langle 1,\; 2,\; 2 \right\rangle\). Multiplying each component of B by \(\frac{2}{3}\) gives \(\frac{2}{3} \times 1 = \frac{2}{3}\), \(\frac{2}{3} \times 2 = \frac{4}{3}\) and \(\frac{2}{3} \times 2 = \frac{4}{3}\).

\(\text{proj}_{\vec{B}}\vec{A} = \frac{6}{9}\,\left\langle 1,\; 2,\; 2 \right\rangle = \left\langle \frac{2}{3},\; \frac{4}{3},\; \frac{4}{3} \right\rangle\)

Final Answer

\(\text{proj}_{\vec{B}}\vec{A} = \left\langle \frac{2}{3},\; \frac{4}{3},\; \frac{4}{3} \right\rangle\)

Calculator and Practice Mode