This may sound silly but what is the purpose of ANNUAL ALLOWANCE OF 40,000?
Having determined the pension contribution for tax relief between the lower of gross total contributions or the higher between 3600 and 100% of relevant earnings, I am not sure what will the annual AA purposed for.
Although tax relief is available on pension contributions paid up to the amount of relevant earnings for a tax year, the annual allowance then acts as an effective maximum annual limit. Where tax relieved contributions based on relevant earnings are paid in excess of the annual allowance (including any brought forward unused allowances), then there will be an annual allowance charge. This charge is then subject to income tax at a person’s marginal rates.