Skip over navigation
Cambridge University Faculty of Mathematics NRich logo
menu search
  • Teachers expand_more
    • Early years
    • Primary
    • Secondary
    • Post-16
    • Events
    • Professional development
  • Students expand_more
    • Primary
    • Secondary
    • Post-16
  • Parents expand_more
    • Early Years
    • Primary
    • Secondary
    • Post-16
  • Problem-Solving Schools
  • About NRICH expand_more
    • About us
    • Impact stories
    • Support us
    • Our funders
    • Contact us
  • search

Or search by topic

Number and algebra

  • The Number System and Place Value
  • Calculations and Numerical Methods
  • Fractions, Decimals, Percentages, Ratio and Proportion
  • Properties of Numbers
  • Patterns, Sequences and Structure
  • Algebraic expressions, equations and formulae
  • Coordinates, Functions and Graphs

Geometry and measure

  • Angles, Polygons, and Geometrical Proof
  • 3D Geometry, Shape and Space
  • Measuring and calculating with units
  • Transformations and constructions
  • Pythagoras and Trigonometry
  • Vectors and Matrices

Probability and statistics

  • Handling, Processing and Representing Data
  • Probability

Working mathematically

  • Thinking mathematically
  • Developing positive attitudes
  • Cross-curricular contexts

Advanced mathematics

  • Decision Mathematics and Combinatorics
  • Advanced Probability and Statistics
  • Mechanics
  • Calculus

For younger learners

  • Early Years Foundation Stage

Square Difference

Age 16 to 18
Challenge Level Yellow starYellow star
  • Problem
  • Student Solutions
  • Teachers' Resources

 

Nishad from Thomas Estley Community College, Dylan from Brooke Weston, Steve from Dulwich College, Ziwei (Gilbert) from Stowe School and Joshua from Bohunt Sixth Form, all in the UK, Xuan Tung from HUS High School for Gifted Students in Vietnam, Dibyadeep from Greenhill School in the USA and Rishik K expressed each of the numbers $3, 5, 8, 12$ and $16$ as the difference of two non-zero squares. This is Rishik's work:

Nishad, Dylan, Joshua, Steve, Ziwei (Gilbert), Rishik, Dibyadeep and Xuan Tung proved that any odd number can be written as the difference of two squares. This is Dylan's work:

Dylan, Dibyadeep, Joshua, Steve, Ziwei (Gilbert), Xuan Tung and Nishad proved that all numbers of the form $4k$ can be written as the difference of two squares. This is Ziwei (Gilbert)'s work, which begins with an exploration (click on the image to open a larger version):

Nishad used a very neat factorisation of $4k$ to prove the statement:

 

Nishad, Dylan, Joshua, Steve, Xuan Tung, Ziwei (Gilbert) and Dibyadeep all proved that no number of the form $4k+2$ can be written as the difference of two squares.

This is Dylan's proof:

Ziwei (Gilbert) and Dibyadeep thought instead about whether $a$ and $b$ (or "$x$" and "$y$") were odd or even. This is Ziwei (Gilbert)'s work (click on the images to open larger versions):

Dibyadeep went into even more possible cases:


To prove that numbers of the form $pq$ (where $p$ and $q$ are primes greater than $2$) can be written as the difference of two squares in exactly two ways, Ziwei (Gilbert) began with several investigations. This is some of Ziwei (Gilbert)'s work (click on the image to open a larger version):

Magnetoninja from the United States, Daniel from Dulwich College, Nishad, Dibyadeep, Dylan, Joshua, Steve and Ziwei (Gilbert) used this idea to prove the statement. This is Magnetoninja's work:

For integers $s$ and $t,$ WLOG (without loss of generality) let $s\gt t,$ the difference of the two squares $s^2-t^2=(s+t)(s-t).$

We claim that the two ways to write $pq$ such that it is the sum of two squares is to let $s-t=1$ and $s+t=pq,$ or to let $s-t=p$ and $s+t=q.$

Now we prove that this works for all primes $p$ and $q$ such that $p,q\gt2.$ We first consider letting $s-t=1$ and $s+t=pq.$ Substituting the first equation for $s$ in terms of $t$ into the second equation, we get $2t+1=pq.$ Note that $t$ can vary since we are only focusing on $p$ and $q,$ so it follows that $2t+1$ can be any odd number. Also, $p$ and $q$ must be odd since they are both primes greater than $2.$ This concludes the proof for our first case.

Next, we prove that $s-t=q$ and $s+t=p$ also works. Substituting the first equation for $s$ in terms of $t$ into the second equation, we obtain $q+2t=p.$ Once again, $t$ can vary so $2t$ can be any even number. Note that $p$ and $q$ are prime, therefore odd, so their difference will be an even number, proving our second case as well.

There are no more ways to write $pq$ as the difference of two squares since $p$ and $q$ are prime so $pq$ has only $4$ divisors and $2$ divisor pairs.

Can you see where Magnetoninja's cases would go wrong if $p=2$ or $q=2$?

Steve expressed $s$ and $t$ (or "$a$" and "$b$") in terms of $p$ and $q,$ and used this to write a clear explanation of why these results do not hold if $p$ is a prime greater than $2$ and $q=2:$

Natal from Canada started with this idea, and actually used this to answer the earlier questions. However, Natal does not find the second way to write $pq$ as the difference of two squares. Click to see Natal's work.

Xuan Tung extended the case of two primes $p$ and $q$ to any odd number that is not square. Click to see Xuan Tung's work.

Nishad, Dylan, Joshua, Daniel, Steve, Ziwei (Gilbert), Dibyadeep and Natal found the number of distinct ways in which $675$ can be written as the difference of two squares. This is Joshua's work:

Nishad, Dibyadeep, Ziwei (Gilbert), Natal and Xuan Tung showed that there are 6 ways without listing them all. This is Natal's work:



 

You may also like

Curvy Equation

This problem asks you to use your curve sketching knowledge to find all the solutions to an equation.

Digital Equation

Can you find a three digit number which is equal to the sum of the hundreds digit, the square of the tens digit and the cube of the units digit?

Euler's Totient Function

How many numbers are there less than $n$ which have no common factors with $n$?

  • Tech help
  • Accessibility Statement
  • Sign up to our newsletter
  • Twitter X logo

The NRICH Project aims to enrich the mathematical experiences of all learners. To support this aim, members of the NRICH team work in a wide range of capacities, including providing professional development for teachers wishing to embed rich mathematical tasks into everyday classroom practice.

NRICH is part of the family of activities in the Millennium Mathematics Project.

University of Cambridge logo NRICH logo