Image copyright Getty Images Image caption The maths survey was conducted in 2011, 2013 and 2015

Pupils in Scotland are doing less well in maths, according to the latest Scottish government figures.

Between 2013 and 2015, the proportion of P4 and S2 students performing "well or very well" fell.

Pupils from better off areas recorded better results than those from the most deprived communities.

The country's new education secretary John Swinney said the statistics reinforced the need to improve attainment.

The statistics feature in the latest Scottish Survey of Literacy and Numeracy (SSLN) which is an annual sample monitoring national performance of school children at P4, P7 and S2 in literacy and numeracy.

'We have much to do'

Approximately 10,500 pupils in 2,200 schools took part in the 2015 survey.

Numeracy performance was highest at P4 and P7 with 66% of pupils at those stages performing well or very well. At S2, 40% of pupils performed well or very well.

After the figures were published, Mr Swinney said: "We have much to do to ensure our young people are supported to improve their understanding and use of numeracy, and our teachers are equipped with the knowledge, skills and confidence to drive up standards in this area.

"We have introduced several measures since numeracy statistics were last published in 2014 as part of our firm commitment to address the attainment gap."

Example S2 question

Fiona's annual electricity bill is £400. A wind turbine would reduce this bill by 25%.

The turbine costs £2,000 to install.

From the savings she makes, how many years would it take her to pay for the cost of the wind turbine?

(Answer at the bottom of the story)

Other findings in the survey included:

at P4 and P7, there was a decrease in the proportion of girls and boys performing well or very well between 2011 and 2013, with no statistically significant change between 2013 and 2015.

there has been no change to the proportion of S2 boys performing well or very well over the three years

S2 girls performance remained the same at 41% in 2011 and 2013, before decreasing to 38% in 2015.

in 2013 boys outperformed girls at P7 only, whereas in 2015 boys outperformed girls at S2 only, so the gender gap in numeracy performance for the same set of pupils still exists.

a performance gap between richer and poorer areas continues to exist across all stages.

when asked about working with numbers, pupils in P4 (90%) and P7 (83%) registered the greatest enjoyment.

and at S2, two-thirds of pupils reported enjoying numeracy work.

The Scottish Conservative Party's education spokeswoman Liz Smith said the "appalling" figures showed the SNP was "failing Scotland's pupils and failing to close the attainment gap".

She added: "The SNP has completely taken its eye of the ball when it comes to education and helping those from the most deprived backgrounds to succeed. The Scottish Conservatives will hold the Nationalists to account on their poor record on education.

"We have said for quite some time that the attainment gap between children from poorer and richer backgrounds remains the biggest challenge in our education system. The SNP must look at narrowing this gap now, as a matter of priority."

Education investment 'slashed'

Scottish Labour education spokesman Iain Gray called the figures a disgrace.

He added: "Our children pay the price in poorer literacy and numeracy skills. No wonder the SNP hid these figures until after the election. They lay bare their failure on education. Performance fell in every category and every stage, and the gap between the richest and the rest increased.

"John Swinney says these new figures show the scale of the challenge he faces, but it is a challenge he created himself by slashing investment in education during his near decade in charge of Scotland's finances."

Scottish Green MSP Ross Greer said the survey showed that the new education secretary must "get to grips with the inequality that is becoming embedded in our society".

He added: "Rather than pursuing national testing, the Scottish government should be making its priorities in our schools the recruitment and retention of staff and the reduction of staff workload.

"Supporting teachers to create stimulating learning environments is essential, as numeracy is a vital skill that equips young people for the challenges of adult life."