<p>Since <code>v∥</code> is parallel to <code>n</code>, it can be expressed as some multiple of <code>n</code>. The multiple is the ratio of the length of <code>v∥</code> to the length of <code>n</code>. The <code>n</code> vector doesn’t have to be normalized, but if it is, then <code>|n|</code> is 1, so the equation becomes <code>v∥ = n * |v∥|</code>.</p>

CC BY-SA 4.0
2019-10-08T19:49:33.687Z
2019-10-08T19:49:33.687Z
Noah Witherspoon
<p>Since we have:</p>

<p><span class="math-container">$$\pmb{v}_{\parallel} \parallel \pmb{n},$$</span></p>

<p>then:</p>

<p><span class="math-container">$$\pmb{v}_{\parallel} = k\pmb{n}$$</span></p>

<p>We want that the length of <span class="math-container">$\pmb{v}_{\parallel}$</span> is <span class="math-container">$\|\pmb{v}_{\parallel}\|$</span>, then:</p>

<p><span class="math-container">$$\|\pmb{v}_{\parallel}\| =|k|\|\pmb{n}\| \implies |k| = \frac{\|\pmb{v}_{\parallel}\|}{\|\pmb{n}\|}$$</span></p>

<p>Then the sign of <span class="math-container">$k$</span> is simply chosen to match the direction of <span class="math-container">$\pmb{v}$</span> (if the angle between <span class="math-container">$\pmb{v}$</span> and <span class="math-container">$\pmb{n}$</span> is more than 90 degrees, the sign is negative, otherwise it is positive).</p>

CC BY-SA 4.0
2019-10-08T19:49:45.373Z
2019-10-08T19:49:45.373Z
lightxbulb
<p>I'm reading the book 3d Math Primer for Graphics and Game Development 1st edition by Fletcher Dunn and Ian Parberry. On page 61 there's this:</p>

<p><a href="https://i.sstatic.net/yscWk.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/yscWk.jpg" alt="enter image description here"></a></p>

<p>How does it derive <span class="math-container">$ v_{||} $</span> there? It doesn't follow from what preceded this point in the book, unless I'm missing something. Also I'm not sure, is <span class="math-container">$n$</span> supposed to be unit vector here? This should probably be in the errata but I didn't find anything. Anyway, how did he deduce this equation? Thanks in advance.</p>

<projections><vectors>
3d Math Primer book equation derivation - Projecting One vector onto another
KeyC0de
# 3d Math Primer book equation derivation - Projecting One vector onto another

(Asked by: username_0 on 2019-10-08)

I'm reading the book 3d Math Primer for Graphics and Game Development 1st edition by Fletcher Dunn and Ian Parberry. On page 61 there's this:

[![enter image description here](https://i.sstatic.net/yscWk.jpg)](https://i.sstatic.net/yscWk.jpg)

How does it derive $ v\_{||} $ there? It doesn't follow from what preceded this point in the book, unless I'm missing something. Also I'm not sure, is $n$ supposed to be unit vector here? This should probably be in the errata but I didn't find anything. Anyway, how did he deduce this equation? Thanks in advance.

**Tags:** projections, vectors


---

## 2 answers

### Answer by username_1 on 2019-10-08. Score: 1 | Accepted answer

Since `v∥` is parallel to `n`, it can be expressed as some multiple of `n`. The multiple is the ratio of the length of `v∥` to the length of `n`. The `n` vector doesn’t have to be normalized, but if it is, then `|n|` is 1, so the equation becomes `v∥ = n * |v∥|`.


---

### Answer by username_2 on 2019-10-08. Score: 1

Since we have:

$$\pmb{v}\_{\parallel} \parallel \pmb{n},$$

then:

$$\pmb{v}\_{\parallel} = k\pmb{n}$$

We want that the length of $\pmb{v}\_{\parallel}$ is $\|\pmb{v}\_{\parallel}\|$, then:

$$\|\pmb{v}\_{\parallel}\| =|k|\|\pmb{n}\| \implies |k| = \frac{\|\pmb{v}\_{\parallel}\|}{\|\pmb{n}\|}$$

Then the sign of $k$ is simply chosen to match the direction of $\pmb{v}$ (if the angle between $\pmb{v}$ and $\pmb{n}$ is more than 90 degrees, the sign is negative, otherwise it is positive).


---

