Skip to content

Four players, four numbers each. The whole team becomes a matrix

One player's performance is a vector. Stack several players together and you have a matrix, the grid that almost all of data science starts from. Multiply it by a set of weights and every player gets a rating.

Beginner Part 2 of Linear Algebra Through Football

Contents

The football question

In the first part, one midfielder's match became a vector: a list of numbers in a fixed order. But a manager doesn't pick one player. How do you hold a whole midfield's numbers at once, so you can compare them all?

The concept

Stack the players' vectors on top of each other. Each player becomes a row, and each statistic a column. That grid is a matrix.

Here are four midfielders from the same match:

Passes Tackles Shots Chances created
Player 1 68 7 3 5
Player 2 61 6 2 4
Player 3 43 2 4 6
Player 4 49 3 5 7

As a matrix:

$$M = \begin{bmatrix} 68 & 7 & 3 & 5 \\ 61 & 6 & 2 & 4 \\ 43 & 2 & 4 & 6 \\ 49 & 3 & 5 & 7 \end{bmatrix}$$

In plain football

  • Each row is one player. Row 1 is exactly the vector from part 1, minus the distance column.
  • Each column is one statistic. Column 2 is every player's tackles.
  • 4 × 4 means 4 rows by 4 columns. Add a fifth player and it becomes 5 × 4.

Data science has its own words for the same thing: each row is an observation and each column a feature. Every spreadsheet of player stats, and every table a machine learning model trains on, is a matrix like this one.

Reading a matrix

One number: a player and a stat

Each entry has an address, row first, then column. \(M_{3,4}\) is row 3, column 4: Player 3's chances created, 6.

Down a column: the team

Average each column and you get the midfield's average player, a vector in its own right:

$$(55.25,\ 4.5,\ 3.5,\ 5.5)$$

In plain football

  • On average this midfield made 55 passes, 4.5 tackles, 3.5 shots and 5.5 chances each.
  • Compare any player's row with it to see who's above or below the group.

Across the rows: team balance

Look at the matrix as a whole and the shape of the midfield jumps out. Players 1 and 2 pass and tackle: they're the ones sitting deeper. Players 3 and 4 pass less but shoot and create more: they're further forward. A balanced midfield has both kinds of row. A matrix full of rows like Player 4's would create plenty and win the ball back rarely.

Multiplying by weights: a rating for every player

Suppose you want one number per player, a rating. Decide how much each statistic is worth, write those weights as a vector, and multiply the matrix by it. Here are some made-up weights that favour attacking play:

$$M \begin{bmatrix} 0.02 \\ 0.3 \\ 0.5 \\ 0.4 \end{bmatrix} = \begin{bmatrix} 6.96 \\ 5.62 \\ 5.86 \\ 7.18 \end{bmatrix}$$

In plain football

  • Each pass is worth 0.02, each tackle 0.3, each shot 0.5, each chance 0.4.
  • For each player, multiply every stat by its weight and add them up. Player 1: 68 × 0.02 + 7 × 0.3 + 3 × 0.5 + 5 × 0.4 = 6.96.
  • One multiplication rates the whole team at once. Fantasy football points work exactly like this.

With these weights, Player 4 is the best, on 7.18. Now weight defending more heavily, with (0.05, 0.5, 0.2, 0.2), and the ratings become 8.5, 7.25, 5.15 and 6.35. Player 1 is now the best and Player 4 drops to third.

Same players, same match, different "best". The matrix holds the facts; the weights hold the opinion. Every player rating system makes that choice, whether it tells you or not.

Show the mathsNotation, the transpose, and how matrix times vector works. Optional.

An \(m \times n\) matrix has m rows and n columns, with entry \(M_{i,j}\) in row i, column j. Our team is \(4 \times 4\); a squad of 25 players with 10 statistics would be \(25 \times 10\).

The transpose \(M^\top\) swaps rows and columns, so each column becomes a player instead.

Multiplying an \(m \times n\) matrix by a vector of length n gives a vector of length m. Each entry is one row multiplied entry by entry with the vector, then summed:

$$(M\mathbf{w})_i = \sum_{j=1}^{n} M_{i,j}\, w_j$$

The column averages are also a matrix product: \(\frac{1}{m} M^\top \mathbf{1}\), where \(\mathbf{1}\) is a vector of ones.

Why it matters

A matrix is the starting point for almost everything in data science. With the whole team in one grid, you can:

  • Compare players, row against row.
  • Analyse team balance, by the shape of the rows.
  • Group similar player profiles, by finding rows that look alike.
  • Feed machine learning models, which take exactly this grid as their input.

Limitations

  • The columns are on different scales. Passes run into dozens, shots into single figures, so raw numbers let passes dominate. That's why the rating weights for passes are so small. Standardising each column first, as in part 1, is the usual fix.
  • One match is a tiny sample. A real analysis would use per-90 averages over a season.
  • The weights are made up. Any real rating needs weights justified by data, for example by how much each action is linked to winning.

Try it yourself

Build a matrix for your own team's midfield from its last match: one row per player, the same four columns. Choose your own weights and rate them. Then change the weights and see whether your best player changes too.

Further reading

Get new pieces by email

An email when something new is published, and the occasional update. Unsubscribe in one click. How your email is used.