Image copyright Reuters Image caption The Barnett formula funding is based on population size

Northern Ireland is set to receive a funding boost, following the restoration of its devolved government.

While the exact figure is not yet known, the extra spending will be on top of the public money Northern Ireland already receives.

So which parts of the UK receive the most government funding and why is it controversial?

What is the Barnett formula?

For 42 years, public spending across Northern Ireland, Scotland, England and Wales has been based around something called the Barnett formula.

In principle, the way this works is extremely simple.

When the UK government decides to spend more or less on things such as health and education in England, the Barnett formula is used to decide how much money the other nations receive.

For example, if health spending increases by £100 per person in England, the devolved governments should receive the equivalent amount.

Image copyright Getty Images Image caption The UK government is promising a large cash injection, on top of the Barnett formula, to tackle acute funding problems in Northern Ireland's hospitals and schools.

This exact amount is based on the size of their population.

However, the devolved governments are free to spend any extra money on whatever they want. Funding doesn't have to go on health just because the money went on health in England.

As well as population, the size of the grant will also be affected by the level of responsibility the devolved governments have for different policy areas. For example, the Welsh Government does not have responsibility for police funding, so its grant is not affected by changes in this area.

The formula is named after its inventor, the former Labour Chief Secretary to the Treasury Joel Barnett. He devised it in 1978 when he was a member of the government of James Callaghan.

It has no legal status and is merely a convention used by the Treasury.

How much does each nation spend on public services?

Public spending per head varies across the UK.

Last year, Northern Ireland spent the most per head, at £11,590, followed by:

Scotland at £11,247

Wales at £10,656

England at £9,296

For the whole of the UK, spending per head was £9,584.

Public spending per head, 2018-2019

Separately, the Office for National Statistics has produced data on surplus/deficit per person - ie the gap between what is raised in revenues and what is spent.

On that measure, Northern Ireland had the highest net fiscal deficit per head, at £4,978, in 2018-2019, followed by:

Wales at £4,289

Scotland at £2,713

England at £68

London was one of three regions to record a surplus, at £4,369 per person.

Why does Northern Ireland spend the most?

According to the House of Commons Library, there are several reasons why some nations need to spend more:

The cost of providing public services can be higher if the population is spread more thinly

Some UK nations have a bigger public sector. For example, the water industry is publicly owned in Scotland but not in England

Different demographics, such as an older population, may mean more demand in some nations

If the Barnett formula is applied strictly, public spending should, in theory, be the same across the UK over time.

But the UK government can also allocate additional funding outside of this arrangement.

In 2017, for example, the Democratic Unionist Party (DUP) negotiated an extra £1bn in funding for Northern Ireland over five years, in exchange for supporting Theresa May's minority Conservative government.

Scotland and Wales did not receive any additional funding, despite arguing the extra £1bn for Northern Ireland was intended for areas of devolved policy.

In July, a group of MPs on the Public Accounts Committee said there was a lack of transparency about how these sort of decisions were made.

They called for more clarity on funding the UK's nations.