Deriving penalty counts from RS's and match results

It struck me this morning while watching RS’s after one match that it should be somewhat possible to recover penalty counts for the losing side in the first n matches given every team’s RS after those n matches at a regional with n teams. Since a team’s RS is dependent on the pre-penalty losing alliance’s score, it therefore contains information about penalties that we can extract by being clever.

Given a team that:
-won games that had reported losing scores of a, b, c, and d
-lost games with reported losing scores of e, f, g, and h
-an unknown penalty vector p, with elements p[sub]a[/sub], p[sub]b[/sub], p[sub]c[/sub], p[sub]d[/sub]… representing how many points were deducted in penalties.

Then this team’s RS can be written as:
RS = ((a+p[sub]a[/sub]) + (b+p[sub]b[/sub]) + (c+p[sub]c[/sub]) + (d+p[sub]d[/sub]) + e + f + g + h)/[matches played = 8 in this case]
MatchesPlayed*RS - a - b - c - d - e - f - g - h = p[sub]a[/sub]+ p[sub]b[/sub]+ p[sub]c[/sub]+ p[sub]d[/sub]

We can do this for every team, and we end up with a bunch of equations with the form
(MatchesPlayed*RS minus losing scores) = sum of unknown penalty scores

We can write these into a matrix, solve it for the p vector, and thus derive the penalty point counts. The cell in the ith column and jth row is 1 if team j participated in and won the i’th match, 0 if they did not. The constant vector’s j’th row is ([number of matches the team played]*RS - sum of losing scores in their games). Matrix height is how many teams there are, matrix width is how many matches you’re using.

I don’t have time to implement this (as a student, I actually do have studying to do), but I thought I’d put it out there for people that might want to try it.

Limitations I can think of:
-I don’t think it’d be solveable once the number of matches exceeds the number of teams, though if you grabbed every team’s RS data at the half-way point you could probably use that data to extract penalty counts for the losing side in every match
-Only works for the losing side, I don’t think there is any information about the winning side encoded in match scores or team rankings
-If there are matches that end with 0 points, the potential number of penalties is infinite, and will probably ruin the matrix. Fortunately, there have been no such matches on Galileo so far.