After a dramatic Qatar Grand Prix, in which Bagnaia finished second while Martin struggled to a season-worst 10th due to a rear tyre issues, the gap between the pair stood at 21 points heading to Valencia.
Bagnaia has led the championship at the end of each weekend since the Spanish Grand Prix, only losing it once briefly in that time in Indonesia when Martin went seven points clear when he won the sprint.
After Martin won the sprint on Saturday in Valencia, with Bagnaia fifth, the gap between the pair coming into the final grand prix of the season is just 14.
The simplest maths is this: if Bagnaia is fifth, regardless of where Martin is, he wins the championship.
The permutations are as follows:
If Bagnaia wins the grand prix, Martin cannot be world champion
If Bagnaia finishes inside the top five, Martin cannot be world champion
If Bagnaia finishes from sixth down to 10th, Martin must win to be crowned champion
If Bagnaia is 11th down to 14th, Martin must be inside the top two to win the championship
If Bagnaia is 15th or lower, Martin must be on the podium to win the championship
This will be the sixth time in the modern MotoGP era that the championship will be decided at the final round of a season.
Last year, Bagnaia beat Fabio Quartararo to the crown after coming to Valencia with a 23-point lead.
Prior to that, the 2017, 2015, 2013 and 2006 championships all went down to the wire in Valencia.