How many of the integers between 1 and 1000, inclusive, can be expressed as the difference of the squares of two non-negative integers?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Actually the answer is 748 because 1 and 4 cannot be expressed as the difference of the squares of two positive integers, because 0 is not a positive integer.
Log in to reply
Good catch - I edited the question to convey the original intent.
Log in to reply
@Freddie Hand Great eye for detail! Those who answered 748 have been marked correct :)
In future, if you notice such errors, you can report the problem directly by selecting that option in the menu.
( n + 1 ) 2 − n 2 = 2 n + 1 ,
thus every odd integer can be expressed as difference between 2 sqares
( n + 1 ) 2 − ( n − 1 ) 2 = 4 n
thus every multiple of 4 can be expressed as difference between 2 sqares
now, we need to prove that 2 ( 2 n + 1 ) cannot be expressed as difference between 2 squares
Assume, 2 ( 2 n + 1 ) can be expressed as difference between 2 squares
2 ( 2 n + 1 ) = a 2 − b 2 = ( a + b ) ( a − b )
now (a+b) and (a-b) will have the same parity i.e,they will both be even or they will both be odd
CASE 1: Assume they are odd
( 2 n + 1 ) ( a + b ) ( a − b ) = 2 which has no solution
CASE 2: Assume they are even
( 2 ) ( a + b ) ( a − b ) = 2 n + 1 ,which has no solution since LHS is always even
Thus our initial assumption is wrong and 2 ( 2 n + 1 ) cannot be expressed as difference between 2 squares
There are 5 0 0 odd numbers between 1 an 1 0 0 0 , and 2 5 0 multiples of 4 , thus the required answer is
5 0 0 + 2 5 0 = 7 5 0
For variety's sake I've decided to post a solution showing my actual path to the answer, rather than a boiled down, sanitised version. I hope you like it.
Every difference of two squares can be factorised like this
a 2 − b 2 = ( a − b ) ( a + b ) … ( 1 )
and for our problem a and b are integers and 0 ≤ b ≤ a
Suppose first of all that a − b = 1 so that a = b + 1 . Then in equation (1) we have
a 2 − b 2 = ( 1 ) ( b + 1 + b ) = 2 b + 1
For b = 0 , 1 , 2 … the right hand side of this equation becomes 1 , 3 , 5 … and so we see that every positive odd integer is the difference of two squares. It is fun to confirm this with some specific examples -
1 = 1 2 − 0 2 3 = 2 2 − 1 2 5 = 3 2 − 2 2 …
Now let's suppose that a − b = 2 so that a = b + 2 . Then in equation (1) we have
a 2 − b 2 = ( 2 ) ( b + 2 + b ) = 2 ( 2 b + 2 ) = 4 ( b + 1 )
Now for b = 0 , 1 , 2 … the right hand side of this equation becomes 4 , 8 , 1 2 … and so we see that every positive multiple of 4 is the difference of two squares. Again it is nice to confirm this with specific examples, to make sure we are not barking up the wrong tree -
4 = 2 2 − 0 2 8 = 3 2 − 1 2 1 2 = 4 2 − 2 2 …
At this point I could intuit the solution: between 1 and 1000, all the 500 odd numbers and all the 250 multiples of four can be expressed as differences of two squares, making 7 5 0 in all.
To make the solution complete we have to make clear why none of the other even numbers can be expressed as the difference of two squares. We can do this by showing that if a 2 + b 2 is even it is necessarily a multiple of 4.
Notice that ( a − b ) and ( a + b ) have the same parity (by which I mean oddness or evenness) because their difference is 2 b which is even. Then from equation 1 we see that a 2 + b 2 can be even only if ( a − b ) and ( a + b ) are both even, which forces a 2 + b 2 to be a multiple of 4.
Clearly, every odd positive integer can be expressed as
(
n
+
1
)
2
−
n
2
=
2
n
+
1
for a non-negative integer
n
.
Now, since all odd positive integers can be expressed as difference of two non-negative squares, by multiplying both squares by
4
they remain as squares and produce every positive integer divisible by
4
.
Also, since squares of non-negative integers are always,
0
or
1
modulo
4
, we trivially know that a difference of two non-negative squares is never congruent to
2
modulo
4
.
Hence, all odd numbers and numbers divisible by 4 can be and all others can't be expressed as difference of two non-negative squares.
Thus, the answer must be 7 5 0 .
a 2 − b 2 = n where a , b ∈ Z + and 1 ≤ n ≤ 1 0 0 0
( a + b ) ( a − b ) = n .Here ( a + b ) and ( a − b ) should be both odd or both even.If a there is only one factor of two in the whole number then if u factorise any ways there will be one even factor and one odd factor .As their parity is different that's why there will be no a,b..Now, we will find such n .Our rquire will looks like n = 2 × 3 a 1 × 5 a 2 × ⋯ .This n ′ s can be found just multiplying 2 with a odd integer.
So, maximum n = 2 m < 1 0 0 0 = 9 9 8 ⟹ m ≤ 4 9 9 . i.e. 1 , 3 , 5 , 7 , . . . . , 4 9 9 .There are 2 5 0 numbers are there.
Therefore, required number of n = 1 0 0 0 − 2 5 0 = 7 5 0
The crux of the problem is to explain why "if n is comprised of only one factor of two, then it is not possible to find a, b". Can you elaborate on that?
The information of "n will look like 2 × 3 a 1 × 5 a 2 … " seems irrelevant. There are much better ways of showing that there are 250 numbers which are multiple of 2 and not 4.
Log in to reply
If a there is only one factor of two in the whole number then if u factorise any ways there will be one even factor and one odd factor .As their parity is different that's why there will be no a,b.
Yes I agree there is a better way to find the number of integers which is only multiple of two not four but at hat moment I got that idea
Log in to reply
As always, steps / explanations like this should be included in the solution directly. Not everyone is a mind reader who knows exactly what you are saying. They can only read what you wrote, to try and understand what you're thinking.
If you bear this in mind, that would greatly help with your solutions. A lot of times you miss out such steps. Sometimes they are minor and can be subsequently edited in, sometimes they are major and impact the entire solution.
As another example, you ignored the impact of "positive integers" vs "non-negative integers" in your solution. In the previous version, we should also have a step to explain why these values a , b are positive integers, in which case you would have realized that the answer was not 750.
Problem Loading...
Note Loading...
Set Loading...
We want to know the number of integers x which can be written as
x = a 2 − b 2
Let's break this up and look at two sets of numbers: odd and even.
If x is an odd number, it can be written as 2 n + 1 . Now consider the number ( n + 1 ) 2 , or n 2 + 2 n + 1 . We can use that to express 2 n + 1 in a different way.
2 n + 1 = ( n + 1 ) 2 − n 2
This proves that every odd number can be written as the difference of two squares. In fact, adjacent squares are separated by successive odd numbers.
Now let's account for the even numbers. First, we know that a 2 − b 2 = ( a + b ) ( a − b ) . Let's consider 3 cases relating to the parity of a and b : a and b are both even, both odd, or one of each.
Both even : a ± b is even, ( a + b ) ( a − b ) is even
Both odd : a ± b is even, ( a + b ) ( a − b ) is even
Even, odd : a ± b is odd, ( a + b ) ( a − b ) is odd
We can ignore the last option, since we've already taken care of the odd numbers.
Any product of two even numbers has to be divisible by 4 − this is because the product will have at least two 2 s in its prime factorization. But the even numbers that cannot be evenly divided by 4 − 2 , 6 , 1 0 , and so on − cannot be expressed as the product of two even numbers. These numbers therefore cannot be expressed in the form ( a + b ) ( a − b ) , which also means that they cannot be expressed as the difference of two squares.
But is the converse − that all the even numbers divisible by 4 can be expressed as the difference of two squares − necessarily true? Yes, because if x is a multiple of 4 , it equals 4 n for some number n .
4 n can be rewritten as: ( n + 1 ) 2 − ( n − 1 ) 2 .
Thus, half of all the even numbers (those divisible by 4 ) can be expressed as the difference of two squares. The first 1 , 0 0 0 integers contain 5 0 0 even numbers, so half of those, plus all the odd numbers, can be expressed as a difference of two squares.
2 5 0 + 5 0 0 = 7 5 0