Vector Addition and Scaling hero
Lesson 2Vectors & Dot Products

Vector Addition and Scaling

Position-wise vector addition and scalar multiplication that combine feature profiles, scale attribute values, and combine multidimensional data.

What happens if you and your friend decide to shop together and combine your carts into a single shopping trip? You add your vectors together position-by-position:

xtotal=xyou+xfriend=[231]+[050]=[2+03+51+0]=[281]x_{\text{total}} = x_{\text{you}} + x_{\text{friend}} = \begin{bmatrix} 2 \\ 3 \\ 1 \end{bmatrix} + \begin{bmatrix} 0 \\ 5 \\ 0 \end{bmatrix} = \begin{bmatrix} 2 + 0 \\ 3 + 5 \\ 1 + 0 \end{bmatrix} = \begin{bmatrix} 2 \\ 8 \\ 1 \end{bmatrix}

Your combined cart now contains 2 Apples, 8 Bananas, and 1 Carrot.

What if you want to stock up on groceries for 3 weeks instead of 1? You scale your entire list by multiplying the vector by a single number (called a scalar):

3⋅xyou=3[231]=[3×23×33×1]=[693]3 \cdot x_{\text{you}} = 3 \begin{bmatrix} 2 \\ 3 \\ 1 \end{bmatrix} = \begin{bmatrix} 3 \times 2 \\ 3 \times 3 \\ 3 \times 1 \end{bmatrix} = \begin{bmatrix} 6 \\ 9 \\ 3 \end{bmatrix}

Formal Definition (nn-Dimensions)

For any two nn-dimensional vectors u,vu, v and any scalar cc, addition and scalar multiplication are defined position-wise:

u+v=[u1u2⋮un]+[v1v2⋮vn]=[u1+v1u2+v2⋮un+vn]c⋅v=c[v1v2⋮vn]=[cv1cv2⋮cvn]u + v = \begin{bmatrix} u_1 \\ u_2 \\ \vdots \\ u_n \end{bmatrix} + \begin{bmatrix} v_1 \\ v_2 \\ \vdots \\ v_n \end{bmatrix} = \begin{bmatrix} u_1 + v_1 \\ u_2 + v_2 \\ \vdots \\ u_n + v_n \end{bmatrix} \qquad\qquad c \cdot v = c \begin{bmatrix} v_1 \\ v_2 \\ \vdots \\ v_n \end{bmatrix} = \begin{bmatrix} c v_1 \\ c v_2 \\ \vdots \\ c v_n \end{bmatrix}
  • Vector Addition: Combines two vectors position by position.
  • Scalar Multiplication: Stretches or shrinks every entry by the same scalar factor cc.
  • A combination like 2u−v2u - v is simply these two operations composed: scale uu by 22, then add −v-v.

TEASER: How Image Generators Blend Concepts Modern AI image generators use this exact principle in high-dimensional feature spaces: take the feature vector representing a dog, add the feature vector for sunglasses, and the model generates an image of a dog wearing sunglasses.


Previous
Feature Vectors