NapkinCalc

Multivariable Calculus — Vectors & Gradients

Vectors in space

ELI5: a vector is an arrow — it has a direction and a length. Add two by laying them tip-to-tail; scale one by stretching it. Two products matter:

  • the dot product measures how much two arrows point the same way (0 = perpendicular)
  • the cross product returns an arrow perpendicular to both.
v1:=[1,2,2]v_{1} := [1, 2, 2] = [1,2,2][1, 2, 2] a 3-D vector
lenv=norm(v1)len_{v} = \mathrm{norm}\left(v_{1}\right) = 33 its length √(1+4+4) = 3
dperp:=dot([1,0],[0,1])d_{perp} := dot([1, 0], [0, 1]) = 00 dot of perpendicular arrows: 0
cup:=cross([1,0,0],[0,1,0])c_{up} := cross([1, 0, 0], [0, 1, 0]) = [0,0,1][0, 0, 1] x̂ × ŷ = ẑ, straight up
✓ pass lenv==3anddperp==0len_{v} == 3 and d_{perp} == 0 length and perpendicularity, both confirmed

Real-world hook: vectors are forces and velocities in physics, positions in 3-D graphics, and feature lists in machine learning; the dot product is how a neural network and a search engine both measure "similarity."

Try it yourself: how long is the vector [6, 8]? (Its length is √(6² + 8²).)

lenyou=10len_{you} = 10 ✏️ Your turn: find the length of [6, 8]. The check confirms length² = 6² + 8² — so it never states the answer.
✓ pass abs(lenyou2(62+82))<1e9andlenyou>0abs(len_{you}^2 - (6^2 + 8^2)) < 1e-9 and len_{you} > 0 green when length² = 6² + 8²