How Fat Tuesday and Lent are determined?

Fat Tuesday is the day before Ash Wednesday. Which is 40 days before Easter