Vector Projection
Vectors
Intro: We return $\operatorname{proj}_{\vec{b}}\vec{a}$ and the orthogonal component $\vec{a}_\perp=\vec{a}-\operatorname{proj}_{\vec{b}}\vec{a}$, with exact fractions and a decimal check.
Worked example
- a=(3,1,−2), b=(1,4,2)
- Formulae: $$\operatorname{proj}_{\vec{b}}\vec{a}=\frac{\vec{a}\cdot\vec{b}}{\|\vec{b}\|^2}\,\vec{b},\qquad \vec{a}_\perp=\vec{a}-\operatorname{proj}_{\vec{b}}\vec{a}.$$
- Dot product: $$\vec{a}\cdot\vec{b}=3\cdot1+1\cdot4+(-2)\cdot2=3+4-4=3.$$
- Squared norm of $\vec{b}$: $$\|\vec{b}\|^2=1^2+4^2+2^2=1+16+4=21.$$
- Projection scalar factor: $$\dfrac{\vec{a}\cdot\vec{b}}{\|\vec{b}\|^2}=\dfrac{3}{21}=\dfrac{1}{7}.$$
- Projection vector: $$\operatorname{proj}_{\vec{b}}\vec{a}=\frac{1}{7}(1,4,2)=\Big(\tfrac{1}{7},\tfrac{4}{7},\tfrac{2}{7}\Big).$$
- Orthogonal component: $$\vec{a}_\perp=\vec{a}-\operatorname{proj}_{\vec{b}}\vec{a}=(3,1,-2)-\Big(\tfrac{1}{7},\tfrac{4}{7},\tfrac{2}{7}\Big)=\Big(\tfrac{20}{7},\tfrac{3}{7},-\tfrac{16}{7}\Big).$$
- Orthogonality check: $\vec{a}_\perp\cdot\vec{b}=\big(\tfrac{20}{7},\tfrac{3}{7},-\tfrac{16}{7}\big)\cdot(1,4,2)=\tfrac{20}{7}+\tfrac{12}{7}-\tfrac{32}{7}=0$ ✔️.
- Optional magnitudes: $$\big\|\operatorname{proj}_{\vec{b}}\vec{a}\big\|=\frac{|\vec{a}\cdot\vec{b}|}{\|\vec{b}\|}=\frac{3}{\sqrt{21}}\approx0.6547,$$ $$\|\vec{a}_\perp\|=\sqrt{\|\vec{a}\|^2-\big\|\operatorname{proj}_{\vec{b}}\vec{a}\big\|^2}=\sqrt{14-\tfrac{9}{21}}=\sqrt{\tfrac{285}{21}}=\sqrt{\tfrac{95}{7}}\approx3.681.$$
- Summary: $$\boxed{\operatorname{proj}_{\vec{b}}\vec{a}=\Big(\tfrac{1}{7},\tfrac{4}{7},\tfrac{2}{7}\Big)},\quad \boxed{\vec{a}_\perp=\Big(\tfrac{20}{7},\tfrac{3}{7},-\tfrac{16}{7}\Big)}.$$
FAQs
Zero vector b?
Projection is undefined when $\vec{b}=\vec{0}$ because the formula divides by $\lVert \vec{b} \rVert^{2}$.
Relation to angle?
The scalar projection (component of a along b) is $\|\vec{a}\|\cos\theta = \dfrac{\vec{a}\cdot\vec{b}}{\|\vec{b}\|}$. The vector projection scales the unit vector in the direction of $\vec{b}$: $\operatorname{proj}_{\vec{b}}\vec{a} = \dfrac{\vec{a}\cdot\vec{b}}{\|\vec{b}\|^2}\,\vec{b}$.
Any dimension?
Yes—works for any $n$. Enter matching-length vectors; we compute dot products and norms accordingly.
Why choose MathGPT?
- Get clear, step-by-step solutions that explain the “why,” not just the answer.
- See the rules used at each step (power, product, quotient, chain, and more).
- Optional animated walk-throughs to make tricky ideas click faster.
- Clean LaTeX rendering for notes, homework, and study guides.
How this calculator works
- Type or paste your function (LaTeX like
\sin,\lnworks too). - Press Generate a practice question button to generate the derivative and the full reasoning.
- Review each step to understand which rule was applied and why.
- Practice with similar problems to lock in the method.