---
id: vector-sub
name: Vector.sub
category: vector
kind: namespace-method
tokens: Vector.sub
sig: Vector.sub(a, b) -> Vector
tip: Component-wise difference a - b.
order: 5
ns: Vector
member: sub
---
Returns the component-wise difference a - b — the vector that points from b to a. Pair it with Vector.length or Vector.normalize to get a distance or a direction.
```ludic
program Demo {
handler Step phase Update {
let toTarget = Vector.sub(target, pos)
}
}
```