0

Suppose I have four sides, and I want to make a square out of them. Each of the sides can be decreased or increased, and a price needs to be payed for such an action: increasing or decreasing a side by one unit has a cost of one unit. What is the minimum cost required to get a square out of these sides?

I saw a solution where they sorted the sides in increasing order, $a \leq b \leq c \leq d$, and then to get answer they did $(c - b) + (c - a) + (d - c)$. Why does this work?

darko
  • 1,191
  • 1
    Step 1 decipher the real problem from the insane wording of the original problem. – marshal craft Apr 13 '17 at 10:22
  • Given $4$ sides having lengths $a,b,c$ and $d$ and cost per unit change $x$. Then $a+a_0=b+b_0=c+c_0=d+d_0$, total cost $$X=x(a_0+b_0+c_0+d_0)$$. The question is to minimize $X$. – marshal craft Apr 13 '17 at 16:45

2 Answers2

0

What do you mean by cost? If the square has side length $a$, decreasing a side's length by 1 will yield an area of $(a)(a-1)$. Please be more specific and place a link to the video here, so we can better comprehend the phrasing and intent of your question.

Toby Mak
  • 16,827
0

I think the minimum cost is achieved by selecting a length for the sides so that it is greater than the second shortest side and less than the second longest side.

Four sides can be ordered like so $ a \le b \le c \le d$. Then the cost is minimized if length of final square's side $b \le L \le c$.