Only approximately 1 0 605 10^{605} cases

Algebra Level 3

The numbers 1 , 2 , 3 , . . . , 2017 , 2018 1,2,3,...,2017,2018 are divided into 2 groups:

a 1 < a 2 < < a 1009 and b 1 > b 2 > > b 1009 . a_1<a_2<\cdots<a_{1009}\qquad \text{and} \qquad b_1>b_2>\cdots>b_{1009}.

What is the sum of all possible values of a 1 b 1 + a 2 b 2 + + a 1009 b 1009 ? |a_1-b_1|+|a_2-b_2|+\cdots+|a_{1009}-b_{1009}|?


The answer is 1018081.

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.

10 solutions

Claim: max ( a i , b i ) { 1010 , 1011 , . . . , 2018 } \max{(a_i,b_i)} \in \{1010,1011,...,2018\} and min ( a i , b i ) { 1 , 2 , , 1009 } \min{(a_i,b_i)} \in \{1, 2, …, 1009\} for all i i .

Proof of Claim: Assume not. Then there is an 1 m 1009 1 \leq m \leq 1009 such that (1) a m > 1009 , b m > 1009 a_m > 1009, b_m > 1009 or (2) a m 1009 , b m 1009 a_m \leq 1009, b_m \leq 1009 .

Case (1): 1009 < a m < a m + 1 < < a 1009 2018 , 1009 < b m < b m 1 < < b 1 2018 1009 < a_m < a_{m+1} < … < a_{1009} \leq 2018, 1009 < b_m < b_{m-1} < … < b_1 \leq 2018 , so there are 1010 1010 distinct integers ( b 1 , . . . , b m , a m , , a 1009 b_1,..., b_m, a_m, …, a_{1009} ) between 1010 1010 and 2018 2018 inclusive, contradiction by Pigeonhole principle.

Case (2): similar to (1)

so the claim holds and the desired sum must be 1010 + 1011 + . . . + 2018 ( 1 + 2 + . . . + 1009 ) 1010+1011+...+2018-(1+2+...+1009) for any partition of { 1 , 2 , . . . , 2018 } \{1,2,...,2018\} .

That's... quite a lot easier than my solution ^_^. I'm going to leave mine there, but you have my upvote.

Brian Moehring - 2 years, 10 months ago

I did it the same way :)

Freddie Hand - 2 years, 10 months ago
Sami .
Aug 14, 2018

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.

Steven Jim - 2 years, 10 months ago

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!

Sami . - 2 years, 10 months ago

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.

Nate Jellis - 2 years, 10 months ago

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?

Sami . - 2 years, 10 months ago

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).

Nate Jellis - 2 years, 10 months ago

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!!!!!

Sami . - 2 years, 9 months ago

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.

Nate Jellis - 2 years, 9 months ago

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!

Sami . - 2 years, 9 months ago

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.

Nate Jellis - 2 years, 9 months ago

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!

Sami . - 2 years, 9 months ago

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.

Alex Burgess - 2 years, 9 months ago

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!

Sami . - 2 years, 9 months ago

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.

Alex Burgess - 2 years, 9 months ago

Log in to reply

@Alex Burgess Completly agree!

Sami . - 2 years, 9 months ago

That's what I did too! It seemed rather simple for an "Advanced" problem.

Nancy Rose - 2 years, 9 months ago

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.

Alex Burgess - 2 years, 9 months ago
Brian Moehring
Jul 30, 2018

We induct on N ( a , b ) = { ( i , j ) : a i < b j , 1 i , j 1009 } N(\mathbf{a},\mathbf{b}) = \Big|\{(i,j)\, :\, a_i < b_j, 1\leq i,j \leq 1009 \}\Big|

First note that if N ( a , b ) = 0 N(\mathbf{a},\mathbf{b})=0 , then a 1 > b 1 a_1 > b_1 so b 1009 < b 1008 < < b 2 < b 1 < a 1 < a 2 < < a 1008 < a 1009 b_{1009} < b_{1008} < \cdots < b_2 < b_1 < a_1 < a_2 < \cdots < a_{1008} < a_{1009} which implies a i b i = 2 i 1 a_i - b_i = 2i-1 for all 1 i 1009 1\leq i\leq 1009 , so i = 1 1009 a i b i = i = 1 1009 ( 2 i 1 ) = 100 9 2 = 1018081. \sum_{i=1}^{1009} |a_i-b_i| = \sum_{i=1}^{1009} (2i-1) = 1009^2 = 1018081.

Now suppose N ( a , b ) > 0 N(\mathbf{a},\mathbf{b})>0 . Then there must be some 1 n , m 1009 1\leq n,m\leq 1009 such that a n < b m . a_n < b_m. Let n n be the maximum such value and then, subject to this n n , let m 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 b_{m+1} < a_n < b_m < b_{m-1} < \cdots < 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 i n b m i = n , b i = { b i i m a n i = m a'_i = \begin{cases}a_i & i\neq n \\ b_m & i=n\end{cases}, \qquad b'_i = \begin{cases}b_i & i\neq m \\ a_n & i=m\end{cases} It's easy to see that these satisfy a 1 < a 2 < < a 1009 , b 1 > b 2 > > b 1009 a'_1 < a'_2 < \cdots < a'_{1009}, \qquad b'_1 > b'_2 > \cdots > b'_{1009} and N ( a , b ) = N ( a , b ) 1 , N(\mathbf{a'}, \mathbf{b'}) = N(\mathbf{a}, \mathbf{b})-1, so we now turn to the task of evaluating a 1 b 1 + a 2 b 2 + + a 1009 b 1009 . |a'_1-b'_1| + |a'_2-b'_2| + \cdots + |a'_{1009} - b'_{1009}|. Immediately, we see that a i b i = a i b i |a'_i-b'_i| = |a_i-b_i| for all i n , m i \neq n,m . For the remaining term(s), we consider the following cases:

  • Case 1: n = m n=m Then a n b n = b n a n = a n b n |a'_n - b'_n| = |b_n - a_n| = |a_n-b_n|
  • Case 2: n < m n<m Then b m < a n + 1 a m b_m < a_{n+1} \leq a_m and a n < b m < b n a_n < b_m < b_n , so a n b n + a m b m = b m b n + a m a n = b n b m + a m a n = a n b n + a m b m |a'_n - b'_n| + |a'_m - b'_m| = |b_m - b_n| + |a_m-a_n| = b_n - b_m + a_m - a_n = |a_n - b_n| + |a_m - b_m|
  • Case 3: n > m n>m Then a m < a n < b m a_m < a_n < b_m and b n b m + 1 < a n b_n \leq b_{m+1} < a_n , so a n b n + a m b m = b m b n + a m a n = b m b n + a n a m = a n b n + a m b m |a'_n - b'_n| + |a'_m - b'_m| = |b_m - b_n| + |a_m-a_n| = b_m - b_n + a_n - a_m = |a_n - b_n| + |a_m - b_m|

Therefore, we see that i = 0 1009 a i b i = i = 0 1009 a i b i \sum_{i=0}^{1009} |a_i - b_i| = \sum_{i=0}^{1009} |a'_i - b'_i| so by induction, i = 0 1009 a i b i = 100 9 2 = 1018081 \sum_{i=0}^{1009} |a_i - b_i| = 1009^2 = 1018081

We can conclude that the only possible value of a 1 b 1 + a 2 b 2 + + a 1009 b 1009 |a_1-b_1| + |a_2-b_2| + \cdots + |a_{1009}-b_{1009}| is 1018081 1018081 , so trivially the sum of all possible values is also 1018081 . \boxed{1018081}.


Note : When I'm defining n , m n,m for the inductive step, I reference b m + 1 b_{m+1} and a n + 1 a_{n+1} in the following inequality. Of course, if either of m , n m,n equals 1009 1009 , 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 \mathbf{a'}, \mathbf{b'} sequences are increasing and decreasing, respectively.

Weirdly complicated but beautiful regardless :D

Steven Jim - 2 years, 10 months ago
Andrew Olesen
Aug 19, 2018

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 \leq 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 100 9 2 1009^2 = 1018081

I will first prove that, for any even number N N , if the numbers from 1 to N N are divided into two groups a 1 < . . . < a N 2 a_1 < ... < a_{\frac{N}{2}} and b 1 > . . . > b N 2 b_1 > ... > b_{\frac{N}{2}} , then the sum k = 1 N 2 a k b k \sum_{k = 1}^{\frac{N}{2}} |a_k - b_k| is the same regardless of the grouping. To see this, imagine the numbers from 1 to N N as being stretched out in a line and half of them bolded. The bolded numbers are in the b b group, and the non-bolded ones are in the a a group. For N = 4 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 \rightarrow 1 2 3 4 \rightarrow 1 2 3 4 \rightarrow 1 2 3 4.

I now claim that performing a swap as defined above does not change the value of k = 1 N 2 a k b k \sum_{k = 1}^{\frac{N}{2}} |a_k - b_k| . To see this, consider the configuration 1 ... x x x + 1 \mathbf{x + 1} ... N. Here, x = a i x = a_i and x + 1 = b j x + 1 = b_j . If i = j i = j , their contribution to the sum is x + 1 x = 1 |x + 1 - x| = 1 , and swapping would simply make it x ( x + 1 ) = 1 = 1 |x - (x + 1)| = |-1| = 1 , which is the same. If i j i \neq j , then these two and their partners ( b i b_i and a j a_j ) in their opposite groups make a contribution to the sum of x b i + a j ( x + 1 ) |x - b_i| + |a_j - (x + 1)| . Now perform a swap to get 1 ... x \mathbf{x} x + 1 x + 1 ... N. After the swap, x = b j x = b_j and x + 1 = a i 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 |(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:

  • If x > b i x > b_i , meaning that x b i x - b_i is positive, then a j ( x + 1 ) a_j - (x + 1) must be negative. This is true because x + 1 x + 1 is larger than b i b_i , and, since it's part of the b b group, must therefore be matched with a member of the a a group smaller than x x .
  • If x < b i x < b_i , meaning that x b i x - b_i is negative, then b i > x + 1 b_i > x + 1 , so a j ( x + 1 ) a_j - (x + 1) must be positive since x + 1 x + 1 , as a member of the b b group that is less than b i b_i , will be matched to a member of the a a group that is greater than x x .This reasoning might seem flawed but it's not because the case where x = a j x = a_j and x + 1 = b i x + 1 = b_i has already been ruled out by specifying that i j i \neq j .

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 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 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 |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 N 2 \frac{N}{2} part of the a a group and all the remaining numbers part of the b b shows that the sum is equal to the sum of the first N 2 \frac{N}{2} odd numbers, or ( N 2 ) 2 (\frac{N}{2})^2 . For N = 2018 N = 2018 , this is 100 9 2 = 1018081 1009^2 = 1018081 .

Nate Jellis
Aug 13, 2018

Let A A be the set of all a n a_n and let B B be the set of all b n b_n .

For all 1 n 1009 1 \leq n \leq 1009 , if a n 1009 a_n \leq 1009 , then there must be at least n n members of A A that are less than or equal to 1009. By the lemma, there are at least n n members of B B that are greater than 1009. That means b n > 1009 b_n \gt 1009 . Since the converse also holds, we can conclude a n 1009 b n > 1009 a_n \leq 1009 \Leftrightarrow b_n \gt 1009 .

After removing absolute values and rearranging terms, the sum is 100 9 2 \boxed{1009^2} .

Lemma: { x A x 1009 } = { x B x > 1009 } |\{x \in A \mid x \leq 1009\}| = |\{x \in B \mid x \gt 1009\}|
This can be proved by combining the following two statements:
{ x A x 1009 } + { x B x 1009 } = 1009 |\{x \in A \mid x \leq 1009\}| + |\{x \in B \mid x \leq 1009\}| = 1009
{ x B x 1009 } + { x B x > 1009 } = 1009 |\{x \in B \mid x \leq 1009\}| + |\{x \in B \mid x \gt 1009\}| = 1009


Nice lemma! Proof is easy, right? :D

Steven Jim - 2 years, 10 months ago

First, set:

a 1 = 1 , a 2 = 2 , . . . , a 1009 = 1009 , b 1009 = 1010 , . . . , b 1 = 2018. a_{1}=1, a_{2}=2, ... , a_{1009}=1009, b_{1009}=1010, ... , b_{1}=2018.

Trivially, the sum is

n = 1 1009 2 n 1 = 100 9 2 = 1018081 \sum_{n=1}^{1009} 2n-1 = 1009^2 = 1018081 .

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.

Carlos Manzo
Aug 17, 2018

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

Gabor Koranyi
Aug 14, 2018

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?

Steven Jim - 2 years, 10 months ago
Jeremy Galvagni
Aug 12, 2018

For the numbers 1 , 2 , 3 , 4 1,2,3,4 there are only ( 4 2 ) = 6 \binom{4}{2}=6 possible groups and the process gives 4 for all of them.

For the numbers 1 , 2 , 3 , 4 , 5 , 6 1,2,3,4,5,6 there are only ( 6 3 ) = 20 \binom{6}{3}=20 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 1,2,3,...,2n always gives the value n 2 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 a with one from b b doesn't change the value. This is complicated by the fact that some a i a_{i} will have to shift position and the point where the a j a_{j} begins to exceed b j b_{j} might also switch.

I will need to give this more thought.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...