Need help in a mathematical formulation

47 Views Asked by At

I have a set of n(n−1)/2 numbers. I should put them in a descend order، then multiply every set by this related value:

  1. the first set has (n−1)numbers× 1;

  2. the next set has (n−2)numbers× 2;

  3. ...

  4. the semi-final set has 2numbers× (n−2); and

  5. the final set has 1number× (n−1).

Then, we get the result by the total sum of values.

Example:

If the set of numbers for n=4 is S={5,3,2,1,1,6}.

S in descending order will be {6,5,3,2,1,1}.

Thus, the result is 1×{6+5+3}+2×{2+1}+3×{1}=23

Question How to formulate it mathematically?

1

There are 1 best solutions below

0
On BEST ANSWER

Your description does a fine job of conveying the information, so it's not entirely clear what more you want. That said, you could convert what you've said into a dot product of two vectors:

\begin{align*}\begin{bmatrix} 6 & 5 & 3 & 2 & 1 & 1 \end{bmatrix}\cdot \begin{bmatrix} 1&1&1&2&2&3 \end{bmatrix} &= 6(1)+5(1)+3(1)+2(2)+1(2)+1(3)\\ &= 23. \end{align*}

In general, then, setting $m = n(n-1)/2$, given a set of $m$ elements, $\{x_{i}\}_{i = 1}^{m}$ in decreasing order, i.e. such that $x_{i} \geq x_{i+1}$ for all $i$, then, provided $1<k<n+1$, we could write this as

$$ \begin{bmatrix} x_{1} & x_{2} & \dotsb &x_{m} \end{bmatrix}\cdot \begin{bmatrix} \underbrace{1 \quad 1\quad\dotsb\quad 1}_{n-1 \text{ times}}&\dotsb&\underbrace{k \quad k\quad\dotsb\quad k}_{n-k \text{ times}}&\dotsb&n-2&n-2&n-1 \end{bmatrix} $$