One way to solve this problem is to represent the possible courses of the match by paths through a directed graph. Each vertex of the graph represents a possible score $\ (h,a)\ $ that might have occurred during the match, with $\ h\ $ being a score for the home team, $\ a\ $ being a score for the away team, $\ 0\le h\le4\ $ and $\ 0\le a\le3\ .$ The graph contains a directed edge from the vertex representing the score $\ \big(h_1,a_1\big)\ $ to that representing the score $\ \big(h_2,a_2\big)\ $ if and only the latter score is one that could immediately follow the former during the match—that is, if and only if either $\ h_2=h_1+1\ $ and $\ a_2=a_1\ $ or $\ h_2=h_1\ $ and $\ a_2=a_1+1\ .$ Here's a diagram of such a graph:
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/zO9wJ785.jpg)
The total number of ways the game could have occurred is the number of directed paths from the initial vertex, $\ (0,0)\ ,$ to the final vertex, $\ (4,3)\ .$ Calculating this is very simple. The total number of directed paths from the initial vertex to any other vertex is the sum over all immediate predecessors of the latter vertex of the number of directed paths to those predecessors, where we artificially consider the number of directed paths to the initial vertex to be equal to $1$. Starting with the immediate successors of the initial vertex we can successively label each vertex of the graph with the number of directed paths to that vertex once all its immediate predecessors have been labelled. The result of this procedure is illustrated in the following diagram, from which we see that there are $35$ possible ways the game could have occurred.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/iWOd8Xj8.jpg)
The red vertices in the graph represent situations where the away team is in the lead, and what you actually want is the total number of directed paths from the initial to the final vertex that visit at least one of the red vertices. The easiest way to calculate this is to instead calculate the total number of directed paths that never visit a red vertex and subtract it from the total number of paths already calculated. The number of directed paths that never visit a red vertex is just the total number of directed paths that visit only black vertices, and this can be calculated in the same way as was done for the total number of paths, but this time ignoring the red vertices. The result is illustrated in the following diagram, from which we see that there are a total of $14$ directed paths from the initial vertex to the final vertex that never visit any of the red vertices.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/oTMsqroA.jpg)
Thus, the number of ways the game could have occurred if the away team was in the lead at some stage is $\ 35-14=21\ .$