2024 and Differences of Squares — Solution

The new year 2024 is a difference of squares, 2024 = 45^2 - 1^2 , which got me thinking about a fun little number theory problem:

Is there a largest number that can not be expressed as the difference of squares? If so, find it. If not, prove no such number exists. Good luck, and happy new year!

As promised, here’s my solution.

There are infinitely many numbers that can not be expressed as a difference of squares. In fact, we can completely characterize numbers that can be expressed as a difference of squares and those that can’t. It all starts with factoring.

Differences of squares have a useful structure that can be exposed by factoring:

a^2 - b^2 = (a + b) \times (a - b)

We can leverage this structure to answer our question.

Suppose n can be factored as n = s \times t. If n can be expressed as a difference of squares, then we can also write

n = a^2 - b^2= (a + b) \times (a - b)

Now set (a + b) = s and (a - b) = t. This gives us the system of equations

a + b = s

a - b = t

We can solve this system by adding and subtracting the equations. Adding gives us a = \frac{s+t}{2} , and subtracting gives us b = \frac{s-t}{2}. This shows us how to express n as a difference of squares: Just factor n into s \times t, compute a = \frac{s+t}{2} and b = \frac{s-t}{2}, and then n =  (a + b) \times (a - b) = a^2 - b^2.

There’s only one thing we have to worry about: a and b must be integers. But as long as s and t have the same parity — that is, s and t are both even or both odd — then the sum and difference of s and t will both be even, and so \frac{s \pm t}{2} will be an integer.

This means that n can be expressed as a difference of squares if and only if we can write n = s \times t where s and t are both odd or both even. This is usually possible, often in multiple ways. But there’s one situation when it isn’t: When n is divisible by 2 exactly once. When this is true, then however you factor n into s \times t, the lone factor of 2 will end up as a part of either s or t, making one of them even and the other odd. Thus, in this case, it’s impossible to factor n so that the two factors have the same parity, and so it’s impossible to express n as a difference of squares.

This gives us a complete answer to our question: A number n is not expressible as a difference of squares if and only if it is divisible by 2 exactly once! In other words, every odd number times 2 is not expressible as a difference of squares, and every other integer is.

As an example, given n = 105 = 3 \times  5 \times 7, we can factor 105 = 7 \times 15 which gives a=\frac{15+7}{2}= 11 and a=\frac{15-7}{2}=4, and sure enough, 105 = 11^2 - 4^2. Notice, we could also write 105 = 5 \times 21, which gives a = \frac{21+5}{2}=13 and b = \frac{21-5}{2}=8, so 105 = 13^2 - 8^2.

On the other hand, it isn’t possible to do this at all for 6. There are only two factorizations, 6 = 6 \times 1 and 6 = 2 \times 3, and in both cases the factors have different parity, so the a and b we need won’t be integers.

There’s an interesting resemblance here to Euclid’s Formula for generating Pythagorean triples. There’s also an interesting follow-up question about how many different ways a number can be expressed as a difference of squares. And since the numbers that answer our question are those that are divisible by 2 exactly once, I wonder what properties numbers that are divisible by 3 exactly once have.

Thanks to everyone who contributed on the Mastodon thread! There are some cool ideas there as well, so be sure to check it out.

Related Posts

2024 and Differences of Squares

The new year is one of my favorite kinds of numbers: a difference of squares!

2024 = 46 \times 44  = (45 + 1) \times (45 - 1) = 45^2 - 1^2

This observation got me thinking about what kinds of numbers can be written as the difference of squares. For example, 3 = 2^2 - 1^2, 5 = 3^2 - 2^2, and 16 = 4^2 - 0^2, but it is impossible to write 6 as the difference of squares of integers.

So here’s a little mathematical puzzle to start the new year: Is there a largest number that can not be expressed as the difference of squares? If so, find it. If not, prove no such number exists. Good luck, and happy new year! I’ll give my answer in a follow-up post.

Related Posts

Related Post

Pierre de Fermat’s Link to a High School Student’s Prime Math Proof — Quanta Magazine

My latest column for Quanta Magazine tells the mathematical story of the incredible high school student who proved a result about not-quite prime numbers that had eluded mathematicians for decades.

[Daniel] Larsen was a high school student in 2022 when he proved a result about a certain kind of number that had eluded mathematicians for decades. He proved that Carmichael numbers — a curious kind of not-quite-prime number — could be found more frequently than was previously known, establishing a new theorem that will forever be associated with his work. So, what are Carmichael numbers? To answer that, we need to go back in time.

You can read the full article for free here.

The Symmetry That Makes Solving Math Equations Easy — Quanta Magazine

My latest column for Quanta Magazine is about one of the most dreaded mathematical objects in high school math: the quadratic formula!

x=\frac{-b \pm \sqrt{b^2-4ac}} {2a}

As complicated as the quadratic formula is, the cubic formula is much worse, but a simple geometric idea connects the two.

As intimidating as this looks, hiding inside is a simple secret that makes solving every quadratic equation easy: symmetry. Let’s look at how symmetry makes the quadratic formula work and how a lack of symmetry makes solving cubic equations much, much harder. So much harder, in fact, that a few mathematicians in the 1500s spent their lives embroiled in bitter public feuds competing to do for cubics what was so easily done for quadratics.

You can read the full article here.

How Big is Infinity? — Quanta Magazine

My latest column for Quanta Magazine explores one of my favorite topics: infinity!

At the end of the Marvel blockbuster Avengers: Endgame, a pre-recorded hologram of Tony Stark bids farewell to his young daughter by saying, “I love you 3,000.” The touching moment echoes an earlier scene in which the two are engaged in the playful bedtime ritual of quantifying their love for each other. According to Robert Downey Jr., the actor who plays Stark, the line was inspired by similar exchanges with his own children.

The game can be a fun way to explore large numbers:

“I love you 10.”

“But I love you 100.”

“Well, I love you 101!”

This is precisely how “googolplex” became a popular word in my home. But we all know where this argument ultimately leads:

“I love you infinity!” “

Oh yeah? I love you infinity plus 1!”

Learn how a staple of high school math — functions — can help mathematicians understand infinity and even describe the different kinds of infinities there are! The full column is available here and includes a few challenging exercises at the end.

Follow

Get every new post delivered to your Inbox

Join other followers: