Where did he run? Describing player movement with vectors
A run from one spot on the pitch to another is a vector, how far forward and how far across. From that pair of numbers you get the length of the run, its direction, its speed and whether it was heading for goal.
Beginner Part 5 of Linear Algebra Through Football
Contents
The football question
A midfielder receives the ball, lays it off and sets off into space. How do you describe that run with numbers?
"A lung-busting run into the channel" is great commentary but you can't average it or compare it with 10,000 other runs. We need numbers. Earlier in this series, a vector held a player's match stats. Here it holds something more physical: a movement across the pitch.
The concept
Put the pitch on a grid. We'll use a 105 m × 68 m pitch, measured in metres:
- x runs up the pitch, from our own goal line (0) to the opponent's (105).
- y runs across it, from one touchline (0) to the other (68).
Every spot on the pitch is now a pair of numbers. Our midfielder starts at A = (25, 18) and finishes at B = (40, 30). His run is the vector from A to B: end minus start.
$$\begin{aligned} \mathbf{v} &= B - A \\ &= (40 - 25,\ 30 - 18) \\ &= (15,\ 12) \end{aligned}$$
In plain football
- 15 is how far he went up the pitch: 15 metres towards the opponent's goal.
- 12 is how far he went across it: 12 metres towards the far touchline.
- The vector is the run itself, not where it happened. The same (15, 12) could start anywhere on the pitch.
That's the whole idea. A run, a carry, a pass or a press is a start point and an end point, and the vector is the difference. Everything else follows from those two numbers.
Four things one run tells you
How far: the length
The run's length is Pythagoras, as with distance between players:
$$\lVert \mathbf{v} \rVert = \sqrt{15^2 + 12^2} = \sqrt{369} \approx 19.2 \text{ m}$$
In plain football
- Square each part, add, take the square root. The run was about 19.2 metres, point to point.
- It's the straight line from A to B. If he curved his run, he covered more ground than this.
Which way: the direction
The two parts also give the run's angle. Measured from straight up the pitch:
$$\theta = \tan^{-1}\!\left(\frac{12}{15}\right) \approx 38.7^\circ$$
In plain football
- 0° would be dead straight towards the opponent's goal line. 90° would be straight across the pitch.
- 38.7° means a diagonal run, a bit more forward than sideways.
The angle is what lets you sort runs by type. Here are four runs, sorted with bands we chose ourselves (there's no official definition): vertical under 25°, diagonal from 25° to 65°, lateral from 65° to 90°, and backwards beyond 90°.
| Type | Run (m) | Angle |
|---|---|---|
| Vertical | (15, 0) | 0° |
| Diagonal (ours) | (15, 12) | 38.7° |
| Lateral | (0, 12) | 90° |
| Backwards | (−10, 5) | 153.4° |
A minus sign in the first number means the player went back towards his own goal. That's how a vector tells a recovery run from an attacking one.
How fast: the speed
Say, as a made-up example, the run took 3 seconds. Divide the vector by the time to get his velocity:
$$\frac{(15,\ 12)}{3} = (5,\ 4) \text{ m/s}$$
That's 5 metres a second up the pitch and 4 across. Its length, 19.2 ÷ 3 ≈ 6.4 m/s (about 23 km/h), is his average speed. A sprint, not a jog.
Was it towards goal?
This is where cosine similarity comes back. The direction from his starting point to the centre of the opponent's goal, at (105, 34), is (105 − 25, 34 − 18) = (80, 16). Compare that with the direction of his run:
$$\cos\theta = \frac{(15 \times 80) + (12 \times 16)}{19.21 \times 81.58} \approx 0.89$$
In plain football
- 1 would mean running straight at the goal. 0 would mean running at right angles to it. Negative means running away from it.
- 0.89 is a run mostly towards goal, about 27° off the direct line.
- For comparison, from the same spot, the straight run up the line scores 0.98, the sideways run 0.20 and the recovery run −0.79.
Adding runs together
Vectors add up, one part at a time. Suppose (again made up) that after his run he receives the ball and carries it (20, −6): 20 m forward, 6 m back across the pitch.
$$(15,\ 12) + (20,\ {-6}) = (35,\ 6)$$
He has ended up 35 m further forward and 6 m across from where he started. The straight line from start to finish is \(\sqrt{35^2 + 6^2} \approx 35.5\) m, but he covered 19.2 + 20.9 ≈ 40.1 m getting there. The gap between the two says how much his route zig-zagged.
Show the mathsThe general formulas for any movement. Optional.
For a player moving from \(A = (x_1, y_1)\) to \(B = (x_2, y_2)\):
$$\mathbf{v} = (x_2 - x_1,\ y_2 - y_1)$$
$$\lVert \mathbf{v} \rVert = \sqrt{v_x^2 + v_y^2}$$
The direction is \(\theta = \operatorname{atan2}(v_y, v_x)\). Plain \(\tan^{-1}(v_y / v_x)\) can't tell a forward run from a backward one, because \((-10, 5)\) and \((10, -5)\) give the same ratio; atan2 looks at the signs of both parts and returns the right quadrant.
Dividing a vector by its length gives a unit vector, which keeps only the direction:
$$\hat{\mathbf{v}} = \frac{\mathbf{v}}{\lVert \mathbf{v} \rVert} \approx (0.78,\ 0.62)$$
Unit vectors are how you compare the direction of a 5 m run with a 40 m one: take the dot product of the two unit vectors and you have the cosine of the angle between them.
A run of several legs \(\mathbf{v}_1, \mathbf{v}_2, \dots, \mathbf{v}_k\) ends at \(A + \mathbf{v}_1 + \dots + \mathbf{v}_k\), and its net displacement is never longer than the total distance covered: \(\lVert \mathbf{v}_1 + \dots + \mathbf{v}_k \rVert \le \lVert \mathbf{v}_1 \rVert + \dots + \lVert \mathbf{v}_k \rVert\) (the triangle inequality).
Why it matters
Once a movement is a vector, the questions a coach asks become calculations:
- Attacking runs: how many of a striker's runs go in behind (vertical, towards goal) rather than dropping short (negative first number)?
- Overlapping full-backs: how far forward, and how wide, does the full-back get compared with the winger inside him?
- Pressing: do the front three press in the same direction, squeezing the ball to one side, or do their vectors point every which way?
- Recovery runs: how quickly does a midfielder get back after losing the ball: the length of his backward vector, divided by the time.
- Ball carries and passes: the same start-minus-end idea, which is where this series goes next.
Data providers already store matches this way. StatsBomb's event data gives every carry a start location and an end location, so the carry's vector is one subtraction away. Tracking data goes further and records every player's position many times a second, so a whole match becomes thousands of small vectors. Add those up and you can find each player's typical runs, and group players by how they move.
Limitations
- Start and end only. A vector records where a run began and ended, not the curve in between. A bending run round a defender and a straight one can have the same vector.
- The grid is a choice. We used 105 m × 68 m with x towards goal. StatsBomb's data uses a 120 × 80 grid with (0, 0) in the top-left corner, so the same run comes out as different numbers. Always convert to one system before comparing.
- Teams swap ends at half-time. A run towards goal in the first half points the other way in the second. Flip the second half's coordinates so "forward" always means forward.
- Pitches differ in size. 15 m forward on a narrow pitch isn't quite the same run as 15 m forward on a wide one.
- The type bands are ours. 25° and 65° are a choice; move them and some runs change type.
Try it yourself
On the same pitch, a winger starts at (60, 5) and finishes at (80, 20). Work out his run vector, its length and its angle. Then compare it with the direction to the centre of goal from his starting point, (45, 29). Was he cutting inside towards goal, or running down the wing?
Further reading
- Vectors, what even are they?, 3Blue1Brown. Vectors as arrows and as lists of numbers, and why both views are the same thing.
- Vectors, Khan Academy. Components, magnitude, direction and adding vectors, with practice questions.
- Displacement, Wikipedia. The difference between displacement and distance travelled.
- StatsBomb open data, StatsBomb. Free match event data, with start and end locations for carries and passes; the documentation shows its pitch coordinates.