Combining Vectors (Addition & Scaling) hero
Lesson 2Linear Algebra Part 1 (Vectors & Dot Products)

Combining Vectors (Addition & Scaling)

Master vector addition and scalar multiplication to transform feature states, scale attributes, and combine multidimensional data profiles.

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):

3xyou=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 vectors u,vRnu, v \in \mathbb{R}^n and any scalar cRc \in \mathbb{R}, addition and scalar multiplication are defined position-wise:

u+v=[u1u2un]+[v1v2vn]=[u1+v1u2+v2un+vn]cv=c[v1v2vn]=[cv1cv2cvn]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 2uv2u - 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
The Vector (State & Identity)