It is important to check you are on the correct tax code!
Your tax code determines how much tax you pay. An example of a tax code is 1257L.
Sometimes the name of the tax code is related to your income. (HM Revenue and Customs determine your tax code.) For example, a person who has £12,570 income which is tax-free might have a tax code of 1257L.
This code imagines a situation in which you get £10,000 for yourself (no tax is applied).
But the next £30,000 you earn is taxed at 10%. This explains the part which states (40000 - 10000) * 0.10.