The numbers 1 , 2 , 3 , . . . , 2 0 1 7 , 2 0 1 8 are divided into 2 groups:
a 1 < a 2 < ⋯ < a 1 0 0 9 and b 1 > b 2 > ⋯ > b 1 0 0 9 .
What is the sum of all possible values of ∣ a 1 − b 1 ∣ + ∣ a 2 − b 2 ∣ + ⋯ + ∣ a 1 0 0 9 − b 1 0 0 9 ∣ ?
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.
That's... quite a lot easier than my solution ^_^. I'm going to leave mine there, but you have my upvote.
I did it the same way :)
They asked for the sum of all possible values so I supposed that the result would be the same no matter how you divide the groups. Then I choosed the a group [1,1009] and the b group [1010,2018] b1 being 2018 and so on. Divided this way, the sum of a-b for all the elements will be 1009. so the result will be 1009 times 1009 equal 1018081.
Sorry this is my first contribution here so I didn't express well my solution but I hope you understood me!
Yes, I can read your solution. And it's completely incorrect.
I had been thinking like you did, until I came up with one that has a lot of different values (regardless, there's still a way to calculate the answer) So yeah, don't force yourself to think that way.
Log in to reply
Why is it incorrect? What is your counter example? if you had different values with different sets then it's a contradiction with the assumption of the exercice!
Log in to reply
It doesn't contradict any assumptions. We know that 1,018,081 is possible, but if there was another set with the value 1,000,000 then the final answer would be 2,018,081.
Log in to reply
@Nate Jellis – I don't think I understand you! I don't see anything wrong with my answer! the exercice says that no matter how you divide the two sets as long as you respect the condition stated, the sum will give allways 10181081. I respected that condition and applied the sum and I got it right! What is wrong with it?
Log in to reply
@Sami . – The exercise doesn't say that. Imagine that you try out all the different ways to divide the two sets. Each time, calculate the value of the expression and write it down. When you're done, add up all the unique numbers you've written down, and that will be your answer.
There are two kinds of sums involved: a sum of absolute values (there may be more than one), and a sum of sums of absolute values (there is only one).
Log in to reply
@Nate Jellis – That's what I have done!!!! I did the sum of sums of absolute values which was supposed to be only one!!!! I did it for one particular set and it worked!!!! The way the exercise is presented suggest that the expression would have the same value no matter how you divide the two sets! so once you get that value for a particular set it will be the same for the others!!!!!!!!!!!!!!!!!! You still didn't point out what is wrong with my logic!!!!!!!! It is like if I asked you what is the value of a number divided by itself! it will be always one! so you need to calculate that division for just one number and you are done! I resolved this exercise with the same logic!!!!!
Log in to reply
@Sami . – Could you explain why you think the exercise suggests that the expression will always have the same value? Which part suggests that?
The sum of sums has only one possible value, but that doesn't mean the expression has only one possible value. Consider this question: if n is an integer between 1 and 5, what is the sum of all possible values of n^2? The answer is 1 + 4 + 9 + 16 + 25, which equals 55. You can't just pick n=2 and then say the answer is 4.
Log in to reply
@Nate Jellis – When they explecitly ask: "What is the sum of all possible values of the expression?" I made the assumption that the exression will always have the same value as long as you respect the conditions stated above. Proving the veracity of this assumption would be a nice exercise though! I took it it for granted and I got the result!
Log in to reply
@Sami . – "What is the sum of all possible values of the expression?" does not imply that the expression will always have the same value, as you can see from the example in my last comment.
Log in to reply
@Nate Jellis – But your example concerns only your example! if there was a different value for the expression then they would have trolled us, letting us looking for a value that change depending on the sets! indeed it doesn't imply 100% that it will have always the same value!
Log in to reply
@Sami . – Let f(X)=|a 1-b 1|+|a 2-b 2|+...+|a 1009-b 1009|. Where X is the set of values of a i and b i satisfying the inequality condition set.
The question asks for the SUM of all possible values of f(X). For this question the solution to the question MUST show that f(X) is the same for all possible sets X, this cannot be assumed.
Log in to reply
@Alex Burgess – Calculating the sum of all possible value is a thing. And proving that that f(x) is the same for all possible sets is another. You can still calculate the value for all possible sets with an algorithme without having to prove that statement! But you are right that if it works for a particular set doesn't mean that it will work for other sets! but the way the question is asked suggest that there will be only one solution so if it's about answering the question right my method is right!
Log in to reply
@Sami . – Calculating the sum, f(X), for all possible sets X, results in you showing that f(X) is the same for every set X. So those statements were equivalent...
I agree only that the question may be misinterpreted in regards to the word 'SUM'. Sum here relates to the SUM of all possible f(X), not the value of the sum f(X). So your method is flawed, but does arrive at the same solution by chance.
That's what I did too! It seemed rather simple for an "Advanced" problem.
Log in to reply
The key to the question is Proving that the sum is the same no matter how you divide the groups. The question asks for the total sum of all possible values of the equation at the bottom. NOT for the value of the equation for one possible grouping.
We induct on N ( a , b ) = ∣ ∣ ∣ { ( i , j ) : a i < b j , 1 ≤ i , j ≤ 1 0 0 9 } ∣ ∣ ∣
First note that if N ( a , b ) = 0 , then a 1 > b 1 so b 1 0 0 9 < b 1 0 0 8 < ⋯ < b 2 < b 1 < a 1 < a 2 < ⋯ < a 1 0 0 8 < a 1 0 0 9 which implies a i − b i = 2 i − 1 for all 1 ≤ i ≤ 1 0 0 9 , so i = 1 ∑ 1 0 0 9 ∣ a i − b i ∣ = i = 1 ∑ 1 0 0 9 ( 2 i − 1 ) = 1 0 0 9 2 = 1 0 1 8 0 8 1 .
Now suppose N ( a , b ) > 0 . Then there must be some 1 ≤ n , m ≤ 1 0 0 9 such that a n < b m . Let n be the maximum such value and then, subject to this n , let m be the maximum such value. That is, b m + 1 < a n < b m < b m − 1 < ⋯ < b 2 < b 1 < a n + 1 (See the note below for a comment on one possible issue). We now consider the new sequences a i ′ = { a i b m i = n i = n , b i ′ = { b i a n i = m i = m It's easy to see that these satisfy a 1 ′ < a 2 ′ < ⋯ < a 1 0 0 9 ′ , b 1 ′ > b 2 ′ > ⋯ > b 1 0 0 9 ′ and N ( a ′ , b ′ ) = N ( a , b ) − 1 , so we now turn to the task of evaluating ∣ a 1 ′ − b 1 ′ ∣ + ∣ a 2 ′ − b 2 ′ ∣ + ⋯ + ∣ a 1 0 0 9 ′ − b 1 0 0 9 ′ ∣ . Immediately, we see that ∣ a i ′ − b i ′ ∣ = ∣ a i − b i ∣ for all i = n , m . For the remaining term(s), we consider the following cases:
Therefore, we see that i = 0 ∑ 1 0 0 9 ∣ a i − b i ∣ = i = 0 ∑ 1 0 0 9 ∣ a i ′ − b i ′ ∣ so by induction, i = 0 ∑ 1 0 0 9 ∣ a i − b i ∣ = 1 0 0 9 2 = 1 0 1 8 0 8 1
We can conclude that the only possible value of ∣ a 1 − b 1 ∣ + ∣ a 2 − b 2 ∣ + ⋯ + ∣ a 1 0 0 9 − b 1 0 0 9 ∣ is 1 0 1 8 0 8 1 , so trivially the sum of all possible values is also 1 0 1 8 0 8 1 .
Note : When I'm defining n , m for the inductive step, I reference b m + 1 and a n + 1 in the following inequality. Of course, if either of m , n equals 1 0 0 9 , then the corresponding value isn't defined. However, this doesn't effect the rest of the proof, as it's only important when the corresponding term does exist to show that the a ′ , b ′ sequences are increasing and decreasing, respectively.
Weirdly complicated but beautiful regardless :D
Taking the first few partial sums we get:
|1 - 2018| = 2017,
|2 - 2017| = 2015,
|3 - 2016| = 2013, and so on
Thus it is deduced that we are being asked to sum the consecutive odd integers ≤ 2017. There is a theorem that states that sum of consecutive odd integers is equal to the square of the number of integers summed. Don't feel like giving a detailed proof because it is fairly intuitive when looking at the first few cases:
1 + 3 = 4,
1 + 3 + 5 = 9,
1 + 3 + 5 + 7 =16 and so on.
Therefore the sum is equal to 1 0 0 9 2 = 1018081
I will first prove that, for any even number N , if the numbers from 1 to N are divided into two groups a 1 < . . . < a 2 N and b 1 > . . . > b 2 N , then the sum ∑ k = 1 2 N ∣ a k − b k ∣ is the same regardless of the grouping. To see this, imagine the numbers from 1 to N as being stretched out in a line and half of them bolded. The bolded numbers are in the b group, and the non-bolded ones are in the a group. For N = 4 , it might look like: 1 2 3 4 . Notice that any possible grouping can be created from any other by repeatedly switching which of two adjacent numbers in different groups is bolded. For example, the grouping 1 2 3 4 can be created from 1 2 3 4 with three such swaps:
1 2 3 4 → 1 2 3 4 → 1 2 3 4 → 1 2 3 4.
I now claim that performing a swap as defined above does not change the value of ∑ k = 1 2 N ∣ a k − b k ∣ . To see this, consider the configuration 1 ... x x + 1 ... N. Here, x = a i and x + 1 = b j . If i = j , their contribution to the sum is ∣ x + 1 − x ∣ = 1 , and swapping would simply make it ∣ x − ( x + 1 ) ∣ = ∣ − 1 ∣ = 1 , which is the same. If i = j , then these two and their partners ( b i and a j ) in their opposite groups make a contribution to the sum of ∣ x − b i ∣ + ∣ a j − ( x + 1 ) ∣ . Now perform a swap to get 1 ... x x + 1 ... N. After the swap, x = b j and x + 1 = a i . Their new contribution to the sum is ∣ ( x + 1 ) − b i ∣ + ∣ a j − x ∣ = ∣ ( x − b i ) + 1 ∣ + ∣ ( a j − ( x + 1 ) ) + 1 ∣ . To show that the the new contribution is identical to the old, two situations must be considered:
The cases above show that the two expressions within the absolute values will always have opposite sign. Therefore, adding one within the absolute value signs to both expressions, as is done by the swapping, will have opposite effects on each, adding 1 to one of the absolute values and subtracting 1 from the other. The net effect is zero, so a swap with the number on the right beginning in the b group does not alter the contribution of the two numbers and their partners to the sum. A swap with the number on the right beginning in the a group is just the reverse, so the net effect of this is zero as well. It's pretty easy to see that a swap doesn't change the values of any other pairs ∣ a k − b k ∣ . This means swaps do not alter the sum at all. Since any grouping can be transformed to any other through swaps, all groupings have the same sum. A convenient grouping can be chosen to calculate it. Making all the numbers from 1 to 2 N part of the a group and all the remaining numbers part of the b shows that the sum is equal to the sum of the first 2 N odd numbers, or ( 2 N ) 2 . For N = 2 0 1 8 , this is 1 0 0 9 2 = 1 0 1 8 0 8 1 .
Let A be the set of all a n and let B be the set of all b n .
For all 1 ≤ n ≤ 1 0 0 9 , if a n ≤ 1 0 0 9 , then there must be at least n members of A that are less than or equal to 1009. By the lemma, there are at least n members of B that are greater than 1009. That means b n > 1 0 0 9 . Since the converse also holds, we can conclude a n ≤ 1 0 0 9 ⇔ b n > 1 0 0 9 .
After removing absolute values and rearranging terms, the sum is 1 0 0 9 2 .
Lemma:
∣
{
x
∈
A
∣
x
≤
1
0
0
9
}
∣
=
∣
{
x
∈
B
∣
x
>
1
0
0
9
}
∣
This can be proved by combining the following two statements:
∣
{
x
∈
A
∣
x
≤
1
0
0
9
}
∣
+
∣
{
x
∈
B
∣
x
≤
1
0
0
9
}
∣
=
1
0
0
9
∣
{
x
∈
B
∣
x
≤
1
0
0
9
}
∣
+
∣
{
x
∈
B
∣
x
>
1
0
0
9
}
∣
=
1
0
0
9
Nice lemma! Proof is easy, right? :D
First, set:
a 1 = 1 , a 2 = 2 , . . . , a 1 0 0 9 = 1 0 0 9 , b 1 0 0 9 = 1 0 1 0 , . . . , b 1 = 2 0 1 8 .
Trivially, the sum is
∑ n = 1 1 0 0 9 2 n − 1 = 1 0 0 9 2 = 1 0 1 8 0 8 1 .
Then show that any other configuration change doesn't produce any different sum value: any configuration can be reached switching an a with a b (you cannot switch a with a or b with b, because of the order) and any a-b switch makes one element of the sum +1 and another one -1. Configuration change is an invariance for the total sum. So there is only one possible value for the sum, 1009^2, and the sum of all possible values is 1009^2.
Carl Friedrich Gauss as an elementary student (1700s) amazed his teacher when he quickly found sum of the integers from 1 to 100 to be 5,050. Gauss recognized he had fifty pairs of numbers when he added the first and last number in the series, the second and second-last number in the series, and so on. For example: (1 + 100), (2 + 99), (3 + 98), . . . , and each pair has a sum of 101.
Following the steps of this great man: 1-1010=-1009; 2-1011=-1009; 3-1012=-1009... So, (-1009)(1009 pairs)=-1018081 Absolute value= 1018081
From the text it is clear that you could choose any such sequence. I chose 1 to 1009 and 1010 to 2018. The elements of the sum are then 1, 3, 5, ... 1009 so the sum is 1009^2.
It's asking for every possible sequence. How are you so sure of the answer? What if there are 10 possible values but there's still a way to calculate the answer?
For the numbers 1 , 2 , 3 , 4 there are only ( 2 4 ) = 6 possible groups and the process gives 4 for all of them.
For the numbers 1 , 2 , 3 , 4 , 5 , 6 there are only ( 3 6 ) = 2 0 possible groups and the process gives 9 for all of them.
Beyond this, there are too many to write them all out, but the structure is already apparent in these small examples.
It is pretty clear that the process for the numbers 1 , 2 , 3 , . . . , 2 n always gives the value n 2 but I don't quite have a proof.
It seems like the best way would be to show that swapping any value from a with one from b doesn't change the value. This is complicated by the fact that some a i will have to shift position and the point where the a j begins to exceed b j might also switch.
I will need to give this more thought.
Problem Loading...
Note Loading...
Set Loading...
Claim: max ( a i , b i ) ∈ { 1 0 1 0 , 1 0 1 1 , . . . , 2 0 1 8 } and min ( a i , b i ) ∈ { 1 , 2 , … , 1 0 0 9 } for all i .
Proof of Claim: Assume not. Then there is an 1 ≤ m ≤ 1 0 0 9 such that (1) a m > 1 0 0 9 , b m > 1 0 0 9 or (2) a m ≤ 1 0 0 9 , b m ≤ 1 0 0 9 .
Case (1): 1 0 0 9 < a m < a m + 1 < … < a 1 0 0 9 ≤ 2 0 1 8 , 1 0 0 9 < b m < b m − 1 < … < b 1 ≤ 2 0 1 8 , so there are 1 0 1 0 distinct integers ( b 1 , . . . , b m , a m , … , a 1 0 0 9 ) between 1 0 1 0 and 2 0 1 8 inclusive, contradiction by Pigeonhole principle.
Case (2): similar to (1)
so the claim holds and the desired sum must be 1 0 1 0 + 1 0 1 1 + . . . + 2 0 1 8 − ( 1 + 2 + . . . + 1 0 0 9 ) for any partition of { 1 , 2 , . . . , 2 0 1 8 } .